Jump to content

Rather confused


Phpfr3ak

Recommended Posts

I want the following script to run attack_code.php when all the statements come back as being ok.. only issue is on the last line i do }else{ include("attack_code.php"); yet it runs the attack_code anyway, its rather odd as if i leave attack_code.php at the top of the page it shows the error messages of the statements below any clues?

<?php 
if($playerID == $defender) {
    echo "<div>You can't attack yourself.</div>";
include("exit.php");
exit;
}
/// below shows the noto forumla
$cashnoto = round($steal_amount / 100);
$drugnoto = round($steal_amount * 15);
?><br />
<?php

$sql = "SELECT * FROM messages WHERE to_username = '$defender_info[username]' AND from_username = '$playerdata[username]' AND type = 'Combat' ORDER BY id DESC LIMIT 1";
$que = mysql_query($sql) or die(mysql_error());
$res = mysql_fetch_array($que);

$now = time();
$lastattack = strtotime($res['timestamp']);
$timesince = $now - $lastattack;

$nextatk = round((10800 - $timesince) / 60);

if($timesince < 10800){
    echo "You can only attack the same player once every 3 hours.<br><br> You can attack this player again in $nextatk minutes.";
include("exit.php");
exit;
}else{

$sql = "SELECT hits FROM users WHERE id = $playerID";
$que = mysql_query($sql) or die(mysql_error());
$res = mysql_fetch_array($que);

$hits = $res['hits'];
if($hits < 1){
echo "You have no available hits. New hit allowances are granted every ten minutes on the :05's";
include("exit.php");
exit;
}else{
?>

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.