Ich kann leider keine Accounts erstellen über mein Registration script...
bekomme diese Fehler:
Account Tabelle:
PHP CODE:
Code:
<?php if(isloggedin($_POST['username'])) { echo "<div class='alert alert-error'>You are already logged in!</div>"; } else { if(isset($_POST['username']) && isset($_POST['password']) && isset($_POST['passwordagain']) && isset($_POST['email'])) { if(!empty($_POST['username']) && !empty($_POST['password']) && !empty($_POST['passwordagain']) && !empty($_POST['email'])) { //defineing variables $username = $_POST['username']; $password = $_POST['password']; $passwordagain = $_POST['passwordagain']; $email = $_POST['email']; if(ctype_alnum($username) && ctype_alnum($password) && ctype_alnum($passwordagain) && filter_var($email, FILTER_VALIDATE_EMAIL)) { if(strlen($username)>=6 && strlen($password)>=6 && strlen($passwordagain)>=6 && strlen($email)>=6) { //passwords match if($password == $passwordagain) { $emailexistcommand = "SELECT * FROM TACCOUNT WHERE szMail = '$email'"; $emailexistquery = odbc_exec($TGLOBALdatabase, $emailexistcommand); if(!odbc_num_rows($emailexistquery)) { $userexistcommand = "SELECT * FROM TACCOUNT WHERE szUserID = '$username'"; $userexistquery = odbc_exec($TGLOBALdatabase, $userexistcommand); if(!odbc_num_rows($userexistquery)) { $salt = generateSalt(); $userregistercommand = "INSERT INTO TACCOUNT (szUserID, szPasswd, bCheck, szSalt, szMail, dwActive, dwAdmin) VALUES (?, ?, ?, ?, ?, ?, ?)"; $userregisterprepare = odbc_prepare($TGLOBALdatabase, $userregistercommand); $userregisterquery = odbc_execute($userregisterprepare, array($username,$password,0,$salt,$email, 0, 0)); $userquerycommand = "SELECT * FROM TACCOUNT WHERE szUserID = '$username'"; $userquery = odbc_exec($TGLOBALdatabase, $userquerycommand); $userinfo = odbc_fetch_array($userquery); $userid = $userinfo['dwUserID']; $usercashcommand = "INSERT INTO TCASHTESTTABLE (dwUserID, dwCash, dwBonus) VALUES (?, ?, ?)"; $usercashprepare = odbc_prepare($TGLOBALdatabase, $usercashcommand); $usercashquery = odbc_execute($usercashprepare, array($userid, 0, 0)); addItem($userid,9,10); addItem($userid,66,5); addItem($userid,100,3); addItem($userid,96,2); addItem($userid,330,3); mail($email, '4Story - Register - NoReply', 'You have succesfully registred an account!To activate your account please visit:http://localhost/account/validate.php?id=' . $userinfo['dwUserID'] . '&code=' . $salt); echo "<div class='alert alert-success'>You succesfully registred!We sent the activation email to your emailTo activate your account please visit: <a href='http://localhost/account/validate.php?id=" . $userinfo['dwUserID'] . "&code=" . $salt . "'>this</a></div>"; } else { echo "<div class='alert alert-error'>This username is already taken!</div>"; } } else { echo "<div class='alert alert-error'>This email is already taken!</div>"; } } else { echo "<div class='alert alert-error'>Passwords must match!</div>"; } } else { echo "<div class='alert alert-error'>Username and password must be more than 6 characters!</div>"; } } else { echo "<div class='alert alert-error'>You can use only alphanumerical characters!</div>"; } } else { echo "<div class='alert alert-error'>You must fill in everything!</div>"; } } echo '<form id="login" action="/account/register.php" method="POST"> <input name="username" type="text" placeholder="Username" class="account"></input><small>*Must be at least 6 characters long and alphanumeric</small><br \> <input name="password" type="password" placeholder="Password" class="account"></input><small>*Must be at least 6 characters long and alphanumeric</small><br \> <input name="passwordagain" type="password" placeholder="Password again" class="account"></input><small>*Must match with first password</small><br \> <input name="email" type="text" placeholder="E-mail" class="account"></input><small>*Must be a valid email address</small><br \> <input type="submit" class="registerbtn" style="float:left;margin-left:20px;" value="submit" class="submit" /><br \> </form>'; } ?>