|
You last visited: Today at 23:02
Advertisement
Whirlpool Login script
Discussion on Whirlpool Login script within the Web Development forum part of the Coders Den category.
05/21/2012, 17:08
|
#1
|
elite*gold: 0
Join Date: Dec 2010
Posts: 509
Received Thanks: 41
|
Whirlpool Login script
Hey,
Ich bin neu hier und suche ein Login Script mit Whirlpool hashing. Ich habe wenig ahnung von PHP. Das Script soll für minecraft sein.  Ich brauche NUR ein Login script dafür die User registrieren sich ingame. Wenn es noch jemand machen würde hätte ich das gerne so, dass man wenn man sich einloggt abgefragt wird welchen status der Account hat. Und je nach status auf eine andere seite weitergeleitet wird.
Spaltennamen:
playername
password
accounttype
bei Accounttype gibt es user, moderator, admin, owner
Vielen Dank
Regen.
|
|
|
05/21/2012, 18:31
|
#2
|
elite*gold: 203
Join Date: Sep 2007
Posts: 732
Received Thanks: 190
|
PHP Code:
<?php function encryptWhirlpool($password) { $salt = substr(hash('whirlpool', uniqid(rand(), true)), 0, 12); $hash = hash('whirlpool', $salt . $password); $saltPos = (strlen($password) >= strlen($hash) ? strlen($hash) : strlen($password)); return substr($hash, 0, $saltPos) . $salt . substr($hash, $saltPos); }
//MySQL hier verbinden! $connection = mysql_connect('host', 'benutzername', 'passwort'); mysql_select_db('datenbank', $connection); $table = 'Tabelle'
//Login if(isset($_POST['login'])) { $user = mysql_real_escape_string($_POST['user']); $password = mysql_real_escape_string($_POST['password']); $passwordCrypted = encryptWhirlpool($password);
$query = mysql_query("SELECT * FROM ".$table." WHERE playername = '".$user."'"); $row = mysql_fetch_assoc($query);
if(empty($user) or empty($password)) { echo "Daten nicht vollständig!"; } elseif($user == $row['playername'] && $passwordCrypted == $row['password']) { switch($row['accounttype']) { case 'user': header("Location: seite1.php"); case 'moderator': header("Location: seite2.php"); case 'admin': header("Location: seite3.php"); case 'owner': header("Location: seite4.php"); } } else { echo "Daten nicht korrekt!"; }
} ?>
<form method="post" action=""> Benutzername: <input type="text" name="user" /><br /> Passwort: <input type="text" name="password" /><br /> <input type="submit" name="login" value="login" /> </form>
Aus der Hand mal gezaubert...noch nicht selber getestet.
|
|
|
05/21/2012, 19:12
|
#3
|
elite*gold: 0
Join Date: Dec 2010
Posts: 509
Received Thanks: 41
|
Erstmal VIELEN VIELEN DANK! Und nochmals Danke, dass du geantwortet hast egal ob es nicht funktioniert!
€dit: ich habe jetzt soweit alles konfiguriert doch :
Das hier erscheint im Webbrowser:
Code:
Parse error: syntax error, unexpected T_IF in E:\xampp\htdocs\Minecraft\logintest\login.php on line 15
Hier nochmal das script:
PHP Code:
<?php
function encryptWhirlpool($password) {
$salt = substr(hash('whirlpool', uniqid(rand(), true)), 0, 12);
$hash = hash('whirlpool', $salt . $password);
$saltPos = (strlen($password) >= strlen($hash) ? strlen($hash) : strlen($password));
return substr($hash, 0, $saltPos) . $salt . substr($hash, $saltPos);
}
//MySQL hier verbinden!
$connection = mysql_connect('localhost', 'root', 'tjawarwolnix :p');
mysql_select_db('minecraftserver', $connection);
$table = 'accounts'
//Login
if(isset($_POST['login'])) {
$user = mysql_real_escape_string($_POST['user']);
$password = mysql_real_escape_string($_POST['password']);
$passwordCrypted = encryptWhirlpool($password);
$query = mysql_query("SELECT * FROM ".$table." WHERE playername = '".$user."'");
$row = mysql_fetch_assoc($query);
if(empty($user) or empty($password)) {
echo "Daten nicht vollständig!";
}
elseif($user == $row['playername'] && $passwordCrypted == $row['password']) {
switch($row['accounttype']) {
case 'user': header("Location: seite1.php");
case 'moderator': header("Location: seite2.php");
case 'admin': header("Location: seite3.php");
case 'owner': header("Location: seite4.php");
}
}
}
else {
echo "Daten nicht korrekt!";
}
}
?>
<form method="post" action="">
Benutzername: <input type="text" name="user" /><br />
Passwort: <input type="text" name="password" /><br />
<input type="submit" name="login" value="login" />
</form>
|
|
|
05/22/2012, 16:49
|
#4
|
elite*gold: 203
Join Date: Sep 2007
Posts: 732
Received Thanks: 190
|
oh, da hatte ich ein ';' vergessen^^
hier berichtigt:
PHP Code:
<?php
function encryptWhirlpool($password) {
$salt = substr(hash('whirlpool', uniqid(rand(), true)), 0, 12);
$hash = hash('whirlpool', $salt . $password);
$saltPos = (strlen($password) >= strlen($hash) ? strlen($hash) : strlen($password));
return substr($hash, 0, $saltPos) . $salt . substr($hash, $saltPos);
}
//MySQL hier verbinden!
$connection = mysql_connect('localhost', 'root', 'tjawarwolnix :p');
mysql_select_db('minecraftserver', $connection);
$table = 'accounts';
//Login
if(isset($_POST['login'])) {
$user = mysql_real_escape_string($_POST['user']);
$password = mysql_real_escape_string($_POST['password']);
$passwordCrypted = encryptWhirlpool($password);
$query = mysql_query("SELECT * FROM ".$table." WHERE playername = '".$user."'");
$row = mysql_fetch_assoc($query);
if(empty($user) or empty($password)) {
echo "Daten nicht vollständig!";
}
elseif($user == $row['playername'] && $passwordCrypted == $row['password']) {
switch($row['accounttype']) {
case 'user': header("Location: seite1.php");
case 'moderator': header("Location: seite2.php");
case 'admin': header("Location: seite3.php");
case 'owner': header("Location: seite4.php");
}
}
}
else {
echo "Daten nicht korrekt!";
}
}
?>
<form method="post" action="">
Benutzername: <input type="text" name="user" /><br />
Passwort: <input type="text" name="password" /><br />
<input type="submit" name="login" value="login" />
</form>
|
|
|
 |
Similar Threads
|
My new edits/mods (Grimhammer, Whirlpool, Goodluck, Steeds, Aura)
01/19/2013 - CO2 Weapon, Armor, Effects & Interface edits - 18 Replies
Hey all, Ive just finished a couple edits ive been working on.
Hope you guys like them, might post download link if i get enough likes :)
Grimhammer (p6 Dragonsoul) Edit/Mod and Whirlpool armor Edit/Mod
http://img685.imageshack.us/img685/7422/6830678.j pg
Uploaded with ImageShack.us
http://img535.imageshack.us/img535/2170/6514584.j pg
Uploaded with ImageShack.us
|
Login script
02/13/2012 - Web Development - 4 Replies
hey leute,
kruze frage wie sollte ich ein loginscript bauen ?
ist es sinnvoll eine dirkete weiterleitung einzusetzten, nachdem alle daten überprüft und einse session erstellt wurde ?
|
Captcha im Login Script
11/04/2011 - Metin2 Private Server - 1 Replies
Weiß jemand wie ich ein Captcha in mein Loginscript auf der Hp einbauen kann?
|
PHP Login script!!! HELP!!!
02/21/2011 - Web Development - 19 Replies
hallo,
Also ich habe mal ein PHP Login Script gecoddet und nun also wenn ich mich einlogge auf der login seite komme ich immer weiter auf die seite wo das passwort überprüft wird nur das dumme das passwort wird nicht überprüft.Würde hilfe brauchen Scripts folgen.
<?php
$username = $_POST;
$password = $_POST;
if ($username&&password)
|
[PHP]Login Script[HELP]
03/26/2008 - EO PServer Hosting - 0 Replies
Hello veryone im currently making a website everything is working except the login, Basicly the site has a login page where the user can check his stats and send messages and login into sever but the script won't seem to work after i updated the register script because the old one it wud not let u login into the server so if ur good and would help me plz pm me or add me on
[email protected]
Thanks
|
All times are GMT +1. The time now is 23:02.
|
|