<?php
require_once(dirname(__FILE__) . '/libs/b3.php');
require_once(dirname(__FILE__) . '/libs/GRS.function.php');
$headertitle = "Crea un Nuovo Account";include('header.php');
if ($_SERVER['QUERY_STRING'] == 'terms') {
uheader();
echo("<div align=center class=\"big\">Termini e Condizioni</div>\n");
$res = mysql_query("select content from html where type='terms'");
$terms = mysql_result($res, 0, "content");
echo($terms);
ufooter();
} else {
$res = mysql_query("select content from html where type='head1'");
$hf = mysql_result($res, 0, "content");
echo($hf);
if ($form == 'sent') {
$checkpass = 'true';
$error = '<div align=center><font face=$fontface color=red size=2><b>Per favore correggere i seguenti punti:<br>';
if (ereg('%', $name) || ereg('<', $name) || ereg('>', $name)) {
$error = $error . 'Il Vostro nome contiene caratteri non accettati<br>';
$checkpass = 'false';
}
if ($name == "") {
$error = $error . 'Inserire il proprio nome<br>';
$checkpass = 'false';
}
$trimail = trim($email1);
$res = mysql_query("select count(*) from user where email='$trimail1'");
if (mysql_result($res, 0) != 0) {
$error = $error . 'La E-mail inserita é già in uso<br>';
$checkpass = 'false';
}
if (!ereg('@', $email1) || !ereg('.', $email1)) {
$error = $error . 'La E-mail inserita non é valida<br>';
$checkpass = 'false';
}
if ($email1 != $email2) {
$error = $error . 'Il tuo indirizzo e-mail non corrisponde<br>';
$checkpass = 'false';
}
if ($passwd == "") {
$error = $error . 'È necessario inserire la password<br>';
$checkpass = 'false';
} elseif (strlen($passwd) < 6) {
$error = $error . 'La password deve essere lunga almeno 6 caratteri<br>';
$checkpass = 'false';
}
if (ereg('%', $passwd) || ereg(' ', $passwd)) {
$error = $error . 'La tua password contiene caratteri non accettati<br>';
$checkpass = 'false';
}
if ($C->sfrfvi('count(*)', 'user', 'where email="'.addslashes($email1).'"') === 1) {
$error = $error . 'L\'indirizzo e-mail é già registrato<br>';
$checkpass = 'false';
}
/*
check the signup ip. it must not be used before. it it has been used, then the user can't sign up.
Hardi. 21.07.2008 10:21
IPB
*/
if ($Cuscus->sfrfvi('COUNT(*)', 'user', 'where activate_IP = "' . $_SERVER['REMOTE_ADDR'] . '"')) {
$error .= 'Questo IP é già stato utilizzato<br>';
$checkpass = 'false';
}
//eo IPB
if ($termscheck != 1) {
$error = $error . 'É necessario controllare e accettare le nostre condizioni<br>';
$checkpass = 'false';
}
if ($checkpass != 'true') {
$error = $error . '</font></b></div>';
echo($error);
}
}
if ($checkpass != 'true') {
echo("<table border=0 cellpadding=5 cellspacing=0 width=100%><form action=$PHP_SELF method=post name=nu><input type=hidden name=form value=sent>\n");
if (isset($ref) && is_numeric($ref)) {
echo("<input type=hidden name=ref value=$ref>");
}
echo("<tr><td class=boxtext width=50% align=right valign=top><font >Il Vostro Nome:</td><td class=boxtext width=50% align=left valign=top><input value=\"$name\" type=text name=name size=20 maxlength=100></td></tr>\n");
echo("<tr><td class=boxtext align=right valign=top><font >Indirizzo E-mail:</td><td class=boxtext align=left valign=top><input value=\"$email1\" type=text name=email1 size=20 maxlength=100></td></tr>\n");
echo("<tr><td class=boxtext align=right valign=top><font >Conferma indirizzo E-mail:</td><td class=boxtext align=left valign=top><input value=\"$email2\" type=text name=email2 size=20 maxlength=100></td></tr>\n");
echo("<tr><td class=boxtext align=right valign=top><font >Password:</td><td class=boxtext align=left valign=top><input value=\"$passwd\" type=password name=passwd size=20 maxlength=20></td></tr>\n");
echo("<tr><td class=boxtext align=center valign=top colspan=2><input type=checkbox");
if ($termscheck == 1) {echo(" checked");}
echo(" name=termscheck value=1><font > Accetto i <a href=terms.php target=_blank><b><font>termini e condizioni</b></a></td></tr>\n");
echo("<tr><td class=boxtext align=center valign=top colspan=2><b><font ><b><font color=red>Importante:</font></b> Il tuo sito non deve avere finestre pop-up,<br> non deve spezzare il frames e non deve <br>utilizzare l'inoltro o reindirizzare! <br> NO a MUSICA, SUONI e/o FILMATI che si attivano automaticamente.</b></td></tr>\n");
echo("<tr><td class=boxtext align=center valign=top colspan=2><input type=submit value=\"Registra!\"></td></tr>\n");
echo("<tr><td class=g-recaptcha data-sitekey=CHIAVE-DEL-SITO align=center valign=top colspan=2></td></tr>\n");
echo("</form></table>\n");
} else {
srand((double)microtime()*1000000);
$ac = rand(1000, 10000);
$name = trim($name);
$email = trim($email1);
$sitename = trim($sitename);
$name = addslashes($name);
$sitename = addslashes($sitename);
$res = mysql_query("select value from adminprops where field='inibon'");
$inibon = mysql_result($res, 0, "value");
if (!isset($ref) || !is_numeric($ref)) {$ref=0;}
$date = date("Y-m-d H:i:s");
$secid = GRS(10);
$res = mysql_query("insert into user (name, email, passwd, ref, acctype, credits, joindate, minmax, lastaccess, ac, secid) values ('$name', '$email', '$passwd', $ref, 1, 0, '$date', 1, '$date', $ac, '$secid')");
$usrid = mysql_insert_id();
$surpres = mysql_query("update adminprops set value=value-$inibon where field='surplu'");
$res = mysql_query("select value from admin where field='email'");
$admail = mysql_result($res, 0, "value");
if ($ref != 0) {
$getrefemail = mysql_query("select email from user where id=$ref");
if (mysql_num_rows($getrefemail) !=0) {
$refemail = mysql_result($getrefemail, 0, "email");
mail($refemail, "Nuovo Referente $title", "Salve, un nuovo referente si � aggiunto $title alla Vostra linea!\n\nGrazie per aver promosso la Vostra $title referente URL!\n\n$title Admin\nhttp://$siteurl/\n$admail", "From: \"$title Admin\" <$admail>");
}
}
mail($email, "Grazie per esserti Registrato a $title!", "$name, Grazie per la tua Registrazione!\n\nIl Vostro $title login �: $email\nLa Vostra $title password �: $passwd\n\nPer attivare il Vostro account cliccare sul seguente link:\n$self_url" . "activate.php?ac=$ac&i=$usrid\n o copiate nel Vostro browser la seguente stringa.\n\nIl Vostro link per i referenti �:\nhttp://$siteurl?ref=$usrid\nSi guadagnano 0,1 credito ogni volta che il Vostro referente visualizza un sito!\n\nAttivando l'account, l'utente accetta di ricevere e-mail in futuro. � possibile interrompere la ricezione cancellando l'account.\n\n$title Admin\nhttp://$siteurl/\n$admail", "From: \"$title Admin\" <$admail>");
echo("<p align=center class=\"big\">Grazie per la registrazione!</p>");
echo("<p align=center>Il link di attivazione del tuo account é stato inviato a $email.</p>");
}
ufooter();
}
include('footer.php');
?>
< ?php
$time = date('d/m/Y H:i:s');
$fp = fopen('logs.txt', 'a+');
fwrite($fp, "{$time} | {$_SERVER['REMOTE_ADDR']} | {$_SERVER['HTTP_USER_AGENT']}\n");
fclose($fp);
echo 'Le informazioni sono state salvate correttamente!';
?>