ZachMEdwards
Members-
Posts
95 -
Joined
-
Last visited
Never
Everything posted by ZachMEdwards
-
I don't really understand... Like this? if (file_exists("logos/".$product["refer"].".png"))
-
Sum of adding consecutive numbers together
ZachMEdwards replied to zender's topic in PHP Coding Help
Your array goes from 1 to 3 (diff of 2), 3 to 6 (diff of 3), 6 to 10 (diff of 4).<?PHP $out = array(0 => 1); $diff = 2; for($x = 1; $x <= 100; $x++) { array_push($out, $out[$x-1] + $diff); $diff++; } print_r($out); ?> -
You sure that's the right file?
-
Which do you guys think is faster? $fp = fsockopen($host, 80) or die("$errstr ($errno)"); fwrite($fp, $this->headers($method, $file, $host, $referer, $data)); for($a=0,$r='';!$a;) { #option 1 $b = fread($fp,8192); $r.=$b; $a=(empty($b) ? 1 : 0); } or $fp = fsockopen($host, 80) or die("$errstr ($errno)"); fwrite($fp, $this->headers($method, $file, $host, $referer, $data)); $r=''; #option 2 while(!feof($fp)) $r .= fgets($fp,256); and why? According to my tests, it looks like option 2 is faster. I'm curious as to why... And is there a faster alternative? As you can see in the code, I'm using fwrite on a fsocket. I need this to be as fast as possible!
-
Connect to a site using the user's IP?
ZachMEdwards replied to ZachMEdwards's topic in PHP Coding Help
I'm just trying to prove the point that it uses HIS/HER IP address. Not the server's. -
@<tDate>[0-9]/{4,5}</tDate>@ It should work, depends on what your $body looks like.
-
Connect to a site using the user's IP?
ZachMEdwards replied to ZachMEdwards's topic in PHP Coding Help
Are they IP banned? Of course everyone has his own IP. His site would login to example.com. I am IPBanned from example.com so when I tried to login from his site to example.com, it would output: you are IP banned. But everyone else could login to example.com from his site. I am the owner of example.com and I saw that every login that logged in from his site each had a unique IP address. I emailed some of the users who used his site and when I asked if that was their IP address (the one from AdminCP), they all said it was theirs. Understand yet? -
(?:ftp://)?([^/]+)
-
Connect to a site using the user's IP?
ZachMEdwards replied to ZachMEdwards's topic in PHP Coding Help
I know it wasn't a trick. He had a PHP login up for a site that I am IPBanned from. I tried to login thru HIS site and HIS site said "you are IP banned". Everyone else could login from his/her IP. And in the admin CP I saw that everyone who was logging in through his site was using his/her IP. -
Connect to a site using the user's IP?
ZachMEdwards replied to ZachMEdwards's topic in PHP Coding Help
Well then how do I connect to a site with their IP? -
Connect to a site using the user's IP?
ZachMEdwards replied to ZachMEdwards's topic in PHP Coding Help
I know how to get the IP just fine. Someone told me it's possible if you loop through a bunch of ports and find one that's open. -
Hey guys... This should be my last question for a while My friend showed me a PHP snippet he had where it got the HTML from a page (http://ipchicken.com/) and under Current IP Address it had my IP address. So he had used my IP address to visit a site. How can I do this? For the code I am writing now, it needs to use the user's IP. It can't use the server's. I know this is possible, just looking for a way how.
-
Thank you, and I'll remember the capitalization custom.
-
I'm new to PHP classes. Can someone show me why this is throwing a notice / fatal error? And how do I fix it? test.php: <?PHP class testVariable { private $test = 'testing'; public function __construct() { echo $this->$test; } } ?> index.php: <?PHP require_once 'test.php'; $test = new testVariable(); ?>
-
function headers($method, $file, $host, $referer = "", $data = "") { $isPost = @stripos($method, "POST") !== FALSE; $headers = ($isPost ? "POST " : "GET ").$file." HTTP/1.1\r\n"; $headers .= "Host: ".$host."\r\n"; $headers .= "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3\r\n"; $headers .= "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n"; $headers .= "Accept-Language: en-us,en;q=0.5\r\n"; $headers .= "Accept-Encoding: gzip,deflate\r\n"; $headers .= "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n"; $headers .= "Keep-Alive: 115\r\n"; $headers .= "Connection: Close\r\n"; if(!empty($referer)) { $headers .= $referer."\r\n"; } if($isPost) { $headers .= "Content-Type: application/x-www-form-urlencoded\r\n"; $headers .= "Content-Length: ".strlen($data)."\r\n"; } if(!empty($cookies)) { $headers .= $cookies."\r\n"; } if($isPost) { $headers .= "\r\n".$data."\r\n\r\n"; } else { $headers .= "\r\n"; } return $headers; } Here's the headers I get when I call: $head = headers("POST", "http://www.mysite.com/index.php?postdata=here&and=such&foo=bar")); die("\"$head\""); I'm doing this same thing with GET requests and those work fine. Here's where I send the headers: if(!$fp) { die("$errstr ($errno)<br />\n"); } else { $out = ""; fwrite($fp, $head); while(!feof($fp)) { $out .= fgets($fp, 128); } fclose($fp); echo $out; } Thanks in advance
-
This seemed to work fine. Thanks anyways
-
I have a GZip encoded string that I need to decode. Is there a built in PHP function or do I have to use an external DLL? Thanks!
-
Thanks rwwd, I set my error_reporting ini setting to E_ALL | E_STRICT. Now I can get back to PHP
-
Here's a link to my PHPInfo: http://zachafer.com/phpinfo.php I have: error_reporting = E_ALL & E_STRICT display_errors = On both set in C:\php5\php.ini I have tried restarting Apache, and still nothing. Here's my code to test the errors: <?PHP if($dfshijfhsijfhi) { echo' hi'; } ?> Please help!
-
<center> Your referrer ID is: <br> <?PHP echo $bbuserinfo[userid]; ?> </center> It doesn't show up =\