zgkhoo Posted November 2, 2007 Share Posted November 2, 2007 /class.datepicker.php web root folder ./class.datepicker.php current folder ../class.datepicker.php parent folder how to point to parent folder's parent folder? .../ or? Quote Link to comment Share on other sites More sharing options...
poizn Posted November 2, 2007 Share Posted November 2, 2007 ../../ Quote Link to comment Share on other sites More sharing options...
zgkhoo Posted November 2, 2007 Author Share Posted November 2, 2007 cant work,it hang.. Quote Link to comment Share on other sites More sharing options...
zgkhoo Posted November 2, 2007 Author Share Posted November 2, 2007 <?php session_start(); ?> </html> <head> <link rel="stylesheet" type="text/css" href="style.css" /> </head> <div id="bodyarea" style="padding: 1ex 0px 2ex 0px;"> </div> <!--</html>--> <?php include '../../config.php'; include '../../opendb.php'; $cardnum=$_SESSION["cardnum"]; $initial=$_SESSION["initial"]; $active_len=$_SESSION["active_len"]; $active_type=$_SESSION["active_type"]; $point=$_SESSION["point"]; $createdate=$_SESSION["create_date"]; $expirydate=$_SESSION["expiry_date"]; //echo "Card Card Card Card Card".$_SESSION["initial"]; 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; } $con = mysql_connect("localhost","root",""); if (!$con){ die('Could not connect: ' . mysql_error()); } mysql_select_db("my_db", $con); $sql = "CREATE TABLE gamecard ( Serialnum varchar(13), Serial varchar(13), Initial varchar(13), Activatecode varchar(13), Ownerid varchar(13), Status varchar(13), Downleft varchar(13), Downright varchar(13), Upline varchar(13), Expireddate date, Createdate datetime, Point varchar(13), Golden varchar(13) )"; mysql_query($sql,$con); $result = mysql_query("SELECT * FROM gamecard") or die('Query failed: ' . mysql_error()); while($row = mysql_fetch_array($result,MYSQL_ASSOC)){ $serial=$row["Serial"]; // echo "serial=".$serial; }; $serial++; //serial num for the newly added card echo "new serial".$serial; if($serial==1) $serial=$serial+1000; //$cardnum=$_POST['cardnum']; $count=0; echo"<center><table border=1><tr><td>Serial Number</td><td>Activate Code</td><td>Point</td><td>Created Date</td><td>Expiry Date</td></tr>"; while ($count<$cardnum) {//generate activate_code for each new card added $randompass=generatePassword($active_len,$active_type); $_SESSION["generatepass"]=$randompass; echo "serial".$serial; $actualserial=$serial-1000; echo"actual serial".$actualserial; $serialstr=strval($actualserial); echo "serial str".$serialstr; $seriallength=strlen($serialstr); echo "serial length".$seriallength; if ($seriallength<=3){ if($seriallength==1) $serialpart="000".$actualserial; else{ if($seriallength==2) $serialpart="00".$actualserial; else{ $serialpart="0".$actualserial; // echo "add 0".$seriallength; } } } else{ $serialpart=$actualserial; //echo "=>4"; } $serialnum=$initial.$serialpart; $_SESSION["activatenum"]=$serialnum; $card_arr[$count][0]=$serialnum; $card_arr[$count][1]=$serial; $card_arr[$count][2]=$initial; $card_arr[$count][3]=$randompass; $card_arr[$count][4]=$expirydate; $card_arr[$count][5]=$createdate; $card_arr[$count][6]=$point; echo"<tr><td>$serialnum</td><td>$randompass</td><td>$point</td><td>$createdate</td><td>$expirydate</td></tr>"; $count++; $serial++; }//end of while $count<$cardnum $_SESSION["card_arr"]=$card_arr; ?> <center><table><tr><td> <form name="form1" method="post" action="insertcard.php"> <input type="hidden" name="posted" value="true"> <input type="submit" name="Submit" value="Confirm"> </form> </td> </tr> </table> </center> </html> Quote Link to comment Share on other sites More sharing options...
poizn Posted November 2, 2007 Share Posted November 2, 2007 So which line is actually hanging? ../../ "should" work Is it maybe that the script, that you trying to include, doesnt exist? What is the actualt error you get? Quote Link to comment Share on other sites More sharing options...
zgkhoo Posted November 2, 2007 Author Share Posted November 2, 2007 when i change include 'config.php'; to wat u said include '../../config.php'; then hang.. weird. but include '../../opendb.php'; wont. Quote Link to comment Share on other sites More sharing options...
zgkhoo Posted November 2, 2007 Author Share Posted November 2, 2007 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; } is it possible hang by this function again?? Quote Link to comment Share on other sites More sharing options...
poizn Posted November 5, 2007 Share Posted November 5, 2007 Hmmm it could very well be that function. Try this maybe, comment out the line that calls this function (generatePassword) This way you would know, if the function is causing the script to hang Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.