sudo apt-get install apache2
//sudo ifconfig eth0 | grep inet | awk '{ print $2 }'
sudo apt-get install mysql-server
sudo apt-get install php5
installing mysql dependencies
===============================
sudo apt-get install php5-mysql phpmyadmin
sudo apt-get install libapache2-mod-php5 php5-mcrypt
sudo nano /etc/apache2/mods-enabled/dir.conf
apt-cache search php5-
sudo nano /var/www/html/info.php
<?php
phpinfo();
?>
===============
proceed with working on login and registration system
=================================================
Version 1 (for login only)
==============
a)create a login form in index.php
<!DOCTYPE HTML>
<head>
</head>
<body>
<form method="post" action="handle.php">
<input type="text" name="username"/>
<input type="password" name="password"/>
<input type="submit" value="login"/>
</form>
</body>
b)on click redirect to handle.php
<?php
echo $_POST['username'];
echo $_POST['password'];
?>
<?php
echo $_POST['username'];
echo $_POST['password'];
$DB_host = "localhost";
$DB_user = "root";
$DB_pass = "123";
$DB_name = "testdb";
$MySQLi_CON = new MySQLi($DB_host,$DB_user,$DB_pass,$DB_name);
if($MySQLi_CON->connect_errno)
{
die("ERROR : -> ".$MySQLi_CON->connect_error);
}
?>
c)create a database
-
c1)create database testdb
-
c2)create a table users with userid ,username, password
-
c3)insert values 1,abc,123
-
INSERT INTO `testdb`.`users` (`userid`, `username`, `password`) VALUES ('1', 'abc', '123');
e)retreive values from db
//edit handle.php as
<?php
$username= $_POST['username'];
$password= $_POST['password'];
$DB_host = "localhost";
$DB_user = "root";
$DB_pass = "123";
$DB_name = "testdb";
$MySQLi_CON = new MySQLi($DB_host,$DB_user,$DB_pass,$DB_name);
if($MySQLi_CON->connect_errno)
{
die("ERROR : -> ".$MySQLi_CON->connect_error);
}
$query = $MySQLi_CON->query("SELECT userid, username, password FROM users WHERE username='$username'");
$row=$query->fetch_array();
echo $row['password'];
?>
e2) compare values and print message
//don't forget to close the db handle
version 2
===========================================================
klklkl;
a)Login Modification
-
add title
-
seperate signin and signup sections
-
add default value and remembering user choices
-
Add Registration Functionality
<!DOCTYPE HTML>
<head>
<title> Login and Registration System </title>
</head>
<body>
<form method="post" action="handle.php">
<input type="text" name="username" placeholder="Username" required/>
<input type="password" name="password" placeholder="Password" required />
<input type="submit" value="submit"/>
</form>
<?php
echo "Sign Up Here<br/>";
?>
<button>
<a href="register.php"> Sign Up Here </a>
</button>
</body>
b)create a home page—after successful login
<!DOCTYPE html>
<head>
<title> Login </title>
</head>
<body>
<center>
<h1>hai</h1>
</center>
</body>
-
one data in each item
-
Email
-
password
-
Login button
-
register button
<center>
<form>
<table>
<tr>
<td><input type="Text" placeholder="Your Email" required/></td>
</tr>
<tr>
<td><input type="password" placeholder="Your Password" required/></td>
</tr>
<tr>
<td><input type="submit" value="submit" /></td>
</tr>
<tr>
<td><a href="" > Sign Up Here</td>
</tr>
</table>
</form>
</center>
border:solid #dcdcdc 1px;
padding:25px;
box-shadow: 0px 0px 1px rgba(0,0,0,0.2); //h-shadow v-shadow blur-amount color
padding:15px;
border:solid #e1e1e1 1px;
-
table tr td input
-
width:97%;
-
height:45px;
-
border:solid #e1e1e1 1px;
-
border-radius:3px;
-
padding-left:10px;
-
font-family:Verdana, Geneva, sans-serif;
-
font-size:16px;
-
background:#f9f9f9;
-
Edit this in index.php
Version 3
===========
-
Page Layout
-
index.php
-
home.php
-
logout.php
-
dbconnect.php
-
establish connection
-
select database
-
style.css