hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Programming Discussion : wildcard sites
Reply

Forum Jump

wildcard sites

Reply Post New Thread In Programming Discussion Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 06-19-2008, 06:56 AM
NWSTech NWSTech is online now
Web Hosting Evangelist
 
Join Date: Apr 2005
Posts: 535

wildcard sites


hello,
im trying to code a script whereby i can let users create their own virtual site automaticly (php copy files etc) using a subdomain like site.mydomain.net but obviously im going to be uisng wildcard dns to forward the subdomains to the ip of my server - currently i have a script their which detects the name of site (http_host var) and checks a mysql db to see if it exists but i cant work out how to forward from their to the users site without ending up with a link like site.mydomain.net/site which i obviously dont want- tried using the php chdir function but that doesnt work either

current script thats being used as index.php is below
PHP Code:
<?php
include("config.php");
connectdb();

$host=$_SERVER["HTTP_HOST"];
$site=explode(".",$host);
$query1=mysql_query("SELECT * FROM sites WHERE intname='".$site[0]."'");
$sitecheck=mysql_num_rows($query1);
if(
$sitecheck==1)
    {
                
chdr($site[0]);
        
header("Location: index.php");
    }else{
  
header("Cache-Control: no-cache, must-revalidate");            // Prevent caching, HTTP/1.1
  
header("Pragma: no-cache");
echo 
'<?xml version="1.0" encoding="UTF-8"?>'
echo 
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<?php
echo "<head>";
echo 
"<title>***</title>";
echo 
"
<style type=\"text/css\">
<!--

body {
color: #
$txt;
background-color: #
$bgcol;
text-align: center;
font-family: 
$txtstyle;
font-size: 
$sze;
}
a:link { color: #
$lnk; }
a:visited { color: #
$lnk; }

.profile {
color: #
$txt;
background-color: #
$bgcol;
text-align: left;
}
a:link { color: #
$lnk; }
a:visited { color: #
$lnk; }

.breaker {
color: #
$txt;
border-style: dashed;
padding: 5;
border-width: 1px;
background-color: #
$altbg;
text-align: center;
}
a:link { color: #
$lnk; }
a:visited { color: #
$lnk; }

.form-container {
 text-align: center;
}
img
{  border-style: none;
}
-->
</style>

</head>"
;
echo 
"<body><p>";
        echo 
"Sorry Theirs no site here by that name<br/> Feel Free To Click <a href=\"http://www.****.net/create.php\">Here</a> To Make One";
echo 
"</p></body></html>";
    }

?>
excuse the seeminly weird css etc - its going to be a xhtml mobile based site so im trying to keep it valid



Sponsored Links
  #2  
Old 06-19-2008, 09:31 AM
NWSTech NWSTech is online now
Web Hosting Evangelist
 
Join Date: Apr 2005
Posts: 535
no one with any ides ?

  #3  
Old 06-26-2008, 03:42 PM
stanosf stanosf is offline
Newbie
 
Join Date: Jun 2008
Posts: 12
does it have to be a script or are you on your own server (or vps) such that you have full control over httpd.conf?

Sponsored Links
  #4  
Old 06-26-2008, 03:49 PM
NWSTech NWSTech is online now
Web Hosting Evangelist
 
Join Date: Apr 2005
Posts: 535
can be a shell script etc, i use litespeed not apache though so no httpd.conf as such, and i want to be able to copy files to create the site automaticly also

Reply

Related posts from TheWhir.com
Title Type Date Posted
Microsoft Gains Most Sites in April: Netcraft Web Server Survey Web Hosting News 2014-04-08 10:53:35
Microsoft Sees Largest Gains in Netcraft November Web Server Survey Web Hosting News 2013-11-04 16:01:02
Apache Loses 9.9 Million Sites in Netcraft April 2013 Web Server Survey Web Hosting News 2013-04-03 14:42:33
Tumblr Becomes Tenth Largest Web Host in Netcraft November Web Server Survey Web Hosting News 2012-11-09 09:23:04
Netcraft Continues to See a Drop in Responses for July 2012 Web Survey Web Hosting News 2012-07-03 14:35:26


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?