Failure to login into a db via PHP
#1

Testing
Reply
#2

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.
Reply
#3

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;
?>
Reply
#4

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); 
Reply
#5

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.
Reply
#6

I'd suggest to not get the country by ip, The ip can return false information.
Reply
#7

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?
Reply
#8

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)