Jump to content

Is your country selected by default ?


joe123

Recommended Posts

Thats cool. Did you write some custom code for your template to use that?

of course i did what do you think it's working without code ? :)

Would you be willing to share it?

it is still in a test and not fully finished and when the time comes i will .

I still need some more feedback from other countries .

Link to comment
Share on other sites

Worked for me in France, displayed "France or Monaco" which is fine.

Good resource you pointed to, but obviously if you wrote some code you're willing to share I'll be happy to not reinvent the wheel given that I provide some custom code myself before ;-)

Link to comment
Share on other sites

if anyone out there is willing to write a complete ReadMe file with the following , i will share it immediately after that . To avoid questions and how to , the read me file have to include the following

1- how to create the database table and fields with phpmyadmin

(http://ip-to-country.webhosting.info/node/view/54)

2-how to import the database into the database (phpmyadmin)

3-how to update the database to the latest in the future

(http://ip-to-country.webhosting.info/node/view/6)

4- writing the changes made in clientregister.tpl or order-signup.tpl

 

then i will provide you with the following ready to use:

 

php File

javascript file

clientregister.tpl

 

I know some of the above will be asked so let's avoid it and i am really bad in writing documentations.

 

ANY Volunteers lazy people? :)

Link to comment
Share on other sites

Here are the creation files I have created so far based on a few items:

1. Your existing WHMCS database is called whmcs

2. The new WHMCS table will be mod_iptocountry

3. Root can run wget command

 

Run the following from a command prompt while logged into server as root:

cd /tmp
wget http://ip-to-country.webhosting.info/downloads/ip-to-country.csv.zip
unzip ip-to-country.csv.zip
mv ip-to-country.csv iptocountry.csv
rm -f ip-to-country.csv.zip
chown mysql.mysql iptocountry.csv
chmod 666 iptocountry.csv

 

Create a file called iptocountry.sql and add these contents:

CREATE TABLE IF NOT EXISTS `mod_iptocountry` (
 `IP_FROM` double NOT NULL default '0',
 `IP_TO` double NOT NULL default '0',
 `COUNTRY_CODE2` char(2) NOT NULL default '',
 `COUNTRY_CODE3` char(3) NOT NULL default '',
 `COUNTRY_NAME` varchar(50) NOT NULL default '',
 KEY `CODE` (`IP_FROM`,`IP_TO`,`COUNTRY_CODE2`)
) ENGINE=MyISAM;
TRUNCATE `mod_iptocountry`;
LOAD DATA INFILE '/tmp/iptocountry.csv' INTO TABLE `mod_iptocountry` FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n';
OPTIMIZE TABLE `mod_iptocountry`;
SELECT COUNT(*) AS Total FROM `mod_iptocountry`;

 

Finally, run this command to create the table in the whmcs database and populate it:

mysql --database=whmcs < /tmp/iptocountry.sql

 

After running, your out should shold look like this:

Table   Op      Msg_type        Msg_text
mod_iptocountry   optimize        status  OK
Total
81315

The last two lines indicate the number to entries within the new/updated table. As long as your table structure doesn't change, you can safely run the last command over and over with no issues...

 

As a side note, I'm going to do this same thing with the MaxMind City based data... http://www.maxmind.com/app/geolitecity via pecl...

Link to comment
Share on other sites

  • 3 months later...
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated