PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Peter   MySQL Login   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: example file
Class: MySQL Login
Authenticate users with records in a MySQL table
Author: By
Last change:
Date: 18 years ago
Size: 1,659 bytes
 

Contents

Class file image Download
<?php

if ($_GET['login']) {

    include(
'login.php');
   
   
/* VARS */
   
$mysql_database = "0ldsk00l"; // mysql database
   
$mysql_hostname = "localhost"; // mysql hostname
   
$mysql_username = "root"; // mysql username
   
$mysql_password = "dth67yxh"; // mysql password

   
$table_name = "login"; // your login table name (login)
   
$table_username = "username"; // table field w/ usernames
   
$table_password = "password"; // table field w/ passwords
   
   
$query_username = $_POST['username']; // query username
   
$query_password = $_POST['password']; // query password

   
$redirect_accepted = "success.php"; // redirects to this if login is succesful
   
$redirect_denied = "denied.php"; // redirects to this if login has been denied
   
    /* create class */
   
$a = new login($mysql_database,$mysql_hostname,$mysql_username,$mysql_password,$query_username,$query_password,$table_name,$table_username,$table_password,$redirect_accepted,$redirect_denied);
   
   
$a->login_mysql();
   
$a->login_check();
   
    }
else {
   
    print
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n";
    print
"\n";
    print
"<html>\n";
    print
"<head>\n";
    print
"<title>Login</title>\n";
    print
"</head>\n";
    print
"<body>\n";
    print
"\n";
    print
"<form method=\"post\" action=\"example.php?login=1\">\n";
    print
"username:<br />\n";
    print
"<input type=text name=username>\n";
    print
"<br /><br />\n";
    print
"password:<br />\n";
    print
"<input type=password name=password>\n";
    print
"<br /><br />\n";
    print
"<input type=submit>\n";
    print
"</form>\n";
    print
"\n";
    print
"</body>\n";
    print
"</html>\n";
   
    }

?>