Codice PHP:
<?php
session_start();
header("Cache-control: private");
header ("cache-control: no-cache, must-revalidate");
header ("pragma: no-cache");
error_reporting(0);
if(isset($_SESSION['login']))
{header("location: chat.php"); exit;}
if(isset($_COOKIE["bann"]))
{header("location: avviso.php?page=bann"); exit;}
@require_once("setting.inc.php");
@require_once("detect.inc.php");
@require_once("bann.inc.php");
$cell="nondefinito";
$disp="";
if(!empty($subno))
{$cell=$subno;
$disp="cell";
}
if(!empty($h3g))
{$cell=md5($h3g);
$disp="WWW3";}
if(!isset($_POST['login']) OR !isset($_POST['password']) OR !isset($_POST['password2']) OR !isset($_POST['key']) OR !isset($_POST['codice']))
{
$num1 = rand(1,15);
$algoritmo=(($num1*$number)+(4*$num1)+(2*$number));
$algoritmo.="9rjf09fjk8";
$algoritmo=md5($algoritmo);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="shortcut icon" href="favicon.ico" />
<link rel="icon" href="favicon.ico" />
<META http-equiv="Content-Type" content="text/html; charset=utf-8" />
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="0">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META NAME="KEYWORDS" CONTENT="chat,cellulari,mobile,telefonia,wap,chat gratuita,incontri,amicizia">
<META NAME="DESCRIPTION" CONTENT="Chat gratuita accessibile anche da cellulare">
<META NAME="ROBOTS" CONTENT="INDEX, FOLLOW">
<META NAME="REVISIT-AFTER" CONTENT="1 DAYS">
<META NAME="RATING" CONTENT="GENERAL">
<title>Registrazione Utente</title>
<link rel="stylesheet" type="text/css" href="stylechatcell.css"></head>
<body onLoad="self.document.form1.login.focus()" topmargin="0">
<center>
<form name="form1" method="post" class="title" action="registrazione.php">
<div class="testata">
<img border='0' src='user.gif'></img> Registrazione </div>
<?php if (@file_exists("database/bloccoreg.txt")){echo "REGISTRAZIONI CHIUSE<br/><a href='index.php'>.:LOGIN:.</a>"; exit;}?>
<div class='avviso'>NON USARE QUI LA STESSA PWD USATA IN ALTRE CHAT !</div>
Nickname: <br />
<input name="login" type="text" maxlength="14" id="input"><br />
Password:<br />
<input name="password" type="password" id="input"><br />
Ripeti Password:<br />
<input name="password2" type="password" id="input"><br />
<input type="hidden" name="key" value="<?php echo $num1; ?>" />
<input type="hidden" name="codice" value="<?php echo $algoritmo; ?>" /><br />
<a href="regolamento.php?page=reg"><font color="#FF0000">Regolamento</font></a><br />
<input type="checkbox" name="regola" value="on">Ho preso visione del regolamento e lo accetto<br />
<input type="submit" id="input" name="Submit" value="Invia" />
</form>
<div class="testata"><a href="index.php">Torna Al Login</a></div>
</body>
</html>
<?php exit;}
if (@file_exists("database/bloccoreg.txt")){header("location: index.php"); exit;}
$key= $_POST['key'];
$codice= $_POST['codice'];
$visione= $_POST['regola'];
if(!is_numeric($key))
{header("location: index.php"); exit;}
$algoritmo=(($key*$number)+(4*$key)+(2*$number));
$algoritmo.="9rjf09fjk8";
$algoritmo=md5($algoritmo);
if($codice != $algoritmo)
{header("location: index.php"); exit;}
function ipCheck() {
if (getenv('HTTP_CLIENT_IP')) {
$ip = getenv('HTTP_CLIENT_IP');
}
elseif (getenv('HTTP_X_FORWARDED_FOR')) {
$ip = getenv('HTTP_X_FORWARDED_FOR');
}
elseif (getenv('HTTP_X_FORWARDED')) {
$ip = getenv('HTTP_X_FORWARDED');
}
elseif (getenv('HTTP_FORWARDED_FOR')) {
$ip = getenv('HTTP_FORWARDED_FOR');
}
elseif (getenv('HTTP_FORWARDED')) {
$ip = getenv('HTTP_FORWARDED');
}
else {
$ip = $_SERVER['REMOTE_ADDR'];
}
return $ip;
}
$ip= htmlspecialchars(ipCheck());
$ipproxy = $_SERVER["REMOTE_ADDR"];
$client="";
if (getenv('HTTP_X_FORWARDED_FOR'))
{ $client = getenv('HTTP_X_FORWARDED_FOR'); }
if($dispositivo=="PC")
{
//controllo se e' gia' stato richiesto un nick in base a quell IP-PROXY
$richnick=0;
if(@file_exists("database/".$suff."_validanick.txt"))
{
$var2=@file("database/".$suff."_validanick.txt");
$i=count($var2);
for($a=0; $a<$i; $a++){
$riga=trim($var2[$a]);
$dati=explode("||",$riga);
if(!empty($client))
{
if($dati[2]==$client)
{$richnick=1; break;}
}
if($dati[3]==$ipproxy)
{$richnick=1; break;}
}//end for
}
if($richnick==1)
{header("location: avviso.php?page=doppiarich"); exit;}
}
$browser=htmlspecialchars($_SERVER["HTTP_USER_AGENT"]);
$browser = str_replace(array("\r\n", "\r", "\n"), "", $browser);
$browser = str_replace("|","", $browser);
$isp=gethostbyaddr($_SERVER['REMOTE_ADDR']);
//controlli BANN
if(bannbrowser($browser,$suff) OR bannnick("nicknondefinito",$ip,$ipproxy,$suff) OR banncell($cell,$suff) OR bannisp($isp,$suff))
{
setcookie("bann","1", time()+20000000);
header("location: avviso.php?page=bann");exit;}
if($cell!="nondefinito")
{
//controllo se già registrato
$doppionick=0;
$var99=@file("database/".$suff."_phoneid.txt","a+");
@fclose($var5);
$i=count($var99);
for($a=($i-1); $a>=0; $a--){
$cercanick=explode("||",$var99[$a]);
if($cercanick[1]==$cell OR $cercanick[2]==$cell)
{$doppionick=1;
header("location: avviso.php?page=doppionick"); exit;
break;}
}//fine ciclo for
if($doppionick!=1)
{
//altro controllo sul doppio nick
$var97789=@file("database/".$suff."_iduserphone.txt");
$icnt=count($var97789);
for($h=($icnt-1); $h>=0; $h--){
$cercasphone=explode("||",$var97789[$h]);
if(trim($cercasphone[1])==$cell)
{$doppionick=1;
break;}
}//fine ciclo for
}
if($doppionick==1)
{header("location: avviso.php?page=doppionick"); exit;}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="shortcut icon" href="favicon.ico" />
<link rel="icon" href="favicon.ico" />
<META http-equiv="Content-Type" content="text/html; charset=utf-8" />
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="0">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META NAME="KEYWORDS" CONTENT="chat,cellulari,mobile,telefonia,wap,chat gratuita,incontri,amicizia">
<META NAME="DESCRIPTION" CONTENT="Chat gratuita accessibile anche da cellulare">
<META NAME="ROBOTS" CONTENT="INDEX, FOLLOW">
<META NAME="REVISIT-AFTER" CONTENT="1 DAYS">
<META NAME="RATING" CONTENT="GENERAL">
<title>Registrazione Utente</title>
<link rel="stylesheet" type="text/css" href="stylechatcell.css"></head>
<body topmargin="0">
<center>
<div class='title'>
<?php
#prendo i dati dal modulo
$login = trim($_POST["login"]);
$login = str_replace(array("\r\n", "\r", "\n"), "", $login);
$login = str_replace("|","", $login);
$lungh=strlen($login);
$login=htmlspecialchars($login);
$spam=array('figa','troia','porno','sesso','sex','azz','pene','vagin','cristo','gesu','madonna','mignotta','puttan','scopa');
$count=count($spam);
for($i=0; $i<$count; $i++)
{
$key=stristr($login,$spam[$i]);
if(!empty($key))
{ echo "<div class='testata'>.: ATTENZIONE :</div><br />Nick VOLGARI non consentiti! Rileggi BENE il <a href='regolamento.php'>REGOLAMENTO</a>!!<p><div class='testata'>Torna al modulo di <a href='registrazione.php'>registrazione</a></p></div>"; exit;}
}
$password = trim(htmlspecialchars($_POST ["password"]));
$password = str_replace(array("\r\n", "\r", "\n"), "", $password);
$password = str_replace("|","", $password);
$password2 = trim(htmlspecialchars($_POST ["password2"]));
$password2 = str_replace(array("\r\n", "\r", "\n"), "", $password2);
$password2 = str_replace("|","", $password2);
$md5=md5(md5($password.$number));
$data= @time();
#controllo che l'utente abbia inserito tutti i dati e le pwd siano uguali
$errore=false;
$errore_password=false;
$errorenick=false;
$errore_accetta=false;
function chklogin($login)
{
if(!preg_match("!^[a-z0-9\d]+$!i", $login)) {
return false;
}
return true;
}
if(chklogin($login)) {
$errorenick=false;
}
else {
$errorenick=true;
}
if (( $login == "" ) || ( $password == "" ) || ( $password2 == "" ) || ($visione== ""))
{$errore=true; echo "<div class='testata'><font color='red'>Tutti i campi sono obbligatori !!</font></div><br />";}
if ( $password != $password2 ) {
$errore_password=true;
}
if(empty($visione))
{$errore_accetta=true;}
if ($errore_accetta) {
echo "<BR>Devi accettare il Regolamento per registrarti";
}
if ($errore_password) {
echo "<br />Le password inserite non corrispondono";
}
if ($errorenick) {
echo "<br />Il nickname deve contenere solo lettere e numeri";
}