Math Functions Program
This code performs mathematical functions such as finding factorials, permutations and combinations, GCF and LCM, tests for perfect numbers and also can generate a fibonacci sequence.
AI
ИИ-обзор: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Исходный код
Upload
<?
## before using this code you must make the following table in your database
# Table name: stats
# fields: Ipaddress(varchar(150)),host(varchar(150)),browser(varchar(150)),referer(varchar(150)),filename(varchar(150)).
# table name: hits
# fields: ipaddress(varchar(150)),count(int(11))
###############################################
global $dblink,$PHP_SELF;
$ip = getenv("REMOTE_ADDR");
$host = getenv("HTTP_HOST");
$browser = getenv("HTTP_USER_AGENT");
$referer = getenv("HTTP_REFERER");
$sql = "SELECT ipaddress FROM stats WHERE ipaddress = '$ip'";
#### TO DO ######################
# make the connection to your database here
$result = @mysql_query($sql, $dblink);
$num = mysql_num_rows($result);
if( $num == 0 )
{
$sql ="INSERT INTO stats(ipaddress,host,browser,referer,filename) VALUES('$ip', '$host', '$browser', '$referer','$PHP_SELF')";
$result=mysql_query($sql,$dblink);
$sql1="INSERT INTO hits(ipaddress,count) VALUES('$ip',1)";
$result1=@mysql_query($sql1,$dblink);
$text="you had a new visitor from IP: $ip, Host: $host Browser: $browser Referer: $referer";
if ($result)
{
mail("[email protected]", "You had a new visitor",$text, "FROM: [email protected]");
}
}else{
$sql = "UPDATE hits SET count = count + 1 where ipaddress='$ip'";
$result =@mysql_query($sql, $dblink) ;
$sql2 = "UPDATE stats SET filename ='$PHP_SELF' where ipaddress='$ip'";
$result2 =@mysql_query($sql2, $dblink) ;
}
?>
Оригинальные комментарии (3)
Восстановлено из Wayback Machine