PHP Classes

File: installDB.php

Recommend this page to a friend!
  Classes of Andrew   Login Script   installDB.php   Download  
File: installDB.php
Role: Auxiliary script
Content type: text/plain
Description: Installation script
Class: Login Script
Authenticate users with records in a MySQL table
Author: By
Last change:
Date: 15 years ago
Size: 1,805 bytes


Class file image Download

 * Install MySQL DB for use with the LoginScript


$db_name = "";
$db_username = ""; //Your MySQL Settings here!
$db_password = "";
$db_host = "localhost";


$sql = "CREATE TABLE IF NOT EXISTS `user_tbl` ( ".
"`UserName` varchar(20) NOT NULL,".
"`Password` varchar(32) NOT NULL,".
"PRIMARY KEY (`UserName`))";

// connect to db here!!!!!!
$connection = mysql_connect($db_host, $db_username, $db_password)
                or die(
"Error connecting to MySQL!!");
mysql_select_db($db_name, $connection) or die("Unable to select DB!");
"TABLE Created Succesfully on: $db_name (Database)";
"Error Creating TABLE: " . mysql_error());

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Login System Database Installation</title>
    <link href="css/styles.css" rel="stylesheet" type="text/css" media="all" />

<div class="cent">
    <h1>Login System Database Installation</h1>
    <p>This page will help you to install the required user Database for the LoginSystem</p>
    <p class="error"><strong>Make sure you have edited the settings file with your MySQL settings!</strong></p>
    <p>We will use a database called: <strong><? echo $db_name;?></strong></p>
    <form action="<? echo $_SERVER['PHP_SELF']; ?>" method="post">
        <input name="submit" type="submit" value="Install" />