SitePoint Sponsor

User Tag List

Results 1 to 16 of 16

Hybrid View

  1. #1
    SitePoint Addict rikmg's Avatar
    Join Date
    Jan 2002
    Location
    South Yorkshire - UK
    Posts
    222
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    login page: MX/PHP? Any thoughts ?

    Using Dreamweaver MX, Iam attempting to create a login page/register page in PHP, its adding users to the mysql database, but when i add a username that already exists its supposed to divert to another page called taken.php, & also an error page when the login fails,however its still taking me to the welcome page ! whatever i do ? any thoughts ?

    the login page comes back with various errors too, am i missing some important values ? the code for the login is below...

    this is my first attempt, be kind !

    this is the error i get back from the login.php page,

    Warning: open(/tmp\sess_61267ce9f0e04fa7dcd729aaad604a4c, O_RDWR) failed: m (2) in C:\apache\htdocs\login.php on line 4

    and:

    Warning: open(/tmp\sess_61267ce9f0e04fa7dcd729aaad604a4c, O_RDWR) failed: m (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



    Cheers !!

    Richard.


    -----------------------------------------------------------------------------------------------

    <?php require_once('Connections/log.php'); ?>
    <?php
    // *** Start the session
    session_start();
    // *** Validate request to log in to this site.
    $FF_LoginAction = $HTTP_SERVER_VARS['PHP_SELF'];
    if (isset($HTTP_SERVER_VARS['QUERY_STRING']) && $HTTP_SERVER_VARS['QUERY_STRING']!="" ) $FF_LoginAction .= "?".$HTTP_SERVER_VARS['QUERY_STRING'];
    if (isset($HTTP_POST_VARS['username'])) {
    $FF_valUsername=$HTTP_POST_VARS['username'];
    $FF_valPassword=$HTTP_POST_VARS['password'];
    $FF_fldUserAuthorization="";
    $FF_redirectLoginSuccess="welcome.html";
    $FF_redirectLoginFailed="error.html";
    $FF_rsUser_Source="SELECT ID, username ";
    if ($FF_fldUserAuthorization != "" ) $FF_rsUser_Source .= "," . $FF_fldUserAuthorization;
    $FF_rsUser_Source .= " FROM users WHERE ID='" . $FF_valUsername . "' AND username='" . $FF_valPassword . "'";
    mysql_select_db($database_log, $log);
    $FF_rsUser=mysql_query($FF_rsUser_Source, $log) or die(mysql_error());
    $row_FF_rsUser = mysql_fetch_assoc($FF_rsUser);
    if(mysql_num_rows($FF_rsUser) > 0) {
    // username and password match - this is a valid user
    $MM_Username=$FF_valUsername;
    session_register("MM_Username" );
    if ($FF_fldUserAuthorization != "" ) {
    $MM_UserAuthorization=$row_FF_rsUser[$FF_fldUserAuthorization];
    } else {
    $MM_UserAuthorization="";
    }
    session_register("MM_UserAuthorization" );
    if (isset($accessdenied) && false) {
    $FF_redirectLoginSuccess = $accessdenied;
    }
    mysql_free_result($FF_rsUser);
    session_register("FF_login_failed" );
    $FF_login_failed = false;
    header ("Location: $FF_redirectLoginSuccess" );
    exit;
    }
    mysql_free_result($FF_rsUser);
    session_register("FF_login_failed" );
    $FF_login_failed = true;
    header ("Location: $FF_redirectLoginFailed" );
    exit;
    }
    ?>
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <body>
    <form name="form1" method="POST" action="<?php echo $FF_LoginAction?>">

    <table width="80%" cellspacing="0" cellpadding="0">
    <tr>
    <td width="11%">Username/td>
    <td width="89%">
    <input name="username" type="text" id="username"></td>
    </tr>
    <tr>
    <td>Password/td>
    <td>
    <input name="password" type="password" id="password">
    <input type="submit" name="Submit" value="Log in"></td>
    </tr>
    <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    </tr>
    </table>
    </form>
    </body>
    </html>
    Last edited by rikmg

  2. #2
    if($awake){code();} PHP John's Avatar
    Join Date
    Jul 2002
    Location
    Along the Wasatch Fault line.
    Posts
    1,771
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Create a "temp" dir off of your root. ie: C:\temp
    John

  3. #3
    SitePoint Addict rikmg's Avatar
    Join Date
    Jan 2002
    Location
    South Yorkshire - UK
    Posts
    222
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    running on localhost with phpmyadmin apache,mysql all combined, what would the Session variable look like from session_start(); where would is my php.ini stored ?

  4. #4
    SitePoint Addict rikmg's Avatar
    Join Date
    Jan 2002
    Location
    South Yorkshire - UK
    Posts
    222
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    so would i create the temp folder in the apache folder or in htdocs ?

  5. #5
    if($awake){code();} PHP John's Avatar
    Join Date
    Jul 2002
    Location
    Along the Wasatch Fault line.
    Posts
    1,771
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do a search for "php.ini". In it you will find a line like this:
    ; Argument passed to save_handler. In the case of files, this is the path
    ; where data files are stored. Note: Windows users have to change this
    ; variable in order to use PHP's session functions.
    session.save_path = /tmp
    This would be the server root.
    John

  6. #6
    SitePoint Addict rikmg's Avatar
    Join Date
    Jan 2002
    Location
    South Yorkshire - UK
    Posts
    222
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i tried to add another user to the db, via kevins method and now i get submission error again without changing anything previously...

  7. #7
    SitePoint Addict rikmg's Avatar
    Join Date
    Jan 2002
    Location
    South Yorkshire - UK
    Posts
    222
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i created a directory in the apache folder, i'll slow down in my excitement that you may e able to help..

  8. #8
    SitePoint Addict rikmg's Avatar
    Join Date
    Jan 2002
    Location
    South Yorkshire - UK
    Posts
    222
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i've found the file, now i have the temp folder in the apache folder is this my server root, sorry if i sound dumb...

  9. #9
    SitePoint Addict rikmg's Avatar
    Join Date
    Jan 2002
    Location
    South Yorkshire - UK
    Posts
    222
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i changed it to this;

    ; Argument passed to save_handler. In the case of files, this is the path
    ; where data files are stored. Note: Windows users have to change this
    ; variable in order to use PHP's session functions.
    session.save_path = C:/apache/temp


    still no joy....

  10. #10
    chown linux:users\ /world Hartmann's Avatar
    Join Date
    Aug 2000
    Location
    Houston, TX, USA
    Posts
    6,455
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    Have you tried

    session.save_path = C:\apache\temp

    ??

  11. #11
    SitePoint Addict rikmg's Avatar
    Join Date
    Jan 2002
    Location
    South Yorkshire - UK
    Posts
    222
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    is it really that fussy ?

  12. #12
    chown linux:users\ /world Hartmann's Avatar
    Join Date
    Aug 2000
    Location
    Houston, TX, USA
    Posts
    6,455
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by rikmg
    is it really that fussy ?
    It may or may not be... I am not 100% sure.

    Also, make sure that after you make changes to the ini file, you restart Apache.

  13. #13
    SitePoint Addict rikmg's Avatar
    Join Date
    Jan 2002
    Location
    South Yorkshire - UK
    Posts
    222
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    still getting databse error occured in your script iam using the tutorial from kevins PHP sessions/mysql user login tut.

  14. #14
    SitePoint Addict rikmg's Avatar
    Join Date
    Jan 2002
    Location
    South Yorkshire - UK
    Posts
    222
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it worked once and added a user to the db then stopped and i changed nothing, did something time out ?

  15. #15
    SitePoint Addict rikmg's Avatar
    Join Date
    Jan 2002
    Location
    South Yorkshire - UK
    Posts
    222
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I would have thought this would have been relatively easy to sort out, why is it so fussy ? why add one then fail ? looks like Access/ASP or coldfusion is calling !! More expensive yep, but more reliable ? i refuse to give up on this though !!

  16. #16
    chown linux:users\ /world Hartmann's Avatar
    Join Date
    Aug 2000
    Location
    Houston, TX, USA
    Posts
    6,455
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    I don't think it is a question of reliability, maybe just customization.

    Try downloading phpdev from http://www.firepages.com.au

    You can program your site in MX and just run them from the web browser. Everything works out of box with the phpdev setup. Just read the directions and run the install file.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •