i need help on php

  • pureone_36
  • Novice
  • Novice
  • pureone_36
  • Posts: 24
  • Loc: earth

Post 3+ Months Ago

hello everyone i am new here and also new to php i think this is the right forum to post in i never saw anything in the website are

this is the task that i am trying to do

i am making a simple data base with a txt file i want to encode the data base with md5 check sums i kinda know how to do that im half way there on it. but the problem i am having is how to append data that a user has submited this is my html form theres nothing wrong with it

Code: [ Select ]
<html>
<body><center>
<form name="overfile" method="submit"
action="over.php"><input name="username"

type="text" value="create a user name"

/><br/><input name="pasword" type="password"

value=""/><input

type="submit"></form></center></body>
</html>
  1. <html>
  2. <body><center>
  3. <form name="overfile" method="submit"
  4. action="over.php"><input name="username"
  5. type="text" value="create a user name"
  6. /><br/><input name="pasword" type="password"
  7. value=""/><input
  8. type="submit"></form></center></body>
  9. </html>


but its so you understand what im working with

now what i want to happen on the php form is the user name and pass that were submited get appened to a txt file
i cant find much on the
Code: [ Select ]
fopen("database.txt" ,"a")


function i can find info on the fopen function but not on the append part of it i want to know how i can append the user name and pass submited and also turn the password into a md5 check sum

this is the form for the php file it dont work i know that much


Code: [ Select ]
<?php
$user =$_REQUEST["username"]
$pass =$_REQUEST["password"]
$f=fopen("over.txt","a")(
$user . " " . md5($pass));
?>
  1. <?php
  2. $user =$_REQUEST["username"]
  3. $pass =$_REQUEST["password"]
  4. $f=fopen("over.txt","a")(
  5. $user . " " . md5($pass));
  6. ?>
  • SpooF
  • ٩๏̯͡๏۶
  • Bronze Member
  • User avatar
  • Posts: 3422
  • Loc: Richland, WA

Post 3+ Months Ago

in your form your name should be password, not pasword, that sure if that will fix your problem i dont really know how to do that im a noob too ^^
  • pureone_36
  • Novice
  • Novice
  • pureone_36
  • Posts: 24
  • Loc: earth

Post 3+ Months Ago

duh!
  • pureone_36
  • Novice
  • Novice
  • pureone_36
  • Posts: 24
  • Loc: earth

Post 3+ Months Ago

well i corrected that and it still dont work


anyone else have any ideas
  • cipher
  • Graduate
  • Graduate
  • User avatar
  • Posts: 157

Post 3+ Months Ago

first you should say what is the error that you are getting. I just took a glance at it and i think that the error must have come about due to your file I/O scripting. When you post the error i will see what i can do.
  • pureone_36
  • Novice
  • Novice
  • pureone_36
  • Posts: 24
  • Loc: earth

Post 3+ Months Ago

cipher wrote:
first you should say what is the error that you are getting. I just took a glance at it and i think that the error must have come about due to your file I/O scripting. When you post the error i will see what i can do.


ok thanks

this is the error



Quote:
Parse error: parse error in c:\apache\htdocs\over.php on line 3
  • SpooF
  • ٩๏̯͡๏۶
  • Bronze Member
  • User avatar
  • Posts: 3422
  • Loc: Richland, WA

Post 3+ Months Ago

whats on lines 2 3 and 4?
  • Scorpius
  • Proficient
  • Proficient
  • User avatar
  • Posts: 401
  • Loc: Scorpion Hole

Post 3+ Months Ago

Ok well you need to have your file look like this:
PHP Code: [ Select ]
<?php
 
$user = $_REQUEST["username"];
 
$pass = $_REQUEST["password"];
 
$f=fopen("over.txt", "w+");
 
$user . " " . md5($pass); // don't know wht your trying to do here?
 
?>
  1. <?php
  2.  
  3. $user = $_REQUEST["username"];
  4.  
  5. $pass = $_REQUEST["password"];
  6.  
  7. $f=fopen("over.txt", "w+");
  8.  
  9. $user . " " . md5($pass); // don't know wht your trying to do here?
  10.  
  11. ?>

If you are wanting to write something to the file add:
PHP Code: [ Select ]
$content = "Message you want to add to the file.";
 
if(fwrite($f, $content) === FALSE) {
 
     echo "Cannot write to file.";
 
     exit;
 
} else {
 
     echo "Information successfully written.";
 
     fclose($f);
 
}
  1. $content = "Message you want to add to the file.";
  2.  
  3. if(fwrite($f, $content) === FALSE) {
  4.  
  5.      echo "Cannot write to file.";
  6.  
  7.      exit;
  8.  
  9. } else {
  10.  
  11.      echo "Information successfully written.";
  12.  
  13.      fclose($f);
  14.  
  15. }

Hope that helps you out some.

Post Information

  • Total Posts in this topic: 8 posts
  • Users browsing this forum: No registered users and 139 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.