Hi, i m trying to write a code for resetting password. I want this code to show in on the log in page (and the user should be able to open it without being logged in),,, however the problem i am facing is, whenever i open my recover form thus, localhost/pass.php , my recover form has a field for email and security question, ) it just shows the login page, which is localhost/login.php... i'm stuck on this now for days, and nothing seems to improve...

and just to make helping easier, i'm planning to implement a recover function thus:
1. when the user clicks on forgot password on localhost/login.php without already being logged in, it should take them to a page,
pass.php (displaying an email and security question)...

2.and when the users enter both( confirm if they exist in the sql table), then redirect to another form reset.php which shows two fields for "Enter new password" and "Confirm password", and when user enters both, his password is updated in the database...

Pass.php has a template pass_form.php
and reset.php has a template reset_form.phpp

3. another problem is when i log in, and then i open localhost/pass.php, it always keeps on rendering the above template called login_form.php( which is linked to the controller login.php...) instead of displaying the pass_form.php
template...
/// pass_form.php is as follows:

The algorithm i use for forgotten passwords is like this:
When visitor clicks forgot_pass, generate a token and an expiration for it 24 hours out.
Store those values in different fields in your user table for that user.
Send an email to the user containing a reset link, which has the token appended to the url as a $_GET When they go to reset the password, have your update statement include the token, and expiration date fields. For example, your query would be like....

No problem; here's a couple of functions to get you started. you can add more or better encryption (sha1 etc) than i do with the generate_hash function, but the method of encrypting and salting is pretty standard, regardless of the encryption used to generate your hash. In the project I used these functions in, I had them all contained in a class User, which also contained functions to search for user etc, which are called within the code here. I'll leave front end and search functions up to you, and will be happy to answer any specific questions you have about the implementation

thanks for sharing your code, i really appreciate your help... however, i would also like to seek your help in knowing what's wrong with my current work, so that i don't repeat the same mistakes in future...

from my first post, i spoke of the problem of being automatically redirected to the login page when i opened pass.php, i got that one solved, but now i'm stuck with another problem... is there a way i can pass the values in $check from pass.php to a controller file (reset.php)??? i'm facing this problem because the render function i'm using in this page (and on other pages too) works only for templates and not for controllers...
after a few changes, my pass.php looks thus:

Ah, i hadn't even looked at the code to realize you were going for an MVC approach, sorry. I've not done very much MVC, and what I have done i just used the yii framework. That said, passing values from one php file to another can be done with 1) sessions 2)request values(post or get, not actually $_REQUEST) 3) cookies, or a file to pass values. Rather than list examples of each, you can see videos of each approach in action at http://jream.com/learning/videos/php-basics

thanks for you help mate...i m facing a new issue at present, could you please help??
i'm currently working on a health website, and i wish to create a page on the website that automatically fetches top articles from a website like http://health.yahoo.net and displays them... i've thought about this for really a long time, but i have no idea on what to do and i ve heard of other people doing similar things like getting their website to display top trending youtube videos, etc... so i really wanted to do this...

2.and another question weighing me down right now is... on another webpage in my health website, i wish to create a search box, where users can type their medical queries and it will automatically display results from google and wikipedia (a search box for each)... the issue is i dont want them to be directed to the homepages of google or wikipedia,(which is pretty simple to do) but instead be shown results directly from them... how could i go about this??