please, i want your help...
Posted: Sun Dec 04, 2011 3:43 pm
helloevery body
I'm new in this site and i want your help to create registration form.
i have finished all the codes except one.
* if statment that check whenthe adminestrator login, desplay all users details and he can block any user he want.
this is the codes....[/b]
I'm new in this site and i want your help to create registration form.
i have finished all the codes except one.
* if statment that check whenthe adminestrator login, desplay all users details and he can block any user he want.
this is the codes....
Code: Select all
<?php
session_start();
if(isset($_SESSION["user"])){
print_secure_content();
}else{
if(isset($_POST["submit"]))
{
if((checkpass()==1){
if(admin()==1){
$colname_userDets = "-1";
if (isset($_SESSION['user'])) {
$colname_userDets = $_SESSION['user'];
}
mysql_select_db("test", $conn);
$query_userDets = sprintf("SELECT * FROM users
WHERE username = %s",
GetSQLValueString($colname_userDets, "text"));
$userDets = mysql_query("localhost", $conn) or
die(mysql_error());
$row_userDets = mysql_fetch_assoc($userDets);
$totalRows_userDets = mysql_num_rows($userDets);
}
else{
$_SESSION['user']=$_POST['userlogin'];
print"<h1>you have loged in successfully</h1>";
print_secure_content();}
}else{
print "wrong pawssword or username, please try again";
loginform();
}
}
else{
loginform();
}
}
function loginform()
{
print "<h2>Please, enter your login information:</h2>";
print ("<table border='3'><tr><td>username</td><td><input type='text' name='userlogin' size'20'></td></tr><tr><td>password</td><td><input type='password' name='password' size'20'></td></tr></table>");
print "<input name= 'submit' type='submit' >";
print "<h3><a href='registerform.php'>register now!</a></h3>";
}
function checkpass()
{
$password = md5($_POST['password']);
$servername="localhost";
$username="root";
$conn= mysql_connect($servername,$username)or die(mysql_error());
mysql_select_db("test",$conn);
$sql="select * from users where name='$_POST[userlogin]' and password='$password'";
$result=mysql_query($sql,$conn) or die(mysql_error());
return mysql_num_rows($result);
}
function print_secure_content()
{
print("<b><h1>Hello $_SESSION[user]</h1>");
print "<br><h2>You can change your details from here</h2><a href='update.php'>Click here</a><br>";
print "<br><h2>You are login now. You can logout from this link...</h2><a href='logout.php'>Logout</a><br>";
}
?>