Jump to content

If within If


cry of war

Recommended Posts

is there something wrong with this because the page wont display when i added some stuff into this

 

if (isset($_POST['add'])){
$info = $_POST['info'];
    $id   = $_POST['id'];
$find = array('Mercenaries', 'Jaffa Army', 'Super Soldiers', 'Drones', 'Clones', 'bot', 'Units', 'Human Form troop7', 'Soldier', 'NID Agent', 'Army', '  ', ',');
$replace = array('troop1','troop2','troop3','troop4','troop5','troop6','troop7','troop8','troop9','troop10','troop11', ' ', ''); 
$info = str_replace($find, $replace, $info);
    $info2 = explode(" ", $info);
$armynouu = array(is_int('$info[79]'), is_int('$info[80]'), is_int('$info[81]'), is_int('$info[83]'), is_int('$info[84]'), is_int('$info[87]'), is_int('$info[88]'), is_int('$info[89]'), is_int('$info[109]'), is_int('$info[115]'));
$armynouu2 = array_sum($armynouu);
if ($info[82]=="troop7") {
$race = '~';
} elseif($info[82]=="troop2") {
$race = '~~';
} elseif($info[82]=="troop4") {
$race = '~~~';
} elseif($info[82]=="troop9") {
$race = '~~~~';
} elseif($info[82]=="troop11") {
$race = '****';
} else {
$race = '????';
}
if ($info[118] << 200) {
$active = 'ACTIVE';
} else {
$active = '';
}
if ($active=="ACTIVE") {
if ($urlnum== "null"){
$urlnum=0
$finish=0
} else {
$urlnum = $urlnum++;
$finish = $finish++;
}
$url[$urlnum]="$race<a href=http://www.stargatewars.com/stats.php?id=$id target=_blank>$active $info2[16]($info2[121])</a>$race<br />";
} elseif ($urlnum==null){
$urlnum=0
$finish=0
} else {
$urlnum = $urlnum++;
$finish = $finish++;
}
$url[$urlnum]="$race<a href=http://www.stargatewars.com/stats.php?id=$id target=_blank>$info2[16]($armynouu2 ~ $info2[121])</a>$race<br />";
}

Link to comment
https://forums.phpfreaks.com/topic/61160-if-within-if/
Share on other sites

With a quick look, you were missing semi-colons on four lines.

 

Try this code:

<?php

if (isset($_POST['add'])) {
    $info = $_POST['info'];
    $id   = $_POST['id'];
    $find = array('Mercenaries', 'Jaffa Army', 'Super Soldiers', 'Drones', 'Clones', 'bot', 'Units', 'Human Form troop7', 'Soldier', 'NID Agent', 'Army', '  ', ',');
    $replace = array('troop1','troop2','troop3','troop4','troop5','troop6','troop7','troop8','troop9','troop10','troop11', ' ', '');
    $info = str_replace($find, $replace, $info);
    $info2 = explode(" ", $info);
    $armynouu = array(is_int('$info[79]'), is_int('$info[80]'), is_int('$info[81]'), is_int('$info[83]'), is_int('$info[84]'), is_int('$info[87]'), is_int('$info[88]'), is_int('$info[89]'), is_int('$info[109]'), is_int('$info[115]'));
    $armynouu2 = array_sum($armynouu);
    if ($info[82]=="troop7") {
        $race = '~';
    } else if ($info[82]=="troop2") {
        $race = '~~';
    } else if ($info[82]=="troop4") {
        $race = '~~~';
    } else if ($info[82]=="troop9") {
        $race = '~~~~';
    } else if ($info[82]=="troop11") {
        $race = '****';
    } else {
        $race = '????';
    }
    if ($info[118] << 200) {
        $active = 'ACTIVE';
    } else {
        $active = '';
    }
    if ($active=="ACTIVE") {
        if ($urlnum== "null") {
            $urlnum=0;
            $finish=0;
        } else {
            $urlnum = $urlnum++;
            $finish = $finish++;
        }
        $url[$urlnum]="$race<a href=http://www.stargatewars.com/stats.php?id=$id target=_blank>$active $info2[16]($info2[121])</a>$race<br />";
    } else if ($urlnum==null) {
        $urlnum=0;
        $finish=0;
    } else {
        $urlnum = $urlnum++;
        $finish = $finish++;
    }
    $url[$urlnum]="$race<a href=http://www.stargatewars.com/stats.php?id=$id target=_blank>$info2[16]($armynouu2 ~ $info2[121])</a>$race<br />";
}

?>

 

I checked it on my own server, and it didn't give off any syntax errors like it was.

Link to comment
https://forums.phpfreaks.com/topic/61160-if-within-if/#findComment-304365
Share on other sites

Well, for anything to show up at all, this line has to be true:

if (isset($_POST['add'])) {

 

Are you using the form to go along with the code? Without the form, nothing is going to work.

 

Also, that script has absolutely no output to the screen...so what do you expect to show up?

Link to comment
https://forums.phpfreaks.com/topic/61160-if-within-if/#findComment-304370
Share on other sites

this is the total code:

<?php
if (isset($_POST['add'])) {
    $info = $_POST['info'];
    $id   = $_POST['id'];
    $find = array('Mercenaries', 'Jaffa Army', 'Super Soldiers', 'Drones', 'Clones', 'bot', 'Units', 'Human Form troop7', 'Soldier', 'NID Agent', 'Army', '  ', ',');
    $replace = array('troop1','troop2','troop3','troop4','troop5','troop6','troop7','troop8','troop9','troop10','troop11', ' ', '');
    $info = str_replace($find, $replace, $info);
    $info2 = explode(" ", $info);
    $armynouu = array(is_int('$info[79]'), is_int('$info[80]'), is_int('$info[81]'), is_int('$info[83]'), is_int('$info[84]'), is_int('$info[87]'), is_int('$info[88]'), is_int('$info[89]'), is_int('$info[109]'), is_int('$info[115]'));
    $armynouu2 = array_sum($armynouu);
    if ($info[82]=="troop7") {
        $race = '~';
    } else if ($info[82]=="troop2") {
        $race = '~~';
    } else if ($info[82]=="troop4") {
        $race = '~~~';
    } else if ($info[82]=="troop9") {
        $race = '~~~~';
    } else if ($info[82]=="troop11") {
        $race = '****';
    } else {
        $race = '????';
    }
    if ($info[118] <= '200') {
        $active = 'ACTIVE';
    } else {
        $active = '';
    }
    if ($active=="ACTIVE") {
        if ($urlnum== "null") {
		$urlnum = $urlnum++;
            $finish = $finish++;
		$url[$urlnum]="$race<a href=http://www.stargatewars.com/stats.php?id=$id target=_blank>$active $info2[16]($info2[121])</a>$race<br />";
        } else {
            $urlnum = $urlnum++;
            $finish = $finish++;
		$url[$urlnum]="$race<a href=http://www.stargatewars.com/stats.php?id=$id target=_blank>$active $info2[16]($info2[121])</a>$race<br />";
    }
} else {
if ($urlnum==null) {
		$urlnum = $urlnum++;
            $finish = $finish++;
		$url[$urlnum]="$race<a href=http://www.stargatewars.com/stats.php?id=$id target=_blank>$active $info2[16]($info2[121])</a>$race<br />";
    } else {
        $urlnum = $urlnum++;
        $finish = $finish++;
        $url[$urlnum]="$race<a href=http://www.stargatewars.com/stats.php?id=$id target=_blank>$info2[16]($armynouu2 ~ $info2[121])</a>$race<br />";
}
}
?>
<html>
<head>
<title>Personal INFO</title>
</head>
<body>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
PLEASE CLICK INSIDE OF THE SGW SPY LOG AREA AND PRESS CTRL+A THEN CTRL+C THEN CLICK IN THE
TEXT AREA BELOW WHERE IT SAYS "INSERT HERE".
<textarea rows="20" cols="20" name="info" wrap="physical">INSERT HERE</textarea><br />
ENTER ID: <INPUT TYPE="TEXT" name="id" value="INPUT ID HERE" /><br />
<input type="submit" value="add" name="add"/><input type="submit" value="submit" name="submit" />
</form>
<?php
}
elseif (!isset($_POST['submit']))
{
?>
<html>
<head>
<title>Personal INFO</title>
</head>
<body>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
PLEASE CLICK INSIDE OF THE SGW SPY LOG AREA AND PRESS CTRL+A THEN CTRL+C THEN CLICK IN THE
TEXT AREA BELOW WHERE IT SAYS "INSERT HERE".
<textarea rows="20" cols="20" name= "info" wrap="physical">INSERT HERE</textarea><br />
ENTER ID: <INPUT TYPE="TEXT" name="id" value="INPUT ID HERE" /><br />
<input type="submit" value="add" name="add"/><input type="submit" value="submit" name="submit" />
</form>
<?php
}
else
{
   for($urlnum = 0; $urlnum <= $finish; $urlnum++)
    {
    echo $url[$urlnum];
    }
}
?>

 

What I gave you before was the part of the code that i had edited before it started to mess up

 

 

Link to comment
https://forums.phpfreaks.com/topic/61160-if-within-if/#findComment-304371
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.