Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old May 4th, 2006, 01:13 PM
Registered User
 
Join Date: May 2006
Location: , , United Kingdom.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to columbo1977
Default 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>&nbsp;</p>
    </td>
    <td width="15"><img src="images/shim.gif" width="15" height="5"></td>
    <td width="100%">&nbsp;</td>
    <td width="15"><img src="images/shim.gif" width="15" height="5"></td>
    <td width="116">&nbsp;</td>
    <td width="15"><img src="images/shim.gif" width="15" height="5"></td>
  </tr>
  <tr>
    <td width="15">&nbsp;</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>&nbsp;</p></td>
              </tr>
            </table>
            <p align="left"><br>
              <br>
            </p>
          </td>
        </tr>
      </table></td>
    <td width="15">&nbsp;</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>&nbsp;</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>&nbsp;</p>
            </div></td>
          <td> <p>&nbsp;</p></td>
        </tr>
      </table>
    </td>
    <td width="15">&nbsp;</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">&nbsp;</td>
  </tr>
</table>
</body>
</html>


Reply With Quote
  #2 (permalink)  
Old May 21st, 2006, 10:47 PM
Friend of Wrox
 
Join Date: Oct 2003
Location: colombo, WP, Sri Lanka.
Posts: 482
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via MSN to surendran Send a message via Yahoo to surendran
Default

hello,
why you are trying to do a long login method,
here some nice login script, try to use those
http://www.google.com/search?hl=en&q=php+login+script


surendran
(Anything is Possible)
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
having a problem with login script dbwieler PHP Databases 1 November 14th, 2007 01:12 AM
login php Case Problem saifi4u PHP How-To 3 March 6th, 2007 11:58 PM
login script problem hosefo81 PHP How-To 9 August 20th, 2004 11:28 AM
Php login session problem programmer Beginning PHP 1 August 3rd, 2004 03:57 AM
problem with auto login script to MSDE cmedley007 Access VBA 1 July 8th, 2004 11:01 AM



All times are GMT -4. The time now is 03:03 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.