Jump to content

URGENT, ban specific words in textfield


perfexa

Recommended Posts

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, oth​erwise 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-T​R">
<head>
<title>Facekandi for iPhone</title>
<base href="<?php print SITE_BASE; ?>/" />
<meta name="keywords" content="facekandi, livecam,&n​bsp;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&nb​sp;chat, engage and have fun in all ​;kinds of ways. ">
<link rel="stylesheet" type="text/css" href="style.c​ss" />
<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" hei​ght="39" />
<?php
if ($_GET['do']=='start') { 
        $ruser = getRandomUser($_POST['facetimeid']);
        $ruser=$ruser['UserFacetimeID'];
?>
<div class="content">
Great! You can now start a Facetim​e session with <a href="external://facetime​://<?php echo $ruser; ?>"><?php echo $ruser; ?></a>!
<br/>
<form action="index.php?do=random" method="post" /&g​t;<input type="image" src="next.png" class="usersubm​it" /><p> </p>
    <p><font color="#C0C0C0">Go&n​bsp;social facekandi crazy..</font></p><!--&n​bsp;AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style ad​dthis_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" /&g​t;<input type="image" src="next.png" class="usersubm​it" /><p> </p>
    <p><font color="#C0C0C0" si​ze="3">Share Facekandi with everyone..</font>&​lt;/p>
<!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style ad​dthis_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&g​t;
    </form>
</div>


<?php } else { ?>
<form action="index.php?do=start" method="post" >
<fieldset style="width: 120; height: 60; f​ont-size: 18px;">
<legend><span class="Facekandi"><font color="​#F0F0F0">Enter your Apple Facetime ID</font&​gt;<font color="#0066FF">*</font></span></le​gend>
<input type="text" name="facetimeid" class="userinpu​t" maxlength="35" size="37" />
</fieldset>

<input type="image" src="button.png" class="usersubm​it" />
<br />
<br />
<p align="left" class="smallprint"><font color​="#0066FF">*</font>Your Facetime ID is ei​ther 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 Face​kandi application your session will terminate​ from our server</font><br />
  <br />
  Remember: be safe and most import​antly  have fun!</p>
<p align="left"></p>
</form>

<?php } ?>
</div>
<!-- insert your Google Analytics here&nbs​p;-->

<!-- End of Google Analytics code --&​gt;
</body>
</html> 

 

MOD EDIT:

 . . . 

tags added.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

 

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.