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

6 replies · 1,492 views · started 19 years ago · 1 min read

jerephp #1

PLz im need a wml+php+mysql registration/login script,

jerephp #4

It already installs it, but when I enter from I telephone cellular, it says to me: Not WML content.

GumSlone Administrator Principal · 1,690 posts #5

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

External image (may be gone)

Guest #7
  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

  1. 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

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close