Jump to content

Code to Display Box Instead of Posting?


Guest

Recommended Posts

Bad title, I know.

What I mean is I have a code that shows a pop-up error message if you try to post with a username someone else has.

Well, I use this code for my user/pass/message fields:

 

$user = preg_replace("/[^A-Z a-z0-9]/", "", $_POST['user']);
$password = preg_replace("/[^A-Za-z0-9]/", "", $_POST['password']);
$message = preg_replace("/[^A-Za-z0-9]/", "", $_POST['message']);

 

What that does is, if you post with, say, a less than or greater than sign, or some other whack character, it makes the field blank for whichever field(s) you enter other characters into.  So really, when someone posts on my forums with a character I do not want them to use in their user/message, it makes the message completely blank, no matter what other allowed characters are used, and the same with the username...so the post will show up without a poster.

 

My question is, what is a code to use so a pop-up box would show up instead of letting the post go through and post blanks?  Doesn't even have to be a pop-up box, just something to say to the user, "Hey, you can't use (insert disapproved character(s) here)" and to have the post not go through.

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.