php
PHP Mysql query Usergroup IF statement not working
I'm not really sure why its not working i've tried everything here's the code i know its got nothing to do with the mysqli or mysql because i've tested it in a different area and it works if anyone knows how to fix this then please comment below i need it sorted as fast as possible so if anyone has anything please just comment thanks! <?php if (!mysql_connect("localhost", "tsbannoo_client", "886215")) { die('oops connection problem ! --> ' . mysql_error()); } if (!mysql_select_db("tsbannoo_mybb352")) { die('oops database selection problem ! --> ' . mysql_error()); } $sql = "SELECT * FROM mybb0u_users WHERE username='" . $_SESSION['user'] . "'"; $res = mysql_query($sql) or die(mysql_error()); $result = mysql_query($sql); if (!$result) { die("Error running $sql: " . mysql_error()); } $Row = mysql_fetch_array($res); $ADMIN = 4; $MOD = 6; $VIP = 12; $SUPERMOD = 3; $MEMBER = 2; $DONATOR = 11; $AWAITINGACTIVATION = 5; $BANNED = 7; if ($row['usergroup'] == "4") { } elseif ($row['usergroup'] == "6") { } elseif ($row['usergroup'] == "12") { } elseif ($row['usergroup'] == "3") { } elseif ($row['usergroup'] == "2") { session_destroy(); unset($_SESSION['user']); echo '<META HTTP-EQUIV="Refresh" Content="0; URL=error.php?msg=(05)%20Seems%20you%20have%20not%20paid%20for%20our%20cheats%20please%20go%20to%20our%20forums%20and%20purchase%20any%20package!">'; } elseif ($row['usergroup'] == "11") { session_destroy(); unset($_SESSION['user']); echo '<META HTTP-EQUIV="Refresh" Content="0; URL=error.php?msg=(05)%20Seems%20you%20have%20not%20paid%20for%20our%20cheats%20please%20go%20to%20our%20forums%20and%20purchase%20any%20package!">'; } elseif ($row['usergroup'] == "5") { session_destroy(); unset($_SESSION['user']); echo '<META HTTP-EQUIV="Refresh" Content="0; URL=error.php?msg=(06)%20Please%20Activate%20your%20forum%20account%20and%20then%20proceed%20to%20purchasing%20a%20Package%20before%20attempting%20to%20login%20thanks!">'; } elseif ($row['usergroup'] == "7") { session_destroy(); unset($_SESSION['user']); echo '<META HTTP-EQUIV="Refresh" Content="0; URL=error.php?msg=(07)%20Seems%20your%20account%20is%20banned,%20HMMM%20ill%20ask%20politely%20please%20fuck%20off%20thanks!">'; } ?>
You're referring to $_SESSION['user'] which isn't available because you didn't call session_start().
Related Links
Sorting with combobox?
Why wraping return value with parentheses? [duplicate]
Variable from function not being passed to php
Message: Undefined variable: data - CodeIgniter
mongoDB remove sub-array
PHP open new email message with default mail client
Rendering a Static Page in Yii that resides in the Current Theme's Views
Understanding “post/redirect/get” [closed]
Extra characters in PHP email “from” field
PHP configure file in Linux
Link url my site
ui-dahow to display future date as selected in jquery ui-date picker
Mysql database structure webshop
PHP SimpleXml - Retrieving attributes of namespaced children
How to add custom fields in Low Stock report in Magento?
Get fan count for lots of facebook pages