Jump to content

[SOLVED] Someone running php on my site...


blufish

Recommended Posts

Okay so a couple of weeks ago someone ran a php script on my site, which messed up the homepage.  The ran the script through the page creator (allows people to make webpages), I wasn't stripping tags because I wanted to allow html and javascript to be able to get through without any trouble.  So the question I wish to ask is if I told my code to delete everything between the "<?php" and "?>" tags what if they just wrote code like:

echo "Hello World";

would that code be executed by my program or when someone tried to view the page would it still have the "echo".  Essentially what I'm asking is if I display whatever someone writes on my site except for anything they write between the "<?php" and "?>" tags would they still be able to write php code and get it executed?

 

Thanks, Blufish

Link to comment
Share on other sites

Just tested it,

 

<?php

 

$var = htmlspecialchars($_POST['var']);

 

if ($_POST['submit']){

 

echo ''.$var.'';

 

}

 

?>

<html>

<head>

</head>

<body>

<form method="post">

<textarea name="var" rows="5" cols="30"></textarea><br />

<input type="submit" name="submit" />

</form>

</body>

</html>

 

That works fine for me.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.