Zubrag.com
May 22, 2019, 07:14:24 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Cannot create email account. Possible reasons: "fopen" functi.....  (Read 8633 times)
fabcoe
Newbie
*
Posts: 1


« on: July 27, 2007, 08:39:03 AM »

Hi

I keep receiving this error, and my safe mode config is Off.
 Embarrassed
What else could be wrong?

Logged
zubrag
Administrator
Hero Member
*****
Posts: 788


WWW
« Reply #1 on: July 27, 2007, 11:20:02 AM »

Lets try working via sockets.
Replace this code:
Code:
  // Create email account
  $f = fopen ("http://$cpuser:$cppass@$cpdomain:2082/frontend/$cpskin/mail/doaddpop.html?email=$euser&domain=$edomain&password=$epass&quota=$equota", "r");
  if (!$f) {
    $msg = 'Cannot create email account. Possible reasons: "fopen" function allowed on your server, PHP is running in SAFE mode';
  }
  else {
    $msg = "<h2>Email account {$euser}@{$edomain} created.</h2>";

  }

with:
Code:
  $sock = fsockopen($cpdomain,2082);
  if(!$sock) {
    print('Socket error');
    exit();
  }

  $request = "/frontend/$cpskin/mail/doaddpop.html?email=$euser&domain=$edomain&password=$epass&quota=$equota";
  $authstr = "$cpuser:$cppass";
  $pass = base64_encode($authstr);
  $in = "GET $request\r\n";
  $in .= "HTTP/1.0\r\n";
  $in .= "Host:$host\r\n";
  $in .= "Authorization: Basic $pass\r\n";
  $in .= "\r\n";

  fputs($sock, $in);
  $result = '';
  while (!feof($sock)) {
    $result .= fgets ($sock,128);
  }
  fclose( $sock );

  // Check result
  if (ereg ("already exist", $result)) {
    $msg = "<h2>Email account {$euser}@{$edomain} already exists.</h2>";
  }
  else {
    $msg = "<h2>Email account {$euser}@{$edomain} created.</h2>";
  }
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC