OMDAT WIJ HET ANDERS NIET ZIEN DENKT TS?quote:Op zaterdag 13 december 2008 20:33 schreef admiraal_anaal het volgende:
HOEZO MOET DAT IN CAPSLOCK???
OOOH ZIT DAT ZO, IK DACHT BIJNA DAT HIJ DACHT DAT WIJ DOOF WARENquote:Op zaterdag 13 december 2008 20:34 schreef Juup© het volgende:
[..]
OMDAT WIJ HET ANDERS NIET ZIEN DENKT TS?
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | include_once('db_vars.inc'); $supersecret_hash_padding = 'A string that is used to pad out short strings for md5 encryption.'; function user_register() { global $supersecret_hash_padding; if (strlen($_POST['user_name']) <= 25 && strlen($_POST['password1']) <= 25 && ($_POST['password1'] == $_POST['password2'] && strlen($_POST['email']) <= 50 && validate_email ($_POST['email']))) { if (account_namevalid($_POST['user_name']) || strlen($_POST['password1'] >= 6)) $user_name = strtolower($_POST['user_name']); $user_name = trim($user_name); $email = $_POST['email']; $query = "SELECT user_id FROM user WHERE user_name = '$user_name' AND email = '$email'"; $result = mysql_query($query); if ($result && mysql_nam_rows($result) > 0) { $feedback = 'ERROR-Username or email address already exists'; return $feedback; } else { $first_name = $POST['first_name']; $last_name = $POST['last_name']; $password = md5($_POST['password1']); $user_ip = $_SERVER['REMOTE_ADDR']; $has = md5($email.$supersecret_hash_padding); $query = "INSERT INTO user (user_name, first_name, last_name, password, email, remote_addr, confrim_hash, is_confrim, date__created) VALUES ('$user_name', '$first_name', '$last_name', '$password', '$email', '$user_ip', '$hash', '0', NOW())"; $result = mysql_query($query); if (!$result) { $feedback= 'ERROR-Datebase error'; return $feedback; } else { $encoded_email = urlencode($_POST['email']); $mail_body= " eomailbody Tank you for registering at Example.com. click this link to confrim your registration: http://localhost/confrim.php?hash=$hash&email=$encoded_email once you see a confrimation message, you will be logged into Example.com eomailbody"; mail ($email, 'example.com registration Confrimation', $email_body, 'from: noreply@example.com'); $feedback = ' YOU HAVE SUCCESFULLY REGISTERD. YOU WILL RECIVE A CONFRIMATION MAIL SOON'; return $feedback; } } } else { $feedback = 'ERROR-Username or password is invalid'; return $feedback; } } else { $feedback ='ERROR-Please fill in all fields correctly'; return $feedback; } } function account_namevalid() { $span_str = "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-"; if (strspn($_POST['user_name'], $span_str) == 0) { return false; } if (strspn($_POST['user_name'],$span_str) != strlen($name)) { return false; } if (strlen($_POST['user_name']) < 5) { return false; } if (strlen($_POST['user_name']) > 25) { return false; } if (eregi("^((root)|(bin)|(deamon)|(adm)|(lp)|(sync)|(shutdown)| (halt)|(mail)|(news)|(uccp)|(operator)|(games)|(mysql)| (httpd)|(nobody)|(download))$", $_POST['user_name''])) { return false; } if (eregi("^(anoncvs_)", $_POST['user_name'])) { return false; } return true; } function validate_email () { return (ereg('^[-!#$%&\'*\\./0-9=A-Z^_`a-z{|}~]+'. '@' '[- !#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.' . '[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$', $_POST[email'])); } function user_confrim() { global $supersecret_hash_padding; $new_hash = md5 ($_GET['email'].$supersecret_hash_padding); if ($new_hash && ($new_hash == $_GET['hash'])) { $query = "SELECT user_name FROM user WHERE confrim_hash = '$new_hash'"; $result=mysql_query($query); if (!$result || mysql_num_rows($result) <1) { $feedback = 'ERROR-hash not found'; return $feedback; } else { $email = $_GET['email']; $hash = $_GET['hash']; $query = "UPDATE user SET email='$email'; is_confrimed='1' WHERE confrim_hash='$hash'"; $result = mysql_query($query); return 1; } } else { $feedback = ERROR-values do not match'; return $feedback; } } ?> |
Neequote:Op zaterdag 13 december 2008 22:32 schreef immortals het volgende:
<?php
else {
$feedback ='ERROR-Please fill in all fields correctly';
return $feedback;
?<
zo??
Dat begint ergens op te lijken. Nog wat indenting (dus netjes inspringen) zou het helemaal goed maken.quote:
|
|
| Forum Opties | |
|---|---|
| Forumhop: | |
| Hop naar: | |