<?
/**
* Copyright (C) 2004 Tony Bierman
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
/*
see README.html for complete documentation
*/
define('phpGiggle_ABSPATH', dirname(__FILE__).'/');
require_once(phpGiggle_ABSPATH.'phpgiggle-config.inc.php');
$url = urldecode($QUERY_STRING);
if ((! $url) || (! preg_match("/http:/", $url)))
{
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<?php echo '<link rel="stylesheet" type="text/css" media="screen" href="'.phpgiggle_url.'phpgiggle-layout.css" />'."\n"; ?>
<title>phpGiggle login page</title>
</head>
<body>
<div id="rap">
<h1 id="header">Administrative Login</h1>
<div id="menu">
<div id="logo" align="center">
<br/><br/><a href="http://www.biermana.org"><img align="center" src="<?php echo phpgiggle_url.'images/phpgiggle_logo.png';?>" alt="phpGiggle"/></a>
</div>
</div>
<div id="content" width="80%">
<?
//if no cookie is set then display the form
if(!isset($_COOKIE["this_cookie"])){ ?>
<div align="center"><form action="phpgiggle-validate.inc.php" method="post">
<br/>username : <input type="text" name="username"><br/><br/>
password : <input type="password" name="password"><br/><br/>
<input type="submit" value="login"></form></div>
<?
if($upass[1] == "giggle"){ ?>
<p>Warning! The default phpGiggle admin password has not been changed. Please edit the phpgiggle-config.inc.php file.</p>
<?}
}else{?>
<img align="center" src="<?php echo phpgiggle_url.'images/pgenhanced.png';?>" alt="phpGiggle Content Advisory"/>
<br /><br /><a href="phpgiggle-admin.php">Continue to admin page</a>
<?}?>
</div>
</div>
<p class="credit"><cite>Powered by <a href="http://biermana.org" title="Powered by phpGiggle"><strong>phpGiggle</strong></a></cite><? echo " ".phpgiggle_version; ?></p>
</body>
</html>
<?
}
else
{
$COUNT_FILE = phpgiggle_clicksfile;
function error ($error_message) {
echo $error_message."<BR>";
exit;
}
function debug ($error_message) {
echo "DEBUG: ".$error_message."<BR>";
}
if (! file_exists($COUNT_FILE))
error("Can't find file, check '\$COUNT_FILE' var...");
$file_arry = file($COUNT_FILE); //or error("Can not open \$COUNT_FILE");
while (list($key, $val) = each($file_arry)) {
if ($val != "") {
list($file_url, $nb) = preg_split("/\t|\n/", $val);
if ($file_url == $url) {
$nb++; $file_arry[$key] = "$file_url\t$nb\n"; $find = 1;
}
}
}
$file = join ("", $file_arry);
if (! $find) $file .= "$url\t1\n";
$fp = fopen("$COUNT_FILE", "w"); //or error("Can not open \$COUNT_FILE");
flock($fp, 1);
fputs($fp, $file);
flock($fp, 3);
fclose($fp);
if(show_ads==1)
require_once(phpGiggle_ABSPATH.'includes/phpgiggle-message.inc.php');
else
header("Location: $url");
}
?>