Jump to content

after upload to hosting, security code feature become unfunctionable.


zgkhoo

Recommended Posts

<?php 
   session_start();
   include 'config.php';
   include 'opendb.php';

   // check for user field as well as other required field for empty value
   function chk_user($user){
   	$result=mysql_query("SELECT * from person WHERE username='$user'");
$numrows=mysql_num_rows($result);
if ($numrows!=0)
{	
	echo "<center><table><tr><td bgcolor=#FFCC00><font color=#CC0000>The User Name Is Being Registered By Other User</font></td></tr></table></center>";
	 unset($_SESSION['username']);
	return 1;
}
else 
	if ($user==null){
		echo "<center><table><tr><td bgcolor=#FFCC00><font color=#CC0000>Please Enter Your Desired User Name</font></td></tr></table></center>";
		return 1;
	}
	else{
		if (!empty($_SESSION[password])){

			if ($_SESSION[password]==$_SESSION[retypepass]){
				if($_SESSION[country]!="NA")
					return 0;
				else{
					echo "<center><table><tr><td bgcolor=#FFCC00><font color=#CC0000>Please Select Your Country!</font></td></tr></table></center>";
					return 1;
				}
			}
			else{
				echo "<center><table><tr><td bgcolor=#FFCC00><font color=#CC0000>Your Retype Password Not Match Your Password!</font></td></tr></table></center>";
				return 1;
			}
		}		
		else{
			echo "<center><table><tr><td bgcolor=#FFCC00><font color=#CC0000>Please Enter Your Password!</font></td></tr></table></center>";
			return 1;
		}
	}
   }// end of function
   
   //check the newly register card
   function chk_card_availability($card_id){
   	
   	$result = mysql_query("SELECT * FROM gamecard where Serialnum='$card_id'") or die('Query failed: ' . mysql_error());
    $numrows=mysql_num_rows($result);


if ($numrows == 0)
  	{
  	
	return 0;
    }
else{
	return 1;

}

   }//end of function chk_card_availability
   
   function chk_card_owner($card_id){
   	$result = mysql_query("SELECT * FROM gamecard where Serialnum='$card_id'") or die('Query failed: ' . mysql_error());
   	while($row = mysql_fetch_array($result,MYSQL_ASSOC)){
   	 	$owner=$row["Ownerid"];
   	 }
   //	 echo"Owner=".$owner;
   	 
   	 if($owner!=null){
   	 	// echo"Owner=".$owner;
   	 	return 0;
   	 }
   	 else {
   	 	return 1;
   	 }
   	
   }//end of function chk_card_owner
   
   function validate_sponser($card_id){
   		$result = mysql_query("SELECT * FROM gamecard where Serialnum='$card_id'") or die('Query failed: ' . mysql_error());
   	    while($row = mysql_fetch_array($result,MYSQL_ASSOC)){
   	 	$downleft=$row["Downleft"];
   	 	$downright=$row["Downright"];
   	 	}
   	 	
   	 	if($downleft!=null&&$downright!=null)
   	 		return 0;
   	 	else
   	 		return 1;
   	 		
   }//end of function validate_sponser
   
    if(isset($_POST['button'])){

       
   
   if(($_SESSION['security_code'] == $_POST['security_code']) && (!empty($_SESSION['security_code'])) ) {
      // Insert you code for processing the form here, e.g emailing the submission, entering it into a database. 
      $_SESSION[username]=$_POST[username];
      $_SESSION[password]=$_POST[password];
      $_SESSION[retypepass]=$_POST[retypepass];
      $_SESSION[country]=$_POST[country];
      $_SESSION[cardID]=$_POST[cardID];
      $_SESSION[uplineID]=$_POST[uplineID];

      unset($_SESSION['security_code']);
      
     
      	$ans=chk_user($_SESSION[username]); //chk for duplicate user      
      
   		if ($ans==0)  {//(3)
   			//check card availability
   			$ans1=chk_card_availability($_SESSION[cardID]);
   			if($ans1==1){// (2)
   				$ans2=chk_card_owner($_SESSION[cardID]); // check for card owner
   				if($ans2==1){// (1) start checking for the sponsor field
   					$ans3=chk_card_availability($_SESSION[uplineID]);
   					if($ans3==1 ||$_SESSION[uplineID]=='AAA0' ){//(4)
   						$ans4=chk_card_owner($_SESSION[uplineID]);
   						if($ans4==0|| $_SESSION[uplineID]=='AAA0'){//(5)
   							$ans5=validate_sponser($_SESSION[uplineID]);
   							if ($ans5==1)
   								header('Location: register2.php');
   							else{
   								echo "<center><table><tr><td bgcolor=#FFCC00><font color=#CC0000>The Specified Sponsor ID Has No Right To Sponsor Any Card </font></td></tr></table></center>";
   								unset($_SESSION['uplineID']);
   							}
   						}//end of if (5)
   						else{//else (5)
   							echo "<center><table><tr><td bgcolor=#FFCC00><font color=#CC0000>The Specified Sponsor ID Not Owned By Any User</font></td></tr></table></center>";
   							unset($_SESSION['uplineID']);
   						}//end of else (5)
   							
   					}//end of if (4)
   					else{//else (4)
   						echo "<center><table><tr><td bgcolor=#FFCC00><font color=#CC0000>The Specified Sponsor ID Is Not In Our Database</font></td></tr></table></center>";
   						unset($_SESSION['uplineID']);
   					}//end of else (4)
   					
   				} //end of if (1)
   				else{ // else of (1)
   					echo "<center><table><tr><td bgcolor=#FFCC00><font color=#CC0000>The Card Is Being Registered By Other User </font></td></tr></table></center>";
   					unset($_SESSION['cardID']);
   				}//end of else (1)
   				
   			}//end of if (2)
   			else{ //else of (2)
   				echo "<center><table><tr><td bgcolor=#FFCC00><font color=#CC0000>The Card Is Not Available In Our Database</font></td></tr></table></center>";
   				 unset($_SESSION['cardID']);
   				
   			}//end of else (2)
   				
        
   		}//end of if (3)
     
   } //end of security_code if
   else {
   		echo "<center><table><tr><td bgcolor=#FFCC00><font color=#CC0000>Incorrect Security Code!</font></td></tr></table></center>";
   	
   }
   
   
   	
}//end of isset
       
?>




<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>

<body>
<form action="register.php" method="post">
  <div id="bodyarea" style="padding: 1ex 0px 2ex 0px;"> 
    <!--set bg color based on css file-->
    <table width="86%" border="0" align="center">
      <tr>
        <td><font color="#660033"><b><i><font face="Georgia, Times New Roman, Times, serif" size="7">Registration</font></i></b></font></td>
      </tr>
    </table>
    <table width="85%" border="0" align="center" height="60">
      <tr>
        <td width="34%"><img src="step1org.jpg" width="214" height="61" border="1"></td>
        <td width="32%"><img src="step%202.jpg" width="214" height="61" border="1"></td>
        <td width="34%"><img src="step%203.jpg" width="214" height="61" border="1"></td>
    </tr>
  </table>
    <table border="0" width="658" align="center">
      <tr> 
        <td width="185"><b>Country Code</b></td>
        <td width="177"> 
          <select name="country">
          <option value="NA">-- Select a Country --</option>
          <option value="AU">AU - AUSTRALIA</option>
          <option value="BR">BR - BRUNEI</option>
          <option value="CA">CA - CANADA</option>
          <option value="EN">EN - ENGLAND</option>
          <option value="ID">ID - INDONESIA</option>
          <option value="KR">KR - KOREA</option>
          <option value="MY">MY - MALAYSIA</option>
          <option value="PH">PH - PHILIPPINES</option>
          <option value="SG">SG - SINGAPORE</option>
          <option value="TH">TH - THAILAND</option>
          <option value="TW">TW - TAIWAN</option>
          <option value="US">US - UNITED STATES</option>
          <option value="VN">VN - VIETNAM</option>
        </select>
      </td>
        <td width="282"><span style="font-size: 9px; color: #0033FF; font-family: Arial;"><font style="">
	*Select Your Country</font></span> </td>
    </tr>
    <tr> 
        <td width="185"><b>Your prefered Username:</b></td>
        <td width="177"> 
          <input type="text" name="username" <?php if (!empty($_SESSION[username]))?> value="<?php echo $_SESSION[username]; ?>" />
      </td>
        <td width="282"><span style="font-size: 9px; color: #0033FF; font-family: Arial;"><font style="">*13 
          alphanumeric (A-Z, a-z, 0-9).</font></span></td>
    </tr>
    <tr> 
        <td width="185"><b>Login Password:</b></td>
        <td width="177"> 
          <input type="password" name="password" />
      </td>
        <td width="282"><span style="font-size: 9px; color: #0033FF;"><font style="">*8 
          alphanumeric (A-Z, a-z, 0-9).</font></span></td>
    </tr>
    <tr> 
        <td width="185"><b>Retype Password:</b></td>
        <td width="177"> 
          <input type="password" name="retypepass" />
      </td>
        <td width="282"><span style="font-size: 9px; color: #0033FF;"><font style="">*8 
          alphanumeric (A-Z, a-z, 0-9).</font></span></td>
    </tr>
    <tr> 
        <td width="185"><b>New Game Card ID:</b></td>
        <td width="177"> 
          <input type="text" name="cardID" <?php if (!empty($_SESSION[cardID]))?> value="<?php echo $_SESSION[cardID]; ?>"/>
      </td>
        <td width="282"><span style="font-size: 9px; color: #0033FF; font-family: Arial, Helvetica, sans-serif;"><font style="">Specified 
          your New Game ID No</font></span></td>
    </tr>
    <tr> 
        <td width="185"><b>Sponsor Number:</b></td>
        <td width="177"> 
          <input type="text" name="uplineID" <?php if (!empty($_SESSION[uplineID]))?> value="<?php echo $_SESSION[uplineID]; ?>"/>
      </td>
        <td width="282"><span style="font-size: 9px; color: #0033FF; font-family: Arial, Helvetica, sans-serif;"><font style="">Specified 
          your referer Sponsor NO</font></span></td>
    </tr>
    <tr> 
        <td width="185"><b>Security Code</b></td>
        <td width="177"> 
          <input type="text" name="security_code" />
      </td>
        <td width="282"><span class="style4" style="font-size: 9px; color: #0033FF; font-family: Arial, Helvetica, sans-serif;"><font style="">Enter 
          the word shown below</font></span></td>
    </tr>
    <tr> 
        <td width="185"><b>Security Image</b></td>
        <td width="177"> 
          <input type="image" name="securityimage" img src="CaptchaSecurityImages.php"  />
      </td>
        <td width="282"> </td>
    </tr>
    <!--<img src="CaptchaSecurityImages.php" />
//Security Code: 
//<input id="security_code" name="security_code" type="text" />
!-->
    <tr> 
        <td width="185"> 
          <input type="submit" name='button' class="catbg2"/>
      </td>
        <td width="177"> 
          <input type="reset" name="reset" class="catbg2" />
      </td>
        <td width="282"> </td>
    </tr>
  </table>
  </div>
</form>
</body>

</html>

 

when i testing in localhost is working , but after i upload to hosting then become unfunctionable..why?

the hosting link is here

http://multi.3host.biz/register.php which the security image wont display at all.

 

anyone know why?

thanks..

 

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.