Failure to login into a db via PHP -
Amit1998 - 25.05.2016
Testing
Re: Failure to login into a db via PHP (+REP) -
JasperM - 25.05.2016
Assuming you are using MySQL, please show a screenshot of the following part of phpinfo():
The second error is standard because the database connection was not succesfully initialized. The first error was most likely because you don't have the pdo_mysql driver.
Re: Failure to login into a db via PHP (+REP) -
Amit1998 - 25.05.2016
Quote:
Originally Posted by JasperM
Assuming you are using MySQL, please show a screenshot of the following part of phpinfo():
The second error is standard because the database connection was not succesfully initialized. The first error was most likely because you don't have the pdo_mysql driver.
|
Yup, managed to find it and fix it, thank you very much, once again Jeppe
Hum, mind giving me a hand in another difficulty I'm having? I'm trying to set up user-flags for players.
In order for this to work I want to use the geoip extension.
I downloaded the dll file of the geoip extension and put it in C:\Program Files (x86)\IIS Express\PHP\v5.5\php.ini
and edited the php.ini's [ExtensionList] -> I added the extension=php_geoip.dll at it's ending and when Included these lines in the body of my website, i got a blank site
PHP код:
<?php
$ip = "IP.IP.IP.IP";
$country = geoip_country_code_by_name($ip);
echo $country;
?>
Re: Failure to login into a db via PHP -
Amit1998 - 25.05.2016
Trying this code now, tho I need to find a way to extract the country code.
It displays after the "country_code" text in the website:
PHP код:
$pageContent = 'http://freegeoip.net/json/' .$playeronlinee["IP"];
$mystring = strtolower(file_get_contents($pageContent));
$n = sscanf($mystring, "'country_code': '%s'", $section);
Re: Failure to login into a db via PHP -
JasperM - 25.05.2016
You could look into preg_match and DOMDocument. I have to go now, can make something for you when I'm back from dinner in a few hours.
Re: Failure to login into a db via PHP -
Luicy. - 25.05.2016
I'd suggest to not get the country by ip, The ip can return false information.
Re: Failure to login into a db via PHP -
Amit1998 - 25.05.2016
Quote:
Originally Posted by Meller
I'd suggest to not get the country by ip, The ip can return false information.
|
Managed to get it work tho, what's the alternative you offer?
Re: Failure to login into a db via PHP -
JasperM - 25.05.2016
Quote:
Originally Posted by Meller
I'd suggest to not get the country by ip, The ip can return false information.
|
Yeah and lets not do IP bans either because proxies are a thing. Fact is, most IP databases have a pretty high accuracy at the moment. Although they can't get the exact location nor the city most of the time, they do a pretty good job on countries. Ofcourse, proxies are still a thing, but on non-VPN & non-proxy IP's you will have the country in about 90% of the time right.