<?php // access.php -> Password protection for Admin Panel.
require("config.php");
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
// @@ @@
// @@ ++++++++++++++++++ @@
// @@ ++ InstaCounter ++ Version: 1.0 @@
// @@ ++++++++++++++++++ @@
// @@ @@
// @@ InstaCounter was developed by Christophe Johanns. Therefore @@
// @@ he owns the copyright to all files of this script. Feel free @@
// @@ to modify the code for PERSONAL use. @@
// @@ @@
// @@ Copyright © 2001 Christophe Johanns. All rights reserved. @@
// @@ @@
// @@ Support: http://www.freesources.net/instacounter.php @@
// @@ Comments: hide@address.com @@
// @@ @@
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
session_start();
if(($action=="forgotlogin") && (!isset($submit))) {
echo "<HTML><HEAD> <TITLE>Admin Panel Log In °° InstaCounter</TITLE></HEAD><BODY bgcolor=\"#CCCCCC\" text=\"#000000\" link=\"#000000\" vlink=\"#000000\" alink=\"#006D8A\"><P> </P> <P> </P> <P> </P> <FORM action=\"$PHP_SELF\" method=\"post\"> <DIV align=\"center\"> <CENTER><INPUT type=\"hidden\" name=\"action\" value=\"forgotlogin\"><TABLE border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"50%\"> <TR> <TD width=\"100%\" bgcolor=\"#FFFFFF\"> <DIV align=\"center\"> <TABLE border=\"0\" cellpadding=\"0\" cellspacing=\"1\" width=\"100%\"> <TR> <TD width=\"100%\" bgcolor=\"#006D8A\"><B><FONT size=\"2\" face=\"Verdana\" color=\"#FFFFFF\"> Admin Panel Login info Request</FONT></B></TD> </TR> <TR> <TD width=\"100%\" bgcolor=\"#CCCCCC\"> <DIV align=\"center\"> <TABLE border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"> <TR> <TD width=\"100%\" colspan=\"2\"><IMG border=\"0\" src=\"pixel.gif\" width=\"5\" height=\"5\"></TD> </TR> <TR> <TD width=\"100%\" colspan=\"2\"> <P style=\"margin-left: 10; margin-right: 10\"><FONT size=\"1\" face=\"Verdana\"><B>Email address:</B></FONT></TD> </TR> <TR> <TD width=\"65%\"> <P style=\"margin-left: 10; margin-right: 10\"><INPUT type=\"text\" name=\"email\" size=\"24\" style=\"font-family: Verdana; font-size: 10pt\"></TD> </CENTER> <TD width=\"35%\"> <P align=\"left\" style=\"margin-right: 10\"><INPUT type=\"submit\" value=\"Request login info\" name=\"submit\" style=\"font-family: Verdana; font-size: 10pt; font-weight: bold\"></TD> </TR> <CENTER> <TR> <TD width=\"100%\" colspan=\"2\"><IMG border=\"0\" src=\"pixel.gif\" width=\"5\" height=\"5\"></TD> </TR> <TR> <TD width=\"100%\" colspan=\"2\"> <P style=\"margin-left: 10; margin-right: 10\"><FONT size=\"1\" face=\"Verdana\">You need to fill in the email address you provided during the installation, or changed afterwards. The login details will be sent to that address.</FONT></TD> </TR> <TR> <TD width=\"100%\" colspan=\"2\"><IMG border=\"0\" src=\"pixel.gif\" width=\"5\" height=\"5\"></TD> </TR> </TABLE> </DIV> </CENTER></TD> </TR> </TABLE> </DIV> </TD> </TR> </TABLE> </DIV> </FORM> <P align=\"center\"> </P> <P align=\"center\"><FONT size=\"1\" face=\"Verdana\">Powered by InstaCounter. 2001 © copyright Christophe Johanns.</FONT></P></BODY></HTML>";
exit;
}
if(($action=="forgotlogin") && (isset($submit))) {
$db = @mysql_connect("localhost","$user","$pw");
mysql_select_db("$database");
if (!$db) { print "There was an error connecting to the database."; } else {
$query = mysql_query("SELECT * FROM InstaCounter_Config WHERE cid='1'"); $handle = mysql_fetch_array($query);
if($email==$handle[eMail]) {
$message="Username: " . $handle[UserName] . " Password: " . $handle[Password];
mail("$email", "InstaCount Admin panel login information","$message");
echo "<FONT face=\"Verdana\" size=\"2\">Mail sent succesfully.</FONT>";
}
else {
echo "<FONT face=\"Verdana\" size=\"2\">Wrong email address.</FONT>";
}
exit;
}
}
if($action=="counterinfo" || $action=="liststyles" || $action=="counterstats" || $action=="html") {
$db = @mysql_connect("localhost","$user","$pw"); mysql_select_db("$database"); if (!$db) { print "There was an error connecting to the database."; } else {
$query = mysql_query("SELECT public_stats,public_styles,public_info FROM InstaCounter_Config WHERE cid='1'"); $handle = mysql_fetch_array($query);
if(($handle[public_info]=="1")&&($action=="counterinfo")) { $nologin="1"; }
if(($handle[public_info]=="1")&&($action=="html")) { $nologin="1"; }
if(($handle[public_stats]=="1")&&($action=="counterstats")) { $nologin="1"; }
if(($handle[public_styles]=="1")&&($action=="liststyles")) { $nologin="1"; }
}
}
if ($nologin!="1") {
if(!isset($usna)) {
echo "<HTML><HEAD> <TITLE>Admin Panel Log In °° InstaCounter</TITLE> </HEAD><BODY bgcolor=\"#CCCCCC\" text=\"#000000\" link=\"#000000\" vlink=\"#000000\" alink=\"#006D8A\"><P> </P> <P> </P> <P> </P><FORM action=\"$PHP_SELF\" method=\"post\"> <DIV align=\"center\"><INPUT type=\"hidden\" name=\"action\" value=\"$action\"> <CENTER> <TABLE border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"50%\"> <TR> <TD width=\"100%\" bgcolor=\"#FFFFFF\"><DIV align=\"center\"> <TABLE border=\"0\" cellpadding=\"0\" cellspacing=\"1\" width=\"100%\"> <TR> <TD width=\"100%\" bgcolor=\"#006D8A\"><B><FONT size=\"2\" face=\"Verdana\" color=\"#FFFFFF\"> Admin Panel Login</FONT></B></TD> </TR> <TR> <TD width=\"100%\" bgcolor=\"#CCCCCC\"> <DIV align=\"center\"> <TABLE border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"> <TR> <TD width=\"100%\" colspan=\"3\"><IMG border=\"0\" src=\"pixel.gif\" width=\"5\" height=\"5\"></TD> </TR> <TR> <TD width=\"40%\"> <P style=\"margin-left: 10; margin-right: 10\"><FONT size=\"1\" face=\"Verdana\"><B>Username:</B></FONT></TD> <TD width=\"40%\"> <P style=\"margin-left: 10; margin-right: 10\"><FONT size=\"1\" face=\"Verdana\"><B>Password:</B></FONT></TD> <TD width=\"20%\"> <P align=\"center\"></TD> </TR> <TR> <TD width=\"40%\"> <P style=\"margin-left: 10; margin-right: 10\"><INPUT type=\"text\" name=\"usna\" size=\"17\" style=\"font-family: Verdana; font-size: 10pt\"></TD> <TD width=\"40%\"> <P style=\"margin-left: 10; margin-right: 10\"><INPUT type=\"password\" name=\"pawo\" size=\"16\" style=\"font-family: Verdana; font-size: 10pt\"></TD> </CENTER> <TD width=\"20%\"> <P align=\"left\" style=\"margin-right: 10\"><INPUT type=\"submit\" value=\"Log In\" name=\"submit\" style=\"font-family: Verdana; font-size: 10pt; font-weight: bold\"></TD> </TR> <CENTER> <TR> <TD width=\"100%\" colspan=\"3\"><IMG border=\"0\" src=\"pixel.gif\" width=\"5\" height=\"5\"></TD> </TR> <TR> <TD width=\"100%\" colspan=\"3\"> <P style=\"margin-left: 10; margin-right: 10\"><FONT size=\"1\" face=\"Verdana\">» <A href=\"access.php?action=forgotlogin\">Forgot your login details?</A></FONT></TD> </TR> <TR> <TD width=\"100%\" colspan=\"3\"><IMG border=\"0\" src=\"pixel.gif\" width=\"5\" height=\"5\"></TD> </TR> </TABLE> </DIV> </TD> </TR> </TABLE> </DIV> </TD> </TR> </TABLE> </CENTER> </DIV><INPUT type=\"hidden\" name=\"firstlogin\" value=\"1\"></FORM><P align=\"center\"> </P> <P align=\"center\"><FONT size=\"1\" face=\"Verdana\">Powered by InstaCounter. 2001 © copyright Christophe Johanns.</FONT></P></BODY></HTML>";
exit;
}
session_register("usna");
session_register("pawo");
$db = @mysql_connect("localhost","$user","$pw"); mysql_select_db("$database"); if (!$db) { print "There was an error connecting to the database."; } else {
$query = mysql_query("SELECT UserName,Password FROM InstaCounter_Config WHERE cid='1'"); $handle = mysql_fetch_array($query);
if(($usna==$handle[UserName]) && ($pawo==$handle[Password])) {
// Keep executing script.
}
else {
echo "<FONT face=\"Verdana\" size=\"2\">Access Denied. Please try again.</FONT>";
session_unregister("usna");
session_unregister("pawo");
exit;
}
}
}
?>