Re: HELP!! QUERY_STRING
| From: | Evan Nemerson | Date: | Sat, 11 Aug 2001 05:17:37 +0000 |
| Subject: | Re: HELP!! QUERY_STRING | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-62246@lists.php.net to get a copy of this message | ||
I think this is what you're going for:
$portNum = 5500;
$arr = explode(":",$QUERY_STRING);
$ipname = $arr[0];
if(isset($arr[1])) {
$portNum = $arr[1];
};
On Friday 10 August 2001 19:00, you wrote:
> the things i want it to do are:
> when i go to index.php?172.0.0.1:5500
> that it would change the $ipname to 172.0.0.1 and
> $portNum to 5500
> and if i go to
> index.php?172.0.0.1
> then $ipname to 172.0.0.1 and
> $portNum to 5500
>
> so if i would go to:
> index.php?255.255.255.255
> $ipname to 255.255.255.255 and
> $portNum to 5500
>
> ok.. i think i know 50% of the solution of this problem:
> if $portNum eq''
> $portNum "5500";
> else
> }
>
> is that right or i that cgi or is that totally wrong?
>
> right now this is my code: (index.php)
>
>
> ####################################
>
>
> <?
>
> #First output the HTML page
>
> ?>
> <?
> #Some functions
> if (! $sock = fsockopen($ipname, $portNum, &$num, &$error, 5))
> print ("<IMG
> SRC=\"http://hlpass.macomega.com/red.jpg\" WIDTH=10
> HEIGHT=10>");
> else{
> print ("<IMG
> SRC=\"http://hlpass.macomega.com/green.jpg\" WIDTH=10
> HEIGHT=10>");
> fclose($sock);
> }
> #If the form has been posted, process the query, otherwise there's
> #nothing to do yet
>
> if(!$queryType)
> exit;
>
> #Make sure the target appears valid
>
> if( (!$ipname) || (!eregi("\.",$ipname)) ){
> message("Error: You did not specify a valid target host or IP.");
> exit;
> }
>
> #Figure out which tasks to perform, and do them
>
> if( ($queryType=="all") || ($queryType=="checkp") )
> checkp($ipname,$portNum);
>
> ?>
>
> ####################################