PHP Login System with Admin Features

This forum was created to talk about the PHP Login System with admin features created by jpmaster77 on evolt's website


    Function to log when a file is created

    Share
    avatar
    Helios

    Number of posts : 9
    Registration date : 2009-04-21

    Function to log when a file is created

    Post  Helios on Tue Apr 28, 2009 2:29 am

    hey, i'm using linchpin's activation email upon registering modification.

    I was thinking about creating a cron job schedular or function to log when a file is sent out, and 8 days without activation it would delete the file. Or when the user has activated it will delete the file.

    I want to do this becuase the activation folder is getting quite big now Smile

    I know what I want but im sure how to create it; any help would be greatly apreciated.
    avatar
    Linchpin311

    Number of posts : 220
    Age : 33
    Localisation : Long Island
    Registration date : 2007-05-14

    Re: Function to log when a file is created

    Post  Linchpin311 on Wed Apr 29, 2009 4:53 pm

    hey thats a cool idea! ive read about cron jobs but i really dont know how they function. its like a unix command or something that will execute another command (or file or whatever) according to the time you specify. right?

    well in any case you would need to create a short script that will search for users who haven't activated their accounts within 8 days (pretty simple). As for deleting the activation file when a user activates their accounts, you would need to redirect them to such a script and have that script delete the activation file... also pretty simple. let me know if you need any more ideas on how to do this.


    _________________
    in the end, the universe tends to unfold as it should...

    Also note that it is your responsibility to die() if necessary.
    avatar
    Helios

    Number of posts : 9
    Registration date : 2009-04-21

    Re: Function to log when a file is created

    Post  Helios on Thu Apr 30, 2009 2:09 am

    i'd have to use the last active timestamps to see who wasnt active in the last 8 days?
    avatar
    Linchpin311

    Number of posts : 220
    Age : 33
    Localisation : Long Island
    Registration date : 2007-05-14

    Re: Function to log when a file is created

    Post  Linchpin311 on Thu Apr 30, 2009 5:28 pm

    yep. that's how i would do it.


    _________________
    in the end, the universe tends to unfold as it should...

    Also note that it is your responsibility to die() if necessary.
    avatar
    Helios

    Number of posts : 9
    Registration date : 2009-04-21

    Re: Function to log when a file is created

    Post  Helios on Fri May 01, 2009 2:51 am

    whats the command to delete a file in php?
    avatar
    Linchpin311

    Number of posts : 220
    Age : 33
    Localisation : Long Island
    Registration date : 2007-05-14

    Re: Function to log when a file is created

    Post  Linchpin311 on Fri May 01, 2009 5:00 pm

    use the unlink() function


    _________________
    in the end, the universe tends to unfold as it should...

    Also note that it is your responsibility to die() if necessary.
    avatar
    Helios

    Number of posts : 9
    Registration date : 2009-04-21

    Re: Function to log when a file is created

    Post  Helios on Sat May 02, 2009 11:27 am

    I have tried to think about doing this, i havent ever created anything like this before, how would you do it? That may give me some ideas on how to do it myself.
    avatar
    Linchpin311

    Number of posts : 220
    Age : 33
    Localisation : Long Island
    Registration date : 2007-05-14

    Re: Function to log when a file is created

    Post  Linchpin311 on Mon May 04, 2009 12:10 am

    honestly i cant help you with the cron job (not now at least), i just dont know enough about it. i know a lot of hosts (specifically ones that run c-panel) give you a pretty easy interface for creating a cron job, but beyond that i really dont know.

    now i do know that all a cron job really does is run a command (in this case, we want it to run a script) at a specifically set time so we still need to create that script... now this is more in my field!

    first off let me say, like so many of my scripts and mods, this one is old, outdated and in much need of a re-write. i do plan to re-write it but time and sleep are somethings i just dont have enough of to spare. that being said, i dont think this is possible without editing some of the existing code. currently, there is no way to figure out how long ago a user attempted to register. i would suggest opening up session.php and finding the line $num = rand(1, 9999999999); and changing it to $num = time();. this will change the random number to a current unix timestamp thus keeping $num unique (as long as two users dont register at the EXACT same time).

    after you do this you will be able to figure out who hasnt activated within the time frame you set. first you would have to query the database to see who is still a userlevel 1 and look for their file. then you can you can compare the timestamp in the file to the current unix timstamp. if the file is older than whatever you set then use the unlink(); function to take care of a little housekeeping. when the file is successfully make sure you delete the record out of the database so the user can register the same username at a later date if they so choose. you might want to send out an email to the username letting them know they took too long and they'll have to re-register to join your site.


    _________________
    in the end, the universe tends to unfold as it should...

    Also note that it is your responsibility to die() if necessary.

    Sponsored content

    Re: Function to log when a file is created

    Post  Sponsored content


      Current date/time is Wed Nov 14, 2018 1:01 am