How to allow anonymous users to edit their posts by providing only it's password?

I need some help with a small Classfieds site I’m currently trying to
build.

I am letting users publish their classfieds for free and without
registering. But I also want to let them be able to edit their
classfieds at a later point. That’s why I am asking them to provide a
password for their classfied.

What I need to do and can’t accomplish is:

- Show a "login" form to the user
- He has to provide the ID of the classfied ( he knows it, it's in

the description)
- He has to provide the password he entered when creating the
classfied

If those 2 match he is redirected to the edit page of the classfied.

The password is saved in the classfieds table. I can save it as a string
or if your example needs it to be hashed, as a hashed_password + salt (
doesn’t matter to me ).

Thank you for your help!

I hope I’m mistaken, but this appears to be a trivial (<10 min.)
homework assignment, in which case you should not be asking for
assistance on this forum. Nevertheless, your database should have (at
least) the following fields – id (of course), ad information (string
or text), and password (string). The form on which a user enters ad
information should allow the user to input the password (which is then
associated with the ad by id and password). The main page can then
have an “Edit Ad” button (or link) that links to a login page which
will have input boxes for the ad id (which may be displayed on the
classified page) and the password. Alternatively, or in addition, the
classified page can have an “Edit” button (or link) which goes to an
Edit Current Ad page (where only the password is required, as the ad
id should be passed as a hidden field). Either way, the Login or Edit
Current Page should link to a page for editing the specified ad.

I’m not sure what else your assignment calls for, but with the
foregoing, you should be able to figure out how to create the
database, create the views for adding a classified, displaying the
classified (with the ad id and an “Edit” link), displaying a view with
a link to a Login page, etc.

If you have any other questions, please ask after you have some code
to show. However, I don’t think anyone on here wants to do your
complete homework project.