EDIT
Sprawdzilem na polu username i chodzi o to ze zadne pole tabeli nie moze byc kluczem glownym, obojetnie co ustawie jako klucz glowny to rejestracja nie dziala.. Co zrobic zeby tak nie reagowalo ?
REJESTRACJA.PHP
<? include("database.php"); /** * Returns true if the username has been taken * by another user, false otherwise. */ function usernameTaken($username){ } $q = "select username from users where username = '$username'"; } /** * Inserts the given (username, password) pair * into the database. Returns true on success, * false otherwise. */ function addNewUser($username, $password){ $q = "INSERT INTO users VALUES ('$username', '$password')"; } /** * Displays the appropriate message to the user * after the registration attempt. It displays a * success or failure status depending on a * session variable set during registration. */ function displayStatus(){ $uname = $_SESSION['reguname']; if($_SESSION['regresult']){ ?> <h1>Registered!</h1> <p>Thank you <b><? echo $uname; ?></b>, your information has been added to the database, you may now <a href="main.php" title="Login">log in</a>.</p> <? } else{ ?> <h1>Registration Failed</h1> <p>We're sorry, but an error has occurred and your registration for the username <b><? echo $uname; ?></b>, could not be completed.<br> Please try again at a later time.</p> <? } } /** * This is the page that will be displayed after the * registration has been attempted. */ ?> <? displayStatus(); ?> <? return; } /** * Determines whether or not to show to sign-up form * based on whether the form has been submitted, if it * has, check the database for consistency and create * the new account. */ /* Make sure all fields were entered */ if(!$_POST['user'] || !$_POST['pass']){ } /* Spruce up username, check length */ } /* Check if username is already in use */ if(usernameTaken($_POST['user'])){ $use = $_POST['user']; } /* Add the new account to the database */ $_SESSION['reguname'] = $_POST['user']; $_SESSION['regresult'] = addNewUser($_POST['user'], $md5pass); $_SESSION['registered'] = true; return; } else{ /** * This is the page with the sign-up form, the names * of the input fields are important and should not * be changed. */ ?> <table align="center" border="0" cellspacing="0" cellpadding="3"> <tr><td>Nick:</td><td><input type="text" name="user" maxlength="30"></td></tr> <tr><td>Haslo:</td><td><input type="password" name="pass" maxlength="30"></td></tr> <tr><td colspan="2" align="right"><input type="submit" name="subjoin" value="Zarejestruj !"></td></tr> </table> </form> <? } ?>
Z gory dziekuje za jakas podpowiedz ..