Discussione [PROBLEMA]Registrazione

Stato
Discussione chiusa ad ulteriori risposte.

pasqualeeia

Utente Gold
18 Febbraio 2009
670
88
43
270
salve a tutti vorrei mettere i bonus in questo script perchè e l'unico ke va sul mio server

Registrati
Codice:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>.:. Registrazione Account .:.</TITLE>

</HEAD>
<BODY>

<script language="JavaScript">

function CheckValid(form)
{
	if (form.UserID.value.length<8)
	{
	    alert("ERRORE: L'username deve contenere almeno 8 Caratteri!");
	    return false;
	}
	if (form.UserID.value.length>14)
	{
	    alert("ERRORE: L'username deve contenere massimo 14 Caratteri!");
	    return false;
        }
        if (form.UserID.value==form.Password.value)
        {
            alert("ERRORE: La Password deve essere differente dall'Username!")
            return false;
        }
	if (form.Password.value.length<9)
	{
	    alert("ERRORE: La Password deve contenere almeno 9 Caratteri!");
	    return false;
	}
	if (form.Password.value.length>16)
	{
	    alert("ERRORE: La Password deve contenere massimo 9 Caratteri!");
	    return false;
        }

	if (form.Password.value!=form.RPassword.value)
	{
	    alert("ERRORE: La 2 Passwords non coincidono!");
	    return false;
        }
	
	if (form.Email.value.length<5)
	{
	    alert("ERRORE: L'E-Mail deve contenere almeno 5 Caratteri!");
	    return false;
	}
	if (form.Email.value.length>50)
	{
	    alert("ERRORE: L'E-Mail deve contenere massimo 50 Caratteri!");
	    return false;
        }
		
	if (form.UserName.value.length<2)
	{
	    alert("ERRORE: Il Nome Reale deve contenere almeno 2 Caratteri!");
	    return false;
	}
	if (form.UserName.value.length>24)
	{
	    alert("ERRORE: Il Nome Reale deve contenere massimo 24 Caratteri!");
	    return false;
        }	
	if (form.IDCard.value.length!=7)
	{

	        alert("ERRORE: Il Codice di Cancellazione PG deve contenere 8 Numeri!");
	        return false;
	}
	
	
	if (form.Ques.value=="")
	{
	    alert("ERRORE: Metti almeno la 1 Domanda Segreta!");
	    return false;
        }
	
	
	if (form.Ques.value.length>20)
	{
	    alert("ERRORE: La domanda non deve superare i 20 caratteri!");
	    return false;
        }
        
        
	if (form.Answ.value=="")
	{
	    alert("ERRORE: Metti la Risposta Segreta!");
	    return false;
        }
        
	
	if (form.Answ.value.length>20)
	{
	    alert("ERRORE: La Risposta Segreta non deve superare i 20 caratteri!");
	    return false;
        }
        
        
	if (form.Answ.value!=form.Answ1.value)
	{
	    alert("ERRORE: Le 2 Risposte Segrete devono essere Uguali!");
	    return false;
        }
}
function change(code)
{
 switch(code)
 {

 }
}

//-->
</script>
  <form  id="form2" name="form2" method="post" action="controllo.php" onSubmit="return CheckValid(this)">


      <TABLE height=128 width=400 
        border=0>
        <TBODY>
        <TR>
          <TD colspan="6">
            <DIV align=center><br>
                <table width="100%"  border="0" cellpadding="0" cellspacing="0" class="main2">
                  <tr>
                    <td><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                        <tr>
                              <div style="">
                                <div style="float:left; width:150px;">Nome Utente:</div>
                                <input name="UserID" type="text" id="UserID" size="16" maxlength="16" value="" class="inputbox2" onFocus="change(1)" onKeyUp="value=value.replace(/[^\w\.\/]/ig,'')">
              * Minimo 8 Caratteri<br /><br>
              <div style="width:150px; float:left;">Password:</div>
              <input name="Password" type="password" id="Password" size="16" maxlength="16"  class="inputbox2" onFocus="change(2)" onKeyUp="value=value.replace(/[^\w\.\/]/ig,'')">
              * Minimo 9 Caratteri<br /><br>
              <div style="width:150px; float:left;">Verifica Password:</div>
              <input name="RPassword" type="password" id="RPassword" size="16" maxlength="16"  class="inputbox2" onFocus="change(3)">
              * <br /><br>
              <div style="width:150px; float:left;">E-Mail:</div>
              <input type="text" name="Email" id="Email" />
              *<br /><br>
              <div style="width:150px; float:left;">Nome Reale:</div>
              <input name="UserName" type="text" id="UserName" size="12" maxlength="12" value="" class="inputbox2" onFocus="change(5)">
              *<br /><br>
              <div style="width:150px; float:left;">Sesso:</div>
              <input name="Sex" type="radio" value="1" checked>
              Uomo
              <input type="radio" name="Sex" value="0" >
              Donna<br /><br>
              <div style="width:150px; float:left;">Num. Cancellazione PG:</div>
              <input name="IDCard" type="text" id="IDCard" size="7" maxlength="7" value="" class="inputbox2" onFocus="change(6)">
              * Deve contenere 7 Numeri!<br /><br>
 
              <div style="width:150px; float:left;">Domanda Segreta: </div>
              <select name="Ques" class="inputbox2">
                <option value="×îϲšgµÄŒ™Îï">1 Dom</option>
                <option value="×îϲ۵ÄëŠÓ°">2 Dom</option>
                <option value="×î³ç°ÝµÄżÏñ">3 Dom</option>
                <option value="¸¸ÓHµÄÃû×Ö">4 Dom</option>
                <option value="ÅäżµÄÃû×Ö">5 Dom</option>
                <option value="µÚÒ»‚€º¢×ÓµÄÛ·Q">6 Dom</option>
                <option value="ÖÐŒWУÃû">7 Dom</option>
                <option value="×îϲšgµÄÀÏŽŸ">8 Dom</option>
                <option value="×îϲšgµÄß\„Ó†T">9 Dom</option>
              </select>
              *<br /><br>
              <div style="width:150px; float:left;">Risposta Segreta:</div>
              <input name="Answ" type="text" id="Answ" size="20" maxlength="20" value="" class="inputbox2" onFocus="change(7)">
              *<br /><br>
              <div style="width:150px; float:left;">2 Risposta Segreta:</div>
              <input name="Answ1" type="text" id="Answ1" size="20" maxlength="20" value="" class="inputbox2" onFocus="change(8)">
              <br /><br>
              <input type="hidden" name="act" value="send">
              <br /><br>
                <button style="align: center; float: center; margin-left: 150px; " class="Button" align="center" type="submit" name="imageField">
                                                <span class="btn" align="center" style="float: center; align: center;">
                                                    <span class="t">Registrati a DelirusMt2!</span>
                                                    <span class="r"><span></span></span>
                                                    <span class="l"></span>
                                                </span>
                                        </button>

                            </div></td>
                        </tr>
                    </table></td>
                  </tr>
                </table>
                <br>
                <br>
            </DIV>            </TD>
          </TR>
        <TR>
          <TD colSpan=6>
            <DIV align=left></DIV>
            </TD></TR>
        </TBODY></TABLE>
          <td width="4"></td>
    </TD></TR></TBODY></TABLE>
	

</FORM></BODY></HTML>

Controllo
Codice:
<?php
function DeCode($string,$operation,$key='')
    {
        $key=md5($key);
        $key_length=strlen($key);
        $string=$operation=='D'?base64_decode($string):substr(md5($string.$key),0,8).$string;
        $string_length=strlen($string);
        $rndkey=$box=array();
        $result='';
        for($i=0;$i<=255;$i++)
        {
            $rndkey[$i]=ord($key[$i%$key_length]);
            $box[$i]=$i;
        }
        for($j=$i=0;$i<256;$i++)
        {
            $j=($j+$box[$i]+$rndkey[$i])%256;
            $tmp=$box[$i];
            $box[$i]=$box[$j];
            $box[$j]=$tmp;
        }
        for($a=$j=$i=0;$i<$string_length;$i++)
        {
            $a=($a+1)%256;
            $j=($j+$box[$a])%256;
            $tmp=$box[$a];
            $box[$a]=$box[$j];
            $box[$j]=$tmp;
            $result.=chr(ord($string[$i])^($box[($box[$a]+$box[$j])%256]));
        }
        if($operation=='D')
        {
            if(substr($result,0,8)==substr(md5(substr($result,8).$key),0,8))
            {
                return substr($result,8);
            }
            else
            {
                return'';
            }
        }
        else
        {
            return str_replace('=','',base64_encode($result));
        }
    }

?>
<?php
session_start();
$UserID=$_POST["UserID"];
$Password=$_POST["Password"];
$Email=$_POST["Email"];
$UserName=$_POST["UserName"];
$Sex=$_POST["Sex"];
$IDCard=$_POST["IDCard"];

$Ques=$_POST["Ques"];
$Ques=DeCode($_POST["Ques"],'E','daichao');
$Answ=DeCode($_POST["Answ"],'E','daichao');
$BirthYear=$_POST["BirthYear"];
$BirthMonth=$_POST["BirthMonth"];
$BirthDay=$_POST["BirthDay"];
$Addr=$_POST["Addr"];
$PostCode=$_POST["PostCode"];
$Mobile=$_POST["Mobile"];
$Telephone=$_POST["Telephone"];
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>.:. Registrazione Account .:.</title>
</head>

<body>
<?php
if (strlen($UserID) < 8) {$error=$error."<br>ERRORE: L'Username deve contenere minimo 8 Caratteri!";}
if (strlen($Password) < 9) {$error=$error."<br>ERRORE: La Password deve contenere minimo 9 Caratteri!";}
if (strlen($Email) < 1) {$error=$error."<br>ERRORE: L'E-Mail deve contenere minimo 1 Carattere!";}
if (strlen($UserName) < 1) {$error=$error."<br>ERRORE: Il Nome Reale deve contenere minimo 1 Carattere!";}
if (strlen($IDCard) != 7) {$error=$error."<br>ERRORE: Il Codice Cancellazione PG deve contenere 7 Numeri!";}
if (strlen($Answ) < 1) {$error=$error."<br>ERRORE: La risposta segreta deve contenere 1 Carattere!";}
if (strlen($error) > 0){
	echo "ERRORE: <a href=\"javascript:history.back();\">Indietro</a>$error";exit;
}else{
	require_once("conn.php");
	mysql_select_db("account");
	$exec="select * from account where Login='$UserID'";
	$result=mysql_query($exec);
	$rs=mysql_fetch_object($result);
	if($rs){
		echo"ERRORE! <a href=\"javascript:history.back();\">Indietro</a>";
		exit;
	}else{
		$exec="insert into account (Login,Password,Real_name,Social_id,Email,Phone1,Phone2,Address,Question1,Answer1)  values('$UserID',password('$Password'),'$UserName','$IDCard','$Email','$Mobile','$Telephone','$Addr','$Ques','$Answ')";
		mysql_query("set names big5 ");
		mysql_query("set CHARACTER big5 ");
		mysql_query($exec);
		//echo mysql_error();
		//echo $exec;
	//$exec="insert into player.safebox(account_id,size,password) values((select id from account.account where login='$UserID') ,1,'000')";
	//mysql_query($exec);
	//echo mysql_error();
	//echo "<br>".$exec;
?>
<center>
 Registrazione Avvenuta con Successo!
</center>
<?php
	}

}
?>
</body>
</html>

come faccio a mettere i bonus?? =( please aiutatemi
 
Stato
Discussione chiusa ad ulteriori risposte.
Indietro
Top Bottom