This is a discussion on "PHP Login" within the PHP Forum section. This forum, and the thread "PHP Login are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
PHP Login
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
||||
|
||||
|
PHP Login
Hey all. Following this tutorial:
http://www.phpeasystep.com/workshopview.php?id=6 1. Am I using PHP 4 or PHP 5? How can I find out? 2. Try going here: http://www.jackfranklin.co.uk/PHP%20...main_login.php and use the username john and the password 1234. I get lots of errors! The code for the check_login.php is:
Thanks Jack
__________________
Yours is the Earth and everything that's in it
And - which is more - you'll be a Man my son!
Last Blog Entry: A Week with VBulletin (Aug 28th, 2008)
|
|
#2
|
||||
|
||||
|
Re: PHP Login
What are the errors mate? They can help a lot in the debugging process.
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
|
#3
|
|||
|
|||
|
Re: PHP Login
There are no errors in the PHP script. HTML is also OK. Check the SQL login data....
Otherwise I can't see any problems.
Last Blog Entry: 10 Reasons Why My Laptop Is Better Than Your Girlfriend (Dec 15th, 2007)
|
|
#4
|
||||
|
||||
|
Re: PHP Login
The warnings I get are:
Warning: session_register() [function.session-register]: Cannot send session cookie - headers already sent by (output started at /home/jackfran/public_html/PHP Stuff/PHPLogin/checklogin.php:9) in /home/jackfran/public_html/PHP Stuff/PHPLogin/checklogin.php on line 35 Warning: session_register() [function.session-register]: Cannot send session cache limiter - headers already sent (output started at /home/jackfran/public_html/PHP Stuff/PHPLogin/checklogin.php:9) in /home/jackfran/public_html/PHP Stuff/PHPLogin/checklogin.php on line 35 Warning: Cannot modify header information - headers already sent by (output started at /home/jackfran/public_html/PHP Stuff/PHPLogin/checklogin.php:9) in /home/jackfran/public_html/PHP Stuff/PHPLogin/checklogin.php on line 37 Warning: Unknown(): Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0
__________________
Yours is the Earth and everything that's in it
And - which is more - you'll be a Man my son!
Last Blog Entry: A Week with VBulletin (Aug 28th, 2008)
|
|
#5
|
||||
|
||||
|
Re: PHP Login
I'd just like to suggest filtering the input, otherwise this script is vulnerable to SQL Injection i think changing the post part to the following should work:
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
|
#6
|
|||
|
|||
|
Re: PHP Login
OK, I got it:
Your problem is here:
Last Blog Entry: 10 Reasons Why My Laptop Is Better Than Your Girlfriend (Dec 15th, 2007)
|
|
#7
|
|||
|
|||
|
Re: PHP Login
Would it next
Last Blog Entry: Whats your Niche? (Jun 10th, 2008)
|
|
#8
|
||||
|
||||
|
Re: PHP Login
Thanks for the help guys. What can I do to correct it? simon- I dont quite understand what you are saying?
Cheers Jack
__________________
Yours is the Earth and everything that's in it
And - which is more - you'll be a Man my son!
Last Blog Entry: A Week with VBulletin (Aug 28th, 2008)
|
|
#9
|
|||
|
|||
|
Re: PHP Login
Thats how you start a session
Last Blog Entry: Whats your Niche? (Jun 10th, 2008)
|
|
#10
|
||||
|
||||
|
Re: PHP Login
I think Simon means put this in:
__________________
Thanks Marc Staff Manager - Want to be a Moderator? PM me. |
|
#11
|
|||
|
|||
|
Re: PHP Login
OK, Let me explain in what I hope is "normal person" english:
The headers of a HTML page get sent before ANY of the content. So, if you want to set any information in the header using PHP (ex: using the header() function or the session_*() functions), you have to do it before you output anything to the page (using echo() or print() or normal HTML output). So, when you try to start a session and change the header, PHP throws an error, because the header has already been sent to the client and the server can't make any more changes. Hope that makes at least a bit of sense, feel free to throw down some more ?'s....
Last Blog Entry: 10 Reasons Why My Laptop Is Better Than Your Girlfriend (Dec 15th, 2007)
|
|
#12
|
||||
|
||||
|
Re: PHP Login
I think I get it. So would I put the code Marc posted at the very very top of my page, before any other code? or would I move all the code before the <html....?
Thanks for the help! Jack
__________________
Yours is the Earth and everything that's in it
And - which is more - you'll be a Man my son!
Last Blog Entry: A Week with VBulletin (Aug 28th, 2008)
|
|
#13
|
|||
|
|||
|
Re: PHP Login
that's it! you catch on fast...
Last Blog Entry: 10 Reasons Why My Laptop Is Better Than Your Girlfriend (Dec 15th, 2007)
|