SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: activation link

  1. #1
    SitePoint Addict
    Join Date
    Oct 2010
    Posts
    323
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    activation link

    please my registration and activation link was working fine until now, it says problem connecting when the link to activate account is clicked.

    this is the related code of registration file

    PHP Code:
        {
           
    //generate random code
           
    $code rand(11111111,99999999);
           
           
    //send activation email
           
    $to $email;
           
    $subject "Activate your account";
           
    $headers "From: donotreply@reacheasy.co.uk";
           
    $body " Hello $fullname,\n\nUsername $username,\n\n Password $password ,\n\nYou registered and need to activate your account, n\nPlease keep this email safe as it contains your password . Click the link below or paste it into the URL bar of your browser\n\nhttp://reacheasy.co.uk/activate.php?code=$code\n\nThanks!"
    and this is the activation file
    PHP Code:
    <?php
     
    include 'include/global.php';

        
    $code $_GET['code'];

        if (!
    $code)
            echo 
    "No code supplied";
        else
        {
            
    $check mysql_query("SELECT * FROM reusers WHERE code='$code' AND active='1'");
            
    //echo "SELECT * FROM users WHERE code='$code' AND active='1'";
            
    if (mysql_num_rows($check)==1)
                echo 
    "You have already activated your account";
            else
            {
                
    $activate mysql_query("UPDATE reusers SET active='1' WHERE code='$code'");
                echo 
    "Your account has been activated!<a href='index.php'>Return to login page</a>";
            }
            
        }
        
    ?>
    please help have a look thanks

  2. #2
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,097
    Mentioned
    153 Post(s)
    Tagged
    2 Thread(s)
    Could you also post that include/global.php file please, as it would seem the problem is in there, not in the code you've shown so far.
    Rémon - Hosting Advisor

    SitePoint forums will switch to Discourse soon! Make sure you're ready for it!

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  3. #3
    SitePoint Addict
    Join Date
    Oct 2010
    Posts
    323
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    scallioxtx you got it spot on, as in the password in that script has a problem, and i have fixed it.thanks for directing me there

  4. #4
    SitePoint Member
    Join Date
    Apr 2012
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think you getting data from database without making connection. you code is fine. connect to your database with mysql_connect("localhost","username","Password"); and then select database with mysql_select_db("database name here") then try it will work


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
  •