Размер файла: 5.4Kb
<?php
/**
* Wap Portal Server
*
* Copyright (C) 2002 - 2004 Emir Sakic
*
* Wap Portal Server
* Developer: Emir Sakic - [email protected]
* Homepage: http://www.sakic.net
* Date: 15/03/2004
* Version #: 1.2
**/
?>
<?php /* INDEX */ ?>
<?php
// Read site info
$query = "SELECT * FROM wps_site WHERE id = 1";
$result = mysql_query($query);
$row = mysql_fetch_object($result);
?>
<card id="index" title="<?php echo $row->name;?>" newcontext="true">
<p align="left">
<?php if (file_exists("images/logo/logo.wbmp")) {?>
<img src="images/logo/logo.wbmp" alt="<?php echo $row->imgalt;?>"/><br />
<?php } ?>
<?php echo _MAIN_INTRO;
// format and output date with local time adjustments
// Read time adjustment
$query = "SELECT * FROM wps_timediff";
$result = mysql_query($query);
$row = mysql_fetch_object ($result);
$time_offset = $row->timediff * 60 * 60;
$date = strftime ($dateformatlong, time() + $time_offset);
print "<br /><small>"._TODAY_IS.$date."</small>\n";
?>
</p>
<p>
<?php
$query = "SELECT * FROM wps_menu ORDER BY ordering";
$result = mysql_query($query);
for ($i = 1; $row = mysql_fetch_object ($result); $i++) {
if ($row->type=="section") {
$query2 = "SELECT published FROM wps_sections WHERE id = '$row->itemid'";
$result2 = mysql_query($query2);
$row2 = mysql_fetch_object ($result2);
if ($row2->published) {
echo "<a href=\"index.php?option=section&id=$row->itemid\">$row->title</a><br />\n";
}
} else if ($row->type=="component") {
$query2 = "SELECT name, published FROM wps_components WHERE id = '$row->itemid'";
$result2 = mysql_query($query2);
$row2 = mysql_fetch_object ($result2);
if ($row2->published) {
echo "<a href=\"index.php?option=component&id=$row->itemid\">$row->title</a><br />\n";
}
} else {
$query2 = "SELECT published FROM wps_items WHERE id = '$row->itemid'";
$result2 = mysql_query($query2);
$row2 = mysql_fetch_object ($result2);
if ($row2->published) {
echo "<a href=\"index.php?option=item&id=$row->itemid\">$row->title</a><br />\n";
}
}
}
?>
</p>
<p align="center">
<?php
$query = "SELECT * FROM wps_statistics WHERE id = 1";
$result = mysql_query($query);
$row = mysql_fetch_array ($result);
$phone_type = substr(getenv('HTTP_USER_AGENT'), 0 ,3);
switch ($phone_type) {
case "Nok":
$incagent = ++$row['nokia'];
$query = "UPDATE wps_statistics SET nokia = '$incagent' WHERE id = 1";
break;
case "Eri":
$incagent = ++$row['sonyericsson'];
$query = "UPDATE wps_statistics SET sonyericsson = '$incagent' WHERE id = 1";
break;
case "Son":
$incagent = ++$row['sonyericsson'];
$query = "UPDATE wps_statistics SET sonyericsson = '$incagent' WHERE id = 1";
break;
case "MOT":
$incagent = ++$row['motorola'];
$query = "UPDATE wps_statistics SET motorola = '$incagent' WHERE id = 1";
break;
case "SIE":
$incagent = ++$row['siemens'];
$query = "UPDATE wps_statistics SET siemens = '$incagent' WHERE id = 1";
break;
case "SAM":
$incagent = ++$row['samsung'];
$query = "UPDATE wps_statistics SET samsung = '$incagent' WHERE id = 1";
break;
case "SEC":
$incagent = ++$row['samsung'];
$query = "UPDATE wps_statistics SET samsung = '$incagent' WHERE id = 1";
break;
case "LG-":
$incagent = ++$row['lg'];
$query = "UPDATE wps_statistics SET lg = '$incagent' WHERE id = 1";
break;
case "LGE":
$incagent = ++$row['lg'];
$query = "UPDATE wps_statistics SET lg = '$incagent' WHERE id = 1";
break;
case "Pan":
$incagent = ++$row['panasonic'];
$query = "UPDATE wps_statistics SET panasonic = '$incagent' WHERE id = 1";
break;
case "Alc":
$incagent = ++$row['alcatel'];
$query = "UPDATE wps_statistics SET alcatel = '$incagent' WHERE id = 1";
break;
case "PHI":
$incagent = ++$row['philips'];
$query = "UPDATE wps_statistics SET philips = '$incagent' WHERE id = 1";
break;
case "NEC":
$incagent = ++$row['nec'];
$query = "UPDATE wps_statistics SET nec = '$incagent' WHERE id = 1";
break;
default:
$incagent = ++$row['unknown'];
$query = "UPDATE wps_statistics SET unknown = '$incagent' WHERE id = 1";
break;
}
mysql_query($query);
// Check counter / referrer settings
$query = "SELECT * FROM wps_site LIMIT 1";
$result = mysql_query($query);
$row = mysql_fetch_object($result);
$published = $row->counter;
$referer_max_nr = $row->referers;
// Display counter
$query = "SELECT * FROM wps_statistics WHERE id = 1";
$result = mysql_query($query);
$row = mysql_fetch_row ($result);
if ($published) {
$sum = $row[1]+$row[2]+$row[3]+$row[4]+$row[5]+$row[6]+$row[7]+$row[8]+$row[9]+$row[10]+$row[11];
echo _YOU_ARE_VISITOR.":<br />\n";
print "<b>$sum</b>\n";
}
// Save referrer
if (isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER']!="") {
$referer = $_SERVER['HTTP_REFERER'];
$date = date( "Y-m-d H:i:s" );
$query = "SELECT count(id) AS num FROM wps_referers";
$result = mysql_query($query);
$row = mysql_fetch_object($result);
$num = $row->num;
while ($num >= $referer_max_nr) {
$query = "SELECT id FROM wps_referers ORDER BY date ASC LIMIT 1";
$result = mysql_query($query);
$row = mysql_fetch_object($result);
$query = "DELETE FROM wps_referers WHERE id = '$row->id'";
mysql_query($query);
$num--;
}
$query = "INSERT INTO wps_referers VALUES ( '', '$referer', '$date' )";
mysql_query($query);
}
?>
</p>
</card>
<?php /* END INDEX */ ?>