Jump to content


admin panel


1 reply to this topic

#1 dvayne

    Young Padawan

  • Members
  • Pip
  • 11 posts

Posted 10 April 2008 - 07:24 AM

<?php
session_start();
if($_SESSION['s_logged_n'] == 'true'){
include 'process.php';

$query = mysql_query("SELECT * FROM Users where position=admin") or die(mysql_error());
while($row = mysql_fetch_array($query));{

if(mysql_num_rows($query) > 0)
	{   
if($row['Activated'] > 0){
		$_SESSION['adminl'] = 'true';
		   header("Location: adminpanel.php");
		}
		else{
		echo 'access denied';
		}
	}	
		
}		



} else {
	
	header("Location: login.php");
}
?>

please check my code
It displays access denied even if the position that is stored in database is admin..
any help would be appreciated..

#2 I360

    Young Padawan

  • Members
  • Pip
  • 1 posts

Posted 10 April 2008 - 07:53 AM

 <?php
	
	session_start();
	
	if($_SESSION['s_logged_n'] == 'true'){
		
		include 'process.php';

		$query = mysql_query( "SELECT * FROM Users where position=admin" ) or die( mysql_error() );
			
			while($row = mysql_fetch_array($query)){

				if(mysql_num_rows($query) > 0){  

					if($row['Activated'] > 0){
				
						$_SESSION['adminl'] = 'true';

						   header( "Location: adminpanel.php" );

						} else {
					
							echo 'access denied';
					 }
				
				}	
		
			}		

	} else {
	
	header("Location: login.php");
	
	}
	
?>

You had an erroneous semi colon at the end of the while clause.

Try that!





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users