This function has always worked for me:
function getIpAddress()
{
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
$ip_expl = explode('.', $_SERVER['HTTP_CLIENT_IP']);
$referer = explode('.', $_SERVER['REMOTE_ADDR']);
if ($referer[0] != $ip_expl[0]) {
$ip = array_reverse($ip_expl)...
Thank you for the replies. I checked the mapped drives, and they are all connected (there are three). Also, I have had this computer for about a year, and have not changed anything recently.
Since last I posted I ran a registry cleaner, but no luck there either.
If I find anything I will post...
It all started when I noticed my computer getting a little sluggish. I ran Anti-virus, Anti-Spam, disk cleanup, and defrag.
This seemed to fix my sluggish issue, but now my 'Save As...' dialog box, takes about 20-30 seconds to open. It only happens the first time I attempt to 'Save As'. I...
vacunita, I had not thought about new data types being added as DBs mature, and I think you make a very valid point. Since I would assume all values can be represented as strings (except for NULL of course) it would definitely make more sense to have a stable extension instead of trying to...
I have done a little more research into this and found that it actually happens in the MySQL C API.
The documentation I found on mysql_fetch_row() (in the C API) states:
Now PHP does the conversion for you, but I am actually more shocked that it happens in the C because it is not a loosely...
I understand that, my question is why label them as strings when they are coming into PHP as integers? If they were labeled as integers you could still do everything you listed because like you said: PHP variables type depends on its content, and its context.
I completely understand in the...
Actually, I believe they are returned as strings, because using the comparison '===' will fail when comparing the returned value to an integer.
The documentation of mysql_fetch_array (and other mysql functions) state:
Also if you use var_dump() on a returned value it is labeled as a string...
When querying data out of MySQL into PHP, all values from MySQL arrive in PHP as strings, even if the MySQL column type is INT. This is documented behavior, but I was wondering if someone could explain why this is the case.
The data type returned by MySQL corresponds to the column type, so why...
Excellent, error_get_last() looks like the right tool for the job.
I have a tendency to stay away from require() calls, because if it fails it issues an fatal error (E_ERROR), problem with that being that there is no way to trap a fatal error.
I was hoping that require() would be changed to...
Doing some testing on my setup Windows XP/Apache 2.2/PHP 5.2.3
The include_path directive is commented out by default, and loading up the phpinfo() file shows:
include_path .;C:\php5\pear
So I have to assume if PHP finds no include_path directive it defaults to this.
If you uncomment the...
That is what I normally do, but it occurred to me this morning that an include file could have the statement:
return FALSE;
In which case the code:
if ((include $filename) === FALSE){
//do something
}
would not be able to determine if the file was included or not.
I am not actually having a...
Doing some testing, I have found that when and include statement fails to open a stream it returns boolean FALSE (along with generating warnings), but an included file could also return FALSE. I would like to know if there is a way to determine (programmatically) if the include failed or it was...
I have to agree with josel on one point:
But I would also urge you to manually install PHP, you will have a chance to learn about configuring PHP, enabling extensions, and everything else that goes along with it.
I am no server wiz and I recently had to update my development server. I had...
Not to hijack a thread but...
I'm shocked; I have never run into this problem. Do you know of any specific browsers which behave this way?
The value attribute of a checkbox is required by the HTML specs and if no value is given the client is suppose to send the value 'on'. I know browsers...
I should have explained it a little better...
Example 437 shows how the functions date() and mktime() can be used together to add and subtract time.
//ten days ahead
$lastmonth = mktime(0, 0, 0, date("m"), date("d")+10, date("Y"));
//ten days back
$lastmonth = mktime(0, 0, 0, date("m")...
Check out the date() function. Specifically example 437.
-- -- -- -- -- -- -- --
If you give someone a program, you will frustrate them for a day
but if you teach them how to program, you will frustrate them for a lifetime.
Personally, I have always used an absolute path when dealing with files outside the document root but that is just a personal preference either will work and I don't really see any major difference; especially from a security aspect.
If you give someone a program, you will frustrate them for a...
I would agree with feherke. IMO the best thing to do is store the config file outside the document root, this will prevent the file being accessed through any normal browser request.
Another security measure which seems to be over looked when dealing with db connections is the permissions of...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.