zgkhoo
Members-
Posts
507 -
Joined
-
Last visited
Never
Everything posted by zgkhoo
-
cant work,it hang..
-
how to point to parent folder's parent folder? .../ or?
-
opendb.php <?php // This is an example opendb.php $con = mysql_connect($dbhost, $dbuser, $dbpass) or die('Error connecting to mysql'); mysql_select_db($dbname,$con);// add $conn 1/9/07 ?>
-
thanks you very much for ur teaching..
-
`likethis` <--this one database name? y got use ' ??? wat for? thanks..
-
i++; sorry i very dumb
-
after upload to hosting, security code feature become unfunctionable.
zgkhoo replied to zgkhoo's topic in PHP Coding Help
*bump* -
An awful lot of replcated html 《---can give me some example? thanks..
-
<?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" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> </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> anything wrong with this php file? it is workable ,just wanna know it is any design error etc error thanks.
-
then the bug is only at the function.php? thanks
-
$possible="0123456789"; this one only possibility number, which generate a 13 password select from 0123456789
-
huh? wat 10 number?
-
<?php function generatePassword ($length,$type) { $password = ""; if ($type=='Character(Big Letter)'){//3 $possible="ABCDEFGHIJKLMNOPQRSTUVWXYZ"; } else{//3 if($type=='Character(Small Letter)'){//2 $possible="abcdefghijklmnopqrstuvwxyz"; }//2 else{//2 if ($type=='Number'){//1 $possible="0123456789"; }//1 else{//1 $possible = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; }//1 }//2 }//3 // set up a counter $i = 0; // add random characters to $password until $length is reached while ($i < $length) { // pick a random character from the possible ones $char = substr($possible, mt_rand(0, strlen($possible)-1), 1); // we don't want this character if it's already in the password if (!strstr($password, $char)) { $password .= $char; $i++; } }//end of while // done! return $password; } ?>
-
how about initially create of db and create table? how to add in this setting in create clause. thanks a lot
-
from this page. addcard1.php <?php session_start(); ob_start(); if(isset($_POST['click'])){ echo "button clicked"; $_SESSION["serial1"]= $_POST["serial1"]; $_SESSION["code_type"]= $_POST["code_type"]; $_SESSION["spoint"]= $_POST["spoint"]; $_SESSION["screate_date"] = $_POST["screate_date"]; $_SESSION["sexpiry_date"]= $_POST["sexpiry_date"]; header ('Refresh:2;url=testcard1.php'); exit(); } ?> <html> <body> <form action="add1card.php" method="POST"> <table border="1"> <tr> <td width="181">Serial Number</td> <td width="168"> <input type="text" name="serial1" /> </td> </tr> <tr> <td width="181">Activate Code Type</td> <td width="168"> <select name="code_type"> <option value="Character(Big Letter)">Character(Big Letter)</option> <option value="Character(Small Letter)">Character(Small Letter)</option> <option value="Number">Number</option> <option value="Mix">Mix</option> </select> </td> </tr> <tr> <td width="181">Point</td> <td width="168"> <input type="text" name="spoint"> </td> </tr> <tr> <td width="181">Created Date</td> <td width="168"> <input type="text" name="screate_date"> </td> </tr> <tr> <td width="181">Expirly Date</td> <td width="168"> <input type="text" name="sexpiry_date"> </td> </tr> <tr> <td width="181"> <input type="reset" name="reset" /> </td> <td width="168"> <input type="submit" name='click'/> </td> </tr> </table> <!--</td> </tr> </table>--> </form> </body> </html> redirect to this page. testcard1.php <?php session_start(); include 'config.php'; include 'opendb.php'; include 'function.php'; ob_start(); $serial= $_SESSION["serial1"]; $code_type= $_SESSION["code_type"]; $point= $_SESSION["spoint"]; $cdate = $_SESSION["screate_date"]; $edate= $_SESSION["sexpiry_date"]; $l=13; $randompass=generatePassword($l,$code_type); //searching the last serialnum in the db $result = mysql_query("SELECT * FROM gamecard ORDER BY Serialnum") or die('Query failed: ' . mysql_error()); while($row = mysql_fetch_array($result,MYSQL_ASSOC)){ $serialnum=$row["Serialnum"]; }; echo "</br>serialnum (after loop)=".$serialnum; //if database contain no record at all if(mysql_num_rows($result)==0){//if serialnum=null echo "norecordindb"; $serialnum=$serialnum+1001; } else{ $serialnum++; } echo "</br>serialnum=".$serialnum; echo "</br>serial=".$serial; echo "</br>codetype=".$code_type; echo "</br>point=".$point; echo "</br>random pass=".$randompass; echo "</br>createdate=".$cdate; echo "</br>expired date=".$edate; //$sql="INSERT INTO gamecard (Serial,Serialnum,Activatecode,Expireddate,Createdate,Point,Golden) //VALUES //('$serialnum','$serial','$randompass','$expirydate','$createdate','$point','Invalid')"; if(isset($_POST['click'])){ echo "</br>button clicked"; $sql="INSERT INTO gamecard (Serialnum,Serial,Activatecode,Expireddate,Createdate,Point,Golden) VALUES ('$serialnum','$serial','$randompass','$edate','$cdate','$point','invalid')"; mysql_query($sql, $con); header ('Refresh:2;url=displayaddsingle.php'); }//end if ?> <html> <form action="testcard1.php" method="POST" > <input type="submit" name="click" value='click'> </form> </html> error msg when loading test1card.php Fatal error: Maximum execution time of 60 seconds exceeded in H:\xampplite\htdocs\mlm\menu\function.php (which include by this test1.card.php)on line 32
-
how to change mysql table to UTF8?
-
solved..thanks..weird duno y will key in zero..
-
0 is like that. dun play ..bro.. thanks.
-
huh? dollar sign ? $<--this?? y not normal? i dun see any different ..
-
this file is add1card.php , it POST to itself.
-
<?php session_start(); if(isset($_P0ST['click'])){ echo "button clicked"; $_SESSION["serial1"]= $_POST["serial1"]; //$_SESSION["code_type"]= $_POST["code_type"]; //$_SESSION["spoint"]= $_POST["spoint"]; //$_SESSION["screate_date"] = $_POST["screate_date"]; //$_SESSION["sexpiry_date"]= $_POST["sexpiry_date"]; // header ('Refresh:2;url=placebet3.php'); } ?> <html> <body> <form action="add1card.php" method="POST"> <table border="1"> <tr> <td width="181">Serial Number</td> <td width="168"> <input type="text" name="serial1" /> </td> </tr> <tr> <td width="181">Activate Code Type</td> <td width="168"> <select name="code_type"> <option value="Character(Big Letter)">Character(Big Letter)</option> <option value="Character(Small Letter)">Character(Small Letter)</option> <option value="Number">Number</option> <option value="Mix">Mix</option> </select> </td> </tr> <tr> <td width="181">Point</td> <td width="168"> <input type="text" name="spoint"> </td> </tr> <tr> <td width="181">Created Date</td> <td width="168"> <input type="text" name="screate_date"> </td> </tr> <tr> <td width="181">Expirly Date</td> <td width="168"> <input type="text" name="sexpiry_date"> </td> </tr> <tr> <td width="181"> <input type="reset" name="reset" /> </td> <td width="168"> <input type="submit" name='click'/> </td> </tr> </table> <!--</td> </tr> </table>--> </form> </body> </html> testing for many time, the button still wont work... why? thanks..
-
<?php if(isset($_post[check]){ echo "testing1"; } ?> <html> <form action=index.php method=post> <input type=submit name=check value=check> </form> </html> how to disappear the check button after this check button being clicked? meant after click the check button, the page only show "testing1" nothing else.. thanks..
-
*bump*
-
thanks..
-
*bump*