$dnum = date(Ymd)*4;
$from = $_GET['fr'];
if($from == ""){
$from = $_POST['fr'];
}
if($from != $dnum){
echo("<<<<Restricted Area>>>>" .
"
Sorry, you must Log In to view this Page
");
exit();
}
$usrn = $_GET['usrn'];
if($usrn == ""){
$usrn = $_POST['usrn'];
}
if($usrn == ""){
echo("<<<<Restricted Area>>>>" .
"
Problem with your username. Please Log In again.
");
exit();
}
$dbcnx = @mysql_connect('mysql.plainhost.com', 'ecosmar_ecosmart', 'ecoman1');
if (!$dbcnx) {
echo( 'Sorry, trouble connecting to the Data Base.
' .
'Please try again later.
' );
exit();
}
mysql_select_db('ecosmar_products', $dbcnx);
if (! @mysql_select_db('ecosmar_products') ) {
die( 'Sorry, trouble connecting to the Data Base.
' .
'Please try again later.
' );
}
$dtnum = date(Ymd);
$ID = $_GET['ID'];
$productname = $_POST['productname'];
$del = $_GET['del'];
if($del == '1'){
$delcount = mysql_query("DELETE FROM counter WHERE ID='$ID' LIMIT 1");
if(!$delcount){
echo("Could not delete counter
".mysql_error()."
");
}
}
$set = $_GET['set'];
if($set == ""){
$set = $_POST['set'];
}
if($set == '1'){
$setcount = mysql_query("UPDATE counter SET total='0' WHERE ID='$ID' LIMIT 1");
if(!$setcount){
echo("Could not reset counter
".mysql_error()."
");
}
}
if($set == '2'){
$setcheck = mysql_query("SELECT ID FROM counter WHERE productname='$productname'");
if(!$setcheck){
echo("Could not check for duplicate counter
".mysql_error()."
");
}else{
$num_rows = mysql_num_rows($setcheck);
if($num_rows > 0){
echo("No new counter. One already exists.
");
}else{
$setup = mysql_query("INSERT INTO counter SET productname='$productname',total='0',startnum='$dtnum',endnum='$dtnum'");
if(!$setup){
echo("Could not set new counter
".mysql_error()."
");
}
}
}
}
?>
Catalog Info Administration
Page Hit Counters
Current Counters |
Manage
| Product Number
| Started
| Total
|
$listem = @mysql_query("SELECT ID,productname,total,startnum FROM counter ORDER BY startnum");
if(!$listem){
die("Error Selecting Products from Data Base!
".
'Error:' . mysql_error() . '
');
}
$num_rows = mysql_num_rows($listem);
if($num_rows < 1){
echo("No Counters Set |
");
}else{
while ($row = mysql_fetch_array($listem)) {
$ID = $row['ID'];
$productname = $row['productname'];
$total = $row['total'];
$startnum = $row['startnum'];
$chunk = chunk_split($startnum, 2, ':');
$chunk_arrd = explode(":", $chunk);
$startem = $chunk_arrd[2].'/'.$chunk_arrd[3].'/'.$chunk_arrd[0].$chunk_arrd[1];
echo("[DEL]" .
" [Reset] | " .
"" .
"$productname | $startem | $total" .
" |
");
}
}
?>
|
©2006 - Data Base Interface - Custom Built at:
|