Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

php password/forms ...

Status
Not open for further replies.

riwer

Technical User
May 30, 2004
21
BA
Hello!
I’m new to PhP/MySQL and I’m still struggling with it but I managed to make a working application and now I want to protect it with a login/password system . What is the most secure combination without apache authentication? My prime concern is security, not user friendliness, in fact I want users to login every time they access application Just point me in the right direction I’ll do the reading :)
Second, how to submit a form without the user pressing a submit button and
Third how to redirect page, for example
if (condition) {
goto “some page.html”;
} else {
continue ...
}
Thanks
 
For the last two questions first:

Submit a form Without pressing submit: this is Javascript territory, as PHP only begns to work once the form is actually submitted so try the Javascript forum here: Forum216

2.
To redirect to a different page there is something called a header. This header contains among other things a location to redirect to another page, but beofre issuing the command:
you have to make sure that: [red]No output and I mean no output is being sent to the browser before issuing the command. This includes whitespaces, html, plain text, document types etc... Nothing can be sent to the browser before issuing the command.[/red]

The command is:
header("Location:someotherpage.php");

As for the security measures:
Have a DB with the allowed users and a encrypted password to check against login and then You can use Session Variables to maintain the user logged in throughout the App. When the user logs out you can destroy the session. And if the user closes the website it automatically closes the session also. Search for the $_SESSION variable in the PHP online manual.


Hope this helps.



----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
I’ll check out java script

Thanks for header, I tried to use it before but I always got error, now I put it on top of everything and it works.

As for sessions is there any tutorial how to do this securely, all I found is how to make user more “at home” :)

Thanks
 
if you are interested i can send you a user managed script i posted for another tek-tips user. send an email to jpadie [inside] hotmail [gtld] com and i'll post it back. it was written in simple style to give the poster at the time a sandbox to get an understanding for sessions etc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top