Jump to content

Php help script


adamriley

Recommended Posts

Submit.php

 

-----------------------------------------------------

<?php
// error_reporting(E_ALL);
// echo '<pre>$_GET:' . print_r($_GET,true) . '</pre>';
// echo '<pre>$_SERVER:' . print_r($_SERVER,true) . '</pre>';
// echo $_SERVER['REQUEST_METHOD'];

if(function_exists("date_default_timezone_set") and function_exists("date_default_timezone_get"))
@date_default_timezone_set(@date_default_timezone_get());
//
session_start();
// check to make sure there is a session
if(!isset($_SESSION['dir'])){ 
echo "Please contact webmaster as soon as posible";
die();
} else { 
}
//
$Sware_words = <<<Words
Require("includes/bad_word_list.txt"); 
Words;
$Name = $_POST['Name']; // get the name from the form
$Email = $_POST['Email']; // get the email from the form
$code = $_POST['Code']; // Get the secrity code
$dir = $_SESSION['dir']; // Get who they have picked
$file = $_SESSION['dir']; // Get the dir


//
$Time = date('h.i.s A'); // get the time
//
$Date = date('l jS \of F Y'); // get the date
//
// check the name to witheld it from the front person
if ($Name = "Pleasae Enter your full name"){ 
$Name = "**********";
} else { 
}
//
//
// Check That the name has not got no sware words in it
if ($Name = $Sware_words){ 
unset($_SESSION['dir']);
// write the normal info into the Blocked list
$Blockfile = fopen("Blocked.txt","a+");
fwrite($Blockfile, "\r\n$Email:$code:$Date:$Time");
die();
} else { 
}

$pfile = fopen("places/$dir.txt","w");

fwrite($pfile, "\r\n$Name:$Email:$code:$Date:$Time");
header('Location: http://localhost/Game/red.php?$dir');
// 

?>

 

Could any one tell me why the if statement returns when the $name is not one of the sware words ??

 

if ($Name = $Sware_words){ 
unset($_SESSION['dir']);
// write the normal info into the Blocked list
$Blockfile = fopen("Blocked.txt","a+");
fwrite($Blockfile, "\r\n$Email:$code:$Date:$Time");
die();
} else { 
}

 

 

Link to comment
https://forums.phpfreaks.com/topic/201403-php-help-script/
Share on other sites

This is the up to date file but still ,  I used the "==" and the if statement does not return even though that the $name is a sware word listed in the "Bad_words_list.txt" what im thinking is that you cannot Require the file so theres nothing for it to check ???

 

<?php
error_reporting(E_ALL);

if(function_exists("date_default_timezone_set") and function_exists("date_default_timezone_get"))
@date_default_timezone_set(@date_default_timezone_get());
//
session_start();
// check to make sure there is a session
if(!isset($_SESSION['dir'])){ 
echo "Please contact webmaster as soon as posible";
die();
} else { 
}

$Name = $_POST['Name'];
$Email = $_POST['Email'];
$code = $_POST['Code'];
$dir = $_SESSION['dir'];
$file = $_SESSION['dir'];
//
//        Automatic detection dissabled due to not beeing coded fully
/*
$file = <<<Words
Require("includes/bad_word_list.txt"); 
Words;
*/


//
$Time = date('h.i.s A'); // get the time
//
$Date = date('l jS \of F Y'); // get the date
//
// check the name to witheld it from the front person
if ($Name == "Please Enter your full name"){ 
$Name = "**********";
} else { 
}
//
//
// Check That the name has not got no sware words in it
/* if ($Name == $file){ 
// unset($_SESSION['dir']);
// write the normal info into the Blocked list
$Blockfile = fopen("Blocked.txt","a+");
fwrite($Blockfile, "\r\n$Email:$code:$Date:$Time");
echo "Please contact webmaster due to bad name being detected with you security code you got from the last stage"
die();
} else { 
}
*/


$pfile = fopen("places/$dir.txt","w");

fwrite($pfile, "\r\n$Name:$Email:$code:$Date:$Time");
header('Location: http://localhost/Game/red.php?$dir');
// 

?>

Link to comment
https://forums.phpfreaks.com/topic/201403-php-help-script/#findComment-1057367
Share on other sites

The problem is the way you're creating the variable $Sware_words:

<?php
$Sware_words = <<<Words
Require("includes/bad_word_list.txt"); 
Words;
?>

All that does is put the string 'Require("includes/bad_word_list.txt");' in the variable.

What does the text file look like? One word per line?

If so, do something like this:

<?php
$Sware_words = array_map('trim',file('includes/bad_word_list.txt'));
if (in_array($Name, $Sware_words)) {
//
// etc...
//
}
?>

 

Ken

Link to comment
https://forums.phpfreaks.com/topic/201403-php-help-script/#findComment-1057750
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.