SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Guru
    Join Date
    Oct 2004
    Location
    uk
    Posts
    853
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    forgot password + password reset

    Hi guys

    This is my script. it isnt working at moment. it doesnt send the email?

    PHP Code:
    <?php
    // MySQL Information.

    $db_host "localhost"// Host, 99% of the time this is localhost.
    $db_username "notexper_two"// Username here
    $db_password "three"// Password here

    $linkID = @mysql_connect("$db_host""$db_username""$db_password");

    // query commands

    mysql_select_db("notexper_one"$linkID) or die(mysql_error()); // Database here
    $resultID mysql_query("SELECT user_email FROM jobseekers WHERE user_email = '$user_email'"$linkID) or die(mysql_error());

    // End of query commands
    // Check if Email is in database

    $num_rows mysql_num_rows($resultID);
    $row mysql_fetch_array($resultID);
    $user_id $row[0];

    if (
    $user_id == "") {
    print 
    "We're sorry, your Email does not appear to be in our database.";
    }
    else {


    // Create a new, random password.



       
    $password substr (MD5(uniqid(rand(),1)), 310);



    // Make the query.



       
    $query "UPDATE jobseekers SET password=password('$password') WHERE user_id = '"$_SESSION['seeker'] ."'";

       
    $result = @mysql_query ($query); // Run the query.

       
    if (mysql_affected_rows() == 1)  // If it ran OK







    // Send Password to email
    // send email 



    $to      "$user_email";


    $subject 'Your job has been added'



    $message 'Password: $password'



    $headers 'From: christhedonkey2007@yahoo.co.uk'


    if(!
    mail($to$subject$message$headers))



    echo 
    "Your Password has been sent to $user_email ";

    }


    // End of Send Password to email

    mysql_close($linkID);

    ?>
    </body>
    </html>


    <?php include ("footer.php"?>

  2. #2
    play of mind Ernie1's Avatar
    Join Date
    Sep 2005
    Posts
    1,252
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    removing '!' should work
    PHP Code:
    if(mail($to$subject$message$headers))
            echo 
    "Your Password has been sent to $user_email ";
        } 
    my mobile portal
    ghiris.ro

  3. #3
    SitePoint Guru
    Join Date
    Oct 2004
    Location
    uk
    Posts
    853
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I tried it but it didnt work

  4. #4
    play of mind Ernie1's Avatar
    Join Date
    Sep 2005
    Posts
    1,252
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try some debugging
    PHP Code:
    <?php
    ini_set
    ("display_error"1);
    error_reporting(E_ALL);
    // MySQL Information.
    $db_host "localhost"// Host, 99% of the time this is localhost. 
    $db_username "notexper_two"// Username here 
    $db_password "three"// Password here 


    $linkID mysql_connect("$db_host""$db_username""$db_password") or die(mysql_error());

    // query commands
    mysql_select_db("notexper_one"$linkID) or die(mysql_error()); // Database here 
    $resultID mysql_query("SELECT user_email FROM jobseekers WHERE user_email = '$user_email'"$linkID) or die(mysql_error());

    // End of query commands
    // Check if Email is in database
    $num_rows mysql_num_rows($resultID);
    $row mysql_fetch_row($resultID);
    $user_id $row[0];

    if (
    $user_id == ""){
         print 
    "We're sorry, your Email does not appear to be in our database.";
         }else{
        
         
    // Create a new, random password.
        
    $password substr (MD5(uniqid(rand(), 1)), 310);
        
         
    // Make the query.
        
    $query "UPDATE jobseekers SET password=password('$password') WHERE user_id = '" $_SESSION['seeker'] . "'";
        
         
    $result mysql_query ($query); // Run the query. 
        
        
         
    if (mysql_affected_rows()){ // If it ran OK
            
             // Send Password to email
            // send email
            
    $to "$user_email";
            
             
    $subject 'Your job has been added';
            
             
    $message 'Password: $password';
            
             
    $headers 'From: christhedonkey2007@yahoo.co.uk';
            
             if(
    mail($to$subject$message$headers)){
                
                 echo 
    "Your Password has been sent to $user_email ";
                 }
            
             }
         }
     
    // End of Send Password to email
    mysql_close($linkID);

     
    ?> 
    </body> 
    </html> 

    <?php include ("footer.php"?>
    my mobile portal
    ghiris.ro


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
  •