Ir para conteúdo

Lipyzin

Campones
  • Total de itens

    10
  • Registro em

  • Última visita

Sobre Lipyzin

Perfil

  • Gênero
    Masculino

Informações

  • Forma que conheci o xTibia
    Sites de Busca
  • Sou
    RPG Maker

Lipyzin's Achievements

  1. Entao cara, eu vou te passar o que eu aprendi, ok? também não achei isso em nenhum outro fórum, foi tudo testando e reiniciando o servidor diversas vezes. lockStorage = 5000107, -- globalstorage (essa storage é do Oberon, pra cada boss tem que criar uma, no meu caso eu criei a final 108 pra um outro boss.) Apara essa parte dos pillar do seu código para ele ficar mais clean. --[[local monsters = { {pillar = "oberons ire", pos = Position(33367, 31320, 9)}, {pillar = "oberons spite", pos = Position(33361, 31320, 9)}, {pillar = "oberons hate", pos = Position( 33367, 31316, 9)}, {pillar = "oberons bile", pos = Position(33361, 31316, 9)} }]] Storage.TheSecretLibrary.TheOrderOfTheFalcon.OberonTimer, novamente essa é uma storage, ou seja, quando um player entra no boss essa 'Storage' é atualizada com o tempo que você colocou, no seu caso aí está os.time() + 20 * 60 * 3600, no meu server eu arrumei e coloquei os.time() + 20 * 3600. Esse comando os.time() é um padrão da linguagem .lua para retornar a o horário exato, ou seja, ele estará adicionando 20 horas apartir da hora exata que ele puxou a alavanca. Para localizar as Storages vá em data/lib/core/storages.lua (TFS 1.3) Acrescente uma com o nome do seu boss e altere no código da action exemplo: onde estiver o código: getStorageValue(Storage.TheSecretLibrary.TheOrderOfTheFalcon.OberonTimer) altere para: getStorageValue(seunovoboss) Mecânica da alavanca: for y = 32022, 32025 do local playerTile = Tile(Position(32208, y, 13)):getTopCreature() if playerTile and playerTile:isPlayer() then if playerTile:getStorageValue(Storage.seunovoboss) > os.time() then playerTile:sendTextMessage(MESSAGE_STATUS_SMALL, "You or a member in your team have to wait 20 hours to challange Grand Master Oberon again!") item:transform(10030) return true end end end Então, todo mundo que tiver dentro das coordenadas informadas será verificado se a storage é maior que o horário atual. Check de players dentro da sala (spectators): local spectators = Game.getSpectators(config.bossPos, false, false, 15, 15, 15, 15) for i = 1, #spectators do local spectator = spectators if spectator:isMonster() then spectator:remove() end end Esses 15,15,15,15 sao os sqm`s ao redor da posicão central. Você terá que contar quantos ao norte, sul, leste e oeste há do centro da sala e colocar aí. (Não sei qual é a ordem certa) Pelo que me lembro é só isso mesmo. Espero que tenha ajudado você e outros que cheguem a esse fórum com a mesma dúvida. Abraço!
  2. Posta o seu script ai, eu fiz um só que funciona 99% só faltou testar a storage, se após as 20 horas ela reinicia mesmo. As veses agte pode se ajudar.
  3. Neuroniooooos.. ainda

  4. Boa tarde, vou tentar detalhar a minha dúvida. Deve ser idiota para alguns mas acredite, eu já quebrei a cabeça e não consegui. Atualmente eu possuo um otserver é um site hospedo na minha casa e estou melhorando aos poucos. Como todos que começam por baixo eu tbm não fui diferente, criei uma máscara no no-ip (wixglobal.sytes.net). Recebi uma ajuda de um amigo que resolveu me presentear com um domínio do godaddy, então ele comprou o wixglobal.com e me deu. A minha dor de cabeça está sendo a seguinte, todos os outros sites de OtServer aparecem assim: otserver.com/índex.php Ou seja o domínio máscara o ip do servidor deles mas permanece com a página. Já o meu, você pode clicar em qualquer página que sempre continuará na raiz aparecendo só o www.wixglobal.com Eu que estou fazendo errado ou hosts pelo Apache em casa não tem como essa configuração? Obrigado pelo atenção.
  5. Não querendo incomodar, @M4Go o meu sistema de recuperação de conta está com o seguinte erro: PHPMAILER: <?php if(!defined('INITIALIZED')) exit; //////////////////////////////////////////////////// // phpmailer - PHP email class // // Version 1.60, Created 03/30/2002 + modified 01/23/2013 by Gesior for Gesior2012 // // Class for sending email using either // sendmail, PHP mail(), or SMTP. Methods are // based upon the standard AspEmail(tm) classes. // // Author: Brent R. Matzelle <bmatzelle@yahoo.com> // // License: LGPL, see LICENSE //////////////////////////////////////////////////// /** * phpmailer - PHP email transport class * @author Brent R. Matzelle */ class phpmailer { ///////////////////////////////////////////////// // PUBLIC VARIABLES ///////////////////////////////////////////////// /** * Email priority (1 = High, 3 = Normal, 5 = low). Default value is 3. * @public * @type int */ var $Priority = 3; /** * Sets the CharSet of the message. Default value is "iso-8859-1". * @public * @type string */ var $CharSet = "iso-8859-1"; /** * Sets the Content-type of the message. Default value is "text/plain". * @public * @type string */ var $ContentType = "text/plain"; /** * Sets the Encoding of the message. Options for this are "8bit" (default), * "7bit", "binary", "base64", and "quoted-printable". * @public * @type string */ var $Encoding = "8bit"; /** * Holds the most recent mailer error message. Default value is "". * @public * @type string */ var $ErrorInfo = ""; /** * Sets the From email address for the message. Default value is "root@localhost". * @public * @type string */ var $From = "root@localhost"; /** * Sets the From name of the message. Default value is "Root User". * @public * @type string */ var $FromName = "Root User"; /** * Sets the Sender email of the message. If not empty, will be sent via -f to sendmail * or as 'MAIL FROM' in smtp mode. Default value is "". * @public * @type string */ var $Sender = ""; /** * Sets the Subject of the message. Default value is "". * @public * @type string */ var $Subject = ""; /** * Sets the Body of the message. This can be either an HTML or text body. * If HTML then run IsHTML(true). Default value is "". * @public * @type string */ var $Body = ""; /** * Sets the text-only body of the message. This automatically sets the * email to multipart/alternative. This body can be read by mail * clients that do not have HTML email capability such as mutt. Clients * that can read HTML will view the normal Body. * Default value is "". * @public * @type string */ var $AltBody = ""; /** * Sets word wrapping on the body of the message to a given number of * characters. Default value is 0 (off). * @public * @type int */ var $WordWrap = 0; /** * Method to send mail: ("mail", "sendmail", or "smtp"). * Default value is "mail". * @public * @type string */ var $Mailer = "mail"; /** * Sets the path of the sendmail program. Default value is * "/usr/sbin/sendmail". * @public * @type string */ var $Sendmail = "/usr/sbin/sendmail"; /** * Turns Microsoft mail client headers on and off. Useful mostly * for older clients. Default value is false (off). * @public * @type bool */ var $UseMSMailHeaders = false; /** * Path to phpmailer plugins. This is now only useful if the SMTP class * is in a different directory than the PHP include path. * Default is empty (""). * @public * @type string */ var $PluginDir = ""; /** * Holds phpmailer version. * @public * @type string */ var $Version = "1.54"; /** * Sets the email address that a reading confirmation will be sent. Default value is "". * @public * @type string */ var $ConfirmReadingTo = ""; /** * Sets the line endings of the message. Default is "\n"; * @public * @type string */ var $LE = "\n"; ///////////////////////////////////////////////// // SMTP VARIABLES ///////////////////////////////////////////////// /** * Sets the SMTP hosts. All hosts must be separated by a * semicolon. You can also specify a different port * for each host by using this format: [hostname:port] * (e.g. "smtp1.domain.com:25;smtp2.domain.com"). * Hosts will be tried in order. * Default value is "localhost". * @public * @type string */ var $Host = "localhost"; /** * Sets the default SMTP server port. Default value is 25. * @public * @type int */ var $Port = 25; /** * Sets the SMTP HELO of the message. * Default value is "localhost.localdomain". * @public * @type string */ var $Helo = "localhost.localdomain"; /** * Sets SMTP authentication. Utilizes the Username and Password variables. * Default value is false (off). * @public * @type bool */ var $SMTPAuth = false; /** * Sets SMTP username. Default value is "". * @public * @type string */ var $Username = ""; /** * Sets SMTP password. Default value is "". * @public * @type string */ var $Password = ""; /** * Sets the SMTP server timeout in seconds. This function will not * work with the win32 version. Default value is 10. * @public * @type int */ var $Timeout = 10; /** * Sets SMTP class debugging on or off. Default value is false (off). * @public * @type bool */ var $SMTPDebug = false; ///////////////////////////////////////////////// // PRIVATE VARIABLES ///////////////////////////////////////////////// /** * Holds all "To" addresses. * @type array */ var $to = array(); /** * Holds all "CC" addresses. * @type array */ var $cc = array(); /** * Holds all "BCC" addresses. * @type array */ var $bcc = array(); /** * Holds all "Reply-To" addresses. * @type array */ var $ReplyTo = array(); /** * Holds all string and binary attachments. * @type array */ var $attachment = array(); /** * Holds all custom headers. * @type array */ var $CustomHeader = array(); /** * Holds the type of the message. * @type string */ var $message_type = ""; /** * Holds the message boundaries. * @type string array */ var $boundary = array(); ///////////////////////////////////////////////// // VARIABLE METHODS ///////////////////////////////////////////////// /** * Sets message type to HTML. Returns void. * @public * @returns void */ function IsHTML($bool) { if($bool == true) $this->ContentType = "text/html"; else $this->ContentType = "text/plain"; } /** * Sets Mailer to send message using SMTP. * Returns void. * @public * @returns void */ function IsSMTP() { $this->Mailer = "smtp"; } /** * Sets Mailer to send message using PHP mail() function. * Returns void. * @public * @returns void */ function IsMail() { $this->Mailer = "mail"; } /** * Sets Mailer to send message using the $Sendmail program. * Returns void. * @public * @returns void */ function IsSendmail() { $this->Mailer = "sendmail"; } /** * Sets Mailer to send message using the qmail MTA. Returns void. * @public * @returns void */ function IsQmail() { //$this->Sendmail = "/var/qmail/bin/qmail-inject"; $this->Sendmail = "/var/qmail/bin/sendmail"; $this->Mailer = "sendmail"; } ///////////////////////////////////////////////// // RECIPIENT METHODS ///////////////////////////////////////////////// /** * Adds a "To" address. Returns void. * @public * @returns void */ function AddAddress($address, $name = "") { $cur = count($this->to); $this->to[$cur][0] = trim($address); $this->to[$cur][1] = $name; } /** * Adds a "Cc" address. Note: this function works * with the SMTP mailer on win32, not with the "mail" * mailer. This is a PHP bug that has been submitted * on http://bugs.php.net. The *NIX version of PHP * functions correctly. Returns void. * @public * @returns void */ function AddCC($address, $name = "") { $cur = count($this->cc); $this->cc[$cur][0] = trim($address); $this->cc[$cur][1] = $name; } /** * Adds a "Bcc" address. Note: this function works * with the SMTP mailer on win32, not with the "mail" * mailer. This is a PHP bug that has been submitted * on http://bugs.php.net. The *NIX version of PHP * functions correctly. * Returns void. * @public * @returns void */ function AddBCC($address, $name = "") { $cur = count($this->bcc); $this->bcc[$cur][0] = trim($address); $this->bcc[$cur][1] = $name; } /** * Adds a "Reply-to" address. Returns void. * @public * @returns void */ function AddReplyTo($address, $name = "") { $cur = count($this->ReplyTo); $this->ReplyTo[$cur][0] = trim($address); $this->ReplyTo[$cur][1] = $name; } ///////////////////////////////////////////////// // MAIL SENDING METHODS ///////////////////////////////////////////////// /** * Creates message and assigns Mailer. If the message is * not sent successfully then it returns false. Use the ErrorInfo * variable to view description of the error. Returns bool. * @public * @returns bool */ function Send() { $header = ""; $body = ""; if((count($this->to) + count($this->cc) + count($this->bcc)) < 1) { $this->error_handler("You must provide at least one recipient email address"); return false; } // Set whether the message is multipart/alternative if(!empty($this->AltBody)) $this->ContentType = "multipart/alternative"; // Attach sender information & date $header = $this->received(); $header .= sprintf("Date: %s%s", $this->rfc_date(), $this->LE); $header .= $this->create_header(); if(!$body = $this->create_body()) return false; //echo "<pre>".$header . $body . "</pre>"; // debugging // Choose the mailer if($this->Mailer == "sendmail") { if(!$this->sendmail_send($header, $body)) return false; } elseif($this->Mailer == "mail") { if(!$this->mail_send($header, $body)) return false; } elseif($this->Mailer == "smtp") { if(!$this->smtp_send($header, $body)) return false; } else { $this->error_handler(sprintf("%s mailer is not supported", $this->Mailer)); return false; } return true; } /** * Sends mail message to an assigned queue directory. Has an optional * sendTime argument. This is used when the user wants the * message to be sent from the queue at a predetermined time. * The data must be a valid timestamp like that returned from * the time() or strtotime() functions. Returns false on failure * or the message file name if success. * @public * @returns string */ function SendToQueue($queue_path, $send_time = 0) { $message = array(); $header = ""; $body = ""; // If invalid or empty just set to the current time if($send_time == 0) $send_time = time(); if(!is_dir($queue_path)) { $this->error_handler("The supplied queue directory does not exist"); return false; } if((count($this->to) + count($this->cc) + count($this->bcc)) < 1) { $this->error_handler("You must provide at least one recipient email address"); return false; } // Set whether the message is multipart/alternative if(!empty($this->AltBody)) $this->ContentType = "multipart/alternative"; $header = $this->create_header(); if(!$body = $this->create_body()) return false; // Seed randomizer mt_srand(time()); $msg_id = md5(uniqid(mt_rand())); $fp = fopen($queue_path . $msg_id . ".pqm", "wb"); if(!$fp) { $this->error_handler(sprintf("Could not write to %s directory", $queue_path)); return false; } $message[] = sprintf("----START PQM HEADER----%s", $this->LE); $message[] = sprintf("SendTime: %s%s", $send_time, $this->LE); $message[] = sprintf("Mailer: %s%s", $this->Mailer, $this->LE); // Choose the mailer if($this->Mailer == "sendmail") { $message[] = sprintf("Sendmail: %s%s", $this->Sendmail, $this->LE); $message[] = sprintf("Sender: %s%s", $this->Sender, $this->LE); } elseif($this->Mailer == "mail") { $message[] = sprintf("Sender: %s%s", $this->Sender, $this->LE); $message[] = sprintf("Subject: %s%s", $this->Subject, $this->LE); $message[] = sprintf("to: %s%s", $this->addr_list($this->to), $this->LE); } elseif($this->Mailer == "smtp") { $message[] = sprintf("Host: %s%s", $this->Host, $this->LE); $message[] = sprintf("Port: %d%s", $this->Port, $this->LE); $message[] = sprintf("Helo: %s%s", $this->Helo, $this->LE); $message[] = sprintf("Timeout: %d%s", $this->Timeout, $this->LE); if($this->SMTPAuth) $auth_no = 1; else $auth_no = 0; $message[] = sprintf("SMTPAuth: %d%s", $auth_no, $this->LE); $message[] = sprintf("Username: %s%s", $this->Username, $this->LE); $message[] = sprintf("Password: %s%s", $this->Password, $this->LE); $message[] = sprintf("From: %s%s", $this->From, $this->LE); $message[] = sprintf("to: %s%s", $this->addr_list($this->to), $this->LE); $message[] = sprintf("cc: %s%s", $this->addr_list($this->cc), $this->LE); $message[] = sprintf("bcc: %s%s", $this->addr_list($this->bcc), $this->LE); } else { $this->error_handler(sprintf("%s mailer is not supported", $this->Mailer)); return false; } $message[] = sprintf("----END PQM HEADER----%s", $this->LE); // end of pqm header $message[] = $header; $message[] = $body; fwrite($fp, join("", $message)); return ($msg_id . ".pqm"); } /** * Sends mail using the $Sendmail program. Returns bool. * @private * @returns bool */ function sendmail_send($header, $body) { if ($this->Sender != "") $sendmail = sprintf("%s -oi -f %s -t", $this->Sendmail, $this->Sender); else $sendmail = sprintf("%s -oi -t", $this->Sendmail); if(!@$mail = popen($sendmail, "w")) { $this->error_handler(sprintf("Could not execute %s", $this->Sendmail)); return false; } fputs($mail, $header); fputs($mail, $body); $result = pclose($mail) >> 8 & 0xFF; if($result != 0) { $this->error_handler(sprintf("Could not execute %s", $this->Sendmail)); return false; } return true; } /** * Sends mail using the PHP mail() function. Returns bool. * @private * @returns bool */ function mail_send($header, $body) { //$to = substr($this->addr_append("To", $this->to), 4, -2); // Cannot add Bcc's to the $to $to = $this->to[0][0]; // no extra comma for($i = 1; $i < count($this->to); $i++) $to .= sprintf(",%s", $this->to[$i][0]); if ($this->Sender != "" && PHP_VERSION >= "4.0") { $old_from = ini_get("sendmail_from"); ini_set("sendmail_from", $this->Sender); } if ($this->Sender != "" && PHP_VERSION >= "4.0.5") { // The fifth parameter to mail is only available in PHP >= 4.0.5 $params = sprintf("-oi -f %s", $this->Sender); $rt = @mail($to, $this->Subject, $body, $header, $params); } else { $rt = @mail($to, $this->Subject, $body, $header); } if (isset($old_from)) ini_set("sendmail_from", $old_from); if(!$rt) { $this->error_handler("Could not instantiate mail()"); return false; } return true; } /** * Sends mail via SMTP using PhpSMTP (Author: * Chris Ryan). Returns bool. Returns false if there is a * bad MAIL FROM, RCPT, or DATA input. * @private * @returns bool */ function smtp_send($header, $body) { $smtp = new SMTP; $smtp->do_debug = $this->SMTPDebug; // Try to connect to all SMTP servers $hosts = explode(";", $this->Host); $index = 0; $connection = false; $smtp_from = ""; $bad_rcpt = array(); $e = ""; // Retry while there is no connection while($index < count($hosts) && $connection == false) { $host = $hosts[$index]; $port = $this->Port; if($smtp->Connect($host, $port, $this->Timeout)) $connection = true; //printf("%s host could not connect<br>", $hosts[$index]); //debug only $index++; } if(!$connection) { $this->error_handler("SMTP Error: could not connect to SMTP host server(s)"); return false; } // Must perform HELO before authentication $smtp->Hello($this->Helo); // If user requests SMTP authentication if($this->SMTPAuth) { if(!$smtp->Authenticate($this->Username, $this->Password)) { $this->error_handler("SMTP Error: Could not authenticate"); return false; } } if ($this->Sender == "") $smtp_from = $this->From; else $smtp_from = $this->Sender; if(!$smtp->Mail(sprintf("<%s>", $smtp_from))) { $e = sprintf("SMTP Error: From address [%s] failed", $smtp_from); $this->error_handler($e); return false; } // Attempt to send attach all recipients for($i = 0; $i < count($this->to); $i++) { if(!$smtp->Recipient(sprintf("<%s>", $this->to[$i][0]))) $bad_rcpt[] = $this->to[$i][0]; } for($i = 0; $i < count($this->cc); $i++) { if(!$smtp->Recipient(sprintf("<%s>", $this->cc[$i][0]))) $bad_rcpt[] = $this->cc[$i][0]; } for($i = 0; $i < count($this->bcc); $i++) { if(!$smtp->Recipient(sprintf("<%s>", $this->bcc[$i][0]))) $bad_rcpt[] = $this->bcc[$i][0]; } // Create error message if(count($bad_rcpt) > 0) { for($i = 0; $i < count($bad_rcpt); $i++) { if($i != 0) $e .= ", "; $e .= $bad_rcpt[$i]; } $e = sprintf("SMTP Error: The following recipients failed [%s]", $e); $this->error_handler($e); return false; } if(!$smtp->Data(sprintf("%s%s", $header, $body))) { $this->error_handler("SMTP Error: Data not accepted"); return false; } $smtp->Quit(); return true; } ///////////////////////////////////////////////// // MESSAGE CREATION METHODS ///////////////////////////////////////////////// /** * Creates recipient headers. Returns string. * @private * @returns string */ function addr_append($type, $addr) { $addr_str = $type . ": "; $addr_str .= $this->addr_format($addr[0]); if(count($addr) > 1) { for($i = 1; $i < count($addr); $i++) { $addr_str .= sprintf(", %s", $this->addr_format($addr[$i])); } $addr_str .= $this->LE; } else $addr_str .= $this->LE; return($addr_str); } /** * Creates a semicolon delimited list for use in pqm files. * @private * @returns string */ function addr_list($list_array) { $addr_list = ""; for($i = 0; $i < count($list_array); $i++) { if($i > 0) $addr_list .= ";"; $addr_list .= $list_array[$i][0]; } return $addr_list; } /** * Formats an address correctly. * @private * @returns string */ function addr_format($addr) { if(empty($addr[1])) $formatted = $addr[0]; else $formatted = sprintf('"%s" <%s>', addslashes($addr[1]), $addr[0]); return $formatted; } /** * Wraps message for use with mailers that do not * automatically perform wrapping and for quoted-printable. * Original written by philippe. Returns string. * @private * @returns string */ function word_wrap($message, $length, $qp_mode = false) { if ($qp_mode) $soft_break = sprintf(" =%s", $this->LE); else $soft_break = $this->LE; $message = $this->fix_eol($message); if (substr($message, -1) == $this->LE) $message = substr($message, 0, -1); $line = explode($this->LE, $message); $message = ""; for ($i=0 ;$i < count($line); $i++) { $line_part = explode(" ", $line[$i]); $buf = ""; for ($e = 0; $e<count($line_part); $e++) { $word = $line_part[$e]; if ($qp_mode and (strlen($word) > $length)) { $space_left = $length - strlen($buf) - 1; if ($e != 0) { if ($space_left > 20) { $len = $space_left; if (substr($word, $len - 1, 1) == "=") $len--; elseif (substr($word, $len - 2, 1) == "=") $len -= 2; $part = substr($word, 0, $len); $word = substr($word, $len); $buf .= " " . $part; $message .= $buf . sprintf("=%s", $this->LE); } else { $message .= $buf . $soft_break; } $buf = ""; } while (strlen($word) > 0) { $len = $length; if (substr($word, $len - 1, 1) == "=") $len--; elseif (substr($word, $len - 2, 1) == "=") $len -= 2; $part = substr($word, 0, $len); $word = substr($word, $len); if (strlen($word) > 0) $message .= $part . sprintf("=%s", $this->LE); else $buf = $part; } } else { $buf_o = $buf; if ($e == 0) $buf .= $word; else $buf .= " " . $word; if (strlen($buf) > $length and $buf_o != "") { $message .= $buf_o . $soft_break; $buf = $word; } } } $message .= $buf . $this->LE; } return ($message); } /** * Assembles message header. Returns a string if successful * or false if unsuccessful. * @private * @returns string */ function create_header() { $header = array(); // Set the boundaries $uniq_id = md5(uniqid(time())); $this->boundary[1] = "b1_" . $uniq_id; $this->boundary[2] = "b2_" . $uniq_id; // To be created automatically by mail() if(($this->Mailer != "mail") && (count($this->to) > 0)) $header[] = $this->addr_append("To", $this->to); $header[] = sprintf("From: \"%s\" <%s>%s", addslashes($this->FromName), trim($this->From), $this->LE); if(count($this->cc) > 0) $header[] = $this->addr_append("Cc", $this->cc); // sendmail and mail() extract Bcc from the header before sending if((($this->Mailer == "sendmail") || ($this->Mailer == "mail")) && (count($this->bcc) > 0)) $header[] = $this->addr_append("Bcc", $this->bcc); if(count($this->ReplyTo) > 0) $header[] = $this->addr_append("Reply-to", $this->ReplyTo); // mail() sets the subject itself if($this->Mailer != "mail") $header[] = sprintf("Subject: %s%s", trim($this->Subject), $this->LE); $header[] = sprintf("X-Priority: %d%s", $this->Priority, $this->LE); $header[] = sprintf("X-Mailer: phpmailer [version %s]%s", $this->Version, $this->LE); $header[] = sprintf("Return-Path: %s%s", trim($this->From), $this->LE); if($this->ConfirmReadingTo != "") $header[] = sprintf("Disposition-Notification-To: <%s>%s", trim($this->ConfirmReadingTo), $this->LE); // Add custom headers for($index = 0; $index < count($this->CustomHeader); $index++) $header[] = sprintf("%s%s", $this->CustomHeader[$index], $this->LE); if($this->UseMSMailHeaders) $header[] = $this->AddMSMailHeaders(); $header[] = sprintf("MIME-Version: 1.0%s", $this->LE); // Determine what type of message this is if(count($this->attachment) < 1 && strlen($this->AltBody) < 1) $this->message_type = "plain"; else { if(count($this->attachment) > 0) $this->message_type = "attachments"; if(strlen($this->AltBody) > 0 && count($this->attachment) < 1) $this->message_type = "alt"; if(strlen($this->AltBody) > 0 && count($this->attachment) > 0) $this->message_type = "alt_attachments"; } switch($this->message_type) { case "plain": $header[] = sprintf("Content-Transfer-Encoding: %s%s", $this->Encoding, $this->LE); $header[] = sprintf("Content-Type: %s; charset = \"%s\"", $this->ContentType, $this->CharSet); break; case "attachments": case "alt_attachments": if($this->EmbeddedImageCount() > 0) { $header[] = sprintf("Content-Type: %s;%s\ttype=\"text/html\";%s\tboundary=\"%s\"%s", "multipart/related", $this->LE, $this->LE, $this->boundary[1], $this->LE); } else { $header[] = sprintf("Content-Type: %s;%s", "multipart/mixed", $this->LE); $header[] = sprintf("\tboundary=\"%s\"%s", $this->boundary[1], $this->LE); } break; case "alt": $header[] = sprintf("Content-Type: %s;%s", "multipart/alternative", $this->LE); $header[] = sprintf("\tboundary=\"%s\"%s", $this->boundary[1], $this->LE); break; } // No additional lines when using mail() function if($this->Mailer != "mail") $header[] = $this->LE.$this->LE; return(join("", $header)); } /** * Assembles the message body. Returns a string if successful * or false if unsuccessful. * @private * @returns string */ function create_body() { $body = array(); // wordwrap the message body if set if($this->WordWrap > 0) $this->Body = $this->word_wrap($this->Body, $this->WordWrap); switch($this->message_type) { case "alt": // Return text of body $bndry = new Boundary($this->boundary[1]); $bndry->CharSet = $this->CharSet; $bndry->Encoding = $this->Encoding; $body[] = $bndry->GetSource(); $body[] = sprintf("%s%s", $this->AltBody, $this->LE.$this->LE); $bndry = new Boundary($this->boundary[1]); $bndry->CharSet = $this->CharSet; $bndry->ContentType = "text/html"; $bndry->Encoding = $this->Encoding; $body[] = $bndry->GetSource(); $body[] = sprintf("%s%s", $this->Body, $this->LE.$this->LE); // End the boundary $body[] = sprintf("%s--%s--%s", $this->LE, $this->boundary[1], $this->LE.$this->LE); break; case "plain": $body[] = $this->Body; break; case "attachments": $bndry = new Boundary($this->boundary[1]); $bndry->CharSet = $this->CharSet; $bndry->ContentType = $this->ContentType; $bndry->Encoding = $this->Encoding; $body[] = sprintf("%s%s%s%s", $bndry->GetSource(false), $this->LE, $this->Body, $this->LE); if(!$body[] = $this->attach_all()) return false; break; case "alt_attachments": $body[] = sprintf("--%s%s", $this->boundary[1], $this->LE); $body[] = sprintf("Content-Type: %s;%s" . "\tboundary=\"%s\"%s", "multipart/alternative", $this->LE, $this->boundary[2], $this->LE.$this->LE); // Create text body $bndry = new Boundary($this->boundary[2]); $bndry->CharSet = $this->CharSet; $bndry->ContentType = "text/plain"; $bndry->Encoding = $this->Encoding; $body[] = $bndry->GetSource() . $this->LE; $body[] = sprintf("%s%s", $this->AltBody, $this->LE.$this->LE); // Create the HTML body $bndry = new Boundary($this->boundary[2]); $bndry->CharSet = $this->CharSet; $bndry->ContentType = "text/html"; $bndry->Encoding = $this->Encoding; $body[] = $bndry->GetSource() . $this->LE; $body[] = sprintf("%s%s", $this->Body, $this->LE.$this->LE); $body[] = sprintf("%s--%s--%s", $this->LE, $this->boundary[2], $this->LE.$this->LE); if(!$body[] = $this->attach_all()) return false; break; } // Add the encode string code here $sBody = join("", $body); $sBody = $this->encode_string($sBody, $this->Encoding); return $sBody; } ///////////////////////////////////////////////// // ATTACHMENT METHODS ///////////////////////////////////////////////// /** * Adds an attachment from a path on the filesystem. * Checks if attachment is valid and then adds * the attachment to the list. * Returns false if the file could not be found * or accessed. * @public * @returns bool */ function AddAttachment($path, $name = "", $encoding = "base64", $type = "application/octet-stream") { if(!@is_file($path)) { $this->error_handler(sprintf("Could not access [%s] file", $path)); return false; } $filename = basename($path); if($name == "") $name = $filename; // Append to $attachment array $cur = count($this->attachment); $this->attachment[$cur][0] = $path; $this->attachment[$cur][1] = $filename; $this->attachment[$cur][2] = $name; $this->attachment[$cur][3] = $encoding; $this->attachment[$cur][4] = $type; $this->attachment[$cur][5] = false; // isStringAttachment $this->attachment[$cur][6] = "attachment"; $this->attachment[$cur][7] = 0; return true; } /** * Attaches all fs, string, and binary attachments to the message. * Returns a string if successful or false if unsuccessful. * @private * @returns string */ function attach_all() { // Return text of body $mime = array(); // Add all attachments for($i = 0; $i < count($this->attachment); $i++) { // Check for string attachment $isString = $this->attachment[$i][5]; if ($isString) { $string = $this->attachment[$i][0]; } else { $path = $this->attachment[$i][0]; } $filename = $this->attachment[$i][1]; $name = $this->attachment[$i][2]; $encoding = $this->attachment[$i][3]; $type = $this->attachment[$i][4]; $disposition = $this->attachment[$i][6]; $cid = $this->attachment[$i][7]; $mime[] = sprintf("--%s%s", $this->boundary[1], $this->LE); $mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $name, $this->LE); $mime[] = sprintf("Content-Transfer-Encoding: %s%s", $encoding, $this->LE); if($disposition == "inline") $mime[] = sprintf("Content-ID: <%s>%s", $cid, $this->LE); else $mime[] = sprintf("Content-ID: <%s>%s", $name, $this->LE); $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", $disposition, $name, $this->LE.$this->LE); // Encode as string attachment if($isString) { if(!$mime[] = sprintf("%s%s", $this->encode_string($string, $encoding), $this->LE.$this->LE)) return false; } else { if(!$mime[] = sprintf("%s%s", $this->encode_file($path, $encoding), $this->LE.$this->LE)) return false; $mime[] = sprintf("--%s--%s", $this->boundary[1], $this->LE); } } return(join("", $mime)); } /** * Encodes attachment in requested format. Returns a * string if successful or false if unsuccessful. * @private * @returns string */ function encode_file ($path, $encoding = "base64") { if(!@$fd = fopen($path, "rb")) { $this->error_handler(sprintf("File Error: Could not open file %s", $path)); return false; } $file = fread($fd, filesize($path)); $encoded = $this->encode_string($file, $encoding); fclose($fd); return($encoded); } /** * Encodes string to requested format. Returns a * string if successful or false if unsuccessful. * @private * @returns string */ function encode_string ($str, $encoding = "base64") { switch(strtolower($encoding)) { case "base64": // chunk_split is found in PHP >= 3.0.6 $encoded = chunk_split(base64_encode($str)); break; case "7bit": case "8bit": $encoded = $this->fix_eol($str); if (substr($encoded, -2) != $this->LE) $encoded .= $this->LE; break; case "binary": $encoded = $str; break; case "quoted-printable": $encoded = $this->encode_qp($str); break; default: $this->error_handler(sprintf("Unknown encoding: %s", $encoding)); return false; } return($encoded); } /** * Encode string to quoted-printable. Returns a string. * @private * @returns string */ function encode_qp ($str) { $encoded = $this->fix_eol($str); if (substr($encoded, -2) != $this->LE) $encoded .= $this->LE; // Replace every high ascii, control and = characters $encoded = preg_replace("/([\001-\010\013\014\016-\037\075\177-\377])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded); // Replace every spaces and tabs when it's the last character on a line $encoded = preg_replace("/([\011\040])".$this->LE."/e", "'='.sprintf('%02X', ord('\\1')).'".$this->LE."'", $encoded); // Maximum line length of 76 characters before CRLF (74 + space + '=') $encoded = $this->word_wrap($encoded, 74, true); return $encoded; } /** * Adds a string or binary attachment (non-filesystem) to the list. * This method can be used to attach ascii or binary data, * such as a BLOB record from a database. * @public * @returns void */ function AddStringAttachment($string, $filename, $encoding = "base64", $type = "application/octet-stream") { // Append to $attachment array $cur = count($this->attachment); $this->attachment[$cur][0] = $string; $this->attachment[$cur][1] = $filename; $this->attachment[$cur][2] = $filename; $this->attachment[$cur][3] = $encoding; $this->attachment[$cur][4] = $type; $this->attachment[$cur][5] = true; // isString $this->attachment[$cur][6] = "attachment"; $this->attachment[$cur][7] = 0; } /** * Adds an embedded attachment. This can include images, sounds, and * just about any other document. * @param cid this is the Content Id of the attachment. Use this to identify * the Id for accessing the image in an HTML form. * @public * @returns bool */ function AddEmbeddedImage($path, $cid, $name = "", $encoding = "base64", $type = "application/octet-stream") { if(!@is_file($path)) { $this->error_handler(sprintf("Could not access [%s] file", $path)); return false; } $filename = basename($path); if($name == "") $name = $filename; // Append to $attachment array $cur = count($this->attachment); $this->attachment[$cur][0] = $path; $this->attachment[$cur][1] = $filename; $this->attachment[$cur][2] = $name; $this->attachment[$cur][3] = $encoding; $this->attachment[$cur][4] = $type; $this->attachment[$cur][5] = false; // isStringAttachment $this->attachment[$cur][6] = "inline"; $this->attachment[$cur][7] = $cid; return true; } /** * Returns the number of embedded images in an email. * @private * @returns int */ function EmbeddedImageCount() { $ret = 0; for($i = 0; $i < count($this->attachment); $i++) { if($this->attachment[$i][6] == "inline") $ret++; } return $ret; } ///////////////////////////////////////////////// // MESSAGE RESET METHODS ///////////////////////////////////////////////// /** * Clears all recipients assigned in the TO array. Returns void. * @public * @returns void */ function ClearAddresses() { $this->to = array(); } /** * Clears all recipients assigned in the CC array. Returns void. * @public * @returns void */ function ClearCCs() { $this->cc = array(); } /** * Clears all recipients assigned in the BCC array. Returns void. * @public * @returns void */ function ClearBCCs() { $this->bcc = array(); } /** * Clears all recipients assigned in the ReplyTo array. Returns void. * @public * @returns void */ function ClearReplyTos() { $this->ReplyTo = array(); } /** * Clears all recipients assigned in the TO, CC and BCC * array. Returns void. * @public * @returns void */ function ClearAllRecipients() { $this->to = array(); $this->cc = array(); $this->bcc = array(); } /** * Clears all previously set filesystem, string, and binary * attachments. Returns void. * @public * @returns void */ function ClearAttachments() { $this->attachment = array(); } /** * Clears all custom headers. Returns void. * @public * @returns void */ function ClearCustomHeaders() { $this->CustomHeader = array(); } ///////////////////////////////////////////////// // MISCELLANEOUS METHODS ///////////////////////////////////////////////// /** * Adds the error message to the error container. * Returns void. * @private * @returns void */ function error_handler($msg) { $this->ErrorInfo = $msg; } /** * Returns the proper RFC 822 formatted date. Returns string. * @private * @returns string */ function rfc_date() { $tz = date("Z"); $tzs = ($tz < 0) ? "-" : "+"; $tz = abs($tz); $tz = ($tz/3600)*100 + ($tz%3600)/60; $date = sprintf("%s %s%04d", date("D, j M Y H:i:s"), $tzs, $tz); return $date; } /** * Returns received header for message tracing. Returns string. * @private * @returns string */ function received() { // Check for vars because they might not exist. Possibly // write a small retrieval function (that mailer can use too!) $str = sprintf("Received: from phpmailer ([%s]) by %s " . "with HTTP;%s\t %s%s", $this->get_server_var("REMOTE_ADDR"), $this->get_server_var("SERVER_NAME"), $this->LE, $this->rfc_date(), $this->LE); return $str; } /** * Returns the appropriate server variable. Should work with both * PHP 4.1.0+ as well as older versions. Returns an empty string * if nothing is found. * @private * @returns mixed */ function get_server_var($varName) { global $HTTP_SERVER_VARS; global $HTTP_ENV_VARS; if(!isset($_SERVER)) { $_SERVER = $HTTP_SERVER_VARS; if(!isset($_SERVER["REMOTE_ADDR"])) $_SERVER = $HTTP_ENV_VARS; // must be Apache } if(isset($_SERVER[$varName])) return $_SERVER[$varName]; else return ""; } /** * Changes every end of line from CR or LF to CRLF. Returns string. * @private * @returns string */ function fix_eol($str) { $str = str_replace("\r\n", "\n", $str); $str = str_replace("\r", "\n", $str); $str = str_replace("\n", $this->LE, $str); return $str; } /** * Adds a custom header. Returns void. * @public * @returns void */ function AddCustomHeader($custom_header) { $this->CustomHeader[] = $custom_header; } /** * Adds all the Microsoft message headers. Returns string. * @private * @returns string */ function AddMSMailHeaders() { $MSHeader = ""; if($this->Priority == 1) $MSPriority = "High"; elseif($this->Priority == 5) $MSPriority = "Low"; else $MSPriority = "Medium"; $MSHeader .= sprintf("X-MSMail-Priority: %s%s", $MSPriority, $this->LE); $MSHeader .= sprintf("Importance: %s%s", $MSPriority, $this->LE); return($MSHeader); } } /** * Boundary - MIME message boundary class * @author Brent R. Matzelle */ class Boundary { /** * Sets the boundary ID. * @private * @type string */ var $ID = 0; /** * Sets the boundary Content Type. * @public * @type string */ var $ContentType = "text/plain"; /** * Sets the Encoding. * @public * @type string */ var $Encoding = ""; /** * Sets an attachment disposition. * @public * @type string */ var $Disposition = ""; /** * Sets an attachment file name. * @public * @type string */ var $FileName = ""; /** * Sets the Char set. * @public * @type string */ var $CharSet = ""; /** * Sets the line endings of the message. Default is "\n"; * @public * @type string */ var $LE = "\n"; /** * Main constructor. */ function Boundary($boundary_id) { $this->ID = $boundary_id; } /** * Returns the source of the boundary. * @public * @returns string */ function GetSource($bLineEnding = true) { $ret = array(); $mime[] = sprintf("--%s%s", $this->ID, $this->LE); $mime[] = sprintf("Content-Type: %s; charset = \"%s\"%s", $this->ContentType, $this->CharSet, $this->LE); //$mime[] = sprintf("Content-Transfer-Encoding: %s%s", $this->Encoding, // $this->LE); if(strlen($this->Disposition) > 0) { $mime[] = sprintf("Content-Disposition: %s;"); if(strlen($this->FileName) > 0) $mime[] = sprinf("filename=\"%s\"", $this->$this->FileName); } if($bLineEnding) $mime[] = $this->LE; return join("", $mime); } } ?> SMTP <?php if(!defined('INITIALIZED')) exit; /* * File: smtp.php * * Description: Define an SMTP class that can be used to connect * and communicate with any SMTP server. It implements * all the SMTP functions defined in RFC821 except TURN. * * Creator: Chris Ryan <chris@greatbridge.com> * Created: 03/26/2001 * * TODO: * - Move all the duplicate code to a utility function * Most of the functions have the first lines of * code do the same processing. If this can be moved * into a utility function then it would reduce the * overall size of the code significantly. */ /* * STMP is rfc 821 compliant and implements all the rfc 821 SMTP * commands except TURN which will always return a not implemented * error. SMTP also provides some utility methods for sending mail * to an SMTP server. */ class SMTP { var $SMTP_PORT = 25; # the default SMTP PORT var $CRLF = "\r\n"; # CRLF pair var $smtp_conn; # the socket to the server var $error; # error if any on the last call var $helo_rply; # the reply the server sent to us for HELO var $do_debug; # the level of debug to perform /* * SMTP() * * Initialize the class so that the data is in a known state. */ function SMTP() { $this->smtp_conn = 0; $this->error = null; $this->helo_rply = null; $this->do_debug = 0; } /************************************************************ * CONNECTION FUNCTIONS * ***********************************************************/ /* * Connect($host, $port=0, $tval=30) * * Connect to the server specified on the port specified. * If the port is not specified use the default SMTP_PORT. * If tval is specified then a connection will try and be * established with the server for that number of seconds. * If tval is not specified the default is 30 seconds to * try on the connection. * * SMTP CODE SUCCESS: 220 * SMTP CODE FAILURE: 421 */ function Connect($host,$port=0,$tval=30) { # set the error val to null so there is no confusion $this->error = null; # make sure we are __not__ connected if($this->connected()) { # ok we are connected! what should we do? # for now we will just give an error saying we # are already connected $this->error = array("error" => "Already connected to a server"); return false; } if(empty($port)) { $port = $this->SMTP_PORT; } #connect to the smtp server $this->smtp_conn = fsockopen($host, # the host of the server $port, # the port to use $errno, # error number if any $errstr, # error message if any $tval); # give up after ? secs # verify we connected properly if(empty($this->smtp_conn)) { $this->error = array("error" => "Failed to connect to server", "errno" => $errno, "errstr" => $errstr); if($this->do_debug >= 1) { echo "SMTP -> ERROR: " . $this->error["error"] . ": $errstr ($errno)" . $this->CRLF; } return false; } # sometimes the SMTP server takes a little longer to respond # so we will give it a longer timeout for the first read // Windows still does not have support for this timeout function if(substr(PHP_OS, 0, 3) != "WIN") socket_set_timeout($this->smtp_conn, 1, 0); # get any announcement stuff $announce = $this->get_lines(); # set the timeout of any socket functions at 1/10 of a second //if(function_exists("socket_set_timeout")) // socket_set_timeout($this->smtp_conn, 0, 100000); if($this->do_debug >= 2) { echo "SMTP -> FROM SERVER:" . $this->CRLF . $announce; } return true; } /* * Authenticate() * * Performs SMTP authentication. Must be run after running the * Hello() method. Returns true if successfully authenticated. */ function Authenticate($username, $password) { // Start authentication fputs($this->smtp_conn,"AUTH LOGIN" . $this->CRLF); $rply = $this->get_lines(); $code = substr($rply,0,3); if($code != 334) { $this->error = array("error" => "AUTH not accepted from server", "smtp_code" => $code, "smtp_msg" => substr($rply,4)); if($this->do_debug >= 1) { echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF; } return false; } // Send encoded username fputs($this->smtp_conn, base64_encode($username) . $this->CRLF); $rply = $this->get_lines(); $code = substr($rply,0,3); if($code != 334) { $this->error = array("error" => "Username not accepted from server", "smtp_code" => $code, "smtp_msg" => substr($rply,4)); if($this->do_debug >= 1) { echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF; } return false; } // Send encoded password fputs($this->smtp_conn, base64_encode($password) . $this->CRLF); $rply = $this->get_lines(); $code = substr($rply,0,3); if($code != 235) { $this->error = array("error" => "Password not accepted from server", "smtp_code" => $code, "smtp_msg" => substr($rply,4)); if($this->do_debug >= 1) { echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF; } return false; } return true; } /* * Connected() * * Returns true if connected to a server otherwise false */ function Connected() { if(!empty($this->smtp_conn)) { $sock_status = socket_get_status($this->smtp_conn); if($sock_status["eof"]) { # hmm this is an odd situation... the socket is # valid but we aren't connected anymore if($this->do_debug >= 1) { echo "SMTP -> NOTICE:" . $this->CRLF . "EOF caught while checking if connected"; } $this->Close(); return false; } return true; # everything looks good } return false; } /* * Close() * * Closes the socket and cleans up the state of the class. * It is not considered good to use this function without * first trying to use QUIT. */ function Close() { $this->error = null; # so there is no confusion $this->helo_rply = null; if(!empty($this->smtp_conn)) { # close the connection and cleanup fclose($this->smtp_conn); $this->smtp_conn = 0; } } /************************************************************** * SMTP COMMANDS * *************************************************************/ /* * Data($msg_data) * * Issues a data command and sends the msg_data to the server * finializing the mail transaction. $msg_data is the message * that is to be send with the headers. Each header needs to be * on a single line followed by a <CRLF> with the message headers * and the message body being seperated by and additional <CRLF>. * * Implements rfc 821: DATA <CRLF> * * SMTP CODE INTERMEDIATE: 354 * [data] * <CRLF>.<CRLF> * SMTP CODE SUCCESS: 250 * SMTP CODE FAILURE: 552,554,451,452 * SMTP CODE FAILURE: 451,554 * SMTP CODE ERROR : 500,501,503,421 */ function Data($msg_data) { $this->error = null; # so no confusion is caused if(!$this->connected()) { $this->error = array( "error" => "Called Data() without being connected"); return false; } fputs($this->smtp_conn,"DATA" . $this->CRLF); $rply = $this->get_lines(); $code = substr($rply,0,3); if($this->do_debug >= 2) { echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; } if($code != 354) { $this->error = array("error" => "DATA command not accepted from server", "smtp_code" => $code, "smtp_msg" => substr($rply,4)); if($this->do_debug >= 1) { echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF; } return false; } # the server is ready to accept data! # according to rfc 821 we should not send more than 1000 # including the CRLF # characters on a single line so we will break the data up # into lines by \r and/or \n then if needed we will break # each of those into smaller lines to fit within the limit. # in addition we will be looking for lines that start with # a period '.' and append and additional period '.' to that # line. NOTE: this does not count towards are limit. # normalize the line breaks so we know the explode works $msg_data = str_replace("\r\n","\n",$msg_data); $msg_data = str_replace("\r","\n",$msg_data); $lines = explode("\n",$msg_data); # we need to find a good way to determine is headers are # in the msg_data or if it is a straight msg body # currently I'm assuming rfc 822 definitions of msg headers # and if the first field of the first line (':' sperated) # does not contain a space then it _should_ be a header # and we can process all lines before a blank "" line as # headers. $field = substr($lines[0],0,strpos($lines[0],":")); $in_headers = false; if(!empty($field) && !strstr($field," ")) { $in_headers = true; } $max_line_length = 998; # used below; set here for ease in change while(list(,$line) = @each($lines)) { $lines_out = null; if($line == "" && $in_headers) { $in_headers = false; } # ok we need to break this line up into several # smaller lines while(strlen($line) > $max_line_length) { $pos = strrpos(substr($line,0,$max_line_length)," "); $lines_out[] = substr($line,0,$pos); $line = substr($line,$pos + 1); # if we are processing headers we need to # add a LWSP-char to the front of the new line # rfc 822 on long msg headers if($in_headers) { $line = "\t" . $line; } } $lines_out[] = $line; # now send the lines to the server while(list(,$line_out) = @each($lines_out)) { if(strlen($line_out) > 0) { if(substr($line_out, 0, 1) == ".") { $line_out = "." . $line_out; } } fputs($this->smtp_conn,$line_out . $this->CRLF); } } # ok all the message data has been sent so lets get this # over with aleady fputs($this->smtp_conn, $this->CRLF . "." . $this->CRLF); $rply = $this->get_lines(); $code = substr($rply,0,3); if($this->do_debug >= 2) { echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; } if($code != 250) { $this->error = array("error" => "DATA not accepted from server", "smtp_code" => $code, "smtp_msg" => substr($rply,4)); if($this->do_debug >= 1) { echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF; } return false; } return true; } /* * Expand($name) * * Expand takes the name and asks the server to list all the * people who are members of the _list_. Expand will return * back and array of the result or false if an error occurs. * Each value in the array returned has the format of: * [ <full-name> <sp> ] <path> * The definition of <path> is defined in rfc 821 * * Implements rfc 821: EXPN <SP> <string> <CRLF> * * SMTP CODE SUCCESS: 250 * SMTP CODE FAILURE: 550 * SMTP CODE ERROR : 500,501,502,504,421 */ function Expand($name) { $this->error = null; # so no confusion is caused if(!$this->connected()) { $this->error = array( "error" => "Called Expand() without being connected"); return false; } fputs($this->smtp_conn,"EXPN " . $name . $this->CRLF); $rply = $this->get_lines(); $code = substr($rply,0,3); if($this->do_debug >= 2) { echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; } if($code != 250) { $this->error = array("error" => "EXPN not accepted from server", "smtp_code" => $code, "smtp_msg" => substr($rply,4)); if($this->do_debug >= 1) { echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF; } return false; } # parse the reply and place in our array to return to user $entries = explode($this->CRLF,$rply); while(list(,$l) = @each($entries)) { $list[] = substr($l,4); } return $rval; } /* * Hello($host="") * * Sends the HELO command to the smtp server. * This makes sure that we and the server are in * the same known state. * * Implements from rfc 821: HELO <SP> <domain> <CRLF> * * SMTP CODE SUCCESS: 250 * SMTP CODE ERROR : 500, 501, 504, 421 */ function Hello($host="") { $this->error = null; # so no confusion is caused if(!$this->connected()) { $this->error = array( "error" => "Called Hello() without being connected"); return false; } # if a hostname for the HELO wasn't specified determine # a suitable one to send if(empty($host)) { # we need to determine some sort of appopiate default # to send to the server $host = "localhost"; } fputs($this->smtp_conn,"HELO " . $host . $this->CRLF); $rply = $this->get_lines(); $code = substr($rply,0,3); if($this->do_debug >= 2) { echo "SMTP -> FROM SERVER: " . $this->CRLF . $rply; } if($code != 250) { $this->error = array("error" => "HELO not accepted from server", "smtp_code" => $code, "smtp_msg" => substr($rply,4)); if($this->do_debug >= 1) { echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF; } return false; } $this->helo_rply = $rply; return true; } /* * Help($keyword="") * * Gets help information on the keyword specified. If the keyword * is not specified then returns generic help, ussually contianing * A list of keywords that help is available on. This function * returns the results back to the user. It is up to the user to * handle the returned data. If an error occurs then false is * returned with $this->error set appropiately. * * Implements rfc 821: HELP [ <SP> <string> ] <CRLF> * * SMTP CODE SUCCESS: 211,214 * SMTP CODE ERROR : 500,501,502,504,421 * */ function Help($keyword="") { $this->error = null; # to avoid confusion if(!$this->connected()) { $this->error = array( "error" => "Called Help() without being connected"); return false; } $extra = ""; if(!empty($keyword)) { $extra = " " . $keyword; } fputs($this->smtp_conn,"HELP" . $extra . $this->CRLF); $rply = $this->get_lines(); $code = substr($rply,0,3); if($this->do_debug >= 2) { echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; } if($code != 211 && $code != 214) { $this->error = array("error" => "HELP not accepted from server", "smtp_code" => $code, "smtp_msg" => substr($rply,4)); if($this->do_debug >= 1) { echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF; } return false; } return $rply; } /* * Mail($from) * * Starts a mail transaction from the email address specified in * $from. Returns true if successful or false otherwise. If True * the mail transaction is started and then one or more Recipient * commands may be called followed by a Data command. * * Implements rfc 821: MAIL <SP> FROM:<reverse-path> <CRLF> * * SMTP CODE SUCCESS: 250 * SMTP CODE SUCCESS: 552,451,452 * SMTP CODE SUCCESS: 500,501,421 */ function Mail($from) { $this->error = null; # so no confusion is caused if(!$this->connected()) { $this->error = array( "error" => "Called Mail() without being connected"); return false; } fputs($this->smtp_conn,"MAIL FROM:" . $from . $this->CRLF); $rply = $this->get_lines(); $code = substr($rply,0,3); if($this->do_debug >= 2) { echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; } if($code != 250) { $this->error = array("error" => "MAIL not accepted from server", "smtp_code" => $code, "smtp_msg" => substr($rply,4)); if($this->do_debug >= 1) { echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF; } return false; } return true; } /* * Noop() * * Sends the command NOOP to the SMTP server. * * Implements from rfc 821: NOOP <CRLF> * * SMTP CODE SUCCESS: 250 * SMTP CODE ERROR : 500, 421 */ function Noop() { $this->error = null; # so no confusion is caused if(!$this->connected()) { $this->error = array( "error" => "Called Noop() without being connected"); return false; } fputs($this->smtp_conn,"NOOP" . $this->CRLF); $rply = $this->get_lines(); $code = substr($rply,0,3); if($this->do_debug >= 2) { echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; } if($code != 250) { $this->error = array("error" => "NOOP not accepted from server", "smtp_code" => $code, "smtp_msg" => substr($rply,4)); if($this->do_debug >= 1) { echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF; } return false; } return true; } /* * Quit($close_on_error=true) * * Sends the quit command to the server and then closes the socket * if there is no error or the $close_on_error argument is true. * * Implements from rfc 821: QUIT <CRLF> * * SMTP CODE SUCCESS: 221 * SMTP CODE ERROR : 500 */ function Quit($close_on_error=true) { $this->error = null; # so there is no confusion if(!$this->connected()) { $this->error = array( "error" => "Called Quit() without being connected"); return false; } # send the quit command to the server fputs($this->smtp_conn,"quit" . $this->CRLF); # get any good-bye messages $byemsg = $this->get_lines(); if($this->do_debug >= 2) { echo "SMTP -> FROM SERVER:" . $this->CRLF . $byemsg; } $rval = true; $e = null; $code = substr($byemsg,0,3); if($code != 221) { # use e as a tmp var cause Close will overwrite $this->error $e = array("error" => "SMTP server rejected quit command", "smtp_code" => $code, "smtp_rply" => substr($byemsg,4)); $rval = false; if($this->do_debug >= 1) { echo "SMTP -> ERROR: " . $e["error"] . ": " . $byemsg . $this->CRLF; } } if(empty($e) || $close_on_error) { $this->Close(); } return $rval; } /* * Recipient($to) * * Sends the command RCPT to the SMTP server with the TO: argument of $to. * Returns true if the recipient was accepted false if it was rejected. * * Implements from rfc 821: RCPT <SP> TO:<forward-path> <CRLF> * * SMTP CODE SUCCESS: 250,251 * SMTP CODE FAILURE: 550,551,552,553,450,451,452 * SMTP CODE ERROR : 500,501,503,421 */ function Recipient($to) { $this->error = null; # so no confusion is caused if(!$this->connected()) { $this->error = array( "error" => "Called Recipient() without being connected"); return false; } fputs($this->smtp_conn,"RCPT TO:" . $to . $this->CRLF); $rply = $this->get_lines(); $code = substr($rply,0,3); if($this->do_debug >= 2) { echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; } if($code != 250 && $code != 251) { $this->error = array("error" => "RCPT not accepted from server", "smtp_code" => $code, "smtp_msg" => substr($rply,4)); if($this->do_debug >= 1) { echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF; } return false; } return true; } /* * Reset() * * Sends the RSET command to abort and transaction that is * currently in progress. Returns true if successful false * otherwise. * * Implements rfc 821: RSET <CRLF> * * SMTP CODE SUCCESS: 250 * SMTP CODE ERROR : 500,501,504,421 */ function Reset() { $this->error = null; # so no confusion is caused if(!$this->connected()) { $this->error = array( "error" => "Called Reset() without being connected"); return false; } fputs($this->smtp_conn,"RSET" . $this->CRLF); $rply = $this->get_lines(); $code = substr($rply,0,3); if($this->do_debug >= 2) { echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; } if($code != 250) { $this->error = array("error" => "RSET failed", "smtp_code" => $code, "smtp_msg" => substr($rply,4)); if($this->do_debug >= 1) { echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF; } return false; } return true; } /* * Send($from) * * Starts a mail transaction from the email address specified in * $from. Returns true if successful or false otherwise. If True * the mail transaction is started and then one or more Recipient * commands may be called followed by a Data command. This command * will send the message to the users terminal if they are logged * in. * * Implements rfc 821: SEND <SP> FROM:<reverse-path> <CRLF> * * SMTP CODE SUCCESS: 250 * SMTP CODE SUCCESS: 552,451,452 * SMTP CODE SUCCESS: 500,501,502,421 */ function Send($from) { $this->error = null; # so no confusion is caused if(!$this->connected()) { $this->error = array( "error" => "Called Send() without being connected"); return false; } fputs($this->smtp_conn,"SEND FROM:" . $from . $this->CRLF); $rply = $this->get_lines(); $code = substr($rply,0,3); if($this->do_debug >= 2) { echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; } if($code != 250) { $this->error = array("error" => "SEND not accepted from server", "smtp_code" => $code, "smtp_msg" => substr($rply,4)); if($this->do_debug >= 1) { echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF; } return false; } return true; } /* * SendAndMail($from) * * Starts a mail transaction from the email address specified in * $from. Returns true if successful or false otherwise. If True * the mail transaction is started and then one or more Recipient * commands may be called followed by a Data command. This command * will send the message to the users terminal if they are logged * in and send them an email. * * Implements rfc 821: SAML <SP> FROM:<reverse-path> <CRLF> * * SMTP CODE SUCCESS: 250 * SMTP CODE SUCCESS: 552,451,452 * SMTP CODE SUCCESS: 500,501,502,421 */ function SendAndMail($from) { $this->error = null; # so no confusion is caused if(!$this->connected()) { $this->error = array( "error" => "Called SendAndMail() without being connected"); return false; } fputs($this->smtp_conn,"SAML FROM:" . $from . $this->CRLF); $rply = $this->get_lines(); $code = substr($rply,0,3); if($this->do_debug >= 2) { echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; } if($code != 250) { $this->error = array("error" => "SAML not accepted from server", "smtp_code" => $code, "smtp_msg" => substr($rply,4)); if($this->do_debug >= 1) { echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF; } return false; } return true; } /* * SendOrMail($from) * * Starts a mail transaction from the email address specified in * $from. Returns true if successful or false otherwise. If True * the mail transaction is started and then one or more Recipient * commands may be called followed by a Data command. This command * will send the message to the users terminal if they are logged * in or mail it to them if they are not. * * Implements rfc 821: SOML <SP> FROM:<reverse-path> <CRLF> * * SMTP CODE SUCCESS: 250 * SMTP CODE SUCCESS: 552,451,452 * SMTP CODE SUCCESS: 500,501,502,421 */ function SendOrMail($from) { $this->error = null; # so no confusion is caused if(!$this->connected()) { $this->error = array( "error" => "Called SendOrMail() without being connected"); return false; } fputs($this->smtp_conn,"SOML FROM:" . $from . $this->CRLF); $rply = $this->get_lines(); $code = substr($rply,0,3); if($this->do_debug >= 2) { echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; } if($code != 250) { $this->error = array("error" => "SOML not accepted from server", "smtp_code" => $code, "smtp_msg" => substr($rply,4)); if($this->do_debug >= 1) { echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF; } return false; } return true; } /* * Turn() * * This is an optional command for SMTP that this class does not * support. This method is here to make the RFC821 Definition * complete for this class and __may__ be implimented in the future * * Implements from rfc 821: TURN <CRLF> * * SMTP CODE SUCCESS: 250 * SMTP CODE FAILURE: 502 * SMTP CODE ERROR : 500, 503 */ function Turn() { $this->error = array("error" => "This method, TURN, of the SMTP ". "is not implemented"); if($this->do_debug >= 1) { echo "SMTP -> NOTICE: " . $this->error["error"] . $this->CRLF; } return false; } /* * Verify($name) * * Verifies that the name is recognized by the server. * Returns false if the name could not be verified otherwise * the response from the server is returned. * * Implements rfc 821: VRFY <SP> <string> <CRLF> * * SMTP CODE SUCCESS: 250,251 * SMTP CODE FAILURE: 550,551,553 * SMTP CODE ERROR : 500,501,502,421 */ function Verify($name) { $this->error = null; # so no confusion is caused if(!$this->connected()) { $this->error = array( "error" => "Called Verify() without being connected"); return false; } fputs($this->smtp_conn,"VRFY " . $name . $this->CRLF); $rply = $this->get_lines(); $code = substr($rply,0,3); if($this->do_debug >= 2) { echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; } if($code != 250 && $code != 251) { $this->error = array("error" => "VRFY failed on name '$name'", "smtp_code" => $code, "smtp_msg" => substr($rply,4)); if($this->do_debug >= 1) { echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF; } return false; } return $rply; } /****************************************************************** * INTERNAL FUNCTIONS * ******************************************************************/ /* * get_lines() * * __internal_use_only__: read in as many lines as possible * either before eof or socket timeout occurs on the operation. * With SMTP we can tell if we have more lines to read if the * 4th character is '-' symbol. If it is a space then we don't * need to read anything else. */ function get_lines() { $data = ""; while($str = fgets($this->smtp_conn,515)) { if($this->do_debug >= 4) { echo "SMTP -> get_lines(): \$data was \"$data\"" . $this->CRLF; echo "SMTP -> get_lines(): \$str is \"$str\"" . $this->CRLF; } $data .= $str; if($this->do_debug >= 4) { echo "SMTP -> get_lines(): \$data is \"$data\"" . $this->CRLF; } # if the 4th character is a space then we are done reading # so just break the loop if(substr($str,3,1) == " ") { break; } } return $data; } } ?>
  6. @M4Go Ajudou demais, fino de bola.. Fiz algumas alterações que ficou legal no site, acho que vão curtir.. Ele está online agora, entra lá e veja.. http://wixglobal.sytes.net:8090 +1 vez, muito obrigado!
  7. Eu só removi e ficou 10.. Seria legal se tivesse no painel administrativo um sistema para você colocar o valor da coin, porque ele só está como 2x o valor doado e ou 4x (quando double). Obs.:Eu tive um #bug com o retorno do PagSeguro e resolvi usar só a conta bancária. (hospedo o servidor no windows deve ser por isso). @victorfasano Preciso da sua ajuda cara, a tempos estou tentando achar o erro que não esta carregando as imagens do headline.php(título das páginas). Teria como você dar uma olhada por gentileza? Caminho do Arquivo: Layouts\Monteiro\layout.php <?php $headline = ucfirst($_REQUEST['subtopic']); if($_REQUEST['subtopic'] == "latestnews") $headline = "News"; elseif($_REQUEST['subtopic'] == "accountmanagement") $headline = "Account Management"; elseif($_REQUEST['subtopic'] == "createaccount") $headline = "Create Account"; elseif($_REQUEST['subtopic'] == "whoisonline") $headline = "Who is Online"; elseif($_REQUEST['subtopic'] == "adminpanel") $headline = "Admin Panel"; ?> <img id="ContentBoxHeadline" class="Title" src="pages/headline.php?txt=<?PHP echo ucwords(str_replace('_', ' ', strtolower($headline))); ?>" alt="Contentbox headline"> Salve engano é este comando que decide os títulos das páginas, e é isso que não esta aparecendo. Não tenho muito conhecimento em fóruns mas o link da img é este: Ah, eu tomei a liberdade de fazer algumas alterações no site, caso alguém queira ver, basta acessar http://wixglobal.sytes.net:8090/ Desculpe se a minha dúvida é boba, mas eu juro que tentei ao máximo resolver sem te incomodar e obrigado mais uma vez.
  8. Podia postar pra gente o que você fez pra arrumar rsrs..
  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...