<?php
include_once("./lib/include.php");
include_once("./lib/database.php");
$is_complete = "no_fill";
$action = isset($_POST['register']) ? $_POST['register'] : "";
if ($action == "register")
{
$username = isset($_POST['username']) ? $_POST['username'] : "";
$email = isset($_POST['email']) ? $_POST['email'] : "";
$password = isset($_POST['password']) ? $_POST['password'] : "";
$re_password = isset($_POST['password2']) ? $_POST['password2'] : "";
if ($username != "" && $email != "" && $password != "" && $re_password != "")
{
if ($password != $re_password)
$is_complete = "different";
else
{
$dup = mysql_query("SELECT username FROM users WHERE username='".$_POST['username']."'");
if(mysql_num_rows($dup) >0){
echo '<b>username Already Used.</b>';
}
else {
// $password = sha1($password);
$query = "INSERT INTO member(username, password, email) VALUES('{$username}', '{$password}', '{$email}')";
$CDBConn->Query($query);
header("Location: index.php?pageid=login");
}
}
}
?>
<div id="content">
<div class="content" id="register">
<form action="index.php?pageid=register" method="post" enctype="multipart/form-data">
<fieldset>
<div class="left">
<h1>Registracija</h1>
<?php
if ($is_complete == "no_fill" && $action != "")
{
?>
<ul class="errors">
<li>Morate popuniti sva polja. </li>
</ul>
<?php
}
if ($is_complete == "different" && $action != "")
{
?>
<ul class="errors">
<li>Sifre se ne poklapaju. </li>
</ul>
<?php
}
?>
<label>Korisnicko ime:</label>
<input id="username" name="username" class="text " maxlength="20" type="text">
<br class="clear">
<label>Email adresa:</label>
<input id="email" name="email" class="text " id="line2" type="text">
<br class="clear">
<label>Sifra:</label>
<input id="password" name="password" value="" class="text " type="password">
<br class="clear">
<label>Ponovi sifru:</label>
<input id="password2" name="password2" value="" class="text " type="password">
<br class="clear">
<br class="clear">
<input name="submit" value="" id="submit" class="submit" type="submit">
<input name="register" value="register" type="hidden">
</div>
</fieldset>
</form>
</div>
</div>
Help?!:bemused: