perfexa Posted April 10, 2011 Share Posted April 10, 2011 Hi, Please can someone help me, i am trying to add code so when a user enters a word, number or even an email address in the facetimeid textbox field thats been listed as banned by me it wont allow them to proceed Please find the below code of my page please can someone help me <?php require ('settings.php'); require('functions.php'); session_start(); if ($_GET['do']=='start') { if ($_POST['facetimeid']=='') { header("Location:".SITE_BASE); } else { include('init.php'); } } elseif ($_GET['do']=='random') { // Make sure we have a session, otherwise redirect to homepage if ($_SESSION['CurrentUser']=='') { header("Location:".SITE_BASE); } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="tr-TR"> <head> <title>Facekandi for iPhone</title> <base href="<?php print SITE_BASE; ?>/" /> <meta name="keywords" content="facekandi, livecam, webcam, facelette, facetime chat, iphone 4g, facetime, itouch 4g, face chatroom, video chat, world video chat, "> <meta name="description" content="Facekandi is an iPhone and iPad application designed for randomly pairing you with people all over the world. Try it today to chat, engage and have fun in all ;kinds of ways. "> <link rel="stylesheet" type="text/css" href="style.css" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width" /> <link href="http://facekandi.com/iphone/favicon.ico" rel="icon" type="image/x-icon" /> </head> <body> <img src="facekandi.png" alt="" width="265" height="39" /> <?php if ($_GET['do']=='start') { $ruser = getRandomUser($_POST['facetimeid']); $ruser=$ruser['UserFacetimeID']; ?> <div class="content"> Great! You can now start a Facetime session with <a href="external://facetime://<?php echo $ruser; ?>"><?php echo $ruser; ?></a>! <br/> <form action="index.php?do=random" method="post" /><input type="image" src="next.png" class="usersubmit" /><p> </p> <p><font color="#C0C0C0">Go social facekandi crazy..</font></p><!-- AddThis Button BEGIN --> <div class="addthis_toolbox addthis_default_style addthis_32x32_style"> <a class="addthis_button_preferred_1"></a> <a class="addthis_button_preferred_2"></a> <a class="addthis_button_preferred_3"></a> <a class="addthis_button_preferred_4"></a> <a class="addthis_button_compact"></a> </div> <script type="text/javascript">var addthis_config ;= {"data_track_clickback":true};</script> <script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#username=facelette"></script> <!-- AddThis Button END --> <p> </p> </form> </div> <?php } elseif ($_GET['do']=='random') { $ruser = getRandomUser($_SESSION['CurrentUser']); $ruser=$ruser['UserFacetimeID']; ?> <div class="content"> Here's a random Facekandi user for ;you: <a href="external://facetime://<?php echo $ruser; ?>"><?php echo $ruser; ?></a> <br/> <form action="index.php?do=random" method="post" /><input type="image" src="next.png" class="usersubmit" /><p> </p> <p><font color="#C0C0C0" size="3">Share Facekandi with everyone..</font></p> <!-- AddThis Button BEGIN --> <div class="addthis_toolbox addthis_default_style addthis_32x32_style"> <a class="addthis_button_preferred_1"></a> <a class="addthis_button_preferred_2"></a> <a class="addthis_button_preferred_3"></a> <a class="addthis_button_preferred_4"></a> <a class="addthis_button_compact"></a> </div> <script type="text/javascript">var addthis_config ;= {"data_track_clickback":true};</script> <script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4d8a80540dedf0f0"></script>; <!-- AddThis Button END --> <p> </p> <p> </p> <p align="center"></p> <p align="center"> <!--Insert your Adsense code --> <!--Adsense code end--></font></a></p> </form> </div> <?php } else { ?> <form action="index.php?do=start" method="post" > <fieldset style="width: 120; height: 60; font-size: 18px;"> <legend><span class="Facekandi"><font color="#F0F0F0">Enter your Apple Facetime ID</font><font color="#0066FF">*</font></span></legend> <input type="text" name="facetimeid" class="userinput" maxlength="35" size="37" /> </fieldset> <input type="image" src="button.png" class="usersubmit" /> <br /> <br /> <p align="left" class="smallprint"><font color="#0066FF">*</font>Your Facetime ID is either your <b> iPhone mobile number</b> or <b>email address</b> you ;use for Facetime.<br /> <br/> </p> <p align="left" class="smallprint"><font color="#FF3E3E" size="1">Once you exit the Facekandi application your session will terminate from our server</font><br /> <br /> Remember: be safe and most importantly have fun!</p> <p align="left"></p> </form> <?php } ?> </div> <!-- insert your Google Analytics here --> <!-- End of Google Analytics code --> </body> </html> MOD EDIT: . . . tags added. Quote Link to comment https://forums.phpfreaks.com/topic/233298-urgent-ban-specific-words-in-textfield/ Share on other sites More sharing options...
Pikachu2000 Posted April 10, 2011 Share Posted April 10, 2011 Do not mark threads in such a manner as to imply that the problem is 'urgent'. Your problem is no more important than anyone else's. When posting code, enclose it within . . . tags. Quote Link to comment https://forums.phpfreaks.com/topic/233298-urgent-ban-specific-words-in-textfield/#findComment-1199776 Share on other sites More sharing options...
perfexa Posted April 10, 2011 Author Share Posted April 10, 2011 Sorry, I am a newbie to this forum so am not acustom yet, am a rookie when it comes to coding and can peice things together just but as simple as it may sound to you and others i have no idea what to do on how to resolve this or to where to put the code Sorry Quote Link to comment https://forums.phpfreaks.com/topic/233298-urgent-ban-specific-words-in-textfield/#findComment-1199780 Share on other sites More sharing options...
cssfreakie Posted April 10, 2011 Share Posted April 10, 2011 I am not a super start at this nor do i understand why you post this under third party software. BUt i came up with the following. I am not sure if this is the most efficient way but that just popped up. depending on the method you store your badwords, you wil most likely fetch them as an array, so i made a static one. The following works and should be fairly easy to implement. If you read it right. <?php $badwords = array( 'monkey', 'banana', 'justin bieber', 'barbara streisant' ); $pattern = implode('|', $badwords); echo $pattern; if(isset($_POST['submit'])&& !empty($_POST['input'])){ if(preg_match("~$pattern~", $_POST['input'])){ echo 'die!'; }else{ echo 'proceed'; } }else{ echo 'fill in some stuff'; } ?> <form action="" method="post"> <input type="text" value="" name="input" /> <input type="submit" name="submit" value="submit" /> </form> Quote Link to comment https://forums.phpfreaks.com/topic/233298-urgent-ban-specific-words-in-textfield/#findComment-1199835 Share on other sites More sharing options...
perfexa Posted April 11, 2011 Author Share Posted April 11, 2011 Hi all, i'm very sorry that i've posted in the wrong catogary, when it comes to this i have honestly no idea and i even admit to say am thick :-\ Please can someone help me acheive by showing me what to put and where, it will be highly appriciated Quote Link to comment https://forums.phpfreaks.com/topic/233298-urgent-ban-specific-words-in-textfield/#findComment-1200022 Share on other sites More sharing options...
cssfreakie Posted April 11, 2011 Share Posted April 11, 2011 May i assume you didn't saw or understand the code i created above? because that was a badword filter. If you want people to write code for you and your not eager in trying it your self, maybe even the freelance forum is the best place to ask for help. Quote Link to comment https://forums.phpfreaks.com/topic/233298-urgent-ban-specific-words-in-textfield/#findComment-1200083 Share on other sites More sharing options...
perfexa Posted April 11, 2011 Author Share Posted April 11, 2011 Sorry, I did try it, either am not placing it right or it's not working, I'll be honest am a rookie and just need pointing in the right direction Quote Link to comment https://forums.phpfreaks.com/topic/233298-urgent-ban-specific-words-in-textfield/#findComment-1200085 Share on other sites More sharing options...
cssfreakie Posted April 11, 2011 Share Posted April 11, 2011 it just works out of the box, but since it's php code you need to have a server (like wamp). you can't just open that up in a browser. And not working, what do you mean with that? blank page? we are no visionaries. Quote Link to comment https://forums.phpfreaks.com/topic/233298-urgent-ban-specific-words-in-textfield/#findComment-1200088 Share on other sites More sharing options...
perfexa Posted April 11, 2011 Author Share Posted April 11, 2011 Im hosting my script on a Linux VPS server I do have many years experience in servers and code I've tried alsorts including your code and all it does is take me to the normal screen without banning the word! Quote Link to comment https://forums.phpfreaks.com/topic/233298-urgent-ban-specific-words-in-textfield/#findComment-1200093 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.