SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Hybrid View

  1. #1
    SitePoint Zealot
    Join Date
    Jul 2000
    Posts
    132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    is it possible to run session management on your computer?
    i.e. running SAMBAR server, and PHP4.
    I am creating an advertising system which needs this, and therefore I need to test it!
    Thanks.
    -AJ

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sure it doesn't have much to do with the server but more to do with PHP. run phpinfo() and make sure the session functions are available. Then you should be able to run it, are you running into a specific problem?
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  3. #3
    SitePoint Wizard silver trophy Karl's Avatar
    Join Date
    Jul 1999
    Location
    Derbyshire, UK
    Posts
    4,411
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yep, if you use PHP4 or PHP3 with PHP LIB you can run it as you would on the web server.
    Karl Austin :: Profile :: KDA Web Services Ltd.
    Business Web Hosting :: Managed Dedicated Hosting
    Call 0800 542 9764 today and ask how we can help your business grow.

  4. #4
    SitePoint Zealot
    Join Date
    Jul 2000
    Posts
    132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Right.
    Well, thankyou for confirming that for me. I thought you would be able to, but wasn't sure.

    Now, the reason why I am asking, is because I have the following error in my script:
    Code:
    Warning: open(/tmp/sess_eea81f98dd0422f12d567bce5159c228, O_RDWR) failed: m (2) in C:/PROGRAMMING/eliter/advertsys/index.php on line 4
    I have no idea what this means. Then, at the end, I get :
    Code:
    Warning: open(/tmp/sess_eea81f98dd0422f12d567bce5159c228, O_RDWR) failed: m (2) in Unknown on line 0
    
    Warning: Failed to write session data. Please check that the current setting of session.save_path is correct (/tmp) in Unknown on line 0
    However, there is probably an error in the script.
    I have sort of taken some of it from a user management script, because I really DO NOt get session management.
    SO I reckon loads of it is wrong, it is:

    Code:
    <?php
    $sessiontimeout = "900";
    
    session_start();
    session_register("SESSION");
    if (! isset($SESSION)) {
    $SESSION["sessionstart"] = time();
    $SESSION["nicestart"] = date("m-d-Y H:i:s",$SESSION["sessionstart"]);
    $SESSION["lastaccessed"] = $SESSION["sessionstart"];
    $SESSION["expires"] = $SESSION["sessionstart"] + $sessiontimeout;
    $SESSION["loggedin"] = 0;
    $SESSION["logintries"] = 0;
    $SESSION["remote_addr"] = $REMOTE_ADDR;
    } elseif ($SESSION["expires"] > time()) {
    $SESSION["lastaccessed"] = time();
    $SESSION["expires"] = $SESSION["lastaccessed"] + $sessiontimeout;
    } else {
    session_destroy();
    unset($SESSION);
    session_start();
    session_register("SESSION");
    $SESSION["sessionstart"] = time();
    $SESSION["nicestart"] = date("m-d-Y H:i:s",$SESSION["sessionstart"]);
    $SESSION["lastaccessed"] = $SESSION["sessionstart"];
    $SESSION["expires"] = $SESSION["sessionstart"] + $sessiontimeout;
    $SESSION["loggedin"] = 0;
    $SESSION["logintries"] = 0;
    $SESSION["remote_addr"] = $REMOTE_ADDR;
    }
    ?>
    
    
    <html>
    <title>LOGIN - eliter Advert Management System</title>
    <body bgcolor="ffffff" text="000000" topmargin=1 leftmargin=1 rightmargin=1>
    <link rel="stylesheet" href="../style.css" TYPE="text/css">
    
    <table cellpadding=0 cellspacing=0 border=0 bgcolor=ffffff width=580>
    <tr width=580 valign=top><td width=300>
    <img src="titleadvertsys.gif">
    
    </td>
    <td width=280>
    
    </td>
    </tr></table>
    
    <?php
    require("key.php");
    
    if ($SESSION["loggedin"] == 1) {
    header("Location: $advertiserhome");
    exit;
    } else {
    if ($SESSION["logintries"] == 0) {
    
    ?>
    
    <br><br>
    
    <form action="<?PHP echo($advertiserlogin); ?>" method=post>
     <table width="300" border="0" cellspacing="0" cellpadding="4">
    <tr> 
     <td height="4" align="left" width="110" class="tenptbold">Account Name: </td>
    <td height="4" width="190"> 
    <input type="text" name="login">
    </td>
    </tr>
    <tr> 
    <td height="4" align="left" width="110" class="tenptbold">Password: </td>
    <td height="4" width="190"> 
    <input type="password" name="adpasswordlogin">
    </td>
    </tr>
    <tr>
    <td width="120" class="sevenptverdana" align="left"><a href="<?php echo($forgotpassword); ?>">Forgot your password?</a></td>
    <td width="190"> <input type="submit" name="submit" value="Advertiser Login" style="font-family:arial; font-size:10pt">
    </td></tr>
    </table>
    
    <?php 
    } elseif ($SESSION["logintries"] < 3) {
    $trynum = $SESSION["logintries"] + 1;
    ?>
    
    <br><br>
    <font class=tenptbold>This is login attempt number <?php echo($trynum); ?> .</font><br>.
    
    <form action="<?PHP echo($advertiserlogin); ?>" method=post>
     <table width="300" border="0" cellspacing="0" cellpadding="4">
    <tr> 
     <td height="4" align="left" width="110" class="tenptbold">Account Name: </td>
    <td height="4" width="190"> 
    <input type="text" name="login">
    </td>
    </tr>
    <tr> 
    <td height="4" align="left" width="110" class="tenptbold">Password: </td>
    <td height="4" width="190"> 
    <input type="password" name="adpasswordlogin">
    </td>
    </tr>
    <tr>
    <td width="120" class="sevenptverdana" align="left"><a href="<?php echo($forgotpassword); ?>">Forgot your password?</a></td>
    <td width="190"> <input type="submit" name="submit" value="Advertiser Login" style="font-family:arial; font-size:10pt">
    </td></tr>
    </table>
    
    <?php 
    } else {
    $login = $SESSION["login"];
    
    mysql_connect("$mysqlusername","$connection","$mysqlpassword");
    mysql_select_db("$eliterdb");
    
    mysql_query("UPDATE advertisers SET locked='y' WHERE login='$login' ");
    ?>
    <br><br>&nbsp&nbsp;&nbsp;<img src=$arrow>&nbsp;&nbsp;
    <font class=fourteenpt>ACCOUNT <u><?php echo($username); ?></u> LOCKED.</font><br><br>
    <font class=tenpt>You have exceeded the total permitted Login attempts.<br>
    To unlock your account, please contact the Administrator via the <a href="$admincontact">Advertiser Support Form</a>.<br><br>
    <font class=sevenptverdana>We are sorry for any inconvenience caused, but we are simply taking precautions for the advertisers sake.
    
    <?php
    session_destroy();
    exit;
    }
    
    }
    ?>
    Sorry it is so long :/
    -AJ

  5. #5
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes the default setting for the session file dir is set to /tmp a unix setting, you need to open your php.ini file and find the line that says
    session.save_path /tmp

    and change it to

    c:\tmp

    Of course maknig sure to create a dir named c:\tmp on your hard drive

    That way you will a valid place to store the session data
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  6. #6
    SitePoint Zealot
    Join Date
    Jul 2000
    Posts
    132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you very much.
    Very helpful, once again


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
  •