UCP For Whirlpool php code[ask] - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: UCP For Whirlpool php code[ask] (
/showthread.php?tid=608235)
UCP For Whirlpool php code[ask] -
aunzconcept - 29.05.2016
I want to hash Whirlpool On Login page and register page
How I can add code for hash Whirlpool on register and Login ?
Thank for answer [[ This Code Newbie script can use ]]
thankyou very much
Example code : ::
register.php
Код:
<html>
<head>
<title>GTATHAILAND</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>
<body>
<form name="form1" method="post" action="save_register.php">
Register Form <br>
<table width="400" border="1" style="width: 400px">
<tbody>
<tr>
<td width="125"> Username</td>
<td width="180">
<input name="txtUsername" type="text" id="txtUsername" size="20">
</td>
</tr>
<tr>
<td> Password</td>
<td><input name="txtPassword" type="password" id="txtPassword">
</td>
</tr>
<tr>
<td> Confirm Password</td>
<td><input name="txtConPassword" type="password" id="txtConPassword">
</td>
</tr>
<tr>
<td> Name</td>
<td><input name="txtName" type="text" id="txtName" size="35"></td>
</tr>
<tr>
<td> Status</td>
<td>
<select name="ddlStatus" id="ddlStatus">
<option value="ADMIN">ADMIN</option>
<option value="USER">USER</option>
</select>
</td>
</tr>
</tbody>
</table>
<br>
<input type="submit" name="Submit" value="Save">
</form>
</body>
</html>
save_register.php
Код:
<?php
mysql_connect("localhost","root","root");
mysql_select_db("mydatabase");
if(trim($_POST["txtUsername"]) == "")
{
echo "Please input Username!";
exit();
}
if(trim($_POST["txtPassword"]) == "")
{
echo "Please input Password!";
exit();
}
if($_POST["txtPassword"] != $_POST["txtConPassword"])
{
echo "Password not Match!";
exit();
}
if(trim($_POST["txtName"]) == "")
{
echo "Please input Name!";
exit();
}
$strSQL = "SELECT * FROM member WHERE Username = '".trim($_POST['txtUsername'])."' ";
$objQuery = mysql_query($strSQL);
$objResult = mysql_fetch_array($objQuery);
if($objResult)
{
echo "Username already exists!";
}
else
{
$strSQL = "INSERT INTO member (Username,Password,Name,Status) VALUES ('".$_POST["txtUsername"]."',
'".$_POST["txtPassword"]."','".$_POST["txtName"]."','".$_POST["ddlStatus"]."')";
$objQuery = mysql_query($strSQL);
echo "Register Completed!<br>";
echo "<br> Go to <a href='login.php'>Login page</a>";
}
mysql_close();
?>
login.php
Код:
<html>
<head>
<title>gtathailand</title>
</head>
<body>
<form name="form1" method="post" action="check_login.php">
Login<br>
<table border="1" style="width: 300px">
<tbody>
<tr>
<td> Username</td>
<td>
<input name="txtUsername" type="text" id="txtUsername">
</td>
</tr>
<tr>
<td> Password</td>
<td><input name="txtPassword" type="password" id="txtPassword">
</td>
</tr>
</tbody>
</table>
<br>
<input type="submit" name="Submit" value="Login">
</form>
</body>
</html>
check_login.php
Код:
<?php
session_start();
mysql_connect("localhost","root","root");
mysql_select_db("mydatabase");
$strSQL = "SELECT * FROM member WHERE Username = '".mysql_real_escape_string($_POST['txtUsername'])."'
and Password = '".mysql_real_escape_string($_POST['txtPassword'])."'";
$objQuery = mysql_query($strSQL);
$objResult = mysql_fetch_array($objQuery);
if(!$objResult)
{
echo "Username and Password Incorrect!";
}
else
{
$_SESSION["UserID"] = $objResult["UserID"];
$_SESSION["Status"] = $objResult["Status"];
session_write_close();
if($objResult["Status"] == "ADMIN")
{
header("location:admin_page.php");
}
else
{
header("location:user_page.php");
}
}
mysql_close();
?>
user_page.php
Код:
<?php
session_start();
if($_SESSION['UserID'] == "")
{
echo "Please Login!";
exit();
}
if($_SESSION['Status'] != "USER")
{
echo "This page for User only!";
exit();
}
mysql_connect("localhost","root","root");
mysql_select_db("mydatabase");
$strSQL = "SELECT * FROM member WHERE UserID = '".$_SESSION['UserID']."' ";
$objQuery = mysql_query($strSQL);
$objResult = mysql_fetch_array($objQuery);
?>
<html>
<head>
<title>gtathailand</title>
</head>
<body>
Welcome to User Page! <br>
<table border="1" style="width: 300px">
<tbody>
<tr>
<td width="87"> Username</td>
<td width="197"><?php echo $objResult["Username"];?>
</td>
</tr>
<tr>
<td> Name</td>
<td><?php echo $objResult["Name"];?></td>
</tr>
</tbody>
</table>
<br>
<a href="edit_profile.php">Edit</a><br>
<br>
<a href="logout.php">Logout</a>
</body>
</html>