Menu
This thred is for questions that have to do with our shout box. We decided to start a new thred so we stop posting hundreds of threds that all have to do with the same thing. Jona, we are posting the code so you can help us better cause we were having some mis-communication problems! Here is our current code:
[b]EDIT:
Our current problem is the spaces problem we were disscussing in the other thred! Thanks for all your help and help is welcomed from all others as well. ?
[code=php]
$variable = htmlspecialchars($variable);[/code]
[code=php]$message = $_POST['c'];
if (!ereg("^[A-Za-z0-9@.,/:)(}{_ ]{3,15}$",$message))
{ echo "You must enter a valid message!."; exit; }[/code]
That works and dosn't allow anything but what I want, but it also allows messages with just spaces. Is there something I could add to that to make it allow spaces but not messages that are just spaces? I think If I can get this to work generally then I would be able to impliment it into the tags as well. Thanks.[i]Originally posted by mjdimick [/i]
[B]Thanks Jona! Where exactally would I put that... I tried just anywhere but it didn't seem to work.[/b][/quote]
[i]Originally posed by mjdimick[/i]
[b]I have been doing some more research and found this:[code=php]$message = $_POST['c'];
That works and dosn't allow anything but what I want, but it also allows messages with just spaces. Is there something I could add to that to make it allow spaces but not messages that are just spaces? I think If I can get this to work generally then I would be able to impliment it into the tags as well. Thanks. [/B][/QUOTE]
if (!ereg("^[A-Za-z0-9@.,/:)(}{_ ]{3,15}$",$message))
{ echo "You must enter a valid message!."; exit; }[/code]
[code=php]
$c = str_replace(" ", " ", $c);
[/code]
[i]Originally posted by Jona [/i]I just tried the s thing and it didn't work. Here is my code:
[B][font=arial]About the regular expression, try replacing the space that was in the original one with s?[/font][/B][/QUOTE]
$message = $_POST['c'];
if (!ereg("^[A-Za-z0-9@.,/:&;)(}{_s]{3,225}$",$message))
{ echo "You must enter a valid message!"; exit; }
[i]Originally posted by Jona [/i]How does that compact the spaces?
[B][font=arial]For that, use:[code=php]$c = str_replace(" ", " ", $c);[/code]
[/font][/B][/QUOTE]
[i]Originally posted by mjdimick [/i]
[B]I just tried the s thing and it didn't work.[/b][/quote]
[i]Originally posted by mjdimick[/i]
[b]How does that compact the spaces? [/B][/QUOTE]
[i]Originally posted by mjdimick [/i]
[B]Oh well I tried typing in a message with a bunch of spaces in it and it does compact them but when looking in the source it shows them so that kinda bothered me but I guess it's ok if you say so! ? [/B][/QUOTE]
$message = $_POST['c'];
if (!ereg("^[A-Za-z0-9@.,/:&;)(}{_s?]{3,225}$",$message))
{ echo "You must enter a valid message!"; exit; }
I'm really sorry that I keep pestering you but this little thing is being stubern lol...[i]Originally posted by mjdimick [/i]
[B]Well nothing really good to report but I sent the files to Jona and he's working on them on his server because I couldn't figure it out after many trys! ? [/B][/QUOTE]
[code=php]
<?php
header('WWW-Authenticate: Negotiate');
?>
[/code]
[i]Originally posted by sciguyryan [/i]
[B]A question for you Jona - how do you use this:
[code=php]
<?php
header('WWW-Authenticate: Negotiate');
?>
[/code]
I mean how do you set the password and username for it? [/B][/QUOTE]
[i]Originally posted by sciguyryan [/i]
[B]:'( Noooo! [/B][/QUOTE]Yeah sorry! I just found out too. :(
[i]Originally posted by mjdimick [/i]
[B]Yes! It works... But the tags are still allowing blank messages. If i enter [ b ]<- space here ->[ / b ] it will still allow it! Hmm... [/B][/QUOTE]
if(preg_match("/[(b|i|u|s)]s*[/\1]/", $_POST['c'])){
echo("You must enter a valid message!"); exit;
}
To this line:if(preg_match("/[(b|i|u|s|color|font)]s*[/\1]/", $_POST['c'])){
echo("You must enter a valid message!"); exit;
}
But wasn't sure. Would there be anything else to change as well? Thank you so much for all your help.[code=php]if(preg_match("/\[(b|i|u|s|color=.+|font=.+)\]\s*[\/(\\1|color|font)\]/", $_POST['c'])) {
echo("You must enter a valid message!");
exit();
}[/code]
[i]Originally posted by mjdimick [/i]
[B]Oh ok... cool! Thanks! Your the best! ? [/B][/QUOTE]
[i]Originally posted by mjdimick [/i]
[B]Thank you Pyro and Jona...
It's all working perfectly now thanks to you guys. You can go[URL=http://mjdimick.zacknetwork.net/shout.php]here[/URL] to see and test it if you feel like it. Once again, thank you for all your help. ? [/B][/QUOTE]
[code=php]
<?php
# Data file
$file = "data.txt";
# Take out all text and just
# leave the quotes and parentheses,
# and you'll wind up with a blank file
$info = "This is the new data inside the text file.";
$handle = @fopen($file, "w");
fwrite($info);
fclose($handle);
?>
[/code]
[i]Originally posted by mjdimick [/i]
[B]Well the secret code will be something hard to guess that only admins know in the end. This function would be for deleting messages that are abusive or un-wanted without having to clear the whole thing. ? [/B][/QUOTE]
[i]Originally posted by mjdimick [/i]
[B]Hey Jona! Where did you disappear to? I would really like to call this project done but I can't until I get this last function working and I can't figure it out. Thanks for your help. ? [/B][/QUOTE]
[i]Originally posted by sciguyryan [/i]
[B]Oh, sorry to hear that. [/B][/QUOTE]
[i]Originally posted by Jona [/i]
[B][font=arial]Don't be sorry for me--I'm in a Los Angeles hotel (a Marriot, if you know what that is), having a grand time! ? [/font]
[b][J]ona[/b] [/B][/QUOTE]
0.1.9 — BETA 6.2