<?php
echo $_SERVER['DOCUMENT_ROOT']."\web\home\security\security.php";
//including files
//--------------------------------------------------------------
include_once "home/database_handler.php";
require_once $_SERVER['DOCUMENT_ROOT']."\web\home\security\security.php";
include_once "home/session/session_handler.php";
//check session and assign if there ain't any nonce_key
//--------------------------------------------------------------
if (!session_check("nonce_key"))
{
// generate the key
$key=generate_rand_key("str");
$set = set_to_session($key, "nonce_key");
if ($set)
echo "successfully set the session";
else
echo "session set failed!";
}
//check if any session is already set & POST supplied
//--------------------------------------------------------------
hasher("str", "salt");
?>
Here is a code fragment of reg.php
For security.php:
<?php
include_once("/../config/security_config.php");
// functions start here XD
//Generate a new key each time (to be used as nonce/rand key)
//------------------------------------------------------------------
function generate_rand_key($str) {
$time = time();
$key = md5($time);
return $key;
}
function filter_user_input($input) {
// INJECTION
$input = mysql_real_escape_string($input);
// XSS
$input = htmlentities( htmlspecialchars($input));
return $input;
}
function hasher($string, $salt) {
// first md5 with salt
$input = md5("$string.$salt");
//$input = crypt($input);
//using crypt function
$input = crypt($input, $salt);
return $input;
}
?>
And I get this error:
PHP Fatal error: Uncaught Error: Call to undefined function generate_rand_key() in C:\inetpub\wwwroot\web\reg.php:20
It is interesting to note the function hasher doesn't receive this error even if I remove few lines above but the function generate_rand_key gets this error.
For require above, doesn't have any kind of error.
What's the problem here? Is it a bug?
Aucun commentaire:
Enregistrer un commentaire