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


    Send a registration activation email

    Share
    avatar
    Linchpin311

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

    quest

    Post  Linchpin311 on Thu Mar 19, 2009 10:26 pm

    first off elvin, i wanna say i really love people like you. you and questions your make programmers around you better.

    now, onto business. you see this?
    Code:
    /* Verify that user is in database */
    $q = "SELECT password FROM ".TBL_USERS." WHERE username = '$username'";
    $result = mysql_query($q, $this->connection);
    if(!$result || (mysql_numrows($result) < 1)){
    return 1; //Indicates username failure
    }

    that should be right about the code we are having problems with. see the line that queries the database? the query is only returning the password. where it says SELECT password FROM change it to SELECT * FROM and let me know what that does for you.


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

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

    Number of posts : 24
    Registration date : 2009-03-13

    Re: Send a registration activation email

    Post  elvin66 on Fri Mar 20, 2009 3:58 am

    I don't believe it !!!!! I made that small change and it works exactly correct now ! What I don't understand is why ? You got rid of the word 'password' and replaced it with a '*'

    In a million years I would never have thought of that. I'm sure you are going to enlighten me <G>. I imagine it is quite good that I do have programming experience with Delphi as I can pick out things that don't look right to me. Some languages are similar in some ways but on the whole, I am falling in love with Php !

    What country are you from buddy ?
    avatar
    elvin66

    Number of posts : 24
    Registration date : 2009-03-13

    Re: Send a registration activation email

    Post  elvin66 on Fri Mar 20, 2009 4:06 am

    Warning: fopen(activation/1385147461.junkyard.php) [function.fopen]: failed to open stream: Permission denied in /home/elepho5/public_html/login/include/session.php on line 439

    Warning: Cannot modify header information - headers already sent by (output started at /home/elepho5/public_html/login/include/session.php:439) in /home/elepho5/public_html/login/process.php on line 105


    I just tried to register a new user and got these errors. It seems it won't create the file for verification. Any thoughts?
    avatar
    Linchpin311

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

    Re: Send a registration activation email

    Post  Linchpin311 on Fri Mar 20, 2009 10:24 am

    make sure your webserver has full rights to the activation folder. that should do it for you.


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

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

    Number of posts : 1
    Registration date : 2009-03-20

    user reg mods

    Post  phpwalter on Fri Mar 20, 2009 4:09 pm

    I made a few little changes to the user mod system you created here...

    I added a constant...
    Code:
    /**
     * Define the URL root path for this system
     * Don't forget the closing slash!'
     */
    define ('WEB_ROOT', 'http://yourdomain.tld/' );

    I changed the $content code (in session.php) that the mod system creates in the ACTIVATION directory.

    I used the existing db connection constants instead of hard coding these values again...

    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"
                        . '?>';


    I modified the mailer.php portion, as well, to use the new WEB_ROOT constant...

    Code:
                ."My Account page after signing in.\n\n"
                .'Please follow this <a href="' . WEB_ROOT . $file . '">link</a>'
                ."to activate your account.\n"
                .'If the link doesn\'t work, paste "' . WEB_ROOT . $file . '" into the address '
                ."bar of your internet browser.\n\n"
                ."- Jpmaster77's Site";

    I just made this a bit simpler. Now you don't need to hard code your db access in 2 places.

    Thanks for the mod, it worked great!

    Walter
    avatar
    Linchpin311

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

    Re: Send a registration activation email

    Post  Linchpin311 on Fri Mar 20, 2009 5:00 pm

    yea, i like what you've done with it. hopefully in the very near future (depending on my work situation) i will release some updated how-to's for everyone. would you mind if i incorporated some of your ideas into them?


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

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

    Number of posts : 24
    Registration date : 2009-03-13

    Re: Send a registration activation email

    Post  elvin66 on Fri Mar 20, 2009 5:55 pm

    Linchpin311 wrote:make sure your webserver has full rights to the activation folder. that should do it for you.

    That is odd ? It has permissions set as 755 which is full access. It is in the same folder as the login scripts. The path must be set correctly otherwise it would be having an error "File not Found" right ? I'll have a play with it. I might even create a file with the same name and put it in the activation folder and see if it will mail it
    avatar
    elvin66

    Number of posts : 24
    Registration date : 2009-03-13

    Re: Send a registration activation email

    Post  elvin66 on Fri Mar 20, 2009 6:09 pm

    Actually, I just tested the "Forgot Password" link and although it returned with sucsess, I never got the email. I'm wondering if I might have missed something in the setup. When I used the sendbulkmail script, the mail server did send me an email but it only sent it to one email address listed in the address box and I had 5 emails in there all separated properly. The code creates an array and collects every email address from user table and inserts them correctly but it sends it to only one ???

    The email part I must not have setup right.....AArgggg
    avatar
    Linchpin311

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

    Re: Send a registration activation email

    Post  Linchpin311 on Wed Mar 25, 2009 7:20 pm

    elvin66 wrote:The email part I must not have setup right
    did you ever figure out your email settings?


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

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

    Number of posts : 24
    Registration date : 2009-03-13

    Re: Send a registration activation email

    Post  elvin66 on Mon Mar 30, 2009 2:06 am

    I must apologise for my non response to your last question. I read you post and responded, and I have been waiting for days and days for you to respond to my posting, so I just went and checked out the forum and found my post never got published. Please accept my sincere apologies for this misshap.

    As for my response, I never did get it sorted out. If you go to http://www.elepho.com/login you can register an account and see if you get an email but I don't think you will. I will upgrade you to admin so you can see what is happening in that area as well.

    What I really need to sort out, is I have installed WampServer 2.0 and I need to be able to test this login script locally rather than upload scripts all night long. My problem is, I can get normal php scripts working on localhost buy the script will not. I think it is a problem with my database but can't locate the actual problem.

    When I run the main.php (which is now index.php) I get a bunch of code from one of the scripts, then below that I see my login script, then a few php errors. This is just a portion of the crap I see on my screen...


    time = time(); $this->startSession(); } /** * startSession - Performs all the actions necessary to * initialize this session object. Tries to determine if the * the user has logged in already, and sets the variables * accordingly. Also takes advantage of this page load to * update the active visitors tables. */ function startSession(){ global $database; //The database connection session_start(); //Tell PHP to start the session /* Determine if user is logged in */ $this->logged_in = $this->checkLogin(); /** * Set guest value to users not logged in, and update * active

    Any ideas ? On how to debug my local database conncetion ?
    avatar
    Linchpin311

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

    Re: Send a registration activation email

    Post  Linchpin311 on Mon Mar 30, 2009 5:21 pm

    Elvin,

    i couldnt register to your site, i kept getting the registration failed error, dont know whats going on there...

    as for you working out problems with your WAMP server, are you sure you have it set up for PHP correctly? try the old <?php echo 'hello world!'; ?> test. if it is working correctly, you should only see the text "hello world" (without the quotes). If you are seeing anything else, something is wrong.

    I installed a WAMP server on my XP machine, but i hardly ever use it. I will play around with it some more. Also, what version are you using? and finally post anything else you think i might need to know. in the end, i am very confident we will get this sorted out.


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

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

    Number of posts : 24
    Registration date : 2009-03-13

    Re: Send a registration activation email

    Post  elvin66 on Mon Mar 30, 2009 5:44 pm

    I don't know why you couldn't register, it has been working fine yikes ! I just tried and got the same problem so I'll play with it and fix it. As for WampServer it is 2.0 the latest version and php is version 5.2.9.1 and mysql is version 5.1.32 all latest versions. I have many test php files that run on the local server. I can "include" files and it all works great. I'm thinking it may be some problem accessing the database.

    I might create a simple page that includes session.php and database.php that checks for user names in the database and see if I can get that to work.

    I was just thinking, would it be easier if I zipped up my scripts including the directory structure and emailed it to you and see if you can find the problems first hand ? I mean see if you can run it on your localhost ? If so let me know and I'll send it to you...
    avatar
    Helios

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

    Login Failiure

    Post  Helios on Tue Apr 21, 2009 12:35 pm

    I modded the template as you instructed, works fine.

    Coudl you help me create function to delete the user's file after activation, and then delete the user's: username (from mysql database) and file (from server) after say 9 days without activation?
    avatar
    bman900

    Number of posts : 14
    Registration date : 2009-05-09

    Re: Send a registration activation email

    Post  bman900 on Sat May 09, 2009 3:50 pm

    Well everything seems to work but am not getting the email even though I have it set 'true' in the constants. Any ideas?

    I also get the following error on my main.php

    Parse error: syntax error, unexpected ';', expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /homepages/44/d272374679/htdocs/draft/include/session.php on line 458

    Is there a way you can upload your files that work with this modification?
    avatar
    Linchpin311

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

    Re: Send a registration activation email

    Post  Linchpin311 on Sun May 10, 2009 8:52 pm

    thats an odd error to be getting. can you post like ten lines around the line where you are getting this error?


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

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

    Number of posts : 14
    Registration date : 2009-05-09

    Re: Send a registration activation email

    Post  bman900 on Mon May 11, 2009 11:49 am

    I lost everything for now because I have been trying to get the whole lock out after X attempts.
    avatar
    Linchpin311

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

    Re: Send a registration activation email

    Post  Linchpin311 on Mon May 11, 2009 11:38 pm

    well when you are ready to come back to this i'll be here


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

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

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

    Re: Send a registration activation email

    Post  j on Fri Jun 12, 2009 12:19 am

    Hello i need help am getting this error message when i have followed the tutorial

    Parse error: syntax error, unexpected '}' in /home/tomorro1/public_html/process.php on line 196

    I have read other ppl comments but, i have seen that no 1 else has had a problem with the process php.

    Please some help me
    avatar
    Linchpin311

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

    Re: Send a registration activation email

    Post  Linchpin311 on Fri Jun 12, 2009 12:21 am

    post everything from lines 190 to 200


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

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

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

    Re: Send a registration activation email

    Post  j on Fri Jun 12, 2009 2:56 am

    Thank you in advance


    line 189 /* Error found with form */
    else{
    $_SESSION['value_array'] = $_POST;
    $_SESSION['error_array'] = $form->getErrorArray();
    header("Location: ".$session->referrer);
    }
    }
    };

    /* Initialize process */
    $process = new Process;

    line 201 ?>
    avatar
    Linchpin311

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

    Re: Send a registration activation email

    Post  Linchpin311 on Fri Jun 12, 2009 6:39 am

    heh, well that strategy didnt work. Your 10 lines of code looks fine to me. Is it possible you have put an extra } in your code? Try matching up all of your { to your } and see if you can track down the culprit.


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

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

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

    Re: Send a registration activation email

    Post  j on Fri Jun 12, 2009 7:23 am

    Thank you mate that worked fine. I have another problem when i click the link for activation it does not work can you help me again please.
    avatar
    Linchpin311

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

    Re: Send a registration activation email

    Post  Linchpin311 on Fri Jun 12, 2009 4:23 pm

    explain exactly what is or isnt happening? are you getting any errors? also are you trying this on a local or live server.


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

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

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

    Re: Send a registration activation email

    Post  j on Fri Jun 12, 2009 4:52 pm

    I am using a live server and once i reg i get the activate email once i click the link there are no errors but the page is blank. I then go to the login form and type in the details and its says account not activated.
    avatar
    Linchpin311

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

    Re: Send a registration activation email

    Post  Linchpin311 on Fri Jun 12, 2009 5:21 pm

    try turning error reporting on by typing something like error_reporting(E_ALL); somewhere on the script that prints that blank page. then try registering again and clicking the link. hopefully an error will come up and give us some more information about whats happening to you.


    _________________
    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: Send a registration activation email

    Post  Sponsored content


      Current date/time is Tue Sep 19, 2017 9:33 am