Wildcard Dns

Started on the old forum in July 2008 · view the original in the archive · old links redirect here

20 replies · 1,228 views · started 18 years ago · 1 min read

4 participants
SpiderWap Lead · 622 posts #1

Ok, i thought i had it sorted out. But I'm having a little problem....

I got my virual subdomains to work, thanx to sub that remembered me strugling with it on my current host. So now i got it working... But with my current host i strugled to get it working, but he helped me and we got it to wrok...

Now my problem is, it doesn't want to redirect to the correct username (sites/index.php?name=$name)

I did this code

<?
include("config.php");
$srvname=$_SERVER['SERVER_NAME'];
$srvname=strtolower($srvname);
$query = "SELECT * FROM `users` WHERE `name` = '".$srvname."'";
$result = mysql_query($query);
$otvet = mysql_fetch_array($result);
if($otvet['name'])
{
header("location: sites/index.php?name=".$srvname."");
}
else
{
header("location: http://spiderwap.co.za");
}
?>
subzero Super moderator Fellow · 3,954 posts #2

have you use wildcard on your own ?

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

subzero Super moderator Fellow · 3,954 posts #4

what domain bro i mean own ?

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

SpiderWap Lead · 622 posts #7

Ok,,, so if i red the source right the code in my case should be.

<?php
$domain = $_SERVER['HTTP_HOST']; 
$domain_parts = explode('.',$domain); 
if (count($domain_parts) == 3 && $domain_parts[0]!= "www") { // make sure a subdomain is called 
$users=mysql_query(mysql_fetch_array("SELECT name FROM users WHERE name='".$domain_parts."'"));
$users[0] = $domain_parts[0]; 
$loc = "http://4wap.co.cc/sites/index.pnp?name=$users[0]"; 
@header("Location:$loc"); 
}
?>
rukiya Lead · 569 posts #8

no i will be

<?php
$domain = $_SERVER['HTTP_HOST']; 
$domain_parts = explode('.',$domain); 
include("config.php");
if (count($domain_parts) == 3 && $domain_parts[0]!= "www") { // make sure a subdomain is called 
$users=mysql_fetch_array(mysql_query("SELECT name FROM users WHERE name='".$domain_parts."'"));
$loc = "http://4wap.co.cc/sites/index.php?name=$users[0]"; 
@header("Location:$loc"); 
}
?>
rukiya Lead · 569 posts #9

or better

<?php
$domain = $_SERVER['HTTP_HOST']; 
$domain_parts = explode('.',$domain); 
include("config.php");
if (count($domain_parts) == 3 && $domain_parts[0]!= "www") { // make sure a subdomain is called 
$users=mysql_fetch_array(mysql_query("SELECT name FROM users WHERE name='".$domain_parts."'"));
$loc = "http://4wap.co.cc/sites/index.php?name=$users[0]"; 
if($users[0]!= "")
{
@header("Location:$loc"); 
}
else
{
@header("location: http://spiderwap.co.za");
}
}
?>
rukiya Lead · 569 posts #12

thats because co.cc domain will generate 4 exploded part in case of submdomain like username.domain.co.cc so the code will be

<?php
$domain = $_SERVER['HTTP_HOST']; 
$domain_parts = explode('.',$domain); 
include("config.php");
if (count($domain_parts) == 4 && $domain_parts[0]!= "www") { // make sure a subdomain is called 
$users=mysql_fetch_array(mysql_query("SELECT name FROM users WHERE name='".$domain_parts."'"));
$loc = "http://4wap.co.cc/sites/index.php?name=$users[0]"; 
if($users[0]!= "")
{
@header("Location:$loc"); 
}
else
{
@header("location: http://spiderwap.co.za");
}
}
?>
subzero Super moderator Fellow · 3,954 posts #14

Nothing with the domain its how you code it

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

subzero Super moderator Fellow · 3,954 posts #15

here is a fast line coding.

http://grim-reaper.grim-reaper.ws

Now i have subdomain for my members sites yeah i still see my url

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

subzero Super moderator Fellow · 3,954 posts #17

lol mate wow ?

but i can cut out my grim-reaper/users/?grim-reaper and only use grim-reaper.grim-reaper lol

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

wizard Senior · 493 posts #19

thats because co.cc domain will generate 4 exploded part in case of submdomain like username.domain.co.cc so the code will be

<?php
$domain = $_SERVER['HTTP_HOST']; 
$domain_parts = explode('.',$domain); 
include("config.php");
if (count($domain_parts) == 4 && $domain_parts[0]!= "www") { // make sure a subdomain is called 
$users=mysql_fetch_array(mysql_query("SELECT name FROM users WHERE name='".$domain_parts."'"));
$loc = "http://4wap.co.cc/sites/index.php?name=$users[0]"; 
if($users[0]!= "")
{
@header("Location:$loc"); 
}
else
{
@header("location: http://spiderwap.co.za");
}
}
?>

think it should be

WHERE name='".$domain_parts[0]."'
SpiderWap Lead · 622 posts #20
<?php
$domain = $_SERVER['HTTP_HOST']; 
$domain_parts = explode('.',$domain); 
include("4wap/config.php");
if (count($domain_parts) == 4 && $domain_parts[0]!= "www") { // make sure a subdomain is called 
$users=mysql_fetch_array(mysql_query("SELECT name FROM users WHERE name='".$domain_parts[0]."'"));
}
if ($users[0]=="")
{ 
header("location: http://spiderwap.co.za/home.php");
}else{
$loc = "http://4wap.co.cc/sites/index.php?name=$users[0]"; 
header("Location:$loc"); 
}
?>

It works perfect, but funny, i realised that i must use it with my survers primary domain.... and i have a few domains related to my surver, i did a mod on this peace of coding (after having a good nap) and then looked at it again, and realised that it wouldn't have worked with the 4wap domain cause $_SERVER['HTTP_HOST']; goes according to your primary domain name.

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close