PDA

View Full Version : HMM HELP ME!



Drugs
09-08-2006, 06:59 PM
Ok for the first bit i need help, on the thing i use normally you have to add users manually to a txt file like this;

User1||password||
User2||password||
User3||password||

And so on, now i am trying to make an automated process and here is what i have;

newuser.php



<html>
<head>
<title>PixelResources Announement Creator</title>
</head>
<body>

<?php
if($_COOKIE['in'] == "1"){}
else{
die("You are not authrised to view this page.");
}
?>

<font size=1> <font face='verdana'>

<FORM name="shout" action="makeuser.php" method="POST">
Username;<br>
<INPUT TYPE="TEXT" name="username" size="20"><br><br>
Password;<br>
<INPUT TYPE="TEXT" name="password" size="20"><br><br>
<INPUT TYPE="Submit" name="submit" value="Create User" size="20">
</FORM>
<br>

</font>

<?php

// Copyright 2006 - 2007 PixelResources

?>

</body>
</html>


and makeuser.php



<?php

$username = $_POST['username'];
$password = $_POST['password'];

if(empty($username) OR empty($password))
{
echo "You forgot to fill in one or more of the form fields..";


}
else
{

echo "

<script language='javascript'>

alert('User successfully added...');

</script>
";
$username = ($username);
$password = ($password);
$tag = ("$username||$password||<br>");


$read = fopen("users/users.html", "r");
$contents = fread($read, filesize('users/users.html'));
fclose($read);

$write = fopen("users/users.html", "w");
fwrite($write, "$tag $contents");
fclose($write);
}

print "<meta http-equiv=\"refresh\" content=\"0;adminindex.php\">";

// Copyright 2006 - 2007 PixelResources

?>


Basically when i do that, it comes out like this in the txt file;

User1||password|| User2||password|| User3||password||

And it doesn't work, i need to to go onto a new line each time i add a user, can someone edit the makeuser.php code so it will do that, thanks!

Fujitsu
09-08-2006, 07:06 PM
<?php

$username = $_POST['username'];
$password = $_POST['password'];

if(empty($username) OR empty($password))
{
echo "You forgot to fill in one or more of the form fields..";


}
else
{

echo "

<script language='javascript'>

alert('User successfully added...');

</script>
";
$username = ($username);
$password = ($password);
$tag = ("<br>$username||$password||<br>");


$read = fopen("users/users.html", "r");
$contents = fread($read, filesize('users/users.html'));
fclose($read);

$write = fopen("users/users.html", "w");
fwrite($write, "$tag $contents");
fclose($write);
}

print "<meta http-equiv=\"refresh\" content=\"0;adminindex.php\">";

// Copyright 2006 - 2007 PixelResources

?>

Internet
09-08-2006, 07:07 PM
I saw something like this... I can't remember if it was on techtuts... Try it (as soon as its back), maybe it'll be a help...

(BTW, Ryan, check the shoutbox!)

Edit: Fujitsu has posted ;)

Drugs
09-08-2006, 09:17 PM
Fujitsu i tried that it doesn't even post it onto the txt file when you do that.

Edit: Actually it just posts;



<br>User1||password||<b>

Fujitsu
09-08-2006, 09:21 PM
I dunno, I'll help tomorrow. Too tired, cba looking at code :P Cba going to bed, I'd rather lie on the sofa on teh laptop atm. Mind you, I'll probably fall asleep on the sofa.

Drugs
09-08-2006, 09:26 PM
Okay :{

webby
09-08-2006, 09:47 PM
Ryan, thanks to these codes PHP is becoming more clear for me :) With all the echo and $username stuff. TY!<£

Drugs
09-08-2006, 09:52 PM
What lol?

Ok anyway..

Want to hide these adverts? Register an account for free!