I have some PHP code where i need it so it will redirect them to the homepage if the accounttype is standard.
I have the code but it dont seem to be redirecting them.

I have some PHP code where i need it so it will redirect them to the homepage if the accounttype is standard.
I have the code but it dont seem to be redirecting them.
<?php session_start();
include 'config.php';
$username = addslashes($_POST['username']);
$sql = "SELECT adminlevel,accounttype FROM users WHERE username = '" . $username . "' AND accounttype = 'standard'";
echo MySQL_Error();
$result = mysql_query($sql);
$row = mysql_fetch_row($result);
if(!isset($_SESSION['logged_in']) || !isset($_SESSION['username'])) {
header("location: index.php");
exit;
}
if($row['accounttype'] == 'standard') {
header("location: index.php");
exit;
}
?>
<style type="text/css">
<!--
body {
background-image: url(http://lv-cnr.com/bg.png);
}
-->
</style>
mysql_fetch_row returns a numerical array and you're trying to use it as an associative array. Either use $row[1] == 'standard' or change mysql_fetch_row to mysql_fetch_assoc
So like
$row = mysql_fetch_assoc($result);
For some reason it still lets me on the page even though my account is standard
Want to hide these adverts? Register an account for free!