|
Posted by J.O. Aho on 07/10/07 04:07
cover wrote:
> I'm trying to password the 'update' page of a MySQL database that runs
> on a company intranet w/Apache and PHP. I don't care about the
> 'entry' page to this database - just the 'update' page and want the
> five people (or so) who may be doing updates, to enter only a password
> and then write that password to the MySQL database field.
>
> On my entry page as the last part of my form, I'm using;
> <tr>
> <td>Password:</td><td align="left"><input type="password"
> name="password" size="15" maxlength="15" value=""></td>
> </tr>
> <tr>
> <td colspan="4" align="center"><input type="submit"
> value="Enter"></td>
> </tr>
> </table>
> </form>
>
> What I'm looking for is pointers on how to make the second page of
> this work query work based on meeting the criteria of a password
> element - i.e: 2nd page
>
> $password = $_POST['password'];
>
> if (!$password = 'password stored in database' allow write))
> {
> else echo PASSWORD must match file on record for this user;
> }
>
$query="SELECT * FROM table WHERE password_column='{$_POST['password']}'";
$res=mysql_query($query);
if(!mysql_num_rows($res)) {
echo "sorry, the wrong password";
exit;
}
echo "Wow, you know the password";
--
//Aho
Navigation:
[Reply to this message]
|