Jump to content

Recommended Posts

I have just finished coding the front end of my social integration site for my CCA.

I'm having a slight problem in preventing users from posting cross-side scripting or type scripts in the text box. How can I disallow users/disable users from typing <scripts> in the text area and send to server.

 

 

this is my script.

 

 

<form>
<textarea id="textfm" name="text"; onclick="this.innerHTML = '';" onKeyPress="return submitenter(event)">Say something...</textarea>
<input type="button" value="Share!" onClick="ajaxSubmit();"/>

 

 

the ajax all works

 

 

this is where it saves the code


$text = "<img src='images/say.png' height='20px'/><a href='#'>Anonymous</a> " . $text . "<p style='float:right; color:#C0C0C0' align='right'><img ALIGN=ABSMIDDLE src='images/clock.png' height='20px'> " . date("d/m/y : H:i:s", time())  . "</img></p><hr color='#F0F0F0' width='100%' size='1'/>";
$rip = $_SERVER['REMOTE_ADDR'];
$fp = fopen('log.txt', 'a+');
fwrite($fp, $text);
fclose($fp);
$fp = fopen('ip.txt', 'a+');
fwrite($fp, $rip);
fclose($fp);
readfile('log.txt');
}

Link to comment
https://forums.phpfreaks.com/topic/241712-help/
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.