Ok my script now looks like: (I hope I put password snippet from S.J. in the correct place)
<?
//***************************************
// This is downloaded from Affinity Scripts //
/// You can you this on your site for your own PERSONAL use ///
// Please don't remove the link to Affinity Scripts ///
// Creation of Affinity Site Affiliation System is by Aymie Jordaine. ///////
//The author is not responsible for any type of loss or problem or damage on using this script.//
/// You can use it at your own risk. /////
//*****************************************
include "include/config.php";
include "include/signup_header.php";
$todo=$_POST['todo'];
$username=$_POST['username'];
if(isset($email) and $email=="")
$email=$_POST['email'];
if(isset($sitename) and $sitename=="")
$sitename=$_POST['sitename'];
if(isset($siteurl) and $siteurl=="")
$siteurl=$_POST['siteurl'];
if(isset($todo) and $todo=="update"){
$pw=mysql_real_escape_string($pw);
$status = "OK";
$msg="";
$_POST['pw']=(isset($_POST['pw'])?preg_replace("/[^a-zA-Z\-_0-9\.]/",'',$_POST['pw']):'');
if($_POST['pw']!='' && $_POST['pw']==$row['pw']){
// have entered a valid password
}
//check everything's been filled in properly
if (!empty($_POST['pw'])) {
if (strip_tags($_POST['pw2']) != strip_tags($_POST['pw'])) {
echo "<p><strong>Error:</strong> New passwords did not match - please press the back button on your browser and try again.</p>";
exit;
}
if ( strlen($pw) < 3 or strlen($pw) > 10 )
{
echo $msg."<p class=\"centered\">Password must be more than 3 char legth</p>";
$status= "NOTOK";}
exit;
}
//put it into the db
if (!empty($_POST['pw']) && $_POST['pw'] != $row['pw']) {
$pw = strip_tags($_POST['pw']);
$update = mysql_query("UPDATE $table SET pw = '$_POST[pw]' WHERE username='$_POST[username]' LIMIT 1");
}
}
if (!ereg("^(http|ftp)", $siteurl)) {
$siteurl = "$url";
}
if($status<>"OK"){
echo "<font face='Verdana' size='2' color=red>$msg</font><br><input type='button' value='Retry' onClick='history.go(-1)'>";
}
else
{
if($status<>"OK"){ // if validation failed
echo "<font face='Verdana' size='2' color=red>$msg</font><br><input type='button' value='Retry' onClick='history.go(-1)'>";
}else{ // if all validations are passed.
echo "<font face='Verdana' size='2' color=green>You have successfully updated your profile<br></font>";
}
$sql1 = "UPDATE $table SET email='$email' WHERE username='$username' LIMIT 1";
mysql_query1($sql1) or exit(mysql_error());
$sql2 = "UPDATE $table SET sitename='$sitename' WHERE username='$username' LIMIT 1";
mysql_query2($sql2) or exit(mysql_error());
$sql3 = "UPDATE $table SET siteurl='$siteurl' WHERE username='$username' LIMIT 1";
mysql_query3($sql3) or exit(mysql_error());
}
include "include/footer.php";
?>
Although I don't get a mysql error, it does return a blank page (except for header and footer, they show), and my database is NOT updating >_<
Basically I wanted my script to be like this: update on the fly but without the email required (because the UNIQUED name is required), verify email, country, spam proof (my list doesn't list email, just needed for sending password) and delete info.
This file reads from sumit form....so it's the check file...