SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Evangelist
    Join Date
    Nov 2003
    Location
    Brisbane, Australia
    Posts
    408
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Cut Short a Domain Name to Male Account Name

    Hi

    Can someone please help me with the right code to do this.

    Like in WHM/cPanel I need to take a domain name out of my database and create the username the will be the first 8 characters of the domain name.

    e.g. thisismydomain.com would be thisismy

    But if there is a dot (.) then the dote has to be taken out but still make up a 8 character username.

    e.g. theabc.com would be theabcco

    And at the same time if there isn't 8 characters it just uses the total amount there.

    e.g. abc.com would be abccom

    Thanks for any help.

    Murray

  2. #2
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is this what you want? I presume you have access to cpanel DB and you have already retrieved the domain name.
    PHP Code:
    $domain 'thisismydomain.com'// I presume you have access to cpanel DB and you have already retrieved the domain name
    $username substr(str_replace("."""$domain), 08);
    echo 
    $username
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •