Jump to content

Recommended Posts

OK, I'm messing around with PHP.  I am trying to stop it from writing bad words to a file.  Can anyone help?

 

<?

$request = strip_tags($_POST['textfield3']);

$engine = $_POST['engine'];

//$image = $_POST['Image'];

 

 

  $IP = $_SERVER['REMOTE_ADDR'];

  $file=fopen("IPs/$IP".".htm","a+");

                  fwrite($file,"$IP Searched: $request<br><hr><br>");

                  fclose($file);

 

 

  if ($engine == 'Google') {

    if($request != 'porn' || $request != 'sex' || $request != 'fuck' || $request != 'shit') {

  $file=fopen("searches.txt","a+");

fwrite($file,' '."<a href=http://www.google.com/search?q=$request>$request - $engine</a>\n");

fclose($file);

  }

header("Location: http://www.google.com/search?q=$request");

}

 

/*

  if ($engine == 'Google' && $image == '0' ) {

  $file=fopen("searches.txt","a+");

fwrite($file,' '."<a href=http://images.google.com/images?hl=en&q=$request&btnG=Search+Images&gbv=2>$request - $engine (Images)</a>\n");

fclose($file);

header("Location: http://images.google.com/images?hl=en&q=$request&btnG=Search+Images&gbv=2");

}

*/

 

 

elseif ($engine == 'Yahoo') {

if($request != 'porn' || $request != 'sex' || $request != 'fuck' || $request != 'shit') {

$file=fopen("searches.txt","a+");

fwrite($file,' '."<a href=http://search.yahoo.com/search?p=$request>$request - $engine</a>\n");

fclose($file);

}

  header("Location: http://search.yahoo.com/search?p=$request&fr=yfp-t-471&toggle=1&cop=mss&ei=UTF-8");

  }

  elseif ($engine == 'Ask') {

  if($request != 'porn' || $request != 'sex' || $request != 'fuck' || $request != 'shit') {

    $file=fopen("searches.txt","a+");

fwrite($file,' '."<a href=http://www.ask.com/web?q=$request&search=search&qsrc=0&o=0&l=dir>$request - $engine</a>\n");

fclose($file);

  }

  header("Location: http://www.ask.com/web?q=$request&search=search&qsrc=0&o=0&l=dir");

  }

      elseif ($engine == 'Youtube') {

  if($request != 'porn' || $request != 'sex' || $request != 'fuck' || $request != 'shit') {

      $file=fopen("searches.txt","a+");

fwrite($file,' '."<a href=http://youtube.com/results?search_query=$request&search=Search>$request - $engine</a>\n");

fclose($file);

}

  header("Location: http://youtube.com/results?search_query=$request&search=Search");

  }

        elseif ($engine == 'Live') {

if($request != 'porn' || $request != 'sex' || $request != 'fuck' || $request != 'shit') {

      $file=fopen("searches.txt","a+");

fwrite($file,' '."<a href=http://search.live.com/results.aspx?q=$request&mkt=en-us&FORM=LIVSOP&go.x=0&go.y=0&go=Search>$request - $engine</a>\n");

fclose($file);

}

  header("Location: http://search.live.com/results.aspx?q=$request&mkt=en-us&FORM=LIVSOP&go.x=0&go.y=0&go=Search");

  }

            elseif ($engine == 'Blockland') {

if($request != 'porn' || $request != 'sex' || $request != 'fuck' || $request != 'shit') {

      $file=fopen("searches.txt","a+");

fwrite($file,' '."<a href=http://www.google.com/search?q=site%3Ablockland.us+$request&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a>$request - $engine</a>\n");

fclose($file);

}

  header("Location: http://www.google.com/search?q=site%3Ablockland.us+$request&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a");

  }

  elseif ($engine != 'Google' || $engine != 'Yahoo' || $engine != 'Ask'|| $engine != 'Youtube' || $engine != 'Live' || $engine != 'Blockland') {

      echo "<center>There was an error getting the engine to search. Please retry your search.</center>";

  echo "<hr color = red><br>Debug: $engine<br>Debug User IP: " . $_SERVER['REMOTE_ADDR'];

  }

?>

Link to comment
https://forums.phpfreaks.com/topic/67798-noob-needs-help-with-php-d/
Share on other sites

Now I get:

 

Warning: preg_match() [function.preg-match]: Delimiter must not be alphanumeric or backslash in C:\xampp\htdocs\test\result.php on line 14

Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\test\result.php:14) in C:\xampp\htdocs\test\result.php on line 19

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.