<?php
include "conn.inc.php";
?>
<?php print '<'.'?xml version="1.0" encoding="iso-8859-2"?'.'>'; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-2" />
<title>php</title>
<link href="style.css" type="text/css" rel="stylesheet" />
</head>
<body>
<?php
if (isset($_POST['submit']) && $_POST['submit'] == "Zarejestruj") { if ($_POST['username'] != "" &&
$_POST['password'] != "" &&
$_POST['first_name'] != "" &&
$_POST['last_name'] != "" ) {
$query = "SELECT username FROM user_info".
"WHERE username = '" . $_POST['username'] . "';";
?>
Nazwa uzytkownika
<?php echo $_POST['username']; ?> jest już używana. Proszę wybrac inna!
<form acrion="index.php" method="post">
Nazwa kierownika: <input type="text" name="username" /><br />
Haslo: <input type="password" name="password" value="
<?php echo $_POST['password']; ?>" /><br />
Imię: <input type="text" name="first_name" value="
<?php echo $_POST['first_name']; ?>" /><br />
Nazwisko: <input type="text" name="last_name" value="
<?php echo $_POST['last_name']; ?>" /><br />
<input type="submit" name="submit" value="Zarejestruj" />
<input type="reset" value="Wyczysc" />
</form>
<?php
} else {
$query= "INSERT INTO user_info (username, password, first_name, last_name)".
"VALUES (
'".$_POST['username']."',
(PASSWORD('".$_POST['password']."')),
'".$_POST['first_name']."',
'".$_POST['last_name']."')";
$_SESSION['user_logged'] = $_POST['username'];
$_SESSION['user_password'] = $_POST['password'];
?>
<?php echo $_POST['first_name']."".$_POST['last_name']; ?> Zostal pomyslnie dodany jako kierownik.
<?php
header("Refresh: 5; URL=index.php"); echo "Kierownik dodany." . " Za moment nastąpi przeniesienie na stronę glowną.<br />"; }
}else {
?>
Należy wypelnic wszystkie pola!
<form acrion="admin.php" method="post">
Nazwa kierownika: <input type="text" name="user" value="
<?php echo $_POST['username']; ?>" /> <br />
Haslo: <input type="password" name="password" value="
<?php echo $_POST['password']; ?>" /> <br />
Imię: <input type="text" name="first_name" value="
<?php echo $_POST['first_name']; ?>" /> <br />
Nazwisko: <input type="text" name="last_name" value="
<?php echo $_POST['last_name']; ?>" /> <br />
<input type="submit" name="submit" value="Zarejestruj" />
<input type="reset" value="Wyczysc" />
</form>
<?php
}
} else {
?>
Należy podac login, hasla, imienia oraz nazwiska kierownika.
<form acrion="admin.php" method="post">
Nazwa kierownika: <input type="text" name="username" /><br />
Haslo: <input type="password" name="password" /><br />
Imię: <input type="text" name="first_name" /><br />
Nazwisko: <input type="text" name="last_name" /><br />
<input type="submit" name="submit" value="Zarejestruj" />
<input type="reset" value="Wyczysc" />
</form>
<?php
}
?>
</body>
</html>
Problem polega na tym, ze zamiast dzialac wywala mi błąd
Something is wrong in your syntax obok '= 'asdasd'' w linii 1. w bazie mam tabele user_info. HELP
Ten post edytował mtskilla 22.01.2007, 11:53:04