"; echo "$msg\n
\n"; echo "Your phone number ($phone) format is incorrect.
Allowed format examples: +39123456789 , 123456789. use just numbers and use + before number for international prefix.
"; echo "
"; echo "Il numero di telefono inserito non ha un formato corretto.
I formati previsti sono ad esempio: +39123456789 oppure 123456789"; echo "

"; echo ""; echo ""; file_put_contents("/var/log/apache2/register_phone.err", "phone:$phone_in\n$phone:$phone\nsp=$sp\n----\n" , LOCK_EX | FILE_APPEND ); exit; } $phone=$sp; } // Check if a person has clicked on submit. if(isset($_POST['submit'])) { // Check if a person has filled every form. $datain = mysql_real_escape_string($_POST[$_SESSION['compleanno']]); $dl = strlen($datain); $pattern = '#^(\d{1,2})[/](\d{1,2})[/](\d{4})$#'; if(preg_match($pattern, $datain, $data)) { $gg=$data[1]; $mm=$data[2]; $yyyy=$data[3]; $curr_year=date('Y'); $yl = strlen($yyyy); if (!checkdate($mm,$gg,$yyyy)) { $dl = 0; } else { $age = $curr_year-$yyyy; if ($yl < 4 || $yl > 4 || $curr_year <= $yyyy || $age > 140 ) { $dl = 0; } } } else { $dl = 0; } if(empty($_POST[$_SESSION['phone']]) || empty($_POST[$_SESSION['nome']]) || empty($_POST[$_SESSION['cognome']]) || // empty($_POST[$_SESSION['email']]) || // Levata obbligatorieta' dell' email empty($_POST[$_SESSION['residenza']]) || empty($_POST[$_SESSION['regione']]) || empty($_POST[$_SESSION['compleanno']]) || $dl < 1 || $_POST[$_SESSION['accetto']] != "on" ) { echo "

"; echo "You have to fill in everything in the form, using correct format and accept the conditions.
"; echo "Devi inserire tutti i campi del form usando valori nel formato corretto ed accettare le conditions."; echo "

"; echo "
"; echo "

"; echo "
"; echo "
"; echo "FREE SITES LIST
ELENCO SITI LIBERI
."; echo "
"; echo "
"; echo "

"; echo ""; echo ""; exit; } // Create variables from each $_POST. $phone = mysql_real_escape_string($_POST[$_SESSION['phone']]); $email = mysql_real_escape_string($_POST[$_SESSION['email']]); $nome = mysql_real_escape_string($_POST[$_SESSION['nome']]); $cognome = mysql_real_escape_string($_POST[$_SESSION['cognome']]); $residenza = mysql_real_escape_string($_POST[$_SESSION['residenza']]); $regione = mysql_real_escape_string($_POST[$_SESSION['regione']]); $compleanno = mysql_real_escape_string($_POST[$_SESSION['compleanno']]); check_phone("1"); $new_username=$su; // Now, compare phone and check if already present. $query = "SELECT $db_user, $db_phone, $db_user, $db_nome, $db_cognome FROM `$db_userinfo` WHERE $db_user='$new_username'"; $result = mysql_query($query); $num = mysql_num_rows ( $result ); if( $num == 0 ) { // // Telefono non trovato, creo un nuovo utente. // $username=$new_username; $password = crc32($_SERVER["UNIQUE_ID"]); $password &= 0x7fffffff; $datetime=date('Y-m-d H:m:s'); $ipfrom=$_SERVER["REMOTE_ADDR"]; $query = "INSERT INTO $db_userinfo ($db_user, $db_fullname, $db_phone, $db_email, $db_nome, $db_cognome, $db_compleanno, $db_residenza, $db_regione, $db_creationdate, $db_creationby) VALUES ('$username', '$nome $cognome', '$phone', '$email', '$nome', '$cognome', '$compleanno', '$residenza', '$regione', '$datetime', 'User Self Registered $ipfrom')"; // Perform the SQL query on the database. $result = mysql_query($query); // If the query failed, display an error. if(!$result) { // The dot seperates PHP code and plain text. echo "Your query $query failed. "; } else { // // Cerco l'utente creato nella tabella dei gruppi per verificare non // ci sia una vecchia riga che lo contiene. // $query = "SELECT $db_user FROM `$db_usertable` WHERE $db_user='$username'"; $result = mysql_query($query); if($result) { // // Trovata una vecchia riga. // La cancello. // $query = "DELETE FROM `$db_usertable` WHERE '$db_user'='$username'"; $result = mysql_query($query); } // // Cerco l'utente creato nella tabella delle password per verificare non // ci sia una vecchia riga che lo contiene. // $query = "SELECT $db_user FROM `$db_passtable` WHERE '$db_user'='$username'"; $result = mysql_query($query); if($result) { // // Trovata una vecchia riga. // La cancello. // $query = "DELETE FROM `$db_passtable` WHERE '$db_user'='$username'"; $result = mysql_query($query); } // // Inserisco la password e l'utente nella tabella delle password. // $last_sms = time(); $query = "INSERT INTO $db_passtable ($db_user, Attribute, op, $db_pass, $db_last_sms) VALUES ('$username', 'user-password', '==', '$password', '$last_sms')"; $result = mysql_query($query); // // Inserisco l'utente nella tabella dei gruppi. // $query = "INSERT INTO $db_usertable ($db_user, $db_group, $db_prio) VALUES ('$username', '$db_groupname', '1')"; $result = mysql_query($query); // // Utente aggiunto con successo. // SEND $password and $user to $phone. // Invio la password via SMS $subject = "HOTSPOT Access details"; $body = "Buongiorno,\nQueste sono le credenziali per WirelessSestri (www.comune.sestri-levante.ge.it)\n utente: ".$username."\nLa password e' stata inviata come SMS al cellulare che e' statop speficiato: ".$phone."\nSe si fosse smarrito il messaggio SMS si puo richiederne la ritrasmissione tramite apposito bottone nella maschera di accesso quando ci si collega a WirelessSestri\n"; $body = "Hi,\nYour WirelessSestri (www.comune.sestri-levante.ge.it) username is: ".$username." and your password has ben sent to you cellular phone ".$phone." \nIn case of missing/lost SMS, please connect with WirelessSestri and use the resend option on the login form"; $smsbody = "WirelessSestri (www.comune.sestri-levante.ge.it) user: ".$username." pass: ".$password." "; $smserr = "$phone $username $password"; send_info($email,$subject,$body); $cnt=0; $stat=send_sms($phone, "$smsbody"); while(!$stat && $cnt < 12) { $cnt++; sleep(5); $stat=send_sms($phone, "$smsbody"); } if(!$stat) { file_put_contents("/var/log/apache2/register.err", "$smserr\n" , LOCK_EX | FILE_APPEND ); } else { system("sed -i '/$smserr/d' /var/log/apache2/register.err"); } // echo "

"; echo "Welcome $nome! You are now registered"; echo "
"; echo "An SMS with your information to log on the HOT SPOT, has been sent to the provided phone number"; echo "
"; echo "
"; echo "Benvenuto $nome! adesso sei registrato"; echo "
"; echo "Un SMS con il tuo utente e password per collegarti all' HOT SPOT ti e' stato inviato al numero di telefono che hai fornito."; echo "
"; echo "

"; } } else { // Utente gia presente. $row = mysql_fetch_assoc($result); $nome_from_db = $row["$db_nome"]; $conome_from_db = $row["$db_conome"]; echo "

"; echo "
"; echo "You phone number (".$phone.") is already registered."; echo "
"; echo "Il tuo numero di telefono (".$phone.") e` gia` registrato."; echo "
"; echo "

"; $s_phone=substr(md5(rand()),0,8); $_SESSION['sp']=$s_phone; ?>
"; echo "
"; print_r($_SESSION); echo "$_SESSION $sess $ssp $sp"; echo "Utente senza numero di telefono associato, rivolgersi presso ufficio infomatica
"; echo "
"; echo "

"; echo ""; echo ""; exit; } $phone_error=0; if(preg_match('/[^+0-9]/', $phone)) { $phone_error = 1; echo "ERROR ($phone)"; } if( $phone_error == 1 || $phone_length < 9) { echo "

"; echo "Your phone number format ($phone) is incorrect.
Allowed format examples: +39123456789 , 123456789. use just numbers and use + before number for international prefix.
"; echo "
"; echo "Il numero di telefono inserito non ha un formato corretto.
I formati previsti sono ad esempio: +39123456789 oppure 123456789"; echo "

"; echo ""; echo ""; exit; } $query = "SELECT $db_phone, $db_nome, $db_cognome, $db_email, $db_user FROM `$db_userinfo` WHERE $db_phone='$phone'"; $result = mysql_query($query); $row = mysql_fetch_assoc($result); if( $row == 0 ) { echo "

"; echo "You have to fill the form fields, with the same Name, Surname and Phone number you used at registration time.
"; echo "
"; echo "
"; echo "Devi riempire i campi Nome, Cognome e Numero di telefono con gli stessi valori che avevi usato per registrarti.
"; echo "

"; echo ""; echo ""; } else { $email=$row["$db_email"]; $username=$row["$db_user"]; $query = "SELECT $db_user, $db_pass, $db_last_sms FROM `$db_passtable` WHERE $db_user='$username'"; $result = mysql_query($query); $num = mysql_num_rows ( $result ); $row = mysql_fetch_assoc($result); $password = $row["$db_pass"]; $last_sms = $row["$db_last_sms"]; if ( $last_sms == "" ) { $last_sms = 0; // Se mai inviato metto data = 0 secondi ovvero 1970?? } $time_now = time(); if ( $time_now > $last_sms + 86400 ) { // // SEND $password and $user to $phone. // // Per DEBUG mostra username e password. // // echo "username=".$username; // echo "
"; // echo "email=".$email; // echo "
"; // echo "password=".$password; // echo "
"; // // echo "

"; echo "Your WirelessSestri (www.comune.sestri-levante.ge.it) Password has been re-sent at ".$email."\n
\n"; echo "an SMS with your password has been re-sent to ".$phone."\n
\n"; echo "
\n"; echo "

"; $subject = "Resend HOTSPOT Access details"; $body = "Hi,\nYour WirelessSestri (www.comune.sestri-levante.ge.it) username is: ".$username." and your password has ben sent to you cellular phone ".$phone." \n"; $smsbody = "WirelessSestri user: ".$username." pass: ".$password." "; $smserr = "$phone $username $password"; $cnt=0; $stat=send_sms($phone, "$smsbody"); while(!$stat && $cnt < 12) { $cnt++; sleep(5); $stat=send_sms($phone, "$smsbody"); } if(!$stat) { file_put_contents("/var/log/apache2/register.err", "$smserr\n" , LOCK_EX | FILE_APPEND ); } else { system("sed -i '/$smserr/d' /var/log/apache2/register.err"); } send_info($email,$subject,$body); // // Inserisco la data di nuovo invio SMS nella tabella delle password. // $sms_time = time(); $query = "UPDATE $db_passtable SET $db_last_sms = '$sms_time' WHERE $db_user='$username'"; $result = mysql_query($query); } else { echo "Hai gia ricevuto di recente, un SMS con la password.
Per informazioni, chiamare l'ufficio informatica ai numeri:
+39 0185478324/0185478328\n
\n"; echo "
\n"; echo "
\n"; echo "You recently have received an SMS with your password.
Please call the IT office at the following numbers:
+39 0185478324/0185478328\n
\n"; } } } else { if(isset($_SESSION['phone'])) { if(isset($_POST[$_SESSION['phone']])) { $phone = mysql_real_escape_string($_POST[$_SESSION['phone']]); if($phone != "") { check_phone("3"); } } } $s_nome=substr(md5(rand()),0,8); $_SESSION['nome']=$s_nome; $s_cognome=substr(md5(rand()),0,8); $_SESSION['cognome']=$s_cognome; $s_compleanno=substr(md5(rand()),0,8); $_SESSION['compleanno']=$s_compleanno; $s_phone=substr(md5(rand()),0,8); $_SESSION['phone']=$s_phone; $s_email=substr(md5(rand()),0,8); $_SESSION['email']=$s_email; $s_residenza=substr(md5(rand()),0,8); $_SESSION['residenza']=$s_residenza; $s_regione=substr(md5(rand()),0,8); $_SESSION['regione']=$s_regione; $s_accetto=substr(md5(rand()),0,8); $_SESSION['accetto']=$s_accetto; ?>

Registrazione al servizio hotspot


Nome / First Name:
Cognome / Last name:
Data di nascita (dd/mm/aaaa) / Date of birth (dd/mm/yyyy):
Num.Cellulare/Mobile Phone Number to send SMS: Reinserisci il Numero Di Cellulare usato per la registrazione
Insert the Mobile Phone Number used for registration

Email Address:
Comune Residenza / Home address:

Regione / Country/Region:
Accept conditions