PLz im need a wml+php+mysql registration/login script,
I Need Wml+php+mysql Registration/login Script
Collapse
X
-
jerephpTags: None
-
Here is a simple one: http://www.2wap.org/forums/index.php?act=a...post&id=577PLz im need a wml+php+mysql registration/login script,[/b]
-
jerephp -
jerephp
It already installs it, but when I enter from I telephone cellular, it says to me: Not WML content.
Comment
-
Guest -
Guest
1) create a tabel
id : smallint(5) ; not null ; auto increment; primary key
username : varchar(45); not null
password : text; not null
level : varchar(45); not null
2) create index.php
create.phpCode:<? session_start(); $host = "localhost"; $user = "user"; $pass = "pass contului"; $dbase = "user_domain"; $table = "users"; function check_account($username, $password) { global $host, $user, $pass, $dbase, $table; $connection = @mysql_connect($host,$user,$pass); @mysql_select_db($dbase); $query = @mysql_query("SELECT id FROM ".$table." WHERE username='".$username."' and password='".MD5($password)."'",$connection); if (@mysql_num_rows($query) != 0) { return true; } else { return false; } @mysql_close($connection); } function account_level($username) { global $host, $user, $pass, $dbase, $table; $connection = @mysql_connect($host,$user,$pass); @mysql_select_db($dbase); $query = @mysql_query("SELECT level FROM ".$table." WHERE username='".$username."'",$connection); $result= @mysql_fetch_array($query); return $result['level']; @mysql_close($connection); } if (!isset($_SESSION['auth'])) { $_SESSION['auth'] = "logout"; } if ((isset($_POST['action'])) && ($_POST['action'] == "login")) { if (check_account(strip_tags($_POST['username']),strip_tags($_POST['password']))) { $_SESSION['auth'] = "login"; $_SESSION['account']['username'] = strip_tags($_POST['username']); $_SESSION['account']['level'] = account_level(strip_tags($_POST['username'])); } else { echo "eronata ! "; } } if ((isset($_POST['action'])) && ($_POST['action'] == "logout")) { $_SESSION['auth'] = "logout"; } ?> <html> <head> </head> <body> <? if ($_SESSION['auth'] == "logout") { ?> <form action="<? echo $_SERVER['PHP_SELF']; ?>" method="post"> Username <input type="text" name="username"> Password <input type="password" name="password"> [url="create.php"]register[/url] <input type="hidden" name="action" value="login"> <input type="submit" name="Submit" value="login"> </form> <? } elseif ($_SESSION['auth'] == "login") { echo "Username: ".$_SESSION['account']['username']." "; echo "Level: ".$_SESSION['account']['level']." "; ?> <form action="<? echo $_SERVER['PHP_SELF']; ?>" method="post"> <input type="hidden" name="action" value="logout"> <input type="submit" name="Submit" value="logout"> </form> <? } ?> </body> </html>
Code:<? $host = "localhost"; $user = "user_"; $pass = "parola contului"; $dbase = "user_"; $table = "users"; function check_account($username) { global $host, $user, $pass, $dbase, $table; $connection = @mysql_connect($host,$user,$pass); @mysql_select_db($dbase); $query = @mysql_query("SELECT id FROM ".$table." WHERE username='".$username."'"); if (@mysql_num_rows($query) == 0) { return true; } else { return false; } @mysql_close($connection); } function create_account($username, $password, $level) { global $host, $user, $pass, $dbase, $table; $connection = @mysql_connect($host,$user,$pass); @mysql_select_db($dbase); @mysql_query("INSERT INTO ".$table." VALUES ('','".$username."','".MD5($password)."','".$level."')",$connection); @mysql_close($connection); } if ((isset($_POST['action'])) && ($_POST['action'] == "create")) { if (check_account(strip_tags($_POST['username']))) { create_account(strip_tags($_POST['username']),strip_tags($_POST['password']),$_POST['level']); echo "Contul a fost creat cu succes. "; echo "<a href=\"index.php\">login</a>"; exit; } else { echo "NAme alerty exist "; } } ?> <html> <head> </head> <body> <form action="<? echo $_SERVER['PHP_SELF']; ?>" method="post"> Username <input type="text" name="username"> Password <input type="password" name="password"> Level <select name="level"> <option value="administrator">administrator</option> <option value="moderator">moderator</option> <option value="user">user</option> </select> <input type="hidden" name="action" value="create"> <input type="submit" name="Submit" value="create"> </form> </body> </html>
Sry for my english.....i write in romania txt...and i translate this text
Dupa autentificare, pentru obtinerea user-ului logat si al nivelului acestuia, te joci cu variabilele $_SESSION['account']['username'] si $_SESSION['account']['level'] care sunt vor fi vizibile peste tot De asemenea, am facut cam tot ce se putea in privinta securitatii a.i. parolele sunt criptate in baza de date + autentificarea nu se poate face decat de pe contul tau
report erors
Comment

Comment