Any major security risks? And please don't get angry over my novice log system.
<?php
function makesalt($lg)
{
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-';
$sz = strlen( $chars );
$str = '';
for( $i = 0; $i < $lg; $i++ ) {
$str .= $chars[ rand( 0, $sz - 1 ) ];
}
return $str;
}
function duelsha($th)
{
$tem = hash('sha512', $th);
$tem2 = md5($tem);
return hash('sha256', $tem2);
}
function shasalt($ht)
{
$salt = makesalt(30);
return duelsha($ht . $salt) . '|' . $salt;
}
function mysqlsan($ss)
{
if (get_magic_quotes_gpc()) $ss = stripslashes($ss);
return mysql_real_escape_string($ss);
}
function htent($st)
{
return htmlentities($st);
}
function sqlhtml($sm)
{
return htent(mysqlsan($sm));
}
function logs($tl)
{
$fh = fopen("server.log", 'w') or die("File error");
fwrite($fh, $tl) or die("File error");
fclose($fh);
}
?>