Jump to content


Photo

Odd if statement problems...


  • Please log in to reply
2 replies to this topic

#1 ChambeRFienD

ChambeRFienD
  • Members
  • PipPip
  • Member
  • 25 posts

Posted 19 April 2006 - 12:38 AM

case 'admin':
                echo $user_level;
                if($user_level == 1) {
                    echo "<h3>Administrative Alt Edit</h3>";
                    if(isset($_GET['f'])) {
                    $alt_id = $_GET['alt'];
                    $sql_check = mysql_query("SELECT * FROM alts_trade WHERE trade_id='$alt_id'");
                    $row_check = mysql_fetch_array($sql_check);
                    $alt_name = $row_check['trade_name'];
                    if($user_level == 1) {
                        mysql_query("DELETE FROM alts_trade WHERE trade_id='$alt_id'");
                        echo "<strong>$alt_name was deleted from the database!</strong>";
                    } else {
                        echo "<strong>You cannot delete alts from other people's lists!</strong>";
                    }
                    $trade_id = $_GET['alt'];
                    $sql_info = mysql_query("SELECT * FROM alts_trade WHERE trade_id='$trade_id'");
                    $row_info = mysql_fetch_array($sql_info);
                    $comments1 = $row_info['trade_comments'];
                    $name1 = $row_info['trade_name'];
                    $level1 = $row_info['trade_level'];
                    if($user_level != 1) {
                        echo "$user_level<br />There's no way you're supposed to be here.. Tisk tisk.";
                    } else {
                        if(isset($_POST['edited'])) {
                            $alt_id = $_POST['edited'];
                            $comments = mysql_real_escape_string($_POST['comments']);
                            $name = mysql_real_escape_string($_POST['name']);
                            $level = $_POST['level'];
                            mysql_query("UPDATE alts_trade SET trade_name='$name', trade_comments='$comments', trade_level='$level' WHERE trade_id='$alt_id'") or die(mysql_error());
                            echo "<b>Alt Edited</b><br />
                            <font size='-2'><i>Changes will not be seen til you return to your alt list!</i></font>";
                        }
                    }
                    echo "<form action='?page=edit_alts&amp;mode=admin&amp;&amp;e=1&amp;alt=$trade_id' method='post'>";
                    echo "<table border='0' cellpadding='0' cellspacing='10'>";
                    echo "<input type='hidden' name='edited' value='$trade_id' />";
                    echo "<tr><td><font size='-2'>Owned Alt</font><br /><input type='text' name='name' value='$name1' size='15' /></td></tr>";
                    echo "<tr><td><font size='-2'>Trade Level</font><br /><select name='level'>";
                    echo "<option value='6'"; if($level1 == 6){ echo "selected";} echo ">Open for Trade</option>";
                    echo "<option value='5'"; if($level1 == 5){ echo "selected";} echo ">On Hold</option>";
                    echo "<option value='4'"; if($level1 == 4){ echo "selected";} echo ">Not For Trade</option>";
                    echo "</select></td></tr>";
                    echo "<tr><td><font size='-2'>Comments:</font><br /><textarea name='comments'>$comments1</textarea></td></tr>";
                    echo "<tr><td><br /><input type='submit' value='Edit Alt'></td></tr></table>";
                    echo "</form>";

                } else {
                    echo "<br />There's no way you're supposed to be here.. Tisk tisk.";
                }
                }
            break;

When this is run, it echos '1' for the $user_level variable, but it still shows "<br />There's no way you're supposed to be here.. Tisk tisk."

Anyone have any ideas why?

#2 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 19 April 2006 - 02:03 AM


if(! $user_level == 1) {
                        echo "$user_level<br />There's no way you're supposed to be here.. Tisk tisk.";

if($user_level ! >0) {
                        echo "$user_level<br />There's no way you're supposed to be here.. Tisk tisk.";


Tried good luck!
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#3 ChambeRFienD

ChambeRFienD
  • Members
  • PipPip
  • Member
  • 25 posts

Posted 19 April 2006 - 02:14 AM

[!--quoteo(post=366279:date=Apr 18 2006, 10:03 PM:name=redarrow)--][div class=\'quotetop\']QUOTE(redarrow @ Apr 18 2006, 10:03 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
if(! $user_level == 1) {
                        echo "$user_level<br />There's no way you're supposed to be here.. Tisk tisk.";

if($user_level ! >0) {
                        echo "$user_level<br />There's no way you're supposed to be here.. Tisk tisk.";
Tried good luck!
[/quote]


I can't remember what I did, but I managed to fix it a couple minutes ago. Thanks for the reply though. =)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users