Jump to content

Darren2005

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Posts posted by Darren2005

  1. I have a simple login script setup for a website im designing, only when i preview it in my browser no matter what i type in the username and password fields, it always denies me access to the locked page. (even if i enter the correct username and password). Below is the source from the login page:

     

    <?php require_once('Connections/Login.php'); ?>

    <?php

    // *** Validate request to login to this site.

    session_start();

     

    $loginFormAction = $_SERVER['PHP_SELF'];

    if (isset($accesscheck)) {

    $GLOBALS['PrevUrl'] = $accesscheck;

    session_register('PrevUrl');

    }

     

    if (isset($_POST['textfield'])) {

    $loginUsername=$_POST['textfield'];

    $password=$_POST['textfield'];

    $MM_fldUserAuthorization = "";

    $MM_redirectLoginSuccess = "Granted.php";

    $MM_redirectLoginFailed = "Denied.php";

    $MM_redirecttoReferrer = false;

    mysql_select_db($database_Login, $Login);

     

    $LoginRS__query=sprintf("SELECT Username, Password FROM login 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, $Login) or die(mysql_error());

    $loginFoundUser = mysql_num_rows($LoginRS);

    if ($loginFoundUser) {

    $loginStrGroup = "";

     

    //declare two session variables and assign them

    $GLOBALS['MM_Username'] = $loginUsername;

    $GLOBALS['MM_UserGroup'] = $loginStrGroup;

     

    //register the session variables

    session_register("MM_Username");

    session_register("MM_UserGroup");

     

    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" "http://www.w3.org/TR/html4/loose.dtd">

    <html>

    <head>

    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

    <title>Login</title>

    <style type="text/css">

    <!--

    .style1 {

    font-family: Georgia, "Times New Roman", Times, serif;

    font-weight: bold;

    font-size: 14px;

    }

    .style2 {color: #CC99FF}

    .style4 {font-family: Georgia, "Times New Roman", Times, serif; font-weight: bold; font-size: 12px; color: #FFFFFF; }

    -->

    </style>

    </head>

     

    <body>

    <form name="form1" method="POST" action="<?php echo $loginFormAction; ?>">

    <p> </p>

    <p> </p>

    <p align="center" class="style1"> </p>

    <p align="center" class="style1"> </p>

    <table width="233" border="2" align="center" bordercolor="#0000FF">

    <tr bordercolor="#0000FF" bgcolor="#000000">

    <td colspan="2"><div align="center"><span class="style4">Please Enter your Login Details </span></div></td>

    </tr>

    <tr bordercolor="#0000FF">

    <td width="73"><strong>Username:</strong></td>

    <td width="144" bgcolor="#CC99FF"><input type="text" name="textfield"></td>

    </tr>

    <tr bordercolor="#0000FF">

    <td><strong>Password:</strong></td>

    <td bgcolor="#CC99FF"><input type="password" name="textfield"></td>

    </tr>

    <tr bordercolor="#0000FF">

    <td bordercolor="#0000FF" bgcolor="#CC99FF"> </td>

    <td bgcolor="#CC99FF"><div align="right" class="style2">

    <input type="submit" name="Submit" value="Login">

    </div></td>

    </tr>

    </table>

    <div align="center"></div>

    <div align="center"></div>

    </form>

    </body>

    </html>

     

    If anyone has any ideas how this problem can be resolved please let me know.

    Many thanks

  2. Hi, im new to Php and i was trying to design a simple login page for a website im designing. I 've set everything up in Dreamweaver MX with all the Sql connection and all that, only when i preview the page in my browser i get the following errors:

     

    Warning: open(/tmp\sess_6f9ee494d5cbc4be8809e748c8f63447, O_RDWR) failed: No such file or directory (2) in c:\phpdev5\www\test2\login.php on line 4

     

    Warning: Cannot add header information - headers already sent by (output started at c:\phpdev5\www\test2\login.php:4) in c:\phpdev5\www\test2\login.php on line 43

     

    Warning: open(/tmp\sess_6f9ee494d5cbc4be8809e748c8f63447, O_RDWR) failed: No such file or directory (2) in Unknown on line 0

     

    Warning: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0

     

    Does anyone know why im getting these and any ideas on how to get it to work properly?

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.