Thursday, 17 March 2011

Setting up the site so that you can create users from the index

Just wanted to see if i could do it

I had to create an administrator account that was allowed to create other users

CREATE USER 'admin'@'localhost' IDENTIFIED BY 'password';

GRANT ALL PRIVILEGES ON login_membership TO 'admin'@'localhost':

There is now a section on the login form which allows you to create the user and populates the database by using the administrator.

I've also done some CSS

so far it looks awful

body
{color:blue;
width:250px;
padding:10px;
border:10px solid black;
margin:10px;

font-family: Verdana,Arial,Helvetica,sans-serif;
}
h1 {background-color:rgb(34,68,0); text-align:center}
h2 {color:rgb(255,0,0);}

Creating the pages

overview of the pages i created & notes for each

i'm adding the pages seperately after this. EDIT: blogger doesnt like my code so i'll email it round/add to the facebook page

sorry if theyre a little messy. i've included comments

page 1. index.php

-html login page and

2. checklogin.php

-checks the login page. accesses the database using database priveleges. think maybe we could put in an option to sign up, and create a blog and in doing this we could create new users and set up passwords for them?

it gives the option to go to the blog

gives the option to logout

displays last login time/date

3. logout.php

session destroy code (which doesn't like me so ive commented it out)

it says 'logout successful'

create user & grant priveleges

had privilege problems. remembered that i hadnt created user/granted priveleges


CREATE USER 'siobhan'@'localhost' IDENTIFIED BY 'password1';

CREATE USER 'jimi'@'localhost' IDENTIFIED BY 'password2';

GRANT ALL PRIVILEGES ON login_membership TO 'siobhan'@'localhost';

GRANT ALL PRIVILEGES ON login_membership TO 'jimi'@'localhost';

creating the database

CREATE TABLE login_membership

(UserId int(4) NOT NULL auto_increment,
Username VARCHAR(70) NOT NULL,
Password VARCHAR(70) NOT NULL,
PRIMARY KEY (UserId));

INSERT INTO `login_membership` VALUES (1, 'siobhan', 'password1');

INSERT INTO `login_membership` VALUES (2, 'jimi', 'password2');



hey everyone

this blog is for everyone to see what i'm doing and to see the code x