Pages

Wednesday, February 9, 2011

Simple PHP Log In

To be able to create a simple database driven PHP Log in,
first thing to do is CREATE A DATABASE using your PhpMyadmin or anything that are applicable.
Name it db. then create a table and name it members having fieldnames such as IDUserName and Password. or simple copy the following:


-- phpMyAdmin SQL Dump
-- version 3.3.9
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Feb 02, 2011 at 06:54 PM
-- Server version: 5.5.8
-- PHP Version: 5.3.5

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Database: `db`
--

-- --------------------------------------------------------

-- Table structure for table `members`
--

CREATE TABLE IF NOT EXISTS `members` (
  `ID` int(10) NOT NULL AUTO_INCREMENT,
  `UserName` varchar(50) NOT NULL,
  `Password` varchar(50) NOT NULL,
   PRIMARY KEY (`ID`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;

--
-- Dumping data for table `members`
--

INSERT INTO `members` (`ID`, `UserName`, `Password`) VALUES
(1, 'honey', 'a'),
(2, 'a', 'a'),
(3, 'kyte', 'joy'),
(4, 'hard', '123'),
(5, 'jenny', '123');

-- --------------------------------------------------------
SECOND: Create the LOG IN script
Here's the code:
Header("Location:Write the page where you want to redirect after logging in");

No comments:

Post a Comment