Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[PHP] Sockets

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
nwongfeiying
Grandmaster Cheater
Reputation: 2

Joined: 25 Jun 2007
Posts: 695

PostPosted: Thu Jul 02, 2009 12:34 am    Post subject: [PHP] Sockets Reply with quote

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Port Scanner</title>
</head>

<body>
<?php
$domain = $_GET["domain"];

$MIN = 0;
$MAX = 500;

$host = gethostbyname($domain);

$socket = socket_create(AF_INET, SOCK_STREAM, 0);

for($n = $MIN; $n <= $MAX; $n++)
{
   $result = @socket_connect($socket, $host, $n);
   if($result)
   {
      $port = getservbyport($n, "tcp");
      printf("Port $n ($port) is open. <br />");
      $socket = socket_create(AF_INET, SOCKET_STREAM, 0);
   }
   sleep(100);
}

socket_close($socket);
?>
</body>

</html>


I'm doing nothing wrong so why doesn't it work? It works if I use a small range, but doesn't work if I give it a big range. For example, if I use 8060 - 8090 it works, but if I use 1 - 9000, it doesn't work.
Back to top
View user's profile Send private message
Yuri
Advanced Cheater
Reputation: 0

Joined: 09 Dec 2008
Posts: 75
Location: /d/

PostPosted: Thu Jul 02, 2009 12:39 am    Post subject: Reply with quote

you suck.
Back to top
View user's profile Send private message
Cheat Engine User
Something epic
Ban
Reputation: 60

Joined: 22 Jun 2007
Posts: 2071

PostPosted: Thu Jul 02, 2009 12:46 am    Post subject: Re: [PHP] Sockets Reply with quote

nwongfeiying wrote:
I'm doing nothing wrong so why doesn't it work? It works if I use a small range, but doesn't work if I give it a big range. For example, if I use 8060 - 8090 it works, but if I use 1 - 9000, it doesn't work.
Maybe you are getting a timeout, because you set a maximum script runtime.

Also, make a check if $_GET['DOMAIN'] is set: isset($_GET['DOMAIN']
Back to top
View user's profile Send private message
LolSalad
Grandmaster Cheater
Reputation: 1

Joined: 26 Aug 2007
Posts: 988
Location: Australia

PostPosted: Thu Jul 02, 2009 12:51 am    Post subject: Re: [PHP] Sockets Reply with quote

Holly wrote:
Maybe you are getting a timeout, because you set a maximum script runtime.


This is probably correct; try set_time_limit(0).

_________________
Back to top
View user's profile Send private message MSN Messenger
Cheat Engine User
Something epic
Ban
Reputation: 60

Joined: 22 Jun 2007
Posts: 2071

PostPosted: Thu Jul 02, 2009 12:59 am    Post subject: Re: [PHP] Sockets Reply with quote

Wahoa wrote:
Holly wrote:
Maybe you are getting a timeout, because you set a maximum script runtime.


This is probably correct; try set_time_limit(0).


Or set it to 0 in php.ini
Back to top
View user's profile Send private message
Localhost
I post too much
Reputation: 0

Joined: 28 Apr 2007
Posts: 3402

PostPosted: Thu Jul 02, 2009 11:40 am    Post subject: Reply with quote

or maybe your server doesn't support flooding?
_________________
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites