TerrasIOI Posted January 7, 2008 Share Posted January 7, 2008 Hello, I want to build skel file that shows requested domain automatically. I'm using <!--#echo var="REQUEST_URI" --> command but nothing happens. Any idea? 0 Quote Link to comment Share on other sites More sharing options...
bear Posted January 7, 2008 Share Posted January 7, 2008 That will only run if the page it's called from will parse for SSI (server side includes), typically by naming it xxx.shtml. You might try with PHP by using this (name the page "index.php", without "quotes"): <?php $_SERVER['HTTP_HOST'] ?> That should print the entire requested domain name, including the www and .tld Try it? 0 Quote Link to comment Share on other sites More sharing options...
TerrasIOI Posted January 7, 2008 Author Share Posted January 7, 2008 Hello, Thanks for this tip Tried. It returns just '/'. But this work for IP: <!--#echo var="REMOTE_ADDR" --> Any idea? 0 Quote Link to comment Share on other sites More sharing options...
bear Posted January 7, 2008 Share Posted January 7, 2008 Just tested this: <?php $link = $_SERVER['HTTP_HOST']; echo $link; ?> For me it returns the full requested URL, up to the end of the .tld. What do you see? 0 Quote Link to comment Share on other sites More sharing options...
TerrasIOI Posted January 7, 2008 Author Share Posted January 7, 2008 Yes that works!!! Thank you very much for this tip! 0 Quote Link to comment Share on other sites More sharing options...
arhost Posted January 8, 2008 Share Posted January 8, 2008 Try this; it will display a clean out put e.g. yourdomain.com instead of http://yourdomain.com/ <?php print str_replace('/', '',str_replace('www.', '', str_replace('http://', '', $_SERVER['HTTP_REFERER']))); ?> 0 Quote Link to comment Share on other sites More sharing options...
bear Posted January 8, 2008 Share Posted January 8, 2008 "HTTP_REFERER" should be "HTTP_HOST", otherwise, yes. 0 Quote Link to comment Share on other sites More sharing options...
brianoz Posted January 9, 2008 Share Posted January 9, 2008 This doesn't cover the webhost-server1.com/~username case, but to do that you need to fiddle around quite a bit - extract the primary domain from /etc/userdomains, which isn't normally readable. Also a good solution may need to display a different page for reseller-owned accounts. If you're displaying this sort of Welcome message, to make it easier to maintain 100s of domains with this file in place, I'd just have a single line like the following in your cpanel3-skel/public_html/index.php file: <?php include "/home/username/shared/holdingpage.php"; ?> That way you can modify the single included file and have the update available to all your users, without needing to fiddle with files all through various home directories. 0 Quote Link to comment Share on other sites More sharing options...
bear Posted January 9, 2008 Share Posted January 9, 2008 The point was he wanted to show the requested domain name on the page that's shown. What you've done is to include a page of "something", which could be just added to the actual skel directory page instead. No point complicating it in that case. To clarify, the "skel" directory is content that gets included into the home directory of newly created cPanel accounts. There is no "various home directories", as this is only used for new setups. Once set up, the account skel dir is no longer used on that account. 0 Quote Link to comment Share on other sites More sharing options...
brianoz Posted January 9, 2008 Share Posted January 9, 2008 I know how the skel directory (actually cpanel3-skel) works, been using it for 4 years with a script like the one I'm discussing The point is, it introduces only a small complication (one level of indirection), and makes it possible to change or grow the default display for accounts that haven't got webpages. Less than a minute's extra work gives you a simple system that you can upgrade, or not, as time goes along. If you don't do the include trick, to upgrade the script, you'd have to go into each user account and edit the copied index.php file, or just forget about changing anything. We're talking about a potentially dynamic rather than a static page that got copied in 2 years ago when the account got created. Not intending to be a smart alec, hope I don't come across that way, just trying to clarify the value here! 0 Quote Link to comment Share on other sites More sharing options...
bear Posted January 9, 2008 Share Posted January 9, 2008 We're talking about a potentially dynamic rather than a static page that got copied in 2 years ago when the account got created. I don't know about you, but my clients tend to upload their own pages rather quickly, overwriting the skel file "hold" page that this inserts into the account. Do you really have users that buy a hosting account and don't upload anything to it for 2 years? The point of skel files is twofold: - Creating a default holding page so visits aren't shown errors or the cPanel default page. This is intended to be replaced by the user's files. - Copying any important files/scripts to the account automatically on creation. I obviously don't know how you are using this feature, but this is the intended purpose. 0 Quote Link to comment Share on other sites More sharing options...
brianoz Posted January 13, 2008 Share Posted January 13, 2008 Do you really have users that buy a hosting account and don't upload anything to it for 2 years? Yes, although admittedly not common. We have a lot of small business (ie one-person startups, tradies, etc) customers that start off using only their email address and often don't get around to creating an actual web page for some time. I did the figures once and it was something like 40-50% had default pages. 0 Quote Link to comment Share on other sites More sharing options...
bear Posted January 13, 2008 Share Posted January 13, 2008 That's an amazing percentage. I don't believe I've had more than a few that took more than 2 months to upload here. Are they all from one market, like local businesses, or just random? 0 Quote Link to comment Share on other sites More sharing options...
brianoz Posted January 14, 2008 Share Posted January 14, 2008 They're random; but one thing in common is that they're often fairly computer illiterate and they're often in small business start up mode - and they're small - often 1-2 people. I think our experience with larger clients would be fairly similar to yours. My percentages above might be wrong, but they're ballpark correct. Of course, maybe it's as simple as I don't charge enough 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.