I Need Wml+php+mysql Registration/login Script
Started on the old forum in December 2006 · view the original in the archive · old links redirect here
PLz im need a wml+php+mysql registration/login script,
Here is a simple one: http://www.2wap.org/forums/index.php?act=a...post&id=577
Advertise your mobile site for FREE with AdTwirl
It already installs it, but when I enter from I telephone cellular, it says to me: Not WML content.
please give me a link so i can take a look at it
Advertise your mobile site for FREE with AdTwirl
PLz im need a wml+php+mysql registration/login script,
give me 10 min..to code External image (may be gone)
- 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
- create index.php
<?
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>
create.php
<?
$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