login  Naam:   Wachtwoord: 
Registreer je!
 Forum

if, else fout

Offline ottorocket - 21/12/2005 20:54
Avatar van ottorocketOnbekend Ik heb hier een signup script, maar toen ik er een wachtwoord generator wou bijzetten liep het mis,

  1. Parse error: parse error, unexpected T_ELSEIF in /home2/mats/public_html/counter-terrors/signup.php on line 137
Dit was de fout

  1. <?
  2. ?>
  3. <?php /* ------------------------- */
  4. include("_include-config.php");
  5.  
  6. if($data->level == 1) {
  7. print " <tr><td class=\"mainTxt\">Je bent al lid.</td></tr>\n";
  8.  
  9. exit; }
  10. if($data->level == 255) {
  11. print " <tr><td class=\"mainTxt\">Je bent al lid, meer bepaald admin zelf.</td></tr>\n";
  12.  
  13. exit; }
  14.  
  15. if($data->level == 100) {
  16. print " <tr><td class=\"mainTxt\">Je bent al lid, meer bepaald een hacker.</td></tr>\n";
  17.  
  18. exit; }
  19.  
  20. if($data->level == 2) {
  21. print " <tr><td class=\"mainTxt\">Je bent al lid, meer bepaald een hacker.</td></tr>\n";
  22.  
  23. exit; }
  24.  
  25. if($data->level == 100) {
  26. print " <tr><td class=\"mainTxt\">Je bent al lid, meer bepaald een hacker.</td></tr>\n";
  27.  
  28. exit; }
  29.  
  30. if($data->level == 10) {
  31. print " <tr><td class=\"mainTxt\">Je bent al lid, meer bepaald een hacker.</td></tr>\n";
  32.  
  33. exit; }
  34.  
  35. $login = $_POST['login'];
  36. $pass = $_POST['pass'];
  37. $passconfirm = $_POST['passconfirm'];
  38. $email = $_POST['email'];
  39. $type = $_POST['type'];
  40. $IP = $_SERVER['REMOTE_ADDR'];
  41. ${"select$type"} = "selected";
  42.  
  43. if(isset($_POST['submit'])) {
  44. $message = Array(
  45. "Je login mag alleen A-Z, a-z, 0-9, _ en - hebben",
  46. "De wachtwoorden die je gaf zijn niet identiek",
  47. "Vul een geldig e-mail adres in",
  48. "Selecteer een type crimineel",
  49. "Er bestaat al iemand met die login",
  50. "Er is al iemand met die e-mail");
  51.  
  52. $msgnum = -1;
  53. if(preg_match('/^[a-zA-Z0-9_\-]+$/',$login) == 0)
  54. $msgnum = 0;
  55. if($pass == "" || $pass != $passconfirm)
  56. $msgnum = 1;
  57. if(preg_match('/^.+@.+\..+$/',$email) == 0)
  58. $msgnum = 2;
  59. if($type != 1 && $type != 2 && $type != 3)
  60. $msgnum = 3;
  61. else {
  62. $dbres = mysql_query("SELECT `id` FROM `[users]` WHERE `login`='$login'");
  63. if(mysql_num_rows($dbres) > 0)
  64. $msgnum = 4;
  65. $dbres = mysql_query("SELECT `id` FROM `[users]` WHERE `email`='$email'");
  66. if(mysql_num_rows($dbres) > 0)
  67. $msgnum = 5;
  68.  
  69. if($msgnum == -1) {
  70. $code = rand(100000,999999);
  71. mysql_query("UPDATE `[users]` SET `bank`=`bank`+'25000' WHERE `login`='{$recruiter}'");
  72. mysql_query("INSERT INTO `[users]`(signup,login,pass,IP,email,type) values(NOW(),'$login',MD5('$pass'),'$IP','$email',$type)");
  73. mysql_query("INSERT INTO nieuwsbrief (naam, email) VALUES (\"$login\", \"$email\")");
  74. mysql_query("INSERT INTO `[temp]`(login,IP,code,area,time) values('$login','$IP',$code,'signup',NOW())");
  75. $id = mysql_insert_id();
  76. $dbres = mysql_query("SELECT `login` FROM `[temp]` WHERE `area`='signup' AND `id`='$id' AND `code`='$code'");
  77.  
  78. }
  79. }
  80. }
  81.  
  82. /* ------------------------- */ ?>
  83.  
  84. <html>
  85.  
  86.  
  87. <head>
  88. <title><--counter terrors--></title>
  89. <link rel="stylesheet" type="text/css" href="css-v1.css">
  90. </head>
  91.  
  92.  
  93. <body style="background: #996600; margin: 0px;">
  94. <table align="center" width=100%>
  95. <?php /* ------------------------- */
  96.  
  97. if(isset($_GET['id'],$_GET['code'])) {
  98. print " <tr><td class=\"subTitle\"><b>Activatie</b></td></tr>\n";
  99. if($data = mysql_fetch_object($dbres)) {
  100. mysql_query("UPDATE `[users]` SET `activated`=1,`signup`=NOW() WHERE `login`='{$data->login}'");
  101. mysql_query("DELETE FROM `[temp]` WHERE `id`='$id'");
  102. print " <tr><td class=\"mainTxt\"></td></tr>\n";
  103. }
  104. }
  105. else {
  106. if($msgnum != -1) {
  107. print " <tr><td class=\"subTitle\"><b>Aanmelden</b></td></tr>\n";
  108. if(isset($msgnum) && $msgnum != -1)
  109. print " <tr><td class=\"mainTxt\">\n {$message[$msgnum]}\n </td></tr>\n";
  110. $rec = $_GET['rec'];
  111.  
  112. ?>
  113. <tr><td class="mainTxt">
  114. <center><img src="images/bliksem.gif"></center>
  115. <b> Alstublieft een aanmelding per persoon. </b>
  116. <form method="post"><table align="center">
  117. <tr><td width=100>Login:</td> <td><input type="text" name="login" maxlength=16 style="width: 150;" value="<? echo $login ?>"><b>Min. 3 tekens</b></td></tr>
  118. <tr><td width=100>Wachtwoord:</td> <td><input type="password" name="pass" maxlength=16 style="width: 150;">Weet u geen wachtwoord? <a href="javascript: //" onClick="window.open('signup.php?x=wwgen')">kijk hier</a></td></tr>
  119. <tr><td width=100>Herhaal:</td> <td><input type="password" name="passconfirm" maxlength=16 style="width: 150;"></td></tr>
  120. <tr><td width=100>E-Mail:</td> <td><input type="text" name="email" maxlength=64 style="width: 150;" value="<? echo $emaill ?>"></td></tr>
  121. <tr><td width=100>Type:</td> <td><select name="type" style="width: 150;">
  122. <option value="1" $select1>counter terrorist</option>
  123. <option value="2" $select2>terrorist</option>
  124. <option value="3" $select3>wetenschapper</option>
  125. </select> <a href="javascript: //" onClick="window.open('help.php#types')">[?]</a></td></tr>
  126.  
  127. </td></tr>
  128.  
  129. <tr><td></td><td align="right"><input type="submit" name="submit" style="width: 100;" value="Aanmelden"></td></tr>
  130. </table></form><br>
  131. </td></tr>
  132. <?
  133. }
  134. else
  135. print " <tr><td class=\"mainTxt\">Je bent geregistreerd. Je kunt nu inloggen.</td></tr>\n";
  136. elseif(isset($_GET['x'] == "wwgen")){
  137. <?php
  138. $version = "20041107-a";
  139.  
  140. if (!isset($wwlen)) {
  141. // first-time through
  142. $wwlen = 8;
  143. $checked1 = "checked";
  144. $checked2 = "";
  145. $checked3 = "";
  146. $melding = "";
  147. } else {
  148. $checked1 = "";
  149. $checked2 = "";
  150. $checked3 = "";
  151. if ($sterkte == "s1") {
  152. $pattern = "[a-zA-Z0-9]";
  153. $checked1 = "checked";
  154. } elseif($sterkte == "s2") {
  155. $pattern = "[a-zA-Z]";
  156. $checked2 = "checked";
  157. } else {
  158. $pattern = "[abcdefghijklmnopqrstuvwxyz]";
  159. $checked3 = "checked";
  160. }
  161.  
  162. // validate
  163. if ($wwlen < 1 or $wwlen > 16) {
  164. $melding = "Wachtwoordlengte ligt buiten de toegestane waarde (1-16)";
  165. } else {
  166.  
  167. // generate
  168. $genpass = NULL;
  169. for ($i=0; $i<$wwlen; $i++) {
  170. $char = chr(rand(48,122));
  171. while (!ereg($pattern, $char)) {
  172. $char = chr(rand(48,122));
  173. }
  174. $genpass .= $char;
  175. }
  176. $melding = "WachtWoord: <input type='text' size='25' value='$genpass'>";
  177. }
  178. }
  179.  
  180. // # debug
  181. // echo "<br>wwlen : $wwlen<br>
  182. // sterkte: $sterkte<br>
  183. // pattern: $pattern<br>
  184. // checked1 $checked1<br>
  185. // checked2 $checked2<br>
  186. // checked3 $checked3<br>";
  187.  
  188. ?>
  189.  
  190. <html>
  191. <head>
  192. <?php echo "<!versie=$version>" ?>
  193.  
  194. <script language=JavaScript>
  195. <!--
  196. function initialFocus(){document.myForm.wwlen.focus();}
  197. // -->
  198. </script>
  199.  
  200. <link rel='stylesheet' type='text/css' href='jtzondag.css'>
  201. </head>
  202. <body bgcolor='#996600' text='ffffff' onload='initialFocus()'>
  203. <div align='center'>
  204. <table border='0' width='760' cellspacing='0' cellpadding='0'><tr><td>
  205. <h1>WachtWoord Generator</h1>
  206. <p>Vul de gewenste lengte in, kies een sterkte en klik op Genereer.</p>
  207.  
  208. <?php
  209. echo "<form name='myForm' method='POST' action='$PHP_SELF'>
  210. <table border='0'>
  211. <tr>
  212. <td >WachtWoord lengte</td>
  213. <td ><input type='text' name='wwlen' size='2' value='$wwlen' maxlength='2'></td>
  214. </tr>
  215. <tr>
  216. <td ></td>
  217. <td ></td>
  218. </tr>
  219. <tr>
  220. <td >Sterk (a - z, A - Z en 0 - 9)</td>
  221. <td ><input type='radio' name='sterkte' value='s1' $checked1></td>
  222. </tr>
  223. <tr>
  224. <td >Middel (a - z en A - Z)</td>
  225. <td ><input type='radio' name='sterkte' value='s2' $checked2></td>
  226. </tr>
  227. <tr>
  228. <td >Zwak (a - z)</td>
  229. <td ><input type='radio' name='sterkte' value='s3' $checked3></td>
  230. </tr>
  231. <tr>
  232. <td ></td>
  233. <td ></td>
  234. </tr>
  235. <tr>
  236. <td ><input type='submit' value='Genereer' name='Button1'></td>
  237. </tr>
  238. </table>
  239. </form>";
  240.  
  241. echo $melding;
  242.  
  243. echo "<br><br><br><font size=-3>Versie $version</font>";
  244.  
  245.  
  246. </td></tr></table></div>
  247. }
  248. ?>
  249. </table>
  250. <center><a href="index.php">KLIK HIER</a> <font color="white">om terug tegaan naar het hoofdmenu</font></center>
  251. </body>
  252. </html>

0 antwoorden

Gesponsorde links
Er zijn nog geen reacties op dit bericht.
Dit onderwerp is gesloten.
Actieve forumberichten
© 2002-2024 Sitemasters.be - Regels - Laadtijd: 0.204s