PHP Login System with Admin Features

Would you like to react to this message? Create an account in a few clicks or log in to continue.
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


+8
j
bman900
Helios
phpwalter
elvin66
Fred-Eric
Linchpin311
travelfrog
12 posters

    Send a registration activation email

    j
    j


    Number of posts : 5
    Registration date : 2009-06-12

    Send a registration activation email - Page 3 Empty Re: Send a registration activation email

    Post  j Sat Jun 13, 2009 5:22 am

    Ok i have done that no errors came i can show you what code the blank page has this is the activation link the user clicks.

    <?php

    $link = mysql_connect("localhost","root_1","james") or die(mysql_error());
    mysql_select_db("user_people",$link) or die(mysql_error());

    $q = "UPDATE users SET userlevel = 2 WHERE username = 'john123'";
    mysql_query($q, $link);

    error_reporting(E_ALL);
    ?>


    Thank you in advance for your time.
    Linchpin311
    Linchpin311


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

    Send a registration activation email - Page 3 Empty Re: Send a registration activation email

    Post  Linchpin311 Sat Jun 13, 2009 9:12 am

    alright, well i should have been more clear, that error reporting line should have came first... but that really doesnt matter because according to your code it is never suppose to print any message saying if the activation was successful or not.

    try changing mysql_query($q, $link); to something like:
    Code:
    if(mysql_query($q, $link)){

        echo 'Your account has been activated';

    }
    else{

        echo 'An error has occured: <b>' . mysql_error() . '</b>';

    }

    This will tell you if your account was activated or not. And if there was an error and your account wasnt activated you will print out the mysql error so you know what happened.
    julian
    julian


    Number of posts : 4
    Age : 36
    Localisation : Down Under
    Registration date : 2009-08-20

    Send a registration activation email - Page 3 Empty Re: Send a registration activation email

    Post  julian Thu Aug 20, 2009 7:53 am

    hmm, it's been quite a while since the last post/discussion..

    I was wondering if anyone could help me with this 'activation link' please..

    First off, thanks Linchpin311 and all for the help & support..
    I've been following up all the mods to the script and the discussions as well, and it works just fine..

    but, I stuck on the activation link, it keeps saying "404 Not Found" page..

    Well, the activation folder has permissions set to 755
    A new user registration page works great..
    Got email sent including the activation link in the format of:
    Code:
    http://www.mydomainname.com/register/activation/1999912376.sample123.php
    But when I click on that activation link in the email, it always open that "404 Not Found" page..
    I tried to register a new account several times, but still open-up that 404 page..

    And when I tried to login without activate the activation link in the email, it gave me that error message of "Your account has not been activated yet"

    I edit the part as phpwalter mentioned in his/her post:
    Code:
    http://jpmaster77forum.forumotion.com/hacks-and-modifications-f4/send-a-registration-activation-email-t16-15.htm#293
    have i missed something here?
    can anyone please guide me on this problem? thanks Smile
    Linchpin311
    Linchpin311


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

    Send a registration activation email - Page 3 Empty Re: Send a registration activation email

    Post  Linchpin311 Thu Aug 20, 2009 11:12 am

    well, first i need the usual questions answered...

    are you on a live or local server?
    is php giving you any errors?
    if its not giving you any errors, do you have error reporting turned on or off?


    because you say you are getting a 404 when you try to load the page, my first instinct is that the page isnt being created on the server. can you verify if the page is being created? i know you said it, but i would also double check permissions for all files and folders since that is a common reason this script fails.
    julian
    julian


    Number of posts : 4
    Age : 36
    Localisation : Down Under
    Registration date : 2009-08-20

    Send a registration activation email - Page 3 Empty Re: Send a registration activation email

    Post  julian Thu Aug 20, 2009 7:23 pm

    Oh yeah sorry... I forgot to mentioned that earlier.. Smile

    I'm using a Live server.
    No errors found. But it was having the error of that "require once".. I forgot what I did, and that message had gone now.
    About the error reporting, no I don't have it turn on or off.. (actually I don't know how to do it)

    hmm, yes I thought so, that no page has been created under the folder 'activation'.
    and when I checked in that folder on the server, and found no file.

    I've double checked it again, and the activation folder has permissions set to 755.
    I did also tried to put a simple 'index.html' file in that 'activation' folder, and when I checked it on my browser, it works fine.

    Shocked

    thx Linchpin311 for the reply..
    Linchpin311
    Linchpin311


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

    Send a registration activation email - Page 3 Empty Re: Send a registration activation email

    Post  Linchpin311 Thu Aug 20, 2009 11:27 pm

    many live servers automatically turn error reporting off at the php.ini level ...but for security reasons its a good idea to be redundant and turn it off again in your code. leaving error reporting on a live site is a HUGE security risk. always turn it off if you are not debugging your site.

    putting error_reporting(E_ALL); at the top of a script will turn error reporting on for the length of that script. alternitavely, error_reporting(0); will turn it off. if you are using some sort of configuration file that is included in every page on your site then putting a snippet for error reporting will turn this feature on or off site wide.

    since we are using a configuration file for our login script, i would put error_reporting(E_ALL); somewhere in there to turn on error reporting site wide. then go ahead and re-run the script and see if any errors are reported.
    julian
    julian


    Number of posts : 4
    Age : 36
    Localisation : Down Under
    Registration date : 2009-08-20

    Send a registration activation email - Page 3 Empty Re: Send a registration activation email

    Post  julian Fri Aug 21, 2009 3:19 am

    gosh..
    what a silly mistake..
    I somehow pointed the activation folder at the one on top of the register folder Embarassed

    Main
    |_ activation
    |_ register
         |_activation

    And I don't know why, last night I didn't check the activation folder, the one inside the register folder instead... sorry Linchpin311..
    And today, when I check that folder, there are many of these activation files.. affraid

    Anyway, got it fixed! Laughing
    And then got this error message printed on the browser:
    Code:
    Parse error: syntax error, unexpected T_ELSE in ../activation/1236456175.sampleabc.php on line 11
    But I haven't tried to add the error_reporting(E_ALL); line on the script..
    thanks for the suggestion tho..

    And so, was just struggling trying to edit/change the mysql_query($q, $link); part under sessions.php, and finally came out as the following:
    Code:
    $content = "<?php\n\n"
          . 'require_once \'../include/constants.php\';' . "\n\n"
          . '$link = mysql_connect(DB_SERVER,DB_USER,DB_PASS) or die(mysql_error());' . "\n\n"
          . 'mysql_select_db(DB_NAME,$link) or die(mysql_error());' . "\n\n"
          . '$q = "UPDATE `users` SET `userlevel` = 2 WHERE `username` = \'' . $subuser  . "'\";\n\n"
       /* . 'mysql_query($q, $link);' . "\n\n"  */
          . 'if(mysql_query($q, $link)){'
          ."\n"
          ."    echo 'Your account has been activated! click <a href=\"http://www.thanks.Linchpin311.for.your.help\">here to continue</a>';\n"
          ."\n"
          ."}\n"
          ."else{\n"
          ."\n"
          ."    echo 'An error has occured: <b>' . mysql_error() . '</b>';\n"
          ."\n"
          ."}\n"
          .'?>';
    and it works gr8t!! awesome... cheers

    thanks once again Linchpin311..
    Apollo
    Apollo


    Number of posts : 9
    Registration date : 2010-03-22

    Send a registration activation email - Page 3 Empty Re: Send a registration activation email

    Post  Apollo Mon Aug 23, 2010 8:15 pm

    I eventually got this working, but had to read through the topic to see the other flaws in the code. Nice work all the same, thanks.

    I also should point out that if you have implemented this on an existing website like i have done, there will be members still on userlever '1' and therefor not be able to access your site.

    This query will change that:
    Code:

    update users set userlevel = '2' where userlevel = '1'
    Kereltj33
    Kereltj33


    Number of posts : 1
    Registration date : 2011-03-13

    Send a registration activation email - Page 3 Empty It doenst send an e-mail :S:S

    Post  Kereltj33 Sun Mar 13, 2011 5:12 pm

    Hello,

    I have installed your scripts for sending an activation e-mail when users make an account on my website,
    But it doest send an e-mail and i cant find what the problem is :S

    Here you can download my scripts : http://www.mediafire.com/?s2h3n1bgjr3l1
    and i hope you can find the error Wink

    Thank you very much!

    If you need anything more, plz contact me

    Website : www.Kereltj33.com
    E-mail : Robinkopertje@hotmail.com
    Or : Noreply@kereltj33.com

    I hope you can help me!

    Greetings,
    Kereltj33
    Robin Koper
    Enquinbue
    Enquinbue


    Number of posts : 2
    Registration date : 2011-06-10

    Send a registration activation email - Page 3 Empty Worked halfway, sorting through a final bug

    Post  Enquinbue Fri Jun 10, 2011 8:10 am

    think it might be useful to throw in a lil bit o' code so the activation links are sorted into subfolders by days of the week, then trashed after 7 days? might solve the problem with undeleted activation links if they just expire after a certain period of time
    Enquinbue
    Enquinbue


    Number of posts : 2
    Registration date : 2011-06-10

    Send a registration activation email - Page 3 Empty Re: Send a registration activation email

    Post  Enquinbue Fri Jun 10, 2011 8:31 am

    i'm having a bug that i'm tracing back to somewhere in database.php where the error codes aren't allowing users to log in. for some reason, its not referencing the real user level like its supposed to, and whether or not the users are above level 2, it spits out "check the activation email". the whole process is working 100% fine, up until logging in. as soon as i can figure this one out, it will be 100% functional

    Sponsored content


    Send a registration activation email - Page 3 Empty Re: Send a registration activation email

    Post  Sponsored content


      Current date/time is Fri May 17, 2024 4:26 am