Location: PHPKode > projects > OpenHuman > openhuman/create2.php

$error_msg = "Errors:<ul>";

$address = mb_strtolower($_POST['address']);
$namesurname = $_POST['namesurname'];
$email = mb_strtolower($_POST['email']);
$password = $_POST['password'];

if(!ereg('^[a-zA-Z0-9_]{3,60}$',$address)) {
	$error_msg .= "<li>Address can contain letters, numbers or _ character only. It should contain 3 to 60 letters.</li>";

$sql = "SELECT COUNT(id) FROM login WHERE addr='".mysql_real_escape_string($address)."'";
$res = $db->getOne($sql);
if(PEAR::isError($res)||$res!=0) {
	$error_msg .= "<li>Address already taken</li>";

if(!ereg('^[^ ]+ .+$',$namesurname)) {
	$error_msg .= "<li>Name surname field can contain letters only, it should contain a space in between your name and surname</li>";

if(!ereg('^.+@.+\..+$',$email)||undorg_isDisposableEmail($email)) {
	$error_msg .= "<li>Email not valid</li>";

$sql = "SELECT COUNT(id) FROM login WHERE email='".mysql_real_escape_string($email)."'";
$res = $db->getOne($sql);
if(PEAR::isError($res)||$res!=0) {
	$error_msg .= "<li>Email already taken</li>";

if(mb_strlen($password)<5) {
	$error_msg .= "<li>Password must contain at least 5 characters</li>";

$error_msg .= "</ul>";

if($error_msg!="Errors:<ul></ul>") {
	$error_msg .= "Please go back and try again";
$sql = "INSERT INTO login VALUES (NULL, '".mysql_real_escape_string($namesurname)."', '".mysql_real_escape_string($address)."', '".mysql_real_escape_string($email)."', MD5('".mysql_real_escape_string($password)."'),0,'','#FFFFFF','#000000','#FF0000', '')";
$res = $db->query($sql);
	die("An error has occurred, please refresh this page and try again.");


if(isset($_SESSION['fact'])) {
	$sql = "UPDATE login SET fact='".mysql_real_escape_string($_SESSION['fact'])."' WHERE addr='{$address}'";


<p>Congratulations, you are an openhuman now</p>
<p><font size="+2">Your page address is <a href="<?= $home_url; ?>/<?=$address?>"><?= $home_url; ?>/<?=$address?></a>. Bookmark and enjoy!</font></p>
<p><a href="<?= $home_url; ?>/dashboard.php">Start adding photos and writing interesting stuff about yourself!</a></p>
<p>Spread the word via your blogs and/or MySpace page. Add this link to your OpenHuman page by copy/pasting code below:</p>

<a href="<?= $home_url; ?>/<?=$address?>"><img src="<?= $home_url; ?>/images/logopromo.png" width="104" height="108" border="0" onmouseover="this.src='<?= $home_url; ?>/images/logopromo_on.png'" onmouseout="this.src='<?= $home_url; ?>/images/logopromo.png'" alt="" /></a>

<textarea style="width:300px;height:108px;">
<a href="<?= $home_url; ?>/<?=$address?>"><img src="<?= $home_url; ?>/images/logopromo.png" width="104" height="108" border="0" onmouseover="this.src='<?= $home_url; ?>/logopromo_on.png'" onmouseout="this.src='<?= $home_url; ?>/images/logopromo.png'" alt="" /></a>


$content = ob_get_contents();

$tpl->caching = 0;

Return current item: OpenHuman