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.

%domain% -> domain in skeleton

Discussion in 'General Discussion' started by Domenico, Jul 11, 2007.

  1. Domenico

    Domenico Well-Known Member

    Joined:
    Aug 14, 2001
    Messages:
    362
    Likes Received:
    0
    Trophy Points:
    16
    Hi,

    When creating an account the index.php is taken from the skel dir and copied to the public_html dir from the new account.

    In this index.php we use %domain% and before cPanel 11 the new domain name was written on that spot before copied to the new account (I believe /scripts/postwwwacct did this).

    How can we fix this?
     
  2. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
  3. Shrek

    Shrek Active Member

    Joined:
    Sep 6, 2004
    Messages:
    43
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Arkansas, USA
    So what would one change on this code?

    # Checks domain name

    if (!@ARGV || $ARGV[0] eq "" || $ARGV[0] !~ /(\S+)/) {
    deaderror("Missing or wrong argument (domain) in /scripts/postwwwacct\n");
    } else {
    $domain = validatedomain($1);
    print "Setting \%domain\% = $domain\n";

    $ip = "";
    if (-r "/var/cpanel/accounting.log") {
    my $lastline = `tail -1 /var/cpanel/accounting.log`;
    if ($lastline =~ /CREATE:(?:[^:]+:){3}([^:]+)/) {
    $ip = $1;
    }
    }
    if ($ip eq "") {
    print "Warning, could not determine IP number from accounting.log\n";
    $ip = $default_ip;
    }
    print "Setting \%ip\% = $ip\n";
    }

    # Creates the index.html file

    $infile = "/$homedir/public_html/$index";
    $outfile = "/$homedir/public_html/$index.postwwwacct";

    open(IN, "<$infile") or deaderror("Cannot read index.html");
    open(OUT, ">$outfile") or deaderror("Cannot open temp file");
    while (<IN>) {
    s/\%domain\%/$domain/g;
    s/\%ip\%/$ip/g;
    print OUT;
     
Loading...

Share This Page