Jump to content

Disallow URL in php Form variable


wads24

Recommended Posts

So, right now if the form field variable is blank it errors out with below code, but I have been getting a lot of spam submissions on my form and they have been typing in URLs in field.  How can I modify the below so that if they put a URL that is will also error out?  Thanks in advance for any help!

    else if(!$_POST['description'])
    {
        print "<table style='border-collapse: collapse' id='AutoNumber1' border='0' bordercolor='#111111' cellpadding='0' cellspacing='0' width='100%'>
  <tr>
    <td width='38%'>
    <p align='right'>
    <img class='decoded' alt='error.png' src='error.png'></td>
    <td width='26%'>
    <p align='center'><u><font size='5' color='#FF0000'><b>DESCRIPTION ERROR</b></font></u></td>
    <td width='36%'>
    <img class='decoded' alt='error.png' src='error.png'></td>
  </tr>
  <tr>
    <td colspan='3' width='100%'>
    <p align='center'><font size='1'>The Site Description field cannot be blank, or cannot include and URLs.</font></td>
  </tr>
  <tr>
    <td width='100%' colspan='3'> </td>
  </tr>
  <tr>
    <td width='100%' colspan='3'>
    <p align='center'><a href='javascript:javascript:history.go(-1)'>Click here
    to go back to previous page</a></td>
  </tr>
</table>";}
Link to comment
https://forums.phpfreaks.com/topic/278130-disallow-url-in-php-form-variable/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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