Download Horizon :: Staff Members :: TheTechGame.com :: XboxMB YouTube


Old 11-27-2010   #11 (permalink)

AIRBORN LLAMA's Avatar
Join Date: Oct 2010
Location: My house!
Posts: 467
Thanks: 220
Default Re: Arrays

Very nice Tutorial

Very imformative!
AIRBORN LLAMA is offline Send a message via AIM to AIRBORN LLAMA Send a message via MSN to AIRBORN LLAMA
Reply With Quote


Old 01-05-2012   #12 (permalink)
Evilone's Avatar
Join Date: Sep 2010
Location: Planet Xbox360
Posts: 48
Thanks: 11
Default Re: Arrays

here is the practical use of an array contained with in a file to keep dirt bags from a page or a site and send them some were else

this is the file dirtbag.php and you call this with an include statment

PHP Code:

<?php
  $cfraud_ip 
getenv("REMOTE_ADDR");

    
$badips dirname(__FILE__)."/dirtbag.dat";
          
$array file$badips );
              
$cfraud_ips = array();
        foreach ( 
$array as $val )
            
$cfraud_ips[] = rtrim($val);

  if(
in_array($cfraud_ip$cfraud_ips)) {
     
header("Location: http://www.yourwebsite.com/dirtbag.shtml");
    exit();
  }
?>


This is the data file or text file this serves as the array I call it dirtbag.dat I use rtrim to strip any spaces left in the file out look below no comma required just the ips. my foreach statment loops through the array to the end. If the Ips match then I kick them to the page or site I want to, and off the page they came to


dirtbag.dat file contents below
PHP Code:
41.204.224.7
41.204.224.25
41.205.188.27
58.4.97.173
58.120.155.246
58.147.0.228
59.77.17.245
59.95.0.201
60.190.79.18
61.9.62.6
61.178.18.96 

I am sure you can follow the vars

This is where the file ends up becoming an array

PHP Code:
$array file$badips ); 

Below I compare the persons ip against the ips found in the array $cfraud_ips = array();

PHP Code:
 if(in_array($cfraud_ip$cfraud_ips)) 
__________________
It's always best to be evil when ever possible.

Last edited by Evilone; 01-05-2012 at 04:00 AM.
Evilone is offline
Reply With Quote


Old 03-07-2012   #13 (permalink)
Cheater912's Avatar
:D
Join Date: Jul 2010
Location: New York
Posts: 5,683
Thanks: 12,223
Default Re: Arrays

Updated. Added the new, short syntax.
__________________
Cheater912 is offline Send a message via Skype™ to Cheater912
Reply With Quote
The following users thanked this post: Austin, sgt frankieboy


Old 03-07-2012   #14 (permalink)
Regular Member
Odd Future's Avatar
Join Date: Dec 2010
Location: Dat Ass
Posts: 1,965
Thanks: 1,228
Default Re: Arrays

You had me thinking Dean was back. D:
Odd Future is offline Send a message via AIM to Odd Future Send a message via Skype™ to Odd Future
Reply With Quote
The following users thanked this post: o Randyy o, RZRClanLeader

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 09:17 AM.


 

Powered by vBulletin® Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
COPYRIGHT (c) 2010 - 2012 - XboxMB - DESIGN BY:
EDENWEBS.COM