SHOW:
|
|
- or go back to the newest paste.
| 1 | <?php | |
| 2 | include_once('emailfunctions.php');
| |
| 3 | - | |
| 3 | + | $succes=""; |
| 4 | - | $randomnr = rand(1000, 9999); |
| 4 | + | if(!empty($_POST['aanmelden'])) |
| 5 | - | $_SESSION['randomnr2'] = md5($randomnr); |
| 5 | + | {
|
| 6 | - | |
| 6 | + | |
| 7 | - | $im = imagecreatetruecolor(100, 38); |
| 7 | + | if (md5($_POST['norobot']) == $_SESSION['randomnr2']) |
| 8 | - | |
| 8 | + | {
|
| 9 | - | $white = imagecolorallocate($im, 255, 255, 255); |
| 9 | + | $foutenmelding=""; |
| 10 | - | $grey = imagecolorallocate($im, 150, 150, 150); |
| 10 | + | } |
| 11 | - | $black = imagecolorallocate($im, 0, 0, 0); |
| 11 | + | else |
| 12 | - | |
| 12 | + | {
|
| 13 | - | imagefilledrectangle($im, 0, 0, 200, 35, $black); |
| 13 | + | $foutenmelding="You haven't retyped the image correctly!<br>"; |
| 14 | } | |
| 15 | - | //path to font - this is just an example you can use any font you like: |
| 15 | + | } |
| 16 | $title="Home4DSi - Register"; | |
| 17 | - | $font = dirName(__FILE__).'/font/karate/Karate.ttf'; |
| 17 | + | $keywords="Home4DSi register"; |
| 18 | include("../members/db_leden.php");
| |
| 19 | - | imagettftext($im, 20, 4, 22, 30, $grey, $font, $randomnr); |
| 19 | + | |
| 20 | - | |
| 20 | + | $disabledfile = '../members/registering_disabled.txt'; |
| 21 | - | imagettftext($im, 20, 4, 15, 32, $white, $font, $randomnr); |
| 21 | + | if(file_exists($disabledfile)) |
| 22 | - | |
| 22 | + | {
|
| 23 | - | //prevent caching on client side: |
| 23 | + | $contents = file_get_contents($disabledfile); |
| 24 | - | header("Expires: Wed, 1 Jan 1997 00:00:00 GMT");
|
| 24 | + | if($contents == 'yes') |
| 25 | - | header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
| 25 | + | {
|
| 26 | - | header("Cache-Control: no-store, no-cache, must-revalidate");
|
| 26 | + | exit('Registering is currently disabled. Please check back later.');
|
| 27 | - | header("Cache-Control: post-check=0, pre-check=0", false);
|
| 27 | + | } |
| 28 | - | header("Pragma: no-cache");
|
| 28 | + | } |
| 29 | - | |
| 29 | + | |
| 30 | - | header ("Content-type: image/gif");
|
| 30 | + | include_once('../members/inloggen_automatisch.php');
|
| 31 | - | imagegif($im); |
| 31 | + | if(isset($inlogbericht)) |
| 32 | - | imagedestroy($im); |
| 32 | + | {
|
| 33 | die('You cannot register while you are logged in');
| |
| 34 | } | |
| 35 | include_once('../members/inloggen.php');
| |
| 36 | if(isset($inlogbericht)) | |
| 37 | {
| |
| 38 | die('You cannot register while you are logged in');
| |
| 39 | } | |
| 40 | ||
| 41 | $mysql_id=mysql_connect($dbhost,$dbuser,$dbpass); | |
| 42 | mysql_select_db($db); | |
| 43 | ||
| 44 | ||
| 45 | if(!empty($_POST['aanmelden']) && empty($captcha)) | |
| 46 | {
| |
| 47 | $gebruikersnaam=htmlentities($_POST['gebruikersnaam']); | |
| 48 | $email=mysql_real_escape_string(strtolower($_POST['email'])); | |
| 49 | $ip=$_SERVER['REMOTE_ADDR']; | |
| 50 | $allow_mailing = 0; | |
| 51 | if($_POST['allow_mailing'] == 1) | |
| 52 | {
| |
| 53 | $allow_mailing = 1; | |
| 54 | } | |
| 55 | /*$ip = get_ip(); | |
| 56 | if(!$ip) | |
| 57 | {
| |
| 58 | $foutenmelding.="Sorry, but we do not accept accounts that use a proxy. Please turn off your proxy."; | |
| 59 | }*/ | |
| 60 | $wachtwoord=htmlentities($_POST['wachtwoord']); | |
| 61 | $wachtwoordcontrole=htmlentities($_POST['wachtwoordcontrole']); | |
| 62 | if(empty($wachtwoord) or $wachtwoord != $wachtwoordcontrole) | |
| 63 | {
| |
| 64 | $foutenmelding.="Please enter a password that is the same as in the retype password field<br>"; | |
| 65 | } | |
| 66 | if (!eregi("[[:alnum:]]", $gebruikersnaam) or strlen($gebruikersnaam) < 3 or strlen($gebruikersnaam) > 15)
| |
| 67 | {
| |
| 68 | $foutenmelding.="Usernames may only contain letters and numbers and must be 3 - 15 characters long<br>"; | |
| 69 | } | |
| 70 | if(!valid_email($email)) | |
| 71 | {
| |
| 72 | $foutenmelding.="The email address you entered is incorrect!<br>"; | |
| 73 | } | |
| 74 | $wachtwoord= md5($wachtwoord); | |
| 75 | $wachtwoord= sha1($wachtwoord); | |
| 76 | $wachtwoord= $wachtwoord . 'sl'; | |
| 77 | ||
| 78 | function wordsExist(&$gebruikersnaam, $words) {
| |
| 79 | foreach($words as &$word) {
| |
| 80 | if(stripos($gebruikersnaam, $word) !== false) {
| |
| 81 | return true; | |
| 82 | } | |
| 83 | } | |
| 84 | return false; | |
| 85 | } | |
| 86 | ||
| 87 | if (wordsExist($gebruikersnaam, array('fuck','shit','dick','pussy','bitch','cunt','penis','vagina','cock','semen')))
| |
| 88 | {
| |
| 89 | $foutenmelding.="<font color=\"red\">Your name may not contain inappropriate language.</font><br>"; | |
| 90 | } | |
| 91 | ||
| 92 | ||
| 93 | $sql="select gebruikersnaam,email from ledengegevens where gebruikersnaam='$gebruikersnaam' or email='$email'"; | |
| 94 | $res=mysql_query("$sql",$mysql_id);
| |
| 95 | $fout=mysql_errno($mysql_id); | |
| 96 | if ($fout != 0) | |
| 97 | {
| |
| 98 | $fout=mysql_error($mysql_id); | |
| 99 | echo '<font color="#FF2306">' . $fout . '</font>'; | |
| 100 | mysql_close($mysql_id); | |
| 101 | echo '</body></html>'; | |
| 102 | exit; | |
| 103 | } | |
| 104 | $aantal_lijnen=mysql_num_rows($res); | |
| 105 | ||
| 106 | $query2 = mysql_query("select gebruikersnaam, email from pendingmembers where gebruikersnaam='$gebruikersnaam' or email='$email'");
| |
| 107 | $aantal_lijnen_2 = mysql_num_rows($query2); | |
| 108 | ||
| 109 | $taken_username = false; | |
| 110 | $taken_email = false; | |
| 111 | for($i = 0; $i < $aantal_lijnen + $aantal_lijnen_2; $i++) | |
| 112 | {
| |
| 113 | if($i >= $aantal_lijnen) | |
| 114 | {
| |
| 115 | $row = mysql_fetch_assoc($query2); | |
| 116 | } | |
| 117 | else | |
| 118 | {
| |
| 119 | $row = mysql_fetch_assoc($res); | |
| 120 | } | |
| 121 | ||
| 122 | $uname = $row['gebruikersnaam']; | |
| 123 | $mail = $row['email']; | |
| 124 | ||
| 125 | if(strtolower($uname) == strtolower($gebruikersnaam)) | |
| 126 | {
| |
| 127 | $taken_username = true; | |
| 128 | } | |
| 129 | if(strtolower($mail) == strtolower($email)) | |
| 130 | {
| |
| 131 | $taken_email = true; | |
| 132 | } | |
| 133 | } | |
| 134 | ||
| 135 | mysql_close($mysql_id); | |
| 136 | if($taken_username) | |
| 137 | {
| |
| 138 | $foutenmelding.= "The username $gebruikersnaam has already been registered!<br>"; | |
| 139 | } | |
| 140 | if($taken_email) | |
| 141 | {
| |
| 142 | $foutenmelding .= "That email is already taken by someone!<br>"; | |
| 143 | } | |
| 144 | $mysql_id=mysql_connect("$dbhost","$dbuser","$dbpass");
| |
| 145 | mysql_select_db($db); | |
| 146 | $sql=" select ip from ledengegevens where ip='$ip'"; | |
| 147 | $res=mysql_query("$sql",$mysql_id);
| |
| 148 | $aantal_lijntjes=mysql_num_rows($res); | |
| 149 | mysql_close($mysql_id); | |
| 150 | if($aantal_lijntjes==1) | |
| 151 | {
| |
| 152 | //$foutenmelding.="There already is somebody registered via this IP adress!<br>"; | |
| 153 | } | |
| 154 | if(empty($foutenmelding)) | |
| 155 | {
| |
| 156 | $mysql_id=mysql_connect("$dbhost","$dbuser","$dbpass");
| |
| 157 | mysql_select_db($db); | |
| 158 | ||
| 159 | $origin = 'Home4DSi'; | |
| 160 | ||
| 161 | $registration_key = generate_registration_key($email); | |
| 162 | $sql=" INSERT into pendingmembers (gebruikersnaam,wachtwoord,ip,email,online,account_origin,registration_key,allow_mailing,last_verification_mail_time) VALUES ('$gebruikersnaam','$wachtwoord','$ip','$email','".time()."','$origin','$registration_key','$allow_mailing','".time()."')";
| |
| 163 | $res=mysql_query("$sql",$mysql_id);
| |
| 164 | $fout=mysql_errno($mysql_id); | |
| 165 | if ($fout != 0) | |
| 166 | {
| |
| 167 | $fout=mysql_error($mysql_id); | |
| 168 | echo '<font color="#FF2306">' . $fout . '</font>'; | |
| 169 | mysql_close($mysql_id); | |
| 170 | echo '</body></html>'; | |
| 171 | exit; | |
| 172 | } | |
| 173 | else | |
| 174 | {
| |
| 175 | ||
| 176 | send_registration_mail($gebruikersnaam,$email,$registration_key); | |
| 177 | ||
| 178 | setrawcookie("gebruikersnaam", "$gebruikersnaam", time()+54000, "/");
| |
| 179 | setrawcookie("wachtwoord", "$wachtwoord", time()+54000, "/");
| |
| 180 | $succes="ja"; | |
| 181 | mysql_close(); | |
| 182 | ||
| 183 | ||
| 184 | /*$db = "thrdspla_questionbasher"; | |
| 185 | mysql_connect("$dbhost","$dbuser","$dbpass") or die(mysql_error());
| |
| 186 | mysql_select_db($db) or die(mysql_error()); | |
| 187 | $qb_request = mysql_query("INSERT into Hosts (host,question_id,score,questions_had,game_status,time,answerer) VALUES ('$gebruikersnaam','0','0','0','game_start','0','')") or die(mysql_error());
| |
| 188 | mysql_close();*/ | |
| 189 | } | |
| 190 | } | |
| 191 | } | |
| 192 | include("header.php");
| |
| 193 | ||
| 194 | if($succes=="ja") | |
| 195 | {
| |
| 196 | echo "<div align=\"center\"><h3>Please verificate your email address, $gebruikersnaam!</h3><br>"; | |
| 197 | echo "<h4>We are now going to send you a verification email. Please check your mail and click the link that is inside. If you can't find it, try checking your spam folder.</h4>\n"; | |
| 198 | echo "<center><font size=3>Click <a href=\"../index.php\">here</a> to go back to the homepage.</font></center>\n"; | |
| 199 | } | |
| 200 | ||
| 201 | ||
| 202 | if(empty($_POST['aanmelden']) or !empty($foutenmelding)) | |
| 203 | {
| |
| 204 | echo "<br>"; | |
| 205 | echo "<center><h1>Register</h1></center>\n"; | |
| 206 | echo "<br>"; | |
| 207 | if(!empty($foutenmelding)) | |
| 208 | {
| |
| 209 | echo '<font color="#FF2306">'.$foutenmelding.'</font>'; | |
| 210 | } | |
| 211 | ?> | |
| 212 | <style> | |
| 213 | input | |
| 214 | {
| |
| 215 | font-size: 6pt; | |
| 216 | width: 80px; | |
| 217 | } | |
| 218 | </style> | |
| 219 | <form action="<?php echo $_SERVER['PHP_SELF'];?><?php if($_GET['ref'] == 'triniate'){ echo "?ref=triniate";}?>" method="post">
| |
| 220 | <table border=1> | |
| 221 | <tr><td>Username:</td><td><input type="text" name="gebruikersnaam" maxlength="15"></td></tr> | |
| 222 | <tr><td>Password:</td><td><input type="password" name="wachtwoord" maxlength="20"></td></tr> | |
| 223 | <tr><td>Retype password:</td><td><input type="password" name="wachtwoordcontrole" maxlength="20"></td></tr> | |
| 224 | <tr><td>E-mail (You'll receive a verification email):</td><td><input type="text" name="email" maxlength=50></td></tr> | |
| 225 | <?php /*<tr><td>Allow Home4DSi to email you newsletters (<u>Not required</u>):</td><td><select name='allow_mailing'><option value='0'>No</option><option value='1'>Yes</option></select></td></tr>*/ ?> | |
| 226 | <tr><td colspan=2>Retype the image below:</td></tr> | |
| 227 | <tr><td><img src="captcha.php" /> | |
| 228 | </td><td><input class="input" type="text" name="norobot" /></td></tr> | |
| 229 | <tr><td colspan=2><input type="submit" name="aanmelden" value="Register!"></td></tr> | |
| 230 | </table> | |
| 231 | </form> | |
| 232 | <?php | |
| 233 | } | |
| 234 | include('footer.php');
| |
| 235 | ||
| 236 | ||
| 237 | ||
| 238 | ||
| 239 | ||
| 240 | ?> |