This is a discussion on "Login/register" within the PHP Forum section. This forum, and the thread "Login/register are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Login/register
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
||||
|
Login/register
Helloo.
I have mysql/php setup and I use dreamweaver to build my site. It has a login feature builtin. but all it does is redirect you to a page if you have a correct username/pass or somewhere else if you don't :/ What I want is to have people login/register, then that being stored in a cookie or whatever, and them being able to have a page called my account which changes for each user. I have two tables in mysql, userdir: username, name, password, type(account type), gender, email, newsletter, enabled, comment(specific comments from me) and scores: username, scores(when users play flash games they get points sent to this tables) A little help? I know it's a bit advanced and way out of my league, but i'd really appreciate the help! and yes i've tried google, and a few tutorials. most of them gave me a nice blank page.
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
|
|
|
||||
|
Re: Login/register
The easiest way is using PHP sessions. You just have to call the 'session_start()' function at the top of every page where the user should stay logged in. Here's an example login script:
Hope it works 4 u!
Last Blog Entry: 10 Reasons Why My Laptop Is Better Than Your Girlfriend (Dec 15th, 2007)
Last edited by c010depunkk; Jul 26th, 2007 at 06:26. Reason: mysql query wuz wrong |
|
|||
|
Re: Login/register
Yeah I agree, use the header() function instead of javascript, as if its disabled or not working properly it wont redirect.
Also you want to check the session on the page you get directed to, as otherwiswe they could just type that in if they know it. Last edited by Voodoochilli; Jul 26th, 2007 at 09:32. Reason: if its not working it wont work? |
|
||||
|
sorry i haven't replied.
Thankyou. Will test it now!
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
|
||||
|
Re: Login/register
what part of that has to be on every page?
I want it so that, they can view every page. but there's an SSI page, that has the navigation and a login form/logged in paragraph, if you get me. so in that, little bit. do i put something like:
Yes? or something else?
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
|
||||
|
Re: Login/register
Yeah, that would make sure that the user is logged in on every page. Don't forget to call the session_start() function at the very top of every page to keep the session alive.
Last Blog Entry: 10 Reasons Why My Laptop Is Better Than Your Girlfriend (Dec 15th, 2007)
|
|
|||
|
Re: Login/register
personly, I would make a php include, eg check_user.php
inside it I would have this:
on the login page, if the details are correct, you simply register the session and redirect to a page Last edited by Voodoochilli; Jul 29th, 2007 at 13:57. Reason: add php syntax highlight |
|
|||
|
Re: Login/register
hey alex, out of interest how do you display your code with php syntax highlighting? tried both (code) and (html)
|
|
||||
|
Re: Login/register
There's also a 'PHP' code button, directly to the left of the 'HTML' one.
Last Blog Entry: 10 Reasons Why My Laptop Is Better Than Your Girlfriend (Dec 15th, 2007)
|
|
||||
|
Re: Login/register
thanks will give it a go
You mean the forum code? it's PHP in [] if that's what you meant
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
|
|||
|
Re: Login/register
cheers
|
|
||||
|
Righttt, one more question where in the code do i name the session to correspond with this bit:
And isn't that saying, if the session (logged in) is there take them to the login page? sorry if i'm wrong.
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
|
|||
|
Re: Login/register
['usersession'] - change that to what ever you want the session name to be
|
|
|||
|
Re: Login/register
Quote:
Its also use like this sometimes
Last edited by Voodoochilli; Jul 29th, 2007 at 17:22. |
|
||||
|
Re: Login/register
no i mean, in the login code,
do i have to name the session there? thanks for clearing that up about the !
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
|
|||
|
Re: Login/register
Hang on, I will make some login code for you, wont be a min
|
|
|||
|
Re: Login/register
Last edited by Voodoochilli; Jul 29th, 2007 at 17:32. Reason: forgot session_start()! |
|
||||
|
Re: Login/register
brilliant thanks
will try it now
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
|
|||
|
Re: Login/register
I will stay online incase you have any problems
|
|
||||
|
Re: Login/register
thank you.
i think it's all sorted for now just need to get it to get the information from the database and i know that one
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
![]() |
| Tags |
| alexgeek, cs3, dreamweaver, login, mysql, php, register |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| PHP Login Register help | atlaskid | PHP Forum | 6 | Nov 10th, 2006 21:34 |
| some type of member login/register system | Lucid. | Web Page Design | 22 | Feb 3rd, 2006 17:19 |