mercredi 29 avril 2015

How to check line in file (php)

I'm new to php and wanted to make a simple php script to check a form of my html site.

To answer the questions: I have a file, that's the Name of the User and I want to check if the password that is in there (line 1) is the same as the one in the "password" field on my site. And when it's like this it should open a site.

Maybe a check if the file exists would be nice :D

This is my php-file, it's named "check.php":


    $f = fopen($_POST["name"], "r");

    $theData = fgets($f);

    if ($_POST["pw"] == $theData) {
        $ch = curl_init("");


This is my html-file:

<form action="check.php" method='post'>
    <b>Name: </b><input name="name" type="text" value="Name"> <br>
    <b>Password: </b><input name="pw" type="text" value="Passwort"> <br>
    <input type="submit" value="Check">
    <input type="reset" value="Reset">

I hope one can help me ^^ I've tried a lot of things now, nothing really worked.

Aucun commentaire:

Enregistrer un commentaire