Jump to content

Recommended Posts

Happy new year everyone!

 

Can someone help me please.  I have a skadate script installed on a domain and want to set up sub-domains based on the users country of registration - ireland.mydomain.com, france.mydomain.com etc

 

I know that I can install the skadate script within subdomains and refer to the same primary database BUT what I want to do is only show say users registered in Ireland on the ireland.mydomain.com site.

 

Can this be done via the database connection string??

 

// MySQL Connection

define('DB_HOST', 'localhost');

define('DB_USER', 'user_skadate');

define('DB_PASS', 'abc123');

define('DB_NAME', 'user_skadate');

define('DB_TBL_PREFIX', 'skadate_');

 

This is the config.php database string.

 

Any advice or suggestions would be very gratefully recieved.

You should define a catch-all DNS entry:

 

*.<your-domain> IN A <ip>

 

Then in your PHP script:

 

$country = array_shift(explode('.', $_SERVER['HTTP_HOST'])); // ireland, france, ..

 

Be sure to filter $country and validate before using it in a database.

Thanks for your reply, I think I may not have explained fullly, because as I believe $country is a standard php function and what I needed was to use members based on a field they'll have completed (country_id)

Do you have a control panel of your server with DNS access? If so, open it and add a new entry:

 

*.your-domain.com IN A your-ip-address

 

This will "forward" everything to your-domain.com and allows you to handle it like this:

 

$country = array_shift(explode('.', $_SERVER['HTTP_HOST'])); // eg ireland, france, or www

 

Add the necessary code to handle www, ireland and france. If this feels over your head, hire a freelancer/programmer to do it for you.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.