|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
Authentication and header( 'Location...
I am having trouble calling a page from a row in mysql table as the header('Location : newpagehere.php');
It works if I put a page in, the page authenticates the user/password against the mysql db but I can't seem to get the user's webpage to fit into the header line...how is this done? Here is what I have so far, probably a lame attempt... //visitor's name and password work $query = ("SELECT count(*) FROM passwords WHERE name ='$name' and password = '$password'"); $myrow = mysql_fetch_array($result); $master = '$result'; header('Location: $master'); die(); } else { //visitory must try again echo "<h1>Go Away!</h1>"; I want the page to redirect to the user's page, called from their row in the db.
__________________
bow wow! |
|
#2
|
|||
|
|||
|
use of header
I'm not quite sure why it doesn't work with the single '' marks but in your header function it needs to be header("Location: $yadda");
|
|
#3
|
|||
|
|||
|
The problem you're having is from the "COUNT(*)"... All you're doing is retrieving the number of fields contained within the user's row.
I would suggest reading Havard Lindset's article, "PHP, MySQL and Authentication 101". It will explain a lot of the problems you're having. It will help you develop a useful login system. Let me know if you continue to have problems.
__________________
____________________________________________ Developer Shed Weekly Writer | DevArticles Forum Moderator Build Your Own KlipFolio Klip With PHP FrankManno.com - Under Construction Design Interactive Group - Under Construction |
|
#4
|
|||
|
|||
|
Want to require more verification...
I have a copy of the previously mentioned article from H.L. and I learned alot from it. I am trying to allow log in to a main page by a group teachers, each having thier own usernaem and pass, but then they have pages only they can enter..this requires those pages to ask for an additional condition... any good examples of this kind of script? Seriously, I'm not trying to make this too complicated...just secure.
Thanks. |
|
#5
|
|||
|
|||
|
something like this
for simplicity sake we'll assume you've already validated their password and username and them into session variables. If you want them to have links to various pages, simply place them out there, and verify that $_SESSION[username] is the authorized username, and if it is not, simply header them to javascript:history.back() . If you want them automatically redirected, use header("Location: $newPage");
|
|
#6
|
|||
|
|||
|
i would use if (session_registered($name)) to check if the person is allowed to view the page.
not sure if thats the right function... only thing that came to my mind at the moment.
__________________
![]() ![]() "Only Linux users see the end of crashes." - Pl4t0 |
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > Authentication and header( 'Location... |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|