PDA

View Full Version : Drugs replace your addtag.php



Muhammad Haris
08-08-2006, 09:47 PM
<?php

// This gets the information from the form
$name = $_POST['name'];
$website = $_POST['website'];
$message = $_POST['message'];

// This takes the smiley code in the message and turns it into a smiley
$code = array(
'/:\)/',
'/:P/',
'/:D/'
);

$image = array(
'<img src="smileys/smile.gif">',
'<img src="smileys/razz.gif">',
'<img src="smileys/biggrin.gif">'
);
$formatted = preg_replace($code, $image, $message);

if(empty($name) OR empty($website) OR empty($message))
{
echo "Please fill it out the name,website or message field.";
}
else
{
// Set up how it's going to be displayed.
$tag = ("<font size=\"2\" face=\"Arial\">
<a href=\"htmlspecialchars($website);\" target=\"_blank\">htmlspecialchars($name)</a>: htmlspecialchars($formatted);
</font><br>");

// Gather the data currently in the file
$read = fopen("content.txt", "r");
$contents = fread($read, filesize('content.txt'));
fclose($read);

// Open the file and write the tag to it
$write = fopen("content.txt", "w");
fwrite($write, "$tag $contents");
fclose($write);
}

// Refresh!
print "<meta http-equiv=\"refresh\" content=\"0;shoutbox.php\">";

?>


After replacing your addtag.php with the above code, Clear up everything which is in content.txt and let me know.

Please remove any refresh html codes which I told you before because the refresh code is intergated in the above code.

Drugs
08-08-2006, 09:48 PM
Lol the title looks wrong, it looks like it is saying If you take drugs it will replace the addtag.php

Muhammad Haris
08-08-2006, 09:49 PM
Lol the title looks wrong, it looks like it is saying If you take drugs it will replace the addtag.php

Nevermind the title, When you are done. Let me know of any bugs! :)

ClubTime
08-08-2006, 09:51 PM
Lmao. Ryan shut up lol the boy is trying to help you :)

Drugs
08-08-2006, 09:53 PM
Alright i done it but i thought i would say, you know the refresh thing, the bit where you put 15 is meant to be 0 because thats saying, how many seconds till when you have submitted how many seconds till it takes you back to the main page.

Edit: Nah, broke.

Submit something.

Muhammad Haris
08-08-2006, 09:54 PM
Alright i done it but i thought i would say, you know the refresh thing, the bit where you put 15 is meant to be 0 because thats saying, how many seconds till when you have submitted how many seconds till it takes you back to the main page.

Edit: Nah, broke.

Submit something.

Okay, Please link me. I will check any errors and fix them.

You can change the 15 to 0

Drugs
08-08-2006, 09:55 PM
Yeah i changed the 15 to 0 and that works okay, the 'you forgot to fill something in' changes in 0 seconds too, but it doesn't post it * Which is good *

But when you type something out for real it breaks.

http://www.pixelresources.co.uk/shoutbox/shoutbox.php

Edit: I see whats happened, you put in the html disable thing in the display bit, also bear in mind i do not use the $website bit only $name and $message

Muhammad Haris
08-08-2006, 09:59 PM
Fixing it. Patience! :)

Drugs
08-08-2006, 10:00 PM
Alrightey, you will get something in return for this, its just you wont find out till my site is up ;P

Drugs
08-08-2006, 10:00 PM
Alrightey, you will get something in return for this, its just you wont find out till my site is up ;P

Correctable (Forum Moderator) - Please do no double post, simply edit your previous one.

ClubTime
08-08-2006, 10:06 PM
Try this :)



<?php

// This gets the information from the form
$name = $_POST['name'];
$message = $_POST['message'];

// This takes the smiley code in the message and turns it into a smiley
$code = array(
'/:\)/',
'/:P/',
'/:D/'
);

$image = array(
'<img src="smileys/smile.gif">',
'<img src="smileys/razz.gif">',
'<img src="smileys/biggrin.gif">'
);
$formatted = preg_replace($code, $image, $message);

if(empty($name) OR empty($message))
{
echo "Please fill it out the name,website or message field.";
}
else
{
// Set up how it's going to be displayed.
$tag = ("<font size=\"2\" face=\"Arial\">
<a href=\"htmlspecialchars($website);\" target=\"_blank\">htmlspecialchars($name)</a>: htmlspecialchars($formatted);
</font><br>");

// Gather the data currently in the file
$read = fopen("content.txt", "r");
$contents = fread($read, filesize('content.txt'));
fclose($read);

// Open the file and write the tag to it
$write = fopen("content.txt", "w");
fwrite($write, "$tag $contents");
fclose($write);
}

// Refresh!
print "<meta http-equiv=\"refresh\" content=\"0;shoutbox.php\">";

?>


Btw have you CHMODED content.txt to 777?

Muhammad Haris
08-08-2006, 10:06 PM
<?php

// This gets the information from the form
$name = $_POST['name'];
$website = $_POST['website'];
$message = $_POST['message'];

// This takes the smiley code in the message and turns it into a smiley
$code = array(
'/:\)/',
'/:P/',
'/:D/'
);

$image = array(
'<img src="smileys/smile.gif">',
'<img src="smileys/razz.gif">',
'<img src="smileys/biggrin.gif">'
);
$formatted = preg_replace($code, $image, $message);

if(empty($name) OR empty($website) OR empty($message))
{
echo "Please fill it out the name,website or message field.";
}
else
{
// Set up how it's going to be displayed.
$tag = ("<font size=\"2\" face=\"Arial\">
<a href=\"$website\" target=\"_blank\">$name</a>: $formatted;
</font><br>");

// Gather the data currently in the file
$read = fopen("content.txt", "r");
$contents = fread($read, filesize('content.txt'));
fclose($read);

// Open the file and write the tag to it
$write = fopen("content.txt", "w");
fwrite($write, "$tag $contents");
fclose($write);
}

// Refresh!
print "<meta http-equiv=\"refresh\" content=\"0;shoutbox.php\">";

?>

ClubTime
08-08-2006, 10:06 PM
*removed*

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