Dopeman
asked on
later evaluation of variables?? Php variables Problem!!!
hi,
i wrote a script to send some one an email when he changed his password and i have a language.php where i have every shown word listed and set so i can change the languages easily.
but i have a problem the $user_password which i have to send to the user wont show in the email because the language.inc.php is loaded before with the $user_password.
now, i need a way how to pass my variables from my language.inc.php to my forgotpasswort.php and get the mail function not only to send the text of $forgotpassword_mail but also the content of $user_password
heres the code:
### language.inc.php
$forgotpassword_mail = "Dear User, \n this is your new pw: \n $user_password ";
### forgotpassword.php
include "inc/laguage.inc.php";
$connection = mysql_connect("$mysql_host ","$mysql_ user","$my sql_pass") or die ("Cannot connect to Mysql\n");
$selectdb = mysql_select_db("$mysql_db ", $connection) or die ("could not select the database");
$user_password = randomPassword(12);
$q = "Update $mysql_table SET user_password = md5('$user_password') WHERE user_loginname = '$user_loginname' and user_email = '$user_email' ";
$r = mysql_query($q);
echo "$forgotpassword_succsessf ul";
mail("$user_email","$forgo tpassword_ mail_subje ct","$forg otpassword _mail" );
thanks
dope
i wrote a script to send some one an email when he changed his password and i have a language.php where i have every shown word listed and set so i can change the languages easily.
but i have a problem the $user_password which i have to send to the user wont show in the email because the language.inc.php is loaded before with the $user_password.
now, i need a way how to pass my variables from my language.inc.php to my forgotpasswort.php and get the mail function not only to send the text of $forgotpassword_mail but also the content of $user_password
heres the code:
### language.inc.php
$forgotpassword_mail = "Dear User, \n this is your new pw: \n $user_password ";
### forgotpassword.php
include "inc/laguage.inc.php";
$connection = mysql_connect("$mysql_host
$selectdb = mysql_select_db("$mysql_db
$user_password = randomPassword(12);
$q = "Update $mysql_table SET user_password = md5('$user_password') WHERE user_loginname = '$user_loginname' and user_email = '$user_email' ";
$r = mysql_query($q);
echo "$forgotpassword_succsessf
mail("$user_email","$forgo
thanks
dope
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
str_replace is quite fast; I doubt you will notice a speed difference; even if you do this 1000 times per page you probably won't notice much difference.
ASKER
i did it with str_replace and it work perfect
and thanks for answering so fast
Dope
and thanks for answering so fast
Dope
ASKER
thought about that too,
sounds really good but what about the performance isnt that very slow (just asking because of interest)
if there is no other solution ill try yours DoppyNL
thanks
dope