Jump to content

Recommended Posts

Hi guys and gals :D

 

I an new to this PHP and MySQL information

 

I am trying to create a simple user login system for my website where I can save peoples names, a reference number (this is there login password but dont want it to show as a password i.e. letters can be visible) and a web page specific to that user (this is where I will have a set of images relating to that user which no other user can access or see and some button links to the rest of my web page...

 

I have managed to track down a straight forward login system on the net

 

http://net.tutsplus.com/articles/news/how-to-build-a-login-system-for-a-simple-website/

 

it works great i have uploaded it to my server and created a table, however I thought i could just quickly work out how to link to each users specific page on correct login and this hasn't happened

 

My question - would someone be able to point me as to where to look or how I may be able to achieve this user specific page quickly and simply using the information i have already downloaded - I need this down today :S I feel a little silly asking for help a week later but I have quickly come to the conclusion I need to spend more than a few days understanding this and am not really sure how and where to look to solve my issue

 

If i can get that to work i will then make the form more personal and built with the terms i.e the name of the table will change, and obviously the look

 

If anyone can help then I would much appreciate it

 

Many Thanks - Look forward to your response

 

Tom

If you can help I would be much appreciative of this - I am not one for just taking information from people so if someone has got the time to work with me on this I don't mind agreeing to a figure for your time - any help is much appreciated as i really need this up and running

 

Many Thanks

First of all I'd like to point out that the tutorial is not as great as the comments might leave you to think. Not only does it teach you some pretty bad OOP practises (verify_Username_and_Pass () has no business inside the MySQL class, for example), but it is also woefully inadequate at protecting the passwords. Unsalted MD5 has been proven broken since 2006, when it was possible to generate a collision in less than 1 minute on a laptop.

Thus it is strongly recommended to use crypt () with SHA256 (or stronger), and a user-specific salt.

 

More importantly, you should read the following article and make sure you understand it completely before continuing:

http://www.openwall.com/articles/PHP-Users-Passwords

 

Now that the security stuff is out of the way, let's get to your core question. ;)

There are two ways to do this, either use a redirect based upon the user-ID and have the page dynamically created from one (or more) different tables in the database. Or, if you have the pages completed already, add a new field (column) to the user-table, where you save the name of this page. Then just fetch it, along with the username and password, and use it as the target value for the redirect.

 

PS: Note that, contrary to what that tutorial showed you, you will always need to use die () after a header ('Location: ...') call. Otherwise PHP will continue to parse the script, potentially creating problems and/or security issues.

Where are these images coming from?  Do you have a database table for them?

 

The basics of what you want to do aren't difficult.  The problem is that you haven't given anyone much to go on.  A bare bones login system doesn't exactly infer what the rest of your system requirements are, especially since you haven't shared any code.

 

Also, as a general forum etiquette tip, people generally don't respond to threads marked as urgent, nor do they respond to threads that don't have any code written in them.  We're here to help, certainly, but we're not here to magically come up with a solution at the last minute so people can meet their work/school deadlines.

Hi much appreciated for both comments

 

Security of the password isnt as high on my priority list as getting the information to actually make the pages do what i want them to do

 

That being said there will be no information within the 'login' area which is confidential i.e name, date addresses; I am purely using this concept to allow people to log in and find an image of them which has been taken to which I don't want any one else to access...

 

OK, back on point - as i say i feel a little apprehensive of diving in with questions as my knowledge is somewhat limited, however I am happy to give anything a stab - this being said ChristianF - my table at the moment consists of a username (there first name), and a reference number (this is there PIN which they have already been given - this is a 3 digit code which isnt to be secured i.e. a password

 

I can easily add another column to the table pointing to 'x' amount of pages i.e. add a field with the http: where the pages are being saved

 

- To note the pages haven't yet been created - however my test area at the moment looks like this

 

http://www.living-image.co.uk/membershipSite

The Username is username and the password is password

 

Check it out - hopefully you will get an idea of what i am trying to create - it all looks simple but that's the bare bones so my designer can finish off the look and in cooperate it into our other sites

 

When a user logs in they will see there own image and any other generic information along side it...

 

Please let me know what information you would require to better understand my situation

 

I am please people are out to help people like myself and I do apologise for not providing the correct information.

 

Many Thanks

 

That being said there will be no information within the 'login' area which is confidential

If you are enabling your users to choose their own username and set/change the password, you are indeed saving confidential information; The username-password combination. Just think about how many places where you use the same e-mail/username and password combination, and I'm almost willing to bet that you have it on your email account as well.

 

I can easily add another column to the table pointing to 'x' amount of pages i.e. add a field with the http: where the pages are being saved

If there are multiple pages per user, then you need two tables: One to store the users and their related data, and one to store the data related to the pages. Latter should have a foreign key relation to the former (one-to-many relation), so you know which users owns which page(s).

Alternatively, if you have a set number of pages available with a standardized format, you could save the individual "pages" as fields in the column. Use the same user ID foreign key relation, but this time as a one-to-one relation.

Hi

 

Hope you weekend went well - I have just managed to check on here and I was a little cryptic to my doings - always feel a little dubious telling people exactly what I am trying to do but then again unless I do then how can people like yourself help#

 

I am in control of a photographic situation where my customers will need to log back in to see an image which we have taken of them - this singular page will be generic to all in its layout however there will be an image area where one image will be displayed or may be multiple image if more than one is to be viewed - each page i will create as separate pages and add the reference to a column in the table of users

 

My aim is to have each user log into the website using there first name, as they have already given to me and a reference number which I have already given them. neither of these two items are going to be changeable i.e so security is at a minimum as i am trying only to stop one customer seeing everyone else's images without there reference number - if they happen to share the reference number amongst themselves then i cant stop that but nor could i stop them passing a password round

 

When they are logged in and they see there page i will then have re-directs to push them to other parts of my site for them to purchase goods using my on-line shop made in Open Cart

 

What exactly i need is the know how i.e. a slice of code that query's the database, as i fully don't grasp what i am doing i would have preferred someone to look at it understand what i need and supply me with code to slip in, and alter accordingly to work with my existing set-up

 

If i can get this then great if not i will have to find another way to do it - help is much appreciated as i do not have the time to understand how it works fully, which is where people with the knowledge can help me find my way

 

Many Thanks

 

Tom

 

 

 

Thanks for the updated information, it did indeed help in understanding what you're looking for.

 

First of all: You don't need a table containing the pages, but a table containing the ID/name of the images related to said customer. In other words, a table with a one-to-many relation to the users table, and containing two fields: "user_id" and "image". After the user has logged in, you now have his/hers user ID, which you can then use to fetch all of the images from the "user_images" table. Then just loop through the results given to you by the database, and print out the link + img tag to the pictures.

All of this is quite nicely explained in just about any MySQL + PHP tutorial, though usually of very varied quality. The PHP manual is your best bet for anything PHP related, starting with mysqli_query (), and to have the relations explained a simple google search will suffice.

 

Now, we usually don't sit down and write all of the code for people, as that's not what we're here for. What we do, is to help people learn, by pointing out any errors they've missed, where to look for resources (if they tried and failed), or stuff like that.

However, if you do prefer it I can help you out with writing the code and setting the system up for you, and have it working perfectly and securely. As long as you accept that it will be a paid commission. :)

Brilliant just what i was looking for - I would love to give this a go as like you say it is much better for someone to learn from there mistakes than have someone 'just do it' for you

 

However in my such short time scale i really am unsure if i can digest and regurgitate successfully

 

On the other hand however i think i will give it my best shot but if all fails, how long would it take for you to come up with what i am looking for and also what figure would you be looking at - prettiness isn't really an issue as like i have said i have a designer than can throw things together - its just the detailed areas we fall down in

 

Much appreciated

 

Tom

Based upon what you've described here, sans any heavy OpenCart integration, it would take me an hour or two. At the most. Just send me a PM here if you'd want to hire me for the job. :)

 

Good luck on the learning, and just let us know if you require any further help.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.