Jump to content

kirk2010

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

kirk2010's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks for trying to help, but I don't even know how to create a loop, giving myself 30minutes before I give up. Php is so frustrating.
  2. Yeah I've tried to use the explode function before. I'm just not sure where to place the code, and on which page. Sorry for my newbieness. I tried adding $userinfo=explode('|',$data) in my register process, and I just got a parse error, saying I have an unnecessary '{' when in fact it was necessary before I entered that line.
  3. Thanks for the second link waterssaz. That is what I'm trying to achieve. Though my file to read from will have many different usernames and passwords, how do I differentiate between each username and password combo? This is my login page currently, you're only able to log in if you enter the 'testuser' '123456' combo. <?php $username=$_POST['name']; $password=$_POST['password']; if($username=="testuser" && $password=="123456") { $_SESSION['user']=$username; echo "Well done you have logged in as ".$_SESSION['user']; echo "<br/><a href='guestbook.php'>Click here to go to the homepage</a> "; echo ('<meta http-equiv="Refresh" content="3;url=guestbook.php" />'); }else{ echo "<br/><a href='loginpage.php'>Click here to go to back and try again</a>"; } ?> My register process page is this: $username=$_POST['name']; $password=$_POST['password']; $data = "$username | $password \n"; { $file = "registerdetails.txt"; if (!$file_handle = fopen($file,"a+")) { echo "Cannot open file"; } if (!fwrite($file_handle,($data))) { echo "Cannot write to file"; } fclose($file_handle); echo ('<br /><br /><center><div style="background:#ffffff url(ok.jpg) no-repeat left;">You have successfuly registered.<br />Please log in.</div></center>'); echo ('<meta http-equiv="Refresh" content="2;url=loginpage.php" />'); The data is being recorded in my txt file after it has been entered to the register page, I need to use this data to log in. Thanks all for the help, the links are helping
  4. I realise this may seem like a strange request, but the file I'm creating is not for public use, it's just to get me stuck into PHP for the first time. You say that it is possible, how would I go about doing it?
  5. Thanks for your reply. The post is useful, and I'll be referring to it in my next project, no doubt. As I've only just started PHP, our lecturer isn't expecting too much. I know not using a database isn't the norm, which is why I'm getting my data from a text file. I'm after an If statement that connects the log in page with the register.txt file. If word 1 matches username + word 2 matches password, allow log in. Have you looked at my files? It may give you an insight into what I'm trying to achieve. Thanks again for the help.
  6. No help at all? ??? If you need any more information just ask.
  7. Hi, I've only just started to learn PHP, I've been working on a guestbook for about 7 hours now with little progress. I have a page to update the messages. I have a register page - you enter your User Name and Password, and it gets stored in a text file. I also have a login page. I'm attempting to grab data from my registered users text file, and match them up on the log in page. I'm not after a sophisticated system, just simply getting the data from a text file and seeing if the username and password match to enable the user to log in. Any help is appreciated, I've attached everything I have. [attachment deleted by admin]
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.