This may be seen as a bit paranoid but i was convinced someone has been trying to login to my admin backend, so i decided to write something to log all access attempts on my backend and display it in the dashboard, it could be quite useful for some so i will include instructions on what i did. I didn't use sql or anything so no tables need built.
First i added the following code to /admin/view/template/common/login.tpl just between the final two closing div's.
</div>
Insert the code Here
</div>
<?php echo $footer; ?>
Code: Select all
<!--Start IP Log-->
<div class="content" style="min-height: 0px;">
<?php
$logfile= 'iplog.html';
$IP = $_SERVER['REMOTE_ADDR'];
$logdetails= '<span style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #000000;">' . date("F j, g:ia") . ' : <a target="_blank" href=http://www.ip-adress.com/ip_tracer/'.$_SERVER['REMOTE_ADDR'].'>'.$_SERVER['REMOTE_ADDR'].'</a></span>';
$fp = fopen($logfile, "a");
fwrite($fp, $logdetails);
fwrite($fp, "<br />");
fclose($fp);
?>
<span style="color:green;"><b>Info: IP Tracker Installed</b></span><br />
<p>A report of this access and your IP Address (<strong><?php echo $_SERVER['REMOTE_ADDR']; ?></strong>) has been logged and the store admin has been notified.</p>
</div>
<!--End IP Log-->
This could be it complete but i wanted to display the ip log on my dashboard when i logged in so i did the following:
I edited /admin/view/template/common/home, i replaced:
Code: Select all
<div class="content">
<div style="display: inline-block; width: 100%; margin-bottom: 15px; clear: both;">
<div style="float: left; width: 49%;">
<div style="background: #547C96; color: #FFF; border-bottom: 1px solid #8EAEC3; padding: 5px; font-size: 14px; font-weight: bold;"><?php echo $text_overview; ?></div>
<div style="background: #FCFCFC; border: 1px solid #8EAEC3; padding: 10px; height: 180px;">
<table cellpadding="2" style="width: 100%;">
<tr>
<td width="80%"><?php echo $text_total_sale; ?></td>
<td align="right"><?php echo $total_sale; ?></td>
<tr>
<td><?php echo $text_total_sale_year; ?></td>
<td align="right"><?php echo $total_sale_year; ?></td>
</tr>
<tr>
<td><?php echo $text_total_order; ?></td>
<td align="right"><?php echo $total_order; ?></td>
</tr>
<tr>
<td><?php echo $text_total_customer; ?></td>
<td align="right"><?php echo $total_customer; ?></td>
</tr>
<tr>
<td><?php echo $text_total_customer_approval; ?></td>
<td align="right"><?php echo $total_customer_approval; ?></td>
</tr>
<tr>
<td><?php echo $text_total_product; ?></td>
<td align="right"><?php echo $total_product; ?></td>
</tr>
<tr>
<td><?php echo $text_total_review; ?></td>
<td align="right"><?php echo $total_review; ?></td>
</tr>
<tr>
<td><?php echo $text_total_review_approval; ?></td>
<td align="right"><?php echo $total_review_approval; ?></td>
</tr>
</table>
</div>
</div>
<div style="float: right; width: 49%;">
<div style="background: #547C96; color: #FFF; border-bottom: 1px solid #8EAEC3;">
<div style="width: 100%; display: inline-block;">
<div style="float: left; font-size: 14px; font-weight: bold; padding: 7px 0px 0px 5px; line-height: 12px;"><?php echo $text_statistics; ?></div>
<div style="float: right; font-size: 12px; padding: 2px 5px 0px 0px;"><?php echo $entry_range; ?>
<select id="range" onchange="getSalesChart(this.value)" style="margin: 2px 3px 0 0;">
<option value="day"><?php echo $text_day; ?></option>
<option value="week"><?php echo $text_week; ?></option>
<option value="month"><?php echo $text_month; ?></option>
<option value="year"><?php echo $text_year; ?></option>
</select>
</div>
</div>
</div>
Code: Select all
<div class="content">
<div style="display: inline-block; width: 100%; margin-bottom: 15px; clear: both;">
<div style="float: left; width: 26%; padding: 4px;">
<div style="background: #547C96; color: #FFF; border-bottom: 1px solid #8EAEC3; padding: 5px; font-size: 14px; font-weight: bold;">Dashboard Access Log</div>
<div style="background: #FCFCFC; border: 1px solid #8EAEC3; padding: 10px; height: 180px;">
<iframe src="iplog.html" width="100%" height="100%" frameborder="0">
</iframe>
</div>
</div>
<div style="float: left; width: 33%; padding: 4px;">
<div style="background: #547C96; color: #FFF; border-bottom: 1px solid #8EAEC3; padding: 5px; font-size: 14px; font-weight: bold;"><?php echo $text_overview; ?></div>
<div style="background: #FCFCFC; border: 1px solid #8EAEC3; padding: 10px; height: 180px;">
<table cellpadding="2" style="width: 100%;">
<tr>
<td width="80%"><?php echo $text_total_sale; ?></td>
<td align="right"><?php echo $total_sale; ?></td>
<tr>
<td><?php echo $text_total_sale_year; ?></td>
<td align="right"><?php echo $total_sale_year; ?></td>
</tr>
<tr>
<td><?php echo $text_total_order; ?></td>
<td align="right"><?php echo $total_order; ?></td>
</tr>
<tr>
<td><?php echo $text_total_customer; ?></td>
<td align="right"><?php echo $total_customer; ?></td>
</tr>
<tr>
<td><?php echo $text_total_customer_approval; ?></td>
<td align="right"><?php echo $total_customer_approval; ?></td>
</tr>
<tr>
<td><?php echo $text_total_product; ?></td>
<td align="right"><?php echo $total_product; ?></td>
</tr>
<tr>
<td><?php echo $text_total_review; ?></td>
<td align="right"><?php echo $total_review; ?></td>
</tr>
<tr>
<td><?php echo $text_total_review_approval; ?></td>
<td align="right"><?php echo $total_review_approval; ?></td>
</tr>
</table>
</div>
</div>
<div style="float: right; width: 39%; padding: 4px;">
<div style="background: #547C96; color: #FFF; border-bottom: 1px solid #8EAEC3;">
<div style="width: 100%; display: inline-block;">
<div style="float: left; font-size: 14px; font-weight: bold; padding: 7px 0px 0px 5px; line-height: 12px;"><?php echo $text_statistics; ?></div>
<div style="float: right; font-size: 12px; padding: 2px 5px 0px 0px;"><?php echo $entry_range; ?>
<select id="range" onchange="getSalesChart(this.value)" style="margin: 2px 3px 0 0;">
<option value="day"><?php echo $text_day; ?></option>
<option value="week"><?php echo $text_week; ?></option>
<option value="month"><?php echo $text_month; ?></option>
<option value="year"><?php echo $text_year; ?></option>
</select>
</div>
</div>
</div>
The final thing i did was find admin/iplog.html and add the following code to the top of the file, this code just tells your browser not to cache the log file and also to scroll to the bottom as soon as the page loads as the most recent access logs are added to the bottom of the list.
if iplog.html doesn't exist just visit http://www.yourdomain.com/admin and it is automatically created.
Code: Select all
<html>
<head>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
</head>
<body onload="javascript:scroll(0,9999999999999999999)">
<!--/////DELETE BELOW THIS LINE TO RESET LOG-->
Also if anyone uses it let me know, cuz this is the first mod i have published, sorry if the instructions aren't clear, im very stoned. lol