The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

A little helping hand for those who are having domain probs with skeletons

Discussion in 'General Discussion' started by mikeyskona, Aug 4, 2003.

?

did u find this script useful?

  1. yes

    4 vote(s)
    66.7%
  2. no

    2 vote(s)
    33.3%
  1. mikeyskona

    mikeyskona Member

    Joined:
    Jul 27, 2003
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Plymouth UK
    hey :)

    Not too long ago i was looking for a feature that ensim offers with its domains such as $domain = the domain thats been created. However all i could find was a few small scripts that gave the name as types (ie www.domain.com) which wasn't very helpful for giving out pop addresses for the accounts etc. Another way was to create a quite difficult mod to the wwwact file or the postacct file ( tried this way and screwed it up <G>).

    So i set to work with a friend and some PHP. In the end we came up with an explode() implode() arguement which used the SERVER_NAME. What it did was look for the www. at the beginning and removed it if it was there to create the var $domain.

    So you end up with something like http://home.mkserve.net . The output will be the same with or without a www. at the beginning.

    U can do this by adding this snippet of code to the top of your page :

    <?PHP
    $link=$_SERVER['SERVER_NAME'];
    $servername=explode(".",$link);
    if($servername[0]=="www"){
    array_shift($servername);
    }
    $domain=implode(".",$servername);
    ?>

    Now where every u add the following code: <?php print" $domain"; ?> the domain name will appear without the www. Clever eh? <G> (dont forget to save the page as .php and please be sure you server is PHP!!) THis may sound stupid but i have had complaints that index.html doesnt work like mine :D

    If you want the script i used for mine to edit i attached it to this post ( a copy of the skel ), or just download it from here (coded in windows using Dreamweaver):
    http://www.mkserve.net/downloads/skeleton.zip.

    If u create any handy little additions to this script please send them my way as everything help :-D

    I hope you found this useful. I know it saved me alot of work ;) This is a handy little script for my resellers too as they do not need to do any real Mods themselves. :)
     
    #1 mikeyskona, Aug 4, 2003
    Last edited: Aug 4, 2003
  2. perfectsquare

    perfectsquare Active Member

    Joined:
    Sep 11, 2002
    Messages:
    36
    Likes Received:
    0
    Trophy Points:
    6
    What about:

    <?php

    $domain = str_replace("www.","",$_SERVER['SERVER_NAME']);

    ?>

    cPanel.net Support Ticket Number:

    cPanel.net Support Ticket Number:
     
  3. mikeyskona

    mikeyskona Member

    Joined:
    Jul 27, 2003
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Plymouth UK
    that one was tried. but i think that caused problems when there was no www. .. i am learning PHP this was a learning curve for myself aswell. My friend and i tried quite f ew different methods.

    I'll have another crack at that one tho :D ta, lol

    cPanel.net Support Ticket Number:
     
  4. goodmove

    goodmove Well-Known Member

    Joined:
    May 12, 2003
    Messages:
    624
    Likes Received:
    0
    Trophy Points:
    16
    Thanks for the script mikey. How would you get the username so that user paths could be added to the info? ;)
     
  5. mikeyskona

    mikeyskona Member

    Joined:
    Jul 27, 2003
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Plymouth UK
    Hehe this would be a little harder and would require some editing of your wwwacct file or postacct file. I am not all that fluent with Cpanel yet.
    Another suggestion would be a Mysql database. If u create a database with the information in it and a return email address you could create a little script that checks against this address and sends out the details. Problem with this is that you will either ave to be very good with your Cpanel Mods (i am NOT!) lol or you would have to updat this database manually.

    This script was just meant as a quick and easy fix the the lack of a $domain command (Which Ensim includes and so does plesk i think)

    If anyone else has any ideas on this please let us both know ;-)

    thanks

    cPanel.net Support Ticket Number:
     

Share This Page