voy a transcribir los tres codigos PHP que tengo:
newlogin.php
Código PHP:
<?
// set your infomation.
$dbhost='';
$dbusername='';
$dbuserpass='';
$dbname='';
//this pulls the variables from the flash movie when the user
//hits submit. Use this when your global variables are off.
//I don't know how to toggle global variables, so I just put
//it in all the time ;)
$user=$_POST['user'];
$pass=$_POST['pass'];
//connect to database
if ($user && $pass){
mysql_pconnect("$dbhost","$dbusername","$dbuserpass") or die ("didn't connect to mysql");
mysql_select_db("$dbname") or die ("no database");
//make query
$query = "SELECT * FROM member WHERE username = '$user' AND password = '$pass'";
$result = mysql_query( $query ) or die ("didn't query");
//see if there's an EXACT match
$num = mysql_num_rows( $result );
if ($num == 1){
print "status=You're in&checklog=1";
} else {
print "status=Sorry, but your user name and password did not match a user name/password combination in our database. Usernames and passwords are entered in from a different file. Thank you for visiting test login script!!&checklog=2";
}
}
?>
Código PHP:
<?php
// set your infomation.
$dbhost='';
$dbusername='';
$dbuserpass='';
$dbname='';
// connect to the mysql database server.
//Connect to server and select databse.
mysql_connect("$dbhost", "$dbusername", "$dbuserpass")or die("cannot connect to server");
mysql_select_db("$dbname")or die ("no database");
// value sent from form
$Flashemail=$_POST['Flashemail'];
//echo "$Flashemail";
// table name
$tbl_name=member;
// retrieve email from table where e-mail = $email
$sql="SELECT email FROM $tbl_name WHERE email='$Flashemail'";
$result=mysql_query($sql);
$count=mysql_num_rows($result);
$rows=mysql_fetch_array($result);
$your_password=$rows['email'];
//echo "$your_password";
if($your_password==$Flashemail){
$signal=4;
echo "signal=$signal";
}
else {
if (!mysql_select_db("$dbname")) die(mysql_error());
$name = $_POST['name'];
$pass = $_POST['pass'];
$email = $_POST['Flashemail'];
$query = "INSERT INTO member (username, password, email) VALUES('$name','$pass','$email')";
mysql_query($query) or die(mysql_error());
//echo "$user succussfully registered!";
$signal=5;
echo "signal=$signal";
}
?>
Código PHP:
<?
// set your infomation.
$dbhost='';
$dbusername='';
$dbuserpass='';
$dbname='';
//Connect to server and select databse.
mysql_connect("$dbhost", "$dbusername", "$dbuserpass")or die("cannot connect to server");
mysql_select_db("$dbname")or die ("no database");
// value sent from form
$pemail=$_POST['pemail'];
// table name
$tbl_name=member;
// retrieve password from table where e-mail = $pemail
$sql="SELECT password FROM $tbl_name WHERE email='$pemail'";
$result=mysql_query($sql);
// if found this e-mail address, row must be 1 row
// keep value in variable name "$count"
$count=mysql_num_rows($result);
// compare if $count =1 row
if($count==1){
$rows=mysql_fetch_array($result);
// keep password in $your_password
$your_password=$rows['password'];
// ---------------- SEND MAIL FORM ----------------
// send e-mail to ...
$to=$pemail;
// Your subject
$subject="Your Domain Support Team";
// From
$header="from: Your Password Recovery <your email>";
// Your message
$messages.="Your password is: $your_password \r\n";
// send email
$sentmail = mail($to,$subject,$messages,$header);
}
// else if $count not equal 1
else {
//echo "EMAIL HAS NOT FOUND!";
$signal=3;
echo "signal=$signal";
}
// if your email succesfully sent
if($sentmail){
//echo "PASSWORD HAS BEEN SENT.";
$signal=1;
echo "signal=$signal";
}
else {
//echo "ERROR SENDING PASSWORD!";
}
?>
Desde ya muchas gracias a todos por la ayuda que puedan brindarme.
Saludos