Website Help with Client Log-in Page

Messages
1,727
Name
Jamie Palmer
Edit My Images
Yes
Hi Everyone.

Just looking to get all my website up and running efficiently now, and was looking at how I could create a log-in page for my Clients to type in a username and password to log in to view their images.

Such as the one seen here: http://www.christianmichael.co.uk/proofs.php

I have a relatively good knowledge of HTML and have been using dreamweaver to set it the rest of my site so far.

So if somebody could help me with this I could be greatly thankful

Many Thanks
Jamie Palmer
 
Best and most effective way is to use a database and something like PHP.

Dreamweaver has a built in thing to do it, but i wouldnt trust it.
 
Thanks for the advice, but I think PHP will be the best way, but I want it to be able to send you to the right page for the specific user if that makes sense, so dont know how to go about doing that really :confused:
 
PHP coding on HTML sounds like the better answer for me as I wouldn't have a clue how to set up a database lol.
 
If your interested in doing it yourself (most rewarding way in my opinion).

This is the simple idea behind it.
Youd want the user to input a username and password.
You want their details be checked to the database to ensure theyre correct.
If correct assign a session to that user to say user X has logged in (if not redirect to login page saying sorry).
If session has been set redirect them to welcome page then query the database again for all relevant pictures for that user.

Set yourself a week, and use www.w3schools.com to have a go learning PHP/Database connection. Its really simple, but might take a while to get your head round!
 
Yes basically that's correct.
People who have had some photos taken would go onto my website on the proof section.

They would then be prompted to type in a username and password.
The username and password provided will send them to THEIR gallery to view their photographs.

So I want eg. Betty to sign in with username
user: Betty
pass: Betty
This will take her to http://www.mysite.co.uk/Proofs/Betty

And John to sign in;
user: John
pass: John
This will take him to http://www.mysite.co.uk/Proofs/John

Obviously these are made up users and passwords lol
 
Login pages are generally a combination of PHP and MySQL (for the database)

The front end is usually a HTML page which calls a PHP script when the user clicks the login/submit button. The PHP script connects to the MySQL database and verifies the details entered by the user. They are then taken to the relevant page.

I suspect there is a way to do it without MySQL but i wouldnt imagine it will be a case of copying and pasting code and hoping it will work.

I would either read up on PHP/SQL coding or get someone to do it who knows how to code....

You could probably cobble together some code yourself and it may work.....go for it and see if it works :)
 
To be honest with you I wouldn't know where to start with making my own code.

I was basically looking to put together the link that's in my original post, so the clients can type in their user and password and go straight to their gallery area.
 
I'm a first year CS student and this year was was mainly based on PHP I made a site(like flickr) which would work like you want your site too,

You can take a look here: http://cs1.ucc.ie/~rt2/cs1109/lab18/

If you'd like to log in using the username 'RichardT' and the password 'Test' (please don't register as the database shouldn't be modified as it's been submitted to the lecturer)

If you try to access this page now: http://cs1.ucc.ie/~rt2/cs1109/lab18/account.php?id=RichardT

You get a message saying you need to log in, And when you log in you see the users photos..

It does this by using the inbuilt php session_start(); function.

When the user logs in you can store values in a PHP super global called $_Session which is in turn stored as a cookie on the users machine, For you, you could store $_session['user']; which would allow you to recognize which person it logging in, then on the proofs pages you'd have an if/else statement which would check if the user is logged in and if that's true they'll see their photos and if not they'll see the log in page..

This might over complicate the matter as you'd need to create a script in PHP to output the photos(and access a database to get the urls of the images and maybe some text specific to the customer) but it will make it much much quicker in the case of a new customer when all you need to do is add some data to the database instead of making a new page.
 
That is exactly what I'm after Richard, thank you very much.

But there is one small problem, most likely my gallery will be over one page, say 3 or 4 pages.

So when they log in they will need access to all of those pages (obviously on the first gallery there will be links to the other pages, but I want it so they can't just use the link for the second page to get around the password protection.

Hope that makes sense, and do you think it's easily achieveable?

Many Thanks
Jamie Palmer
 
That is exactly what I'm after Richard, thank you very much.

But there is one small problem, most likely my gallery will be over one page, say 3 or 4 pages.

So when they log in they will need access to all of those pages (obviously on the first gallery there will be links to the other pages, but I want it so they can't just use the link for the second page to get around the password protection.

Hope that makes sense, and do you think it's easily achieveable?

Many Thanks
Jamie Palmer

Yep PHP makes that quite simple..

If you set another $_Session variable to $_session['authenticated'] = true;

Then on every page that you only want logged in users to see you'd do this
PHP:
if($_session['authenticated'])
{
//output the users data here
}
else
{
echo "Sorry but you need to log in first";
}

The if($_session['authenticated']) will check if the variable contains true, if it does the if is executed(The users proofs are shown) and if it's false it goes to the else, Telling the user they should log in as they aren't meant to see this.
 
OOOO looks good :)
But where would I edit the users information? So i can set the parameters for the authentication?
 
OOOO looks good :)
But where would I edit the users information? So i can set the parameters for the authentication?

You store all the data in a mysql database, Which make's it all a bit tougher(But i'd recommend learning it!) I'm trying to think of a way to do it without using mysql databases.. but it would be the most secure way.
 
Well I use cPanel for my website, and there's a tab on there for MySQL Databases, so I guess I do it on there somehow lol
 
Well I use cPanel for my website, and there's a tab on there for MySQL Databases, so I guess I do it on there somehow lol

Well in that case it should all be quite easy! Learning the basics of PHP then PHP and SQL would be the next step..

I can tell you it's not the toughest thing to learn and there's loads of tut's online! :)
 
Easy!! lol
I've just created an SQL database now and added a user
But now it's knowing how to connect that to my webpage lol
 
Easy!! lol
I've just created an SQL database now and added a user
But now it's knowing how to connect that to my webpage lol

You'd create a new PHP page that your user log in form submits to, And it will then query the database to check that those credentials (user name and password) are correct, And if they are it will create the new session and then output the user's proof images.
 
I'm going to be annoying now, but what coding do I need on my PHP page to link to the database?
Sorry if I'm being a pain, would be good just to be able to get it all sorted, because I dont want to learn everything about PHP and SQL just what I need, and once this is sorted there is nothing else I need bfore I go live (apart from some photos of course) :p

Many Thanks
Jamie Palmer
 
I think this has made it all worse now lol.
I've made a config.php file and C+P'd the code from that site.
And then I've C+P'd your code you provided earlier onto my index.html

Now where do I go from there?
 
Ok first of all call the file proof.php !
Then put this in if you want your page to validate in xHTML
PHP:
<?php echo '<?xml version="1.0" encoding="UTF-8"?>'; ?>
<!DOCTYPE html 
 PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<body>

<?php
session_start();

$groom = $_POST['groom'];// this puts the data from groom text field into a variable called $groom
$bride = $_POST['bride'];// same as above!

//connect to the database 
//query the database to check if the username($groom) is in the database and if so compare the passwords
//if it's true output the data required and set a cookie
}
?>
</body>

</html>
 
Thanks again Richard. (For all those users who are wondering why it's a very one sided conversation I've been discussing this on MSN with Richard to help solve my query)
 
Thanks for the link Ziggy.

Couple of problems I am facing.
I have made my login page called. http://www.my-site.co.uk/ClientViewing/index.html
That includes my login form, which is my website layout with the info from the website C+P'd onto it.
I then made a page where I want that particular user to enter with the info from website copied onto there.

Then I have set up a database with MySQL on cPanel, which asked for a name and then a username and password for the first user.

Now when I fill out a practice log in on the site with the details I told MySQL it just comes up saying HTTP 404 Not Found.

Any ideas?
 
have you had a dig in your hosting? I have the option to password protect (username and password) directories so my stats directory is passworded but I can password any client gallery I want to quite easily
 
Back
Top