Hi,
Im a newbie to phpbuilder and thanks for having me. I have a issue. I have a login code but i need the code to when certain people login (admin) it sends then here and when ( non admin ) login it sends them there.
I have a users table with a column name "role" 1 as admin and 2 as non admin... Here is my whole login code. Each member has a id so id # 3,15,17 are admin and 1,2 through 31 are non admin . Can anyone help??? Im sure its easy but im still new to php.. THanks in advance.
<?php
if(isset($_COOKIE['logged']))
{
?>
<div id='signin'>
<form action="http://www.virtualhockeyassociation.com/onlogout.php" method="post" name="logForm" id="logForm" >
Welcome <?php session_start(); echo $_SESSION['GM'];?>!
<input type="submit" value="Log Out" />
</form>
</div>
<?php
}
if(isset($_POST['doLogin']))
{
$email=$_POST['usr_email'];
$password=$_POST['pwd'];
if(file_exists('php_classes/config.php'))
include_once 'php_classes/config.php';
else
include_once '../php_classes/config.php';
mysql_connect($dbhost,$dbuser,$dbpass);
mysql_select_db($dbname);
echo "SELECT * FROM teams where email='$email' and password='$password'";
$result = mysql_query("SELECT * FROM teams where email='$email' and password='$password'");
mysql_close();
if(mysql_num_rows($result) >0)
{
session_start();
$row=mysql_fetch_array($result);
setcookie('logged',$row['id'],time()+1000);
$_SESSION['uid']=$row['id'];
$_SESSION['GM']=$row['GM'];
$_SESSION['tid']=$row['newsid'];
$_SESSION['teamname']=$row['teamname_l'];
$_SESSION['teamabr']=$row['teamabr'];
header("location: http://www.virtualhockeyassociation.com/teams/teampage_admin.php?id=".$_SESSION['tid']);
}
else
{
header("location: http://www.virtualhockeyassociation.com/index.php?status=loginerror");
}
}
?>
<div id='signin'>
<form action="http://www.virtualhockeyassociation.com/signin.php" method="post" name="logForm" id="logForm" >
<label class='loginLBL' for='username'>USERNAME:</label><input name="usr_email" type="text" class="required" id="txtbox" size="20">
<label class='loginLBL' for='password'>PASSWORD:</label><input name="pwd" type="password" class="required password" id="txtbox" size="25">
<input name="doLogin" type="submit" id="doLogin3" value="Login">
</form>
</div>
I just need to know where and how to add the changes... Im pretty ignorant and still new to php. THis code was done by someone prior to me...