Jump to content

shergold

Members
  • Posts

    95
  • Joined

  • Last visited

    Never

Everything posted by shergold

  1. ah its ok ive figured it out, since i used md5 to encrypt the password it changed to password into a 32 character string and i was only allowing 30 character strings. thanks, shergold.
  2. is that what you was looking for? sorry if not im a noob also.
  3. ah thank you i echo'ed and only the email wasn't showing. although now i have done this I'm getting another error, when i type a password im getting "The password is to long" string that i set. i used an if statement to check it. if (!isset($reg_username) || !isset($reg_password) || !isset($reg_email)) { echo "Please enter the required fields."; echo"</br><a href=\"javascript: history.go(-1)\">Back</a>"; } elseif( strlen($reg_username)>20 ) echo "$username is too long - <b>it must be 20 characters or under.</b>"; elseif( strlen($reg_password)>30 ) echo "your password is too long - <b>it must be 30 characters or under.</b>"; elseif( strlen($reg_email)>60 ) echo "your email address is too long - <b>it must be 60 characters or under.</b>"; else thanks allot for your help, shergold.
  4. to link the css stylesheet: echo "<LINK REL="style sheet" TYPE="text/css" HREF="mysheet.css" TITLE= "Default"> ";
  5. The form: <?php ?> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> </head> <meta name="generator" content= "HTML Tidy for Windows (vers 14 February 2006), see www.w3.org"> <title>Intranet Registration</title> </head> <body> <h3>Intranet Registration</h3> <form name="register" action="register.php" method="post" enctype="multipart/form-data" id="register"> Username: <input type="text" name="username" id="username" maxlength="20"><br> Password: <input type="password" name="password" id="password" maxlength= "30"></br> Email:<input type="text" name"email" id="email" maxlength = "60"></br> <input type="submit" value="submit"> </form> </body> </html> ill just echo them and get back to you. thanks, shergold.
  6. hey, i was wondering if anyone could help me with the following, <?php //connect to host and select database. include ('dbconnect.inc'); mysql_connect($host, $username, $password) or die(mysql_error()); mysql_select_db ("test") or die(mysql_error()); //get POST data from form. $reg_username =$_POST[username]; $reg_password =md5($_POST[password]); $reg_email =$_POST[email]; $activation_code=uniqid(rand()); if (!isset($reg_username) || !isset($reg_password) || !isset($reg_email)) { echo "Please enter the required fields."; echo"</br><a href=\"javascript: history.go(-1)\">Back</a>"; } everytime i send data via the forum this php file returns the echo string i have set for the !isset if statement even when i enter data for all 3 fields. If anyone can point out my mistake i will be really gratefull. Thanks, Shergold.
  7. doesnt matter, i have got it working. Thanks allot for everyones help, shergold.
  8. i just replaced the $hp -= $yourhit; with the new code but its taken me back to an infinite loop again with the hp staying at 800 :S, im really sorry if ive done it wrong -.- sorry for taking up your time.
  9. ah sorry as i said before im a noob , i dont understand any of this: $hp = ($hp < 0)? 0 : $hp; sorry but please could you explain it to me and how i can implement that into my code :S thanks, shergold.
  10. Here is an example: You hit 106, leaving your opponent with 694hp! You hit 118, leaving your opponent with 576hp! You hit 39, leaving your opponent with 537hp! You hit 150, leaving your opponent with 387hp! You hit 147, leaving your opponent with 240hp! You hit 136, leaving your opponent with 104hp! You hit 133, leaving your opponent with -29hp! that is without the if statement i tried, i want it so that if the hit is greater than the hp, just the remaining hp amount is taken off so the end value is 0. Thanks, Shergold.
  11. ah -.- thankyou i didnt realise i had to do that. also when the hp has gone down to a certain point say "17", and the $hit value is for example "100" it will stop. could you give me an example as to how i can get around that and make it take off the remaining hp amount rather than stopping when the hit amount is greater than the total hp? Thanks again, Shergold. Edit: i just added this to the while statement: if ($yourhit>$hp) $hp= $hp - $hp; but the hp goes into minus :S Edit again: actually the while statement goes into minus without the if statement.
  12. That is what i have put?
  13. Hey, i was wondering if someone would be kind enough to help me fix this while statement. Sorry if its a stupid mistake but im just learning php and this has been bugging me for the past hour. <?php //player $lvl = 10; $maxhit = $lvl *15; $minhit = $lvl *15/4; $yourhp = $lvl *100; //opponent $oplvl = 8; $opmaxhit = $oplvl *15; $opminhit = $oplvl *15/4; $hp = $oplvl *100; while ($hp>0 && $yourhp>0) { $yourhit = rand($minhit,$maxhit); $hp - $yourhit; echo "You hit {$yourhit}, leaving your opponent with {$hp}hp!</br>"; } ?> When i execute the php file i get an infinite loop, the echo statement displays a random number correctly but the hit isnt subtracted from the hp. for example: You hit 57, leaving your opponent with 800hp!. only the random number changes but the hp stays on 800. Thanks, Shergold.
×
×
  • 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.