PHP Login script problem
Hi
I am new to this and I am trying to get a login PHP script right, when i run the site in my testing server and i goto the login page i get the following error :
Warning: open(/tmp\sess_8624c9e01e8a8248449ffb495f6be885, O_RDWR) failed: No such file or directory (2) in c:\webserver\phpdev5\www\ccc_website\login.php on line 5
does anyone know why this is happening, as i want to get the login system working on the site. Sorry if this is a simple problem but i am new to this.
Please see below for the code.
Thanks
Columbo1977
<?php require_once('Connections/DB.php'); ?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
session_start();
}
$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}
if (isset($_POST['username'])) {
$loginUsername=$_POST['username'];
$password=$_POST['password'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "members/members.htm";
$MM_redirectLoginFailed = "denied.html";
$MM_redirecttoReferrer = false;
mysql_select_db($database_DB, $DB);
$LoginRS__query=sprintf("SELECT Username, password FROM users WHERE Username='%s' AND password='%s'",
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));
$LoginRS = mysql_query($LoginRS__query, $DB) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;
if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Chief's Computer Club</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_showHideLayers() { //v6.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
obj.visibility=v; }
}
//-->
</script>
</head>
<body bgcolor="#999999" text="#000000" link="#0000FF" vlink="#0000FF" alink="#0000FF" leftmargin="0" topmargin="0" onLoad="MM_showHideLayers('Profiles','','hide');MM _showHideLayers('Links','','hide');MM_showHideLaye rs('Cinema','','hide');MM_showHideLayers('News','' ,'hide');MM_showHideLayers('attractions','','hide' )">
<table width="100%" border="0">
<tr>
<td><div align="center"> Chief's Computer Club</div></td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="120" nowrap onMouseOver="MM_showHideLayers('attractions','','s how')" onMouseOut="MM_showHideLayers('attractions','','hi de')">
<div align="center"> <a href="news.htm">News</a>
</div></td>
<td width="120" nowrap onMouseOver="MM_showHideLayers('News','','show')" onMouseOut="MM_showHideLayers('News','','hide')">
<div align="center"><a href="#">Downloads</a>
</div></td>
<td width="120" nowrap onMouseOver="MM_showHideLayers('Cinema','','show') " onMouseOut="MM_showHideLayers('Cinema','','hide')" >
<div align="center"><a href="#">Newsletters</a>
</div></td>
<td width="120" nowrap onMouseOver="MM_showHideLayers('Profiles','','show ')" onMouseOut="MM_showHideLayers('Profiles','','hide' )">
<div align="center"><a href="#">Tutorials</a>
</div></td>
<td width="120" nowrap onMouseOver="MM_showHideLayers('Links','','show')" onMouseOut="MM_showHideLayers('Links','','hide')">
<div align="center"><a href="#">Advice</a>
</div></td>
</tr>
</table></td>
</tr>
</table>
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="15" height="23"> <p><img src="images/shim.gif" width="13" height="8"></p>
</td>
<td width="128">
<p> </p>
</td>
<td width="15"><img src="images/shim.gif" width="15" height="5"></td>
<td width="100%"> </td>
<td width="15"><img src="images/shim.gif" width="15" height="5"></td>
<td width="116"> </td>
<td width="15"><img src="images/shim.gif" width="15" height="5"></td>
</tr>
<tr>
<td width="15"> </td>
<td valign="top">
<table width="145" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="128" height="20" valign="top" background="images/background_blue.jpg" bgcolor="#999999"><div align="center">Menu</div></td>
</tr>
<tr>
<td height="171" background="images/background_grey_fullscreen.jpg" bgcolor="#999999">
<p><a href="index.html">Home</a></p>
<p><a href="meetings.htm">Meeting
Dates </a><br>
<br>
<a href="aboutme.htm">About
Me </a><br>
<br>
<a href="links.htm">Links</a></p>
<p><a href="contact.htm">Contact Us</a><br>
<br>
</p>
</td>
</tr>
</table>
<table width="145" border="0" cellpadding="0" cellspacing="0" bgcolor="#999999">
<tr>
<td width="128" background="images/background_blue.jpg" bgcolor="#999999"><div align="center">Login</div></td>
</tr>
<tr>
<td valign="top" background="images/background_grey_fullscreen.jpg" bgcolor="#999999">
<p align="center"><br>
<a href="login.php">Login Page</a></p>
<p align="center"><a href="registration.php">New
User Signup</a></p>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><p>You are visitor number :</p>
<p> </p></td>
</tr>
</table>
<p align="left"><br>
<br>
</p>
</td>
</tr>
</table></td>
<td width="15"> </td>
<td valign="top">
<table width="100%" height="98%" border="0" cellpadding="0" cellspacing="0" bordercolor="#999999" background="images/background_grey_fullscreen.jpg">
<tr>
<td width="100%" height="9%" bgcolor="#999999"> <div align="center"><strong>Login
Page </strong></div></td>
<td> </td>
</tr>
<tr>
<td height="398" valign="top" bgcolor="#999999"> <div align="center">
<p>Enter your Username and Password below to enter the members area
of the website</p>
<form ACTION="<?php echo $loginFormAction; ?>" name="form1" method="POST">
<table width="100%" border="1">
<tr>
<td width="50%">Username</td>
<td><input name="username" type="text" id="username"></td>
</tr>
<tr>
<td width="50%">Password</td>
<td><input name="password" type="password" id="password"></td>
</tr>
<tr>
<td width="50%"><div align="center">
<input type="submit" name="Submit" value="Login">
</div></td>
<td><div align="center">
<input type="reset" name="Submit5" value="Reset">
</div></td>
</tr>
</table>
</form>
<p> </p>
</div></td>
<td> <p> </p></td>
</tr>
</table>
</td>
<td width="15"> </td>
<td valign="top">
<table width="156" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="128" background="images/background_blue.jpg" bgcolor="#999999"><div align="center">Search</div></td>
</tr>
<tr>
<td width="128" height="177" valign="top" background="images/background_grey_fullscreen.jpg">
<p align="center">Search The Site :<br>
<input type="text" name="textfield3">
<input type="submit" name="Submit3" value="Search">
</p>
<form name="form6" method="post" action="">
<div align="center"> </div>
</form>
<form name="form3" method="post" action="">
</form>
<p align="center">Search The Internet<br>
<input type="text" name="textfield4">
<input type="submit" name="Submit4" value="Search">
</p>
<form name="form7" method="post" action="">
</form>
<form name="form4" method="post" action="">
</form>
</td>
</tr>
</table>
<table width="145" height="360" border="0" cellpadding="0" cellspacing="0">
<tr>
<td background="images/background_blue.jpg"><div align="center">Signup</div></td>
</tr>
<tr>
<td height="207" background="images/background_grey_fullscreen.jpg">
<p>Newsletter<br>
Please enter E-Mail address</p>
<form name="form5" method="post" action="">
<div align="center">
<input type="text" name="textfield5">
<br>
<input type="submit" name="Submit2" value="Submit">
</div>
</form>
<p align="center"> ------------------------<br>
Image Of The Month<br>
<a href="images/Computer_sq.jpg"><img src="images/Computer_sq.jpg" alt="" name="Advert" width="155" height="156" border="0"></a>
</p>
</td>
</tr>
</table> </td>
<td width="15"> </td>
</tr>
</table>
</body>
</html>
|