Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Problem with blocking ip code


itfitz

Recommended Posts

Posted

I get this error:

 

Parse error: parse error, unexpected T_STRING in /home/lotions2/public_html/ecommerce/os/catalog/admin/includes/languages/english/ip_admin.php on line 19

 

 

<?php

/*

$Id: ip_admin.php,v 1.00 2004/10/17 22:00:00 dgw_ Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2004 P.Pajukoski ([email protected])

 

Released under the GNU General Public License

*/

 

DEFINE ('HEADING_TITLE', 'IP banning');

DEFINE ('COL1_TITLE', 'Nr. ');

DEFINE ('COL2_TITLE', 'IP-address');

DEFINE ('COL3_TITLE', 'Date added (yyyy-mm-dd)');

DEFINE ('TEXT_DELETE', 'Delete');

DEFINE ('TEXT_NEW_IP', 'New');

DEFINE ('TEXT_IP_FILE_UPDATED', 'List of blocked IP's updated successfully.');

DEFINE ('HEADING_IMAGE_WIDTH', 20);

DEFINE ('HEADING_IMAGE_HEIGHT', 20);

 

?>

 

Any help would be great.

 

thanks,

Shawn

If it was easy, anyone could do it!

Posted
I get this error:

 

Parse error: parse error, unexpected T_STRING in /home/lotions2/public_html/ecommerce/os/catalog/admin/includes/languages/english/ip_admin.php on line 19

<?php

/*

  $Id: ip_admin.php,v 1.00 2004/10/17 22:00:00 dgw_ Exp $

 

  osCommerce, Open Source E-Commerce Solutions

  http://www.oscommerce.com

 

  Copyright ? 2004 P.Pajukoski ([email protected])

 

  Released under the GNU General Public License

*/

 

DEFINE ('HEADING_TITLE', 'IP banning');

DEFINE ('COL1_TITLE', 'Nr. ');

DEFINE ('COL2_TITLE', 'IP-address');

DEFINE ('COL3_TITLE', 'Date added (yyyy-mm-dd)');

DEFINE ('TEXT_DELETE', 'Delete');

DEFINE ('TEXT_NEW_IP', 'New');

DEFINE ('TEXT_IP_FILE_UPDATED', 'List of blocked IP's updated successfully.');

DEFINE ('HEADING_IMAGE_WIDTH', 20);

DEFINE ('HEADING_IMAGE_HEIGHT', 20);

 

?>

 

Any help would be great.

 

thanks,

Shawn

 

 

 

DEFINE ('TEXT_IP_FILE_UPDATED', 'List of blocked IP's updated successfully.');

 

should be :

 

DEFINE ('TEXT_IP_FILE_UPDATED', 'List of blocked IP\'s updated successfully.');

Treasurer MFC

Posted
DEFINE ('TEXT_IP_FILE_UPDATED', 'List of blocked IP's updated successfully.');

 

should be :

 

DEFINE ('TEXT_IP_FILE_UPDATED', 'List of blocked IP\'s updated successfully.');

 

That did the trick, thanks.

 

The simplist things................................

If it was easy, anyone could do it!

Posted

now I have another problem. When I go to add an IP I get the following error:

 

Warning: fopen(http://lotions2go.com/ecommerce/os/catalog/includes/blocked.txt): failed to open stream: HTTP wrapper does not support writeable connections. in /home/lotions2/public_html/ecommerce/os/catalog/admin/ip_admin.php on line 26

 

I assume this has something to do with the chmod # on the file, but dont know what to change it to or which file to change. But I could be completely wrong on that. Wouldnt be the first time.

 

thanks,

Shawn

If it was easy, anyone could do it!

Posted
now I have another problem.  When I go to add an IP I get the following error:

 

Warning: fopen(http://lotions2go.com/ecommerce/os/catalog/includes/blocked.txt): failed to open stream: HTTP wrapper does not support writeable connections. in /home/lotions2/public_html/ecommerce/os/catalog/admin/ip_admin.php on line 26

 

I assume this has something to do with the chmod # on the file, but dont know what to change it to or which file to change.  But I could be completely wrong on that.  Wouldnt be the first time.

 

thanks,

Shawn

Here is the code for the ip_admin.php file:

 

<?php

/*

$Id: ip_admin.php,v 1.00 2003/10/17 22:00:00 dgw_ Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2004 P.Pajukoski ([email protected])

 

Released under the GNU General Public License

*/

 

DEFINE ('FS_IP_FILE', 'http://lotions2go.com/ecommerce/os/catalog/includes/blocked.txt');

 

require('includes/application_top.php');

require(DIR_WS_INCLUDES . 'header.php');

 

// Get updated vars from form

if ($HTTP_POST_VARS['ip']):

$ip = $HTTP_POST_VARS['ip'];

$rows = count($ip);

$del_ip = $HTTP_POST_VARS['del_ip'];

$date_blocked = $HTTP_POST_VARS['date_blocked'];

 

// update blocked.txt

if (!$fp_out = fopen(FS_IP_FILE, 'w')):

$msg_stack = "Can\'t open " . IP_FILE;

exit;

endif;

$blocked_ip = array();

for ($x = 0; $x < $rows; $x++) {

if ($ip[$x] == '' or $del_ip[$x] == 'yes') :

$blocked_ip[$x] = '';

else:

$blocked_ip[$x] = $ip[$x] .',' . $date_blocked[$x] . "\n";

fwrite($fp_out, $blocked_ip[$x]);

endif;

}

fclose($fp_out);

$msg_stack = TEXT_IP_FILE_UPDATED;

endif;

 

clearstatcache();

$longnow = date("Y-n-d H:i:s", mktime());

$shortnow = date("Y-n-d", mktime());

 

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

<title><?php echo TITLE; ?></title>

<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">

<!-- header //-->

<?php ?>

<!-- header_eof //-->

 

<!-- body //-->

<table border="0" width="100%" cellspacing="2" cellpadding="2">

<tr>

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">

<!-- left_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

<!-- left_navigation_eof //-->

</table></td>

<!-- body_text //-->

 

<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">

<?php echo '<form action="ip_admin.php?action=update" method="post">' . "\n"; ?>

<table width="80%">

<tr>

<td class="pageHeading" colspan="3"><?php echo HEADING_TITLE; ?></td>

</tr>

<tr>

<td class="pageHeading" colspan="3" align="left" width="100%"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>

</tr>

<tr>

<td class="infoBoxHeading" align="left" width="20%"><B> <?php echo COL1_TITLE; ?></B></td>

<td class="infoBoxHeading" align="left" width="50%"><B> <?php echo COL2_TITLE; ?></B></td>

<td class="infoBoxHeading" align="left" width="30%"><B> <?php echo COL3_TITLE; ?></B></td>

</tr>

 

<?php

// read blocked.txt into an array and print form

$row = 0;

$fp_in = fopen (FS_IP_FILE,"r");

while ($data = fgetcsv ($fp_in, 1000, ",")) {

$num = count ($data);

echo '<tr>';

echo '<td class="main" width="20%" align="right">' . ($row + 1) . ': </td>' . "\n";

echo '<td class="main" width="50%"><input type="text" name="ip[' . $row . ']" value="' . $data[0] . '"> <input type="checkbox" name="del_ip[' . $row . ']" value="yes">' . TEXT_DELETE . "</td>\n";

$shortdate = substr ( $data[1], 0 , 10 );

echo '<td class="main" width="30%">' . $shortdate . '<input type="hidden" name="date_blocked[' . $row . ']" value="' . $data[1] . ' "> </td>' . "\n";

echo '</tr>' . "\n";

$row++;

}

fclose ($fp_in);

echo '<tr>' . "\n";

echo '<td class="main" width="20%" align="right"><b>' . TEXT_NEW_IP . ':</b> </td>' . "\n";

echo '<td class="main" width="50%"><input type="text" name="ip[' . ($row + 0) . ']"></td>' . "\n";

echo '<td class="main" width="30%"><I>' . $shortnow . '</I><input type="hidden" name="date_blocked[' . ($row + 0) . ']" value="' . $longnow . ' "> </td>' . "\n";

 

echo '</tr>' . "\n";

echo '<tr>' . "\n";

echo '<td class="main" colspan="3"> </td>' . "\n";

echo '</tr>' . "\n";

echo '<tr>' . "\n";

echo '<td class="main" colspan="3">' . tep_image_submit('button_update.gif', IMAGE_UPDATE) . '</td>' . "\n";

echo '</tr>' . "\n";

?>

</table>

</form>

</td>

<!-- body_text_eof //-->

</tr>

</table>

<!-- body_eof //-->

 

<!-- footer //-->

<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>

<!-- footer_eof //-->

<br>

</body>

</html>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

If it was easy, anyone could do it!

Posted
now I have another problem.  When I go to add an IP I get the following error:

 

Warning: fopen(http://lotions2go.com/ecommerce/os/catalog/includes/blocked.txt): failed to open stream: HTTP wrapper does not support writeable connections. in /home/lotions2/public_html/ecommerce/os/catalog/admin/ip_admin.php on line 26

 

I assume this has something to do with the chmod # on the file, but dont know what to change it to or which file to change.  But I could be completely wrong on that.  Wouldnt be the first time.

 

thanks,

Shawn

Try CHMOD blocked.txt to 777.

Posted
Try CHMOD blocked.txt to 777.

 

 

OK, set the permissions on blocked.txt to 777 and still have the same problem.

 

Any other thoughts?

 

Thanks,

Shawn

If it was easy, anyone could do it!

Posted
OK, set the permissions on blocked.txt to 777 and still have the same problem.

 

Any other thoughts?

 

Thanks,

Shawn

Okay, well leave it at 777 while you troubleshoot.

Posted
Okay, well leave it at 777 while you troubleshoot.

 

So do you have any ideas of what the problem might be?

If it was easy, anyone could do it!

Posted
OK, set the permissions on blocked.txt to 777 and still have the same problem.

 

Any other thoughts?

 

Thanks,

Shawn

Is your admin area http or https?

Posted

.htaccess is much easier. Not as sexy, but much easier.

 

Add:

 

deny from xxx.xxx.xx.xxx

 

(replace x's with the IP address of course).

Posted
.htaccess is much easier.  Not as sexy, but much easier.

 

Add:

 

deny from xxx.xxx.xx.xxx

 

(replace x's with the IP address of course).

 

OK, I'll go and check that out. Shouold be in the root of my site?

If it was easy, anyone could do it!

Posted
OK, I'll go and check that out.  Shouold be in the root of my site?

 

I'll see if I cant figure out the one I am using as well, it gives the banned user a little more content about their violating.

If it was easy, anyone could do it!

  • 1 month later...
Posted

We have this running on our site, which has a very HEAVY amount of b2b traffic. We combined both this "Throw em Out" contrib along with the "IP Address Account Created" contrib. This pretty much allows us to monitor accounts at all times, especially with a heavily modded "Who's Online" page.

 

A number of falsified accounts were being created, probably just to access wholesale prices. What they dont realize is that their prices arent adjusted until we approve their reseller wholesale account. ;)

 

AH WELL.....at least this is one way to discourage laziness! Anyone have thoughts as to whether it is a good idea to notify applicants that their IP addresses are being recorded? Again, please note that these are wholesale accounts, and we're not selling to the public.

 

Thx :)

Carpe Carp: Seize the Fish.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...