1. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,957
    Rep Power
    1046
    And what are the three garbage collector settings? Read them at runtime to make sure you're looking at the right values.

    Are you sure there's no external script which regularly empties the session folder?
    The 6 worst sins of security ē How to (properly) access a MySQL database with PHP

    Why canít I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".
  2. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2014
    Posts
    5
    Rep Power
    0
    session.gc_probability = 0
    session.gc_divisor = 1000
    ;session.gc_maxlifetime = 0

    the maxlifetime is commented out.

    There are no external scripts from what I can see that do anything to the session folder.
  3. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,957
    Rep Power
    1046
    Those aren't the runtime values. They're from the ini file and might be overwritten in an .htaccess file or through ini_set().

    We need the effective values at runtime.

    Also note that a different application which uses the same session folder might delete session files based on its own settings. So use a unique folder for this application and set it at runtime with session_save_path(). This will prevent other applications or scripts from messing with the session files.

    Finally, make a minimal example. Start a session, write some value to it and then make a script which does nothing but echo the session content when called.
    The 6 worst sins of security ē How to (properly) access a MySQL database with PHP

    Why canít I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".
  4. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2014
    Posts
    1
    Rep Power
    0

    Session Variables


    How do I add new session variables and then echo it in different locations? For example, the users first and last name, and location. I want these to be displayed in the users profile.

    Thanks!
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2014
    Posts
    1
    Rep Power
    0
    Can someone help me please? I followed this tutorial to the tee but it doesn't work. When I go to login.php I am getting an error..
    Failed to connect to the database: SQLSTATE[28000] [1045] Access denied for user 'u307191351_admin'@'10.1.2.17' (using password: YES)
    I am pretty sure it has to do with the CREATE TABLE...)ENGINE=InnoDB..When I check the structure of the table it says the type is MyISAM. I am guessing it didn't recognize InnoDB and defaulted to MyISAM. How can I fix this? The code looks awesome and I have read many positive comments about it. I have no formal training on PHP and I know even less about MySQL. Please help!
  6. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    369
    Rep Power
    8
    first of all, sorry for the late response, have you double checked your password, username, database name and host in common.php? Can you reach the database in any other way with the same password etc.?
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2014
    Posts
    3
    Rep Power
    0

    Session Variables


    Am trying to add both registration and login to one index.php but i keep getting this error

    "Notice: A session had already been started - ignoring session_start() in C:\wamp\www\css\common.php on line 86"
  8. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2014
    Posts
    3
    Rep Power
    0
    create a database (eg)"members
    paste the database code "CREATE TABLE..." into the SQL

    on common.php edit the following
    IF on test sever app try this
    $username = "root"; or your SQL user name
    $password = ""; or SQL your password
    $host = "localhost or 127.0.0.1";
    $dbname = "members";
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2014
    Posts
    3
    Rep Power
    0
    create a database (eg)"members
    paste the database code "CREATE TABLE..." into the SQL

    on common.php edit the following
    IF on test sever app try this
    $username = "root"; or your SQL user name
    $password = ""; or SQL your password
    $host = "localhost or 127.0.0.1";
    $dbname = "members";
  10. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2014
    Posts
    3
    Rep Power
    0
    First of all, Thanks for the code..
    I had one request.. is there anyway someone could help me show last logged in inputs.. I am really new to this..
    I've managed to to show it on my memberlist.php I just can't get it to update the database when he user has logged in..
    Did I mention how new I was?

    Thanks again for the code!!
  11. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    369
    Rep Power
    8
    frankchris, please post some code, and I think you required common.php twice

    What was you problem with the database?

    Simon, what do you exactly want? I think I don't really understand your request...
  12. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2014
    Posts
    3
    Rep Power
    0
    Hey derplumo..
    I would like to to be able to view the last time the user logged in and display it on the memberslist.php page..
    THanks
  13. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    369
    Rep Power
    8
    Hi,

    I need that for my own website too, so it will come. I'm currently very busy so sorry if it comes a bit late.

    Also I know that it should be set (so the user is online) by logging in, but it should be unset when the user logs out. But a lot of people just close their browsers so this is going to be hard. I don't really know how check by routine (5 minutes or something) which users are logged in and so which sessions still exist...
  14. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2014
    Posts
    3
    Rep Power
    0
    I have the date/time registered figured out using the MySQL timestamp function and echoing it out to the memberlist.php.. The last logged in function is stumping me....
  15. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2014
    Posts
    5
    Rep Power
    0
    Very good login system, works perfect!, can anybody suggest a code how I can protect the login from multiple logins with the same user.

    how to prevent multiple logins of the same account at the same time from different devices? [duplicate]

IMN logo majestic logo threadwatch logo seochat tools logo