Hi, i have coded the following today (a user registration form, only im notb sure how to validate the username entered. Is it strlen and ereg? However, i have looked on php.net and there isnt any helpful info on either of these functions. Anyone know how i can comnbine validation into my code? ;
<?php
/*
***********sdhgjfs.com**********
Script Name: register.php
Description: Registers a user. *
*/
$DBhost = "localhost";
$DBuser = "";
$DBpass = "";
$DBname = "***";
$log_date_time = date("m d y HⓂs");
$log_ip = $REMOTE_ADDR;
$log_page = $PHP_SELF;
if ($action == "register") {
session_start();
session_register("logged_in");
if ($logged_in == "1") {
print("Your Allready logged in!");
} else {
$cn = mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable to connect to database");
mysql_select_db ($DBname);
$query = mysql_query("INSERT INTO *_users (username, password, email, full_name, age, location, joined) VALUES ('$username', '". md5($password) ."', '$email', '$full_name', '$age', '$location', '$log_date_time')");
Print("You Have Successfully Registered. You May Now <a href='http://www..com/forums/login/login.php'>Login</a>");
}
} else {
print("<form name='register' action='$PHP_SELF?action=register' method='POST'>
Username: <input name='username' type='text' maxlength='30'><br>
Password: <input name='password' type='password' maxlength='30'><br>
Email: <input name='email' type='text' maxlength='30'><br>
Full Name: <input name='full_name' type='text' maxlength='30'><br>
Age: <input name='age' type='text' maxlength='30'><br>
Location: <input name='location' type='text' maxlength='30'><br>
<input name='submit' type='submit' value='Register!'>
</form>");
}
?>