473,380 Members | 1,225 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,380 software developers and data experts.

forgot password email works but registeration doesnt

29
i have a form if user forgot password it send the new password to the user email but now i'm trying to is to also send when user register but is not wrking

this is the forgot password which works perfectlty

Expand|Select|Wrap|Line Numbers
  1.  header("Location: ".$session->referrer);
  2.  
  3.       {
  4.          /* Generate new password */
  5.          $newpass = $session->generateRandStr(8);
  6.  
  7.          /* Get email of user */
  8.          $usrinf = $database->getUserInfo($subuser);
  9.          $email  = $usrinf['email'];
  10.  
  11.          /* Attempt to send the email with new password */
  12.          if($mailer->sendNewPass($subuser,$email,$newpass)){
  13.             /* Email sent, update database */
  14.             $database->updateUserField($subuser, "password", md5($newpass));
  15.             $_SESSION['forgotpass'] = true;
  16.          }

Expand|Select|Wrap|Line Numbers
  1.  function sendNewPass($user, $email, $pass){
  2.       $from = "From: ".EMAIL_FROM_NAME." <".EMAIL_FROM_ADDR.">";
  3.       $subject = "Elite ticket master - Your new password";
  4.       $body = $user.",\n\n"
  5.              ."We've generated a new password for you at your "
  6.              ."request, you can use this new password with your "
  7.              ."username to log in to Eliteticketsevents Site.\n\n"
  8.              ."Username: ".$user."\n"
  9.              ."New Password: ".$pass."\n\n"
  10.              ."It is recommended that you change your password "
  11.              ."to something that is easier to remember, which "
  12.              ."can be done by going to the My Account page "
  13.              ."after signing in.\n\n"
  14.              ."- EliteTickets's Site";
  15.  
  16.  
  17.               $server = "smtp.virgin.net";
  18.  ini_set("SMTP",$server);
  19.  
  20.  
  21.  
  22.       return mail($email,$subject,$body,$from);
but now i tried to do the same to register but doesnt send the email

Expand|Select|Wrap|Line Numbers
  1.  if($retval == 0){
  2.          $_SESSION['reguname'] = $_POST['user'];
  3.          $_SESSION['regsuccess'] = true;
  4.          header("Location: ".$session->referrer);
  5.  
  6.          if($mailer->sendWelcome($user, $email, $pass)){
  7.  
  8.          }

Expand|Select|Wrap|Line Numbers
  1.   function sendWelcome($user, $email, $pass){
  2.       $from = "From: ".EMAIL_FROM_NAME." <".EMAIL_FROM_ADDR.">";
  3.       $subject = "Elite ticket master - Welcome!";
  4.       $body = $user.",\n\n"
  5.              ."Welcome! You've just registered at EliteTickets Site "
  6.              ."with the following information:\n\n"
  7.              ."Username: ".$user."\n"
  8.              ."Password: ".$pass."\n\n"
  9.              ."If you ever lose or forget your password, a new "
  10.              ."password will be generated for you and sent to this "
  11.              ."email address, if you would like to change your "
  12.              ."email address you can do so by going to the "
  13.              ."My Account page after signing in.\n\n"
  14.              ."- EliteTickets's Site";
  15.  
  16.  
  17.  
  18.  
  19.       return mail($email,$subject,$body,$from);
  20.    }
Apr 22 '10 #1
1 1629
yepen
3
not exactly same! why register doesn't have this $server = "smtp.virgin.net";
ini_set("SMTP",$server);
Apr 23 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Ini | last post by:
Hi, I forgot my password for an Access-database. Is there any way to open it or export structure and / or data? I'm using Access97. Thanks
2
by: DDK | last post by:
I really wish there were some examples explaining how to create a forgot password email link system when you encrypt a password in a database and use ASP.NET/C# preferably. Since the password is...
5
by: barry | last post by:
Below are my setting in the web.config file for forgotten passwords. I receive a completion that the password has been sent but upon looking in outlook there is no email sent to me. I have also...
2
by: kuldeep singh sethi | last post by:
Hey Friends, I have searched in google to get information about "forgot password ?". but didn't satisfy.i need help for this code. i want code for forgot password. I have no idea how to send...
2
by: chaos | last post by:
Hi all, i need help in this forgot password page, as the error message is show in another page cause the arrangement of the design in a mess. As i want to show the error message on the forgot...
1
by: Peterwkc | last post by:
Hello all respective fellows, i have a assignment where i need to create website that allow customer to order online with theusername and password. My situation is when user forgot the password,...
1
by: groupie | last post by:
Hi, I'd like to know how to implement the "Forgot Password" feature on many websites which require a login, exactly like this ebay example:...
2
by: whitey | last post by:
Hi All, The following script works when username(or email) and password are in 1 table. what i need to know is how to adjust the code to reflect that the email will be held in tbl_email and the...
3
by: jerrydigital | last post by:
Hi, I am working on a forgotpassword.asp page. I would like the user to enter their email address, and click submit. Upon submit, an email will be sent to the user's email address provided with...
10
matheussousuke
by: matheussousuke | last post by:
Hi, guys, I'm developing a script and it's almost done, just left two little things: Forgot password option Change password option About forgot password: The user can use as many user names...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.