php-general Digest 13 Dec 2005 21:32:28 -0000 Issue 3848
Topics (messages 227367 through 227397):
Re: IE6 not returning POST data from a textarea
227367 by: Erfan Shirazi
227376 by: Al
asianwhiteskin beauty product
227368 by: liezel (sent by Nabble.com)
227369 by: Raz
Re: need for $_POST[''] changed after server upgrade
227370 by: Ford, Mike
Re: Questions from a ColdFusion Developer
227371 by: Jochem Maas
Re: [JOB] MySQL/PHP Engineer, Los Angeles, CA
227372 by: Angelo Zanetti
Problems downloading e-mail
227373 by: Oli Howson
227377 by: Jochem Maas
Re: detecting file size
227374 by: Ahmed Saad
Re: Container Loading Script
227375 by: Jochem Maas
1 ip address go here all others go here
227378 by: Dave Carrera
227380 by: Jay Blanchard
227382 by: Dave Carrera
227383 by: Zareef Ahmed
227384 by: Duncan Hill
227385 by: Jay Blanchard
227386 by: David Grant
227387 by: John Nichel
227388 by: Dave Carrera
227389 by: Dan Parry
227390 by: Jochem Maas
227391 by: David Grant
227392 by: David Grant
227393 by: Dave Carrera
227394 by: Ray Hauge
227395 by: Duncan Hill
227396 by: Ray Hauge
Page Setup
227379 by: Denyl Meneses Guillén
227381 by: Jay Blanchard
Re: Sending $_GET directly to AJAX
227397 by: comex
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[email protected]
----------------------------------------------------------------------
--- Begin Message ---
Are you doing a mysql_escape_string on the POST variable received? That
doesn't work so good with textareas.
Jay Blanchard wrote:
[snip]
Everyone keeps asking it. Of course it's named or Mozzilla wouldn't work.
[/snip]
You can insert a textarea into a page without a name and mozilla will work.
If the textarea is named have you tried this....
echo $_POST['textareaName'];
--- End Message ---
--- Begin Message ---
Jay Blanchard wrote:
[snip]
Everyone keeps asking it. Of course it's named or Mozzilla wouldn't work.
[/snip]
You can insert a textarea into a page without a name and mozilla will work.
If the textarea is named have you tried this....
echo $_POST['textareaName'];
This thread was broken.
Note my message in the original thread. It explains the bug and a fix.
--- End Message ---
--- Begin Message ---
We supply all kinds of Whitening Pills and other whitening products, diet
pills, herbal supplements, breast enlarger, pink nipple cream, whitening
creams, soaps, lotions, anti-acne creams, anti-aging creams, under arm
whitening creams and under arm kit, foot and nail care kit, bath salt, body
scrub kit, bath salt, hair and scalp care kit, scars and stretch marks remover
and more…!
--
Sent from the PHP - General forum at Nabble.com:
http://www.nabble.com/asianwhiteskin-beauty-product-t733161.html#a1920247
--- End Message ---
--- Begin Message ---
Can I have some breast enlarger please?
--- End Message ---
--- Begin Message ---
On 13 December 2005 04:22, Ray wrote:
> Hello,
> Thanks Matt, I appreciate your help. your solution is a lot
> easier than mine.
even easier:
extract($_POST);
>
> -----Original Message-----
> From: "Matt Babineau" <[EMAIL PROTECTED]>
> To: "'Ray'" <[EMAIL PROTECTED]>, <[email protected]>
> Date: Sun, 11 Dec 2005 22:42:46 -0800
> Subject: RE: [PHP] need for $_POST[''] changed after server upgrade
>
> > Register globals is no longer ON I believe. That is why it happened.
> >
> > To fix this:
> >
> > Foreach($_POST as $key => $value) ${$key} = $value;
> >
> > That will convert all of your post variables to local variables.
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS, LS6 3QS, United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211
To view the terms under which this email is distributed, please go to
http://disclaimer.leedsmet.ac.uk/email.htm
--- End Message ---
--- Begin Message ---
CF has an application scope - PHP does not.
the strength and simplicity of PHP stem from the decision to make/keep
PHP a "share nothing" architecture.
with regard to shoving stuff in the SESSION superglobal:
1. it not shared between requests by different users - meaning
that the SQL query you gave as an exmaple would still be run once
by every visitor and each visitor would have a copy of the
result set object.
2. performance-wise sticking objects in the session is possibly
something to be avoided is possible - storage and retrieval of 'complex'
structure (i.e. objects in this case) comes with a certain performance
penalty (you might want to consider using an array to store the query results)
3. you MUST load the class definitions of ALL the objects that are in your
session
BEFORE you start the session.
Christopher Jordan wrote:
Hi folks,
I'm a ColdFusion developer, but I'm branching out into PHP because alot of my smaller clients don't want to pay for CF.
Anyway, a bit of background:
I've got a page that does a search on one of my tables. I'm using Justin Vincent's ezSQL (http://php.justinvincent.com) to fetch the result set into an object that can be referenced nicely. Here's what his example code looks like:
// Select multiple records from the database and print them out..
$users = $db->get_results("SELECT name, email FROM users");
foreach ( $users as $user ){
// Access data using object syntax
echo $user->name;
echo $user->email;
}
So far so good. So I've got an iframe on the page which (I hope) will eventually display the results of the search. The user will then click on the search result for which they want to view the details, and the information from that row will be populated inside the main page (the one that houses the iframe).
Hope that makes sense.
Okay, so my trouble is that I don't know how to enable the page inside the iframe to have access to the result object created by Justin Vincent's nifty little class. In CF I can just say:
session.oResults = queryname
CF automatically returns any query as an object with the name of the query as the object name (i.e. queryname.MyIdField, or queryname.EmployeeNumber, etc.) Using a line like the one above (assigning the query object to a session variable) all of my subsequent requests would have access to that result set simply by using the object.
I'm *sure* there's a way to do this in PHP. I'm just falling short of finding the answer. I've tried:
$_SESSION["SearchResult"] = $db->get_results($query);
But it doesn't seem to work. I may have some other problem using the object. I just re-read my error and it says:
Fatal error: Call to a member function get_results() on a non-object in inventorymanager.php on line 93
hmm... I sure would appreciate a little guidence here. Even if my problem is with the way I'm using the object, is the idea of assigning that object to the session scope the right way to do this or is there a better approach. To that end, I suppose I'm looking for an idea of the best practice.
Thanks!
Christopher Jordan
Planet Access
Arlington, TX
---------------------------------
Yahoo! Shopping
Find Great Deals on Holiday Gifts at Yahoo! Shopping
--- End Message ---
--- Begin Message ---
LOL!!!!!!!!
Curt Zirzow wrote:
On Fri, Dec 09, 2005 at 10:41:15PM -0600, Beau Gould wrote:
[JOB] MySQL/PHP Engineer, Los Angeles, CA
http://www.superiorss.com/jobs.htm
Consider what would happpen if everone on this list would decide to
post their resume?
You know what would happen?
My resume would be better than anyone.
Curt.
--- End Message ---
--- Begin Message ---
I've used the IMAP functions to connect to my pop3 server. I want to
download the emails. I can fetch headers, or fetch the body, but I
don't seem to be able to download the entire e-mail as one raw file.
This is so I can pass it to the PEAR mail mime class for parsing, as
well as for storage. Anyone got any suggestions for this?
Oli
--- End Message ---
--- Begin Message ---
Oli Howson wrote:
I've used the IMAP functions to connect to my pop3 server. I want to
download the emails. I can fetch headers, or fetch the body, but I don't
seem to be able to download the entire e-mail as one raw file. This is
so I can pass it to the PEAR mail mime class for parsing, as well as for
storage. Anyone got any suggestions for this?
use google, see where it gets you?
I searched for 'php pop3 connection'
and found this straight away:
http://www.thewebmasters.net/php/class.POP3.phps
I would take a look at the get() method - it might do what you want, or inspire
you to figure somethign out..
Oli
--- End Message ---
--- Begin Message ---
Ahmed basha :)
On 12/12/05, Ahmed Abdel-Aliem <[EMAIL PROTECTED]> wrote:
> i know i can detect the file size after being uploaded, but i do want
> to detect the file after it is being uploaded to the server.
You may want to read this code walkthrough
http://blog.joshuaeichorn.com/archives/2005/05/01/ajax-file-upload-progress/
-ahmed
--- End Message ---
--- Begin Message ---
Leonard,
this is a mailing for helpinmg people understand PHP and
solve PHP problems.
the fact that you need a complete webbased interface to a container loading
algorythm does not really constitute a 'php problem'.
what you are asking for is, softly put, quite complex & rather specialized.
people have spent years developing software to this end ... the price you pay
for it is reflected in that. chances are it does not exist in the open source
arena. you might consider looking beyond php though, given that conceptually
the mathematics involved are probably above you (unless you major in mathematics
or something similar :-) there is little need to have such a tool written in
a language you [fully] understand. (I found at least one tool which had an ASP
api available for linking in a webbased interface).
Leonard Burton wrote:
HI all,
I am working on a project where it would be nice to be able to create
a load plan for a semi trailer or ocean container. There are some
commercially available programs to do this in windows but nothing in
PHP.
Does anyone know of a PHP script that will do this?
Basically it needs to know the size of the trailer and the size of the
items being loaded and then it will go through and create a load based
upon the density of each piece and distribute the weight evenly across
the trailer and fill the trailer up.
Thanks,
--
Leonard Burton, N9URK
[EMAIL PROTECTED]
"You must understand, if you are on a plane you must behave yourself."
"The prolonged evacuation would have dramatically affected the
survivability of the occupants."
--- End Message ---
--- Begin Message ---
Hi List,
Is there a way of sending users with a local ip address say 127.0.0.1
and 192.168.xxx.xxx to goto one page and all other visitors to goto another?
Kind Regards
Dave C
--- End Message ---
--- Begin Message ---
[snip]
Is there a way of sending users with a local ip address say 127.0.0.1
and 192.168.xxx.xxx to goto one page and all other visitors to goto another?
[/snip]
Yes, there is.
$_SERVER['REFERER'] will give you the referer mosy of the time. More info
from TFM can be found here;
http://us3.php.net/reserved.variables
Header can then be used to redirect
header("Location: http://www.example.com/"); /* Redirect browser */. More
info from TFM can be found here;
http://us3.php.net/header
--- End Message ---
--- Begin Message ---
Jay Blanchard wrote:
[snip]
Is there a way of sending users with a local ip address say 127.0.0.1
and 192.168.xxx.xxx to goto one page and all other visitors to goto another?
[/snip]
Yes, there is.
$_SERVER['REFERER'] will give you the referer mosy of the time. More info
from TFM can be found here;
http://us3.php.net/reserved.variables
Header can then be used to redirect
header("Location: http://www.example.com/"); /* Redirect browser */. More
info from TFM can be found here;
http://us3.php.net/header
snip from TFM
'HTTP_REFERER'
The address of the page (if any) which referred the user agent to
the current page. This is set by the user agent. Not all user agents
will set this, and some provide the ability to modify HTTP_REFERER
as a feature. In short, it cannot really be trusted.
notice the last 7 words !!!!
--- End Message ---
--- Begin Message ---
Hi Dave,
You can look for the value of $_SERVER['REMOTE_ADDR'], and then you can
serve users as per your preferences.
Zareef Ahmed
----- Original Message -----
From: "Dave Carrera" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, December 13, 2005 11:06 AM
Subject: [PHP] 1 ip address go here all others go here
> Hi List,
>
> Is there a way of sending users with a local ip address say 127.0.0.1
> and 192.168.xxx.xxx to goto one page and all other visitors to goto
another?
>
> Kind Regards
>
> Dave C
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
====================================================
PHP Expert Consultancy in Development http://www.indiaphp.com
Yahoo! : consultant_php MSN : [EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
On Tuesday 13 December 2005 16:13, Jay Blanchard wrote:
> $_SERVER['REFERER'] will give you the referer mosy of the time. More info
> from TFM can be found here;
REFERER is the URL the client came from though, not the local IP address of
the client. Methinks the OP wants REMOTE_ADDR.
--- End Message ---
--- Begin Message ---
[snip]
snip from TFM
'HTTP_REFERER'
The address of the page (if any) which referred the user agent to
the current page. This is set by the user agent. Not all user agents
will set this, and some provide the ability to modify HTTP_REFERER
as a feature. In short, it cannot really be trusted.
notice the last 7 words !!!!
[/snip]
That is why I said it would "give the referer most of the time". There is no
other way, at least that I am aware of, to accurately gain the referer of
the user each and every time.
--- End Message ---
--- Begin Message ---
Try $_SERVER['REMOTE_HOST'] instead of REFERER.
Dave Carrera wrote:
> Jay Blanchard wrote:
>
>> [snip]
>> Is there a way of sending users with a local ip address say 127.0.0.1
>> and 192.168.xxx.xxx to goto one page and all other visitors to goto
>> another?
>> [/snip]
>>
>>
>> Yes, there is.
>>
>>
>> $_SERVER['REFERER'] will give you the referer mosy of the time. More info
>> from TFM can be found here;
>>
>> http://us3.php.net/reserved.variables
>>
>> Header can then be used to redirect
>>
>> header("Location: http://www.example.com/"); /* Redirect browser */. More
>> info from TFM can be found here;
>>
>> http://us3.php.net/header
>>
>>
>>
> snip from TFM
>
> 'HTTP_REFERER'
>
> The address of the page (if any) which referred the user agent to
> the current page. This is set by the user agent. Not all user agents
> will set this, and some provide the ability to modify HTTP_REFERER
> as a feature. In short, it cannot really be trusted.
>
> notice the last 7 words !!!!
>
--
David Grant
http://www.grant.org.uk/
--- End Message ---
--- Begin Message ---
Dave Carrera wrote:
Jay Blanchard wrote:
[snip]
Is there a way of sending users with a local ip address say 127.0.0.1
and 192.168.xxx.xxx to goto one page and all other visitors to goto
another?
[/snip]
Yes, there is.
$_SERVER['REFERER'] will give you the referer mosy of the time. More info
from TFM can be found here;
http://us3.php.net/reserved.variables
Header can then be used to redirect
header("Location: http://www.example.com/"); /* Redirect browser */. More
info from TFM can be found here;
http://us3.php.net/header
snip from TFM
'HTTP_REFERER'
The address of the page (if any) which referred the user agent to
the current page. This is set by the user agent. Not all user agents
will set this, and some provide the ability to modify HTTP_REFERER
as a feature. In short, it cannot really be trusted.
notice the last 7 words !!!!
I'm sure that's why Jay provided a link to TFM, and said "mosy" (use
your damn spellchecker Jay!!!)
--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
i know about
$_SERVER['REMOTE_HOST']
but i think i should of said how do i compare any address starting with 192.168.
sorry if my first question was to vague
David Grant wrote:
Try $_SERVER['REMOTE_HOST'] instead of REFERER.
Dave Carrera wrote:
Jay Blanchard wrote:
[snip]
Is there a way of sending users with a local ip address say 127.0.0.1
and 192.168.xxx.xxx to goto one page and all other visitors to goto
another?
[/snip]
Yes, there is.
$_SERVER['REFERER'] will give you the referer mosy of the time. More info
from TFM can be found here;
http://us3.php.net/reserved.variables
Header can then be used to redirect
header("Location: http://www.example.com/"); /* Redirect browser */. More
info from TFM can be found here;
http://us3.php.net/header
snip from TFM
'HTTP_REFERER'
The address of the page (if any) which referred the user agent to
the current page. This is set by the user agent. Not all user agents
will set this, and some provide the ability to modify HTTP_REFERER
as a feature. In short, it cannot really be trusted.
notice the last 7 words !!!!
--- End Message ---
--- Begin Message ---
[snip]
In short, it cannot really be trusted.
notice the last 7 words !!!!
[/snip]
Any external data introduced into a script can't be trusted... including
$_GET and $_POST
That doesn't mean they shouldn't be used... just used carefully
Also if you want to use the IP address maybe REMOTE_ADDRESS would be
favourite
-----Original Message-----
From: Dave Carrera [mailto:[EMAIL PROTECTED]
Sent: 13 December 2005 16:23
To: Jay Blanchard
Cc: [email protected]
Subject: Re: [PHP] 1 ip address go here all others go here
Jay Blanchard wrote:
>[snip]
>Is there a way of sending users with a local ip address say 127.0.0.1
>and 192.168.xxx.xxx to goto one page and all other visitors to goto
another?
>[/snip]
>
>
>Yes, there is.
>
>
>$_SERVER['REFERER'] will give you the referer mosy of the time. More info
>from TFM can be found here;
>
>http://us3.php.net/reserved.variables
>
>Header can then be used to redirect
>
>header("Location: http://www.example.com/"); /* Redirect browser */. More
>info from TFM can be found here;
>
>http://us3.php.net/header
>
>
>
snip from TFM
'HTTP_REFERER'
The address of the page (if any) which referred the user agent to
the current page. This is set by the user agent. Not all user agents
will set this, and some provide the ability to modify HTTP_REFERER
as a feature. In short, it cannot really be trusted.
notice the last 7 words !!!!
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
__________ NOD32 1.1320 (20051212) Information __________
This message was checked by NOD32 antivirus system.
http://www.eset.com
--- End Message ---
--- Begin Message ---
Dave Carrera wrote:
Jay Blanchard wrote:
[snip]
Is there a way of sending users with a local ip address say 127.0.0.1
and 192.168.xxx.xxx to goto one page and all other visitors to goto
another?
[/snip]
....
snip from TFM
'HTTP_REFERER'
The address of the page (if any) which referred the user agent to
the current page. This is set by the user agent. Not all user agents
will set this, and some provide the ability to modify HTTP_REFERER
as a feature. In short, it cannot really be trusted.
notice the last 7 words !!!!
I'm sure Jay is well aware of that issue - I'll expand the concept for you...
every freaking bit (as in 8 bits make a byte) sent to your script from a
user agent (e.g. your browser) cannot _really_ be trusted (what so f***ing
ever).
BUT HTTP_REFERER is not what you want I think ... because that gives you the
domain/ip of the server which referred the visitor to your page and not the
domain/ip
of the client.
consider that there might a better/safer solution at the level of the
webserver (e.g. virtual hosts combined with conditionally set env vars) or at
the level of the networking subsystem of your server (e.g. seperate interface
for
local subnet traffic?).
also you might find something useful in the couple of IP related
functions I include below....
/* Determine if an ip is in a net.
* E.G. 120.120.120.120 in 120.120.0.0/16
*/
function isIPInSubnet($ip, $net, $mask)
{
$firstpart = substr(str_pad(decbin(ip2long($net)), 32, "0", STR_PAD_LEFT)
,0 , $mask);
$firstip = substr(str_pad(decbin(ip2long($ip)), 32, "0", STR_PAD_LEFT),
0, $mask);
return (strcmp($firstpart, $firstip) == 0);
}
/* This function check if a ip is in an array of nets (ip and mask) */
function isPrivateIP($theip)
{
foreach (array("10.0.0.0/8",
"172.16.0.0/12",
"192.168.0.0/16") as $subnet)
{
list($net, $mask) = explode('/', $subnet);
if(isIPInSubnet($theip,$net,$mask)) {
return true;
}
}
return false;
}
/* Building the ip array with the HTTP_X_FORWARDED_FOR and REMOTE_ADDR HTTP
vars.
* With this function we get an array where first are the ip's listed in
* HTTP_X_FORWARDED_FOR and the last ip is the REMOTE_ADDR
*/
function getRequestIPs()
{
$ipList = array();
foreach (array('HTTP_X_FORWARDED_FOR', 'HTTP_FORWARDED_FOR', 'REMOTE_ADDR')
as $key) {
if (isset($_SERVER[$key]) && $_SERVER[$key]) {
$ipList = array_merge($ipList, explode(',', $_SERVER[$key]));
break;
}
}
return $ipList;
}
/* try hard to determine whAt the users/clients public IP address is */
function getRequestIP($allowPrivIPs = false)
{
foreach (getRequestIPs() as $ip) {
if($ip && ($allowPrivIPs === true || !isPrivateIP($ip))) {
return $ip;
}
}
return 'unknown';
}
--- End Message ---
--- Begin Message ---
Quick and (very) nasty:
$parts = split(".", $_SERVER['REMOTE_HOST']);
if ($_SERVER['REMOTE_HOST'] == '127.0.0.1' || ($parts[0] == '192' &&
$parts[1] == '168')) {
// Local
} else {
// Remote
}
Dave Carrera wrote:
> i know about
>
> $_SERVER['REMOTE_HOST']
>
> but i think i should of said how do i compare any address starting with
> 192.168.
>
> sorry if my first question was to vague
>
>
> David Grant wrote:
>
>> Try $_SERVER['REMOTE_HOST'] instead of REFERER.
>>
>> Dave Carrera wrote:
>>
>>
>>> Jay Blanchard wrote:
>>>
>>>
>>>> [snip]
>>>> Is there a way of sending users with a local ip address say 127.0.0.1
>>>> and 192.168.xxx.xxx to goto one page and all other visitors to goto
>>>> another?
>>>> [/snip]
>>>>
>>>>
>>>> Yes, there is.
>>>>
>>>>
>>>> $_SERVER['REFERER'] will give you the referer mosy of the time. More
>>>> info
>>>> from TFM can be found here;
>>>>
>>>> http://us3.php.net/reserved.variables
>>>>
>>>> Header can then be used to redirect
>>>>
>>>> header("Location: http://www.example.com/"); /* Redirect browser */.
>>>> More
>>>> info from TFM can be found here;
>>>>
>>>> http://us3.php.net/header
>>>>
>>>>
>>>>
>>>>
>>> snip from TFM
>>>
>>> 'HTTP_REFERER'
>>>
>>> The address of the page (if any) which referred the user agent to
>>> the current page. This is set by the user agent. Not all user agents
>>> will set this, and some provide the ability to modify HTTP_REFERER
>>> as a feature. In short, it cannot really be trusted.
>>>
>>> notice the last 7 words !!!!
>>>
>>>
>>
>>
>>
>>
>
--
David Grant
http://www.grant.org.uk/
--- End Message ---
--- Begin Message ---
Erm, REMOTE_ADDR, not REMOTE_HOST. Sorry!
David Grant wrote:
> Quick and (very) nasty:
>
> $parts = split(".", $_SERVER['REMOTE_HOST']);
> if ($_SERVER['REMOTE_HOST'] == '127.0.0.1' || ($parts[0] == '192' &&
> $parts[1] == '168')) {
> // Local
> } else {
> // Remote
> }
>
>
> Dave Carrera wrote:
>> i know about
>>
>> $_SERVER['REMOTE_HOST']
>>
>> but i think i should of said how do i compare any address starting with
>> 192.168.
>>
>> sorry if my first question was to vague
>>
>>
>> David Grant wrote:
>>
>>> Try $_SERVER['REMOTE_HOST'] instead of REFERER.
>>>
>>> Dave Carrera wrote:
>>>
>>>
>>>> Jay Blanchard wrote:
>>>>
>>>>
>>>>> [snip]
>>>>> Is there a way of sending users with a local ip address say 127.0.0.1
>>>>> and 192.168.xxx.xxx to goto one page and all other visitors to goto
>>>>> another?
>>>>> [/snip]
>>>>>
>>>>>
>>>>> Yes, there is.
>>>>>
>>>>>
>>>>> $_SERVER['REFERER'] will give you the referer mosy of the time. More
>>>>> info
>>>>> from TFM can be found here;
>>>>>
>>>>> http://us3.php.net/reserved.variables
>>>>>
>>>>> Header can then be used to redirect
>>>>>
>>>>> header("Location: http://www.example.com/"); /* Redirect browser */.
>>>>> More
>>>>> info from TFM can be found here;
>>>>>
>>>>> http://us3.php.net/header
>>>>>
>>>>>
>>>>>
>>>>>
>>>> snip from TFM
>>>>
>>>> 'HTTP_REFERER'
>>>>
>>>> The address of the page (if any) which referred the user agent to
>>>> the current page. This is set by the user agent. Not all user agents
>>>> will set this, and some provide the ability to modify HTTP_REFERER
>>>> as a feature. In short, it cannot really be trusted.
>>>>
>>>> notice the last 7 words !!!!
>>>>
>>>>
>>>
>>>
>>>
>
>
--
David Grant
http://www.grant.org.uk/
--- End Message ---
--- Begin Message ---
Thanks David,
Thats the kind of thing i was looking for.
Onwards and upwards ;-)
Dave C
David Grant wrote:
Quick and (very) nasty:
$parts = split(".", $_SERVER['REMOTE_HOST']);
if ($_SERVER['REMOTE_HOST'] == '127.0.0.1' || ($parts[0] == '192' &&
$parts[1] == '168')) {
// Local
} else {
// Remote
}
Dave Carrera wrote:
i know about
$_SERVER['REMOTE_HOST']
but i think i should of said how do i compare any address starting with
192.168.
sorry if my first question was to vague
David Grant wrote:
Try $_SERVER['REMOTE_HOST'] instead of REFERER.
Dave Carrera wrote:
Jay Blanchard wrote:
[snip]
Is there a way of sending users with a local ip address say 127.0.0.1
and 192.168.xxx.xxx to goto one page and all other visitors to goto
another?
[/snip]
Yes, there is.
$_SERVER['REFERER'] will give you the referer mosy of the time. More
info
from TFM can be found here;
http://us3.php.net/reserved.variables
Header can then be used to redirect
header("Location: http://www.example.com/"); /* Redirect browser */.
More
info from TFM can be found here;
http://us3.php.net/header
snip from TFM
'HTTP_REFERER'
The address of the page (if any) which referred the user agent to
the current page. This is set by the user agent. Not all user agents
will set this, and some provide the ability to modify HTTP_REFERER
as a feature. In short, it cannot really be trusted.
notice the last 7 words !!!!
--- End Message ---
--- Begin Message ---
That would be something along the lines of:
preg_match("/^192\.168/",$_SERVER['REMOTE_HOST']);
I'm a little rusty on my regex, but that should do it.
Dave Carrera wrote:
i know about
$_SERVER['REMOTE_HOST']
but i think i should of said how do i compare any address starting
with 192.168.
sorry if my first question was to vague
David Grant wrote:
Try $_SERVER['REMOTE_HOST'] instead of REFERER.
Dave Carrera wrote:
Jay Blanchard wrote:
[snip]
Is there a way of sending users with a local ip address say 127.0.0.1
and 192.168.xxx.xxx to goto one page and all other visitors to goto
another?
[/snip]
Yes, there is.
$_SERVER['REFERER'] will give you the referer mosy of the time.
More info
from TFM can be found here;
http://us3.php.net/reserved.variables
Header can then be used to redirect
header("Location: http://www.example.com/"); /* Redirect browser
*/. More
info from TFM can be found here;
http://us3.php.net/header
snip from TFM
'HTTP_REFERER'
The address of the page (if any) which referred the user agent to
the current page. This is set by the user agent. Not all user agents
will set this, and some provide the ability to modify HTTP_REFERER
as a feature. In short, it cannot really be trusted.
notice the last 7 words !!!!
--- End Message ---
--- Begin Message ---
On Tuesday 13 December 2005 16:33, Dave Carrera wrote:
> $_SERVER['REMOTE_HOST']
>
> but i think i should of said how do i compare any address starting with
> 192.168.
REMOTE_HOST contains the resolved DNS name of an IP address. This value is
dependent on your web server doing DNS resolution (and most people configure
it not to due to the speed impact).
REMOTE_ADDR contains the IP.
preg_match() probably does what you want.
--- End Message ---
--- Begin Message ---
Oops... REMOTE_ADDR should have been used.
Ray Hauge wrote:
That would be something along the lines of:
preg_match("/^192\.168/",$_SERVER['REMOTE_HOST']);
I'm a little rusty on my regex, but that should do it.
Dave Carrera wrote:
i know about
$_SERVER['REMOTE_HOST']
but i think i should of said how do i compare any address starting
with 192.168.
sorry if my first question was to vague
David Grant wrote:
Try $_SERVER['REMOTE_HOST'] instead of REFERER.
Dave Carrera wrote:
Jay Blanchard wrote:
[snip]
Is there a way of sending users with a local ip address say 127.0.0.1
and 192.168.xxx.xxx to goto one page and all other visitors to goto
another?
[/snip]
Yes, there is.
$_SERVER['REFERER'] will give you the referer mosy of the time.
More info
from TFM can be found here;
http://us3.php.net/reserved.variables
Header can then be used to redirect
header("Location: http://www.example.com/"); /* Redirect browser
*/. More
info from TFM can be found here;
http://us3.php.net/header
snip from TFM
'HTTP_REFERER'
The address of the page (if any) which referred the user agent to
the current page. This is set by the user agent. Not all user agents
will set this, and some provide the ability to modify HTTP_REFERER
as a feature. In short, it cannot really be trusted.
notice the last 7 words !!!!
--- End Message ---
--- Begin Message ---
Sorry , my question is about javascript .
I want to eliminate the Headers (&w&bPage &p of &P ) and Footers ( &u&b&d )
of my pagina by means of Javascript.
this is poible? , please help me.
thanks
Denyl.
--- End Message ---
--- Begin Message ---
[snip]
Sorry , my question is about javascript .
I want to eliminate the Headers (&w&bPage &p of &P ) and Footers ( &u&b&d )
of my pagina by means of Javascript.
this is poible? , please help me.
[/snip]
No, it is not possible. These are browser based controls that are not
exposed to scripting of any type.
--- End Message ---
--- Begin Message ---
> But when I try to set the variables again for AJAX to use after a
> timeout, nothing happens and it only displays what is called (RSD:
> received) AJAX debug mode. Which seems to be the answer to AJAX "question".
As far as I know, "AJAX" is just the use of the Javascript
XMLHttpRequest object to make HTTP requests of the server; it looks
like you have some AJAX framework that tries to automate things. Can
you be more specific about what you're using?
--- End Message ---