Jump to content

if problem :(


JakeD

Recommended Posts

<?
$amount = $_POST['amount'];
$id = $userdata['user_id'];
$otherid = $_POST['id'];
$usermoney = "user_money";
$money = $userdata['user_money'];
$take = $money - $amount;
$othermoney = dbquery("SELECT ".$usermoney." FROM ".$db_prefix."users WHERE user_id='".$otherid."'");
$omoney = mysql_fetch_row($othermoney); $omoney=$omoney[0];
$money = $omoney;
$times = $amount / 2;
$kill="false";
if ($amount > $money)
{

echo "<script language=\"Javascript\">

<!--

alert (\"Not enough money\")
//-->

</script>";
echo "<SCRIPT LANGUAGE=\"JavaScript\">
<!-- 
window.location=\"/\";
// -->
</script>";
$kill = "fasleasdasdasdasdasdasdasd";
}	


if ($times >= $othermoney)
{
$kill="true";

}
else 
{
echo "Your hitman did not successfully kill the person he was attacking, and ran off with your money, pay him more next time";
dbquery("UPDATE ".$db_prefix."users SET user_money=".$take." WHERE user_id='".$id."'");
}
if ($kill == "true")
{
$rwd = $money + $othermoney;
echo "Successfully killed your target, they had \$$othermoney which is now yours.";
dbquery("UPDATE ".$db_prefix."users SET user_money=".$rwd." WHERE user_id='".$id."'");
dbquery("DELETE FROM ".$db_prefix."users WHERE user_id='$otherid'");
dbquery("DELETE FROM ".$db_prefix."articles WHERE article_name='$otherid'");
dbquery("DELETE FROM ".$db_prefix."comments WHERE comment_name='$otherid'");
dbquery("DELETE FROM ".$db_prefix."messages WHERE message_to='$otherid'");
dbquery("DELETE FROM ".$db_prefix."messages WHERE message_from='$otherid'");
dbquery("DELETE FROM ".$db_prefix."news WHERE news_name='$otherid'");
dbquery("DELETE FROM ".$db_prefix."poll_votes WHERE vote_user='$otherid'");
dbquery("DELETE FROM ".$db_prefix."ratings WHERE rating_user='$otherid'");
dbquery("DELETE FROM ".$db_prefix."shoutbox WHERE shout_name='$otherid'");
dbquery("DELETE FROM ".$db_prefix."threads WHERE thread_author='$otherid'");
dbquery("DELETE FROM ".$db_prefix."posts WHERE post_author='$otherid'");
}
?>


 

if ($amount > $money)

 

i made $amount > $money, and it alerts the javascript....but it still runs the SQL querys! im getting so frustrated...it shouldnt because i put if ($kill == "true") to run it, and by default kill doesnt = true!!!! please help me:( thanks guys

Link to comment
Share on other sites

Thanks for replying, so i would ad an else after the if?

if ($amount > $money)
{

echo "<script language=\"Javascript\">

<!--

alert (\"Not enough money\")
//-->

</script>";
echo "<SCRIPT LANGUAGE=\"JavaScript\">
<!-- 
window.location=\"/\";
// -->
</script>";
$kill = "fasleasdasdasdasdasdasdasd";
}	

else {echo "";}

 

like so?

Link to comment
Share on other sites

yup, and where you have that echo put the rest of your code:

if ($times >= $othermoney)
{
$kill="true";

}
else 
{
echo "Your hitman did not successfully kill the person he was attacking, and ran off with your money, pay him more next time";
dbquery("UPDATE ".$db_prefix."users SET user_money=".$take." WHERE user_id='".$id."'");
}
if ($kill == "true")
{
$rwd = $money + $othermoney;
echo "Successfully killed your target, they had \$$othermoney which is now yours.";
dbquery("UPDATE ".$db_prefix."users SET user_money=".$rwd." WHERE user_id='".$id."'");
dbquery("DELETE FROM ".$db_prefix."users WHERE user_id='$otherid'");
dbquery("DELETE FROM ".$db_prefix."articles WHERE article_name='$otherid'");
dbquery("DELETE FROM ".$db_prefix."comments WHERE comment_name='$otherid'");
dbquery("DELETE FROM ".$db_prefix."messages WHERE message_to='$otherid'");
dbquery("DELETE FROM ".$db_prefix."messages WHERE message_from='$otherid'");
dbquery("DELETE FROM ".$db_prefix."news WHERE news_name='$otherid'");
dbquery("DELETE FROM ".$db_prefix."poll_votes WHERE vote_user='$otherid'");
dbquery("DELETE FROM ".$db_prefix."ratings WHERE rating_user='$otherid'");
dbquery("DELETE FROM ".$db_prefix."shoutbox WHERE shout_name='$otherid'");
dbquery("DELETE FROM ".$db_prefix."threads WHERE thread_author='$otherid'");
dbquery("DELETE FROM ".$db_prefix."posts WHERE post_author='$otherid'");
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.