Enjoy unlimited access to all forum features for FREE! Optional upgrade available for extra perks.
Sedo.com

Wanted: Service Php Developer Wanted

Status
Not open for further replies.

potman100

New Member
Legacy Platinum Member
Joined
Apr 2, 2006
Messages
1
Reaction score
0
Hi

Firstly Im a Vb Developer, and Im struggerling with some php code, so I wonder if someone can help.

Right

Got a form with 1 field, it on a page call About.php

Code:

<form action="login.php" method="post" onsubmit="return checkform(this);">
<center>
<font face="arial" size="2">Email address</font><br>
<input type="text" size="30" name="email"><br><br>
<input type="submit" value="Submit"><font face="arial" size="1">
</center>
</form>


When the for is submitted it runs checkform

Code:

<script language="JavaScript" type="text/javascript">
<!--
function checkform ( form )
{
// see http://www.thesitewizard.com/archive/validation.shtml
// for an explanation of this script and how to use it on your
// own website

// ** START **
if (form.email.value == "") {
alert( "Please enter your email address." );
form.email.focus();
return false ;
}
// ** END **

var x = form.email.value;
var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (filter.test(x)) check();
// return true;
else alert('NO! Incorrect email address');
return false;

}
//-->
</script>



If the email appears not valid or is blank an alert box is displayed, the user can try again !

If it is ok then I want it to search my users table and check is it already exsists, using check()


Code:


function check(){


$sql = mysql_connect("xx.208.193.88", "monste4","xxxxxx") or die ('Error connecting to mysql');

mysql_select_db('monste4');


$email = "[email protected]";
$u = strtolower($uid);
//$pw = createRandomPassword();
$today = date("dmY");
$enddate = date('dmY',mktime(0, 0, 0, date("m"), date("d")+7, date("Y")));

$sql="select * from users where email='$email'";
$result=mysql_query($sql) or die("select fails");
$no=mysql_num_rows($result);

if ($no==0) {

echo $sql;
$sql="insert into users(id,pwd,email,datesignup,dateexpire,status,dt_changed,stealthuser) values('$email','$pw','$email','$today','$enddate','expired',NOW(),'0')";
$result = mysql_query($sql) or die("insert fails");

if (isset($result)) {



echo "<br><b>Account Successfully Created!</b><br><br>";
echo "An Email has Been Dispached to $email<br>";
echo "Please Follow The Details For Logging In.<br>";
echo $message;
echo "<br>Login Below";

return TRUE;
} else {
echo "<br>Error Inserting Record. Contact Site Admin<br>";
}

} else {
echo "Email";
echo $email;
echo "<center><font color=red>User with that Email Address or Username already exists. <a href='".BASEHREF."/signup.php'>Try Agin?</a></font><br>";


}

}


?>



What I need to do is , if the user does not exsist in the database add them and go to the login page, and if poss fill the username field, or
or if they do exsist show the error on the about page and let then enter a different email address.

Hopes this makes sense, willing to pay to get this sorted, so if anyone can help please either add to this thread, or email [email protected].


Many Thanks

Potman100
 
Status
Not open for further replies.

The Rule #1

Do not insult any other member. Be polite and do business. Thank you!

Members Online

Sedo - it.com Premiums

IT.com

Premium Members

MariaBuy

Our Mods' Businesses

UrlPick.com

*the exceptional businesses of our esteemed moderators

Top Bottom