Autor Zpráva
kuba95
Profil
Ahoj,
mám script na odeslání mailu, ale script mi z nějakého důvodu email nepošle... mohl by mi někdo pomoct??

Předem díky

Script:
<?
session_start();

include "config.php";
global $c,$loggedin;
include "data.php";
global $config;
include "funciones.php";
?>
<? include "header2.php"; ?>

<h3>Forgot Password</h3>
<?php
if($_POST)
{
$code = $_POST["code"];
$email = $_POST["email"];
$emailx = mysql_query("SELECT COUNT(*) AS cnt FROM tb_users WHERE email='{$_POST['email']}'");
$emailx = mysql_fetch_array($emailx);
$emailx = $emailx["cnt"];
$errormsg = false;
if($_SESSION['string'] != $code)
{
$error = 1;
$errormsg .= "<b>Error -</b> The captcha was entered incorrectly.<br />";
}
if(!$code)
{
$error = 1;
$errormsg .= "<b>Error -</b> The captcha was entered incorrectly.<br />";
}
if(!$email)
{
$error = 1;
$errormsg .= "<b>Error -</b> The email was not supplied.<br />";
}
if(!$emailx)
{
$error = 1;
$errormsg .= "<b>Error -</b> No account was found with that email address.<br />";
}
if($_SESSION['next_reseptsend'] != 0)
{
$error = 1;
$errormsg .= "<b>Error -</b> You have already made a password retrieval within the last 15 minutes.<br />";
}
$_SESSION['string'] = false;
if($error)
{
print $errormsg."<br><br>";
} else {
$s = mysql_query("SELECT * FROM tb_users WHERE email='{$_POST['email']}'");
$x = mysql_fetch_array($s);
$_SESSION['next_reseptsend'] = 1;
$message = "Hello {$x['username']},
You requested to resend your account password a while ago.

Account Username: {$x['username']}
Account Password: {$x['password']}

We hope you can have a good time earning your money again,

Thanks,
{$config['site_name']}";
mail($x["email"],"Password Retrieval - ".$config["site_name"],$message,"From: mail@".$_SERVER['HTTP_HOST']);
print "<b>Password Sent!</b><br />
We have dispatched your password to your email address.<br />
You can only make another account retrieval again in 15 minutes.<br />";
}
}
?>

<div style="padding-left:25px;">
<form action="recover.php" method="post" name="resend">
<table>
<tr><td class="midtext">Your Email:</td><td><input type="text" name="email" size="25" class="form" autocomplete="off" value="<?=$_POST['email']?>"></td></tr>
<tr><td class="midtext" valign="top">Security Code:</td><td class="midtext"><img src="image.php" onclick="this.src='image.php?newtime=' + (new Date()).getTime();"><br /><span style="font-size:10px;">(Click to reload)</span><br /><input type="text" name="code" size="17" maxlength="" autocomplete="off" class="form"></td></tr>
<tr><td></td><td align="right"><input type="submit" value="Login" name="loginsubmit"  class="inputbox"></td></tr>
</table>
</form>
</div>

<? include "footer.php"; ?>
Ulikar
Profil *
Kde jsi ten kód vzal?
A co máš v těch souborech confing.php, data.php a funciones.php?
kuba95
Profil
Ulikar:
config.php:

<?php

$dhost 			= "localhost"; //usually localhost, or ip
$dusername 		= "*****"; // database user
$dpassword 		= "*****"; // database pass
$ddatabase 		= "*****"; // database name
$script_path	= "http://*****"; // your script have isntalled, do not include "/" slash at the end


					//////////////////////////////////////////////
					//											//
					//											//
					//			Connect to MySQL server			//
					//		 Do not change anything bellow		//
					//											//
					//											//
					//////////////////////////////////////////////


//Connect to MySQL server///////////////////////////////////////////////////////////////
																					////
$con = mysql_connect($dhost, $dusername, $dpassword) or die("Cannot Connect"); 		////
mysql_select_db($ddatabase, $con);													////
																					////
if($_COOKIE["usNick"] and $_COOKIE["usPass"])										////
{																					////
$q = mysql_query("SELECT * FROM tb_users WHERE username='{$_COOKIE['usNick']}' AND	 password='{$_COOKIE['usPass']}'") or die(mysql_error());							////
if(mysql_num_rows($q) == 0)															////
{																					////
$_COOKIE['usNick'] = false;															////
$_COOKIE['usPass'] = false;															////
} else {																			////
$loggedin = 1;																		////
$r = mysql_fetch_array($q);															////
}																					////
}																					////

?>


data.php:
<?php
session_start();

include "config.php";
global $loggedin;

if($_GET['r'])
{
$_SESSION['r'] = $_GET['r'];
}
$user = $_COOKIE['ucNick'];

$sitenamez1 = "SELECT price FROM tb_config WHERE item='Site_Name' and howmany='1'";
$alertpayz1 = "SELECT price FROM tb_config WHERE item='Admin_Alertpay_' and howmany='1'";
$forumz1 = "SELECT price FROM tb_config WHERE item='Forum_URL' and howmany='1'";
$titlez1 = "SELECT price FROM tb_config WHERE item='Site_Title' and howmany='1'";
$payouts1 = "SELECT price FROM tb_config WHERE item='Amount_Payouts' and howmany='1'";

$sitenamez2 = mysql_query($sitenamez1);
$alertpayz2 = mysql_query($alertpayz1);
$forumz2 = mysql_query($forumz1);
$titlez2 = mysql_query($titlez1);
$payoutz2 = mysql_query($payoutz1);

$sitenamez3 = mysql_fetch_array($sitenamez2);
$alertpayz3 = mysql_fetch_array($alertpayz2);
$forumz3 = mysql_fetch_array($forumz2);
$titlez3 = mysql_fetch_array($titlez2);
$payoutz3 = mysql_query($payoutz2);

$config['site_name'] = $sitenamez3["price"];
$config['title'] = $titlez3["price"];
$config["forum"] = $forumz3["price"]; 
$config["Alertpay"] = $alertpayz3["price"];
$config["payout"] = $payoutz3["price"]; 
$config['site_path'] = "$script_path";

///////////////////////////////////////////////////////////////////////////////////////////////


// funcion para sanitizar variables
function securedata($mensaje)
{
$mensaje = htmlentities(stripslashes(trim($mensaje)));
$mensaje = str_replace("'"," ",$mensaje);
$mensaje = str_replace(";"," ",$mensaje);
$mensaje = str_replace("$"," ",$mensaje);
return $mensaje;
}



// ip real
function getRealIPe()
{
   
   if( $_SERVER['HTTP_X_FORWARDED_FOR'] != '' )
   {
      $client_ip =
         ( !empty($_SERVER['REMOTE_ADDR']) ) ?
            $_SERVER['REMOTE_ADDR']
            :
            ( ( !empty($_ENV['REMOTE_ADDR']) ) ?
               $_ENV['REMOTE_ADDR']
               :
               "unknown" );
   

   
      $entries = split('[, ]', $_SERVER['HTTP_X_FORWARDED_FOR']);
   
      reset($entries);
      while (list(, $entry) = each($entries))
      {
         $entry = trim($entry);
         if ( preg_match("/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/", $entry, $ip_list) )
         {
            // http://www.faqs.org/rfcs/rfc1918.html
            $private_ip = array(
                  '/^0\./',
                  '/^127\.0\.0\.1/',
                  '/^192\.168\..*/',
                  '/^172\.((1[6-9])|(2[0-9])|(3[0-1]))\..*/',
                  '/^10\..*/');
   
            $found_ip = preg_replace($private_ip, $client_ip, $ip_list[1]);
   
            if ($client_ip != $found_ip)
            {
               $client_ip = $found_ip;
               break;
            }
         }
      }
   }
   else
   {
      $client_ip =
         ( !empty($_SERVER['REMOTE_ADDR']) ) ?
            $_SERVER['REMOTE_ADDR']
            :
            ( ( !empty($_ENV['REMOTE_ADDR']) ) ?
               $_ENV['REMOTE_ADDR']
               :
               "unknown" );
   }
   
   return $client_ip;
   
}
?>


funciones.php:
<?php

error_reporting(0);

function limitatexto( $texto, $limite )
{
if( strlen($texto)>$limite )
{
$texto = substr( $texto,0,$limite );
}
return $texto;

}

function mostrarTemplate($tema, $variables)
{
//var_dump($variables);
extract($variables);
eval("?>".$tema."<?");
}

function parsearTags($mensaje)
{
$mensaje = str_replace("[citar]", "<blockquote><hr width='100%' size='2'>", $mensaje);
$mensaje = str_replace("[/citar]", "<hr width='100%' size='2'></blockquote>", $mensaje);
return $mensaje;
}

// funcion para validar email
function ValidaMail($pMail) {
if (ereg("^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@+([_a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]{2,200}\.[a-zA-Z]{2,6}$", $pMail ) ) {
return true;
} elseif ($_POST["email"]="NULL") {
echo "<h4 style=\"color:red;\"><b>Error</b> - The email field is Empty.</h4>";
} else {
echo "<h4 style=\"color:red;\"><b>Error</b> - Your email is invalid.</h4>";
}
}

// minimo de carateres
function minimo($contenido) {

// echo "Everything's fine ...";
return $contenido;
}


function minimopass($contenido) {
// echo "Everything's fine ...";
return $contenido;
}

// funcion para sanitizar variables
function limpiar($mensaje)
{
$mensaje = htmlentities(stripslashes(trim($mensaje)));
$mensaje = str_replace("'"," ",$mensaje);
$mensaje = str_replace(";"," ",$mensaje);
$mensaje = str_replace("$"," ",$mensaje);
return $mensaje;
}

function shout($nombre_usuario){
if (ereg("^[a-zA-Z0-9\-_]{3,20}$", $nombre_usuario)) {
// echo "The field $username is correct<br>";
return $nombre_usuario;
} else {
echo "<h4 style=\"color:red;\"><b>Error</b> - The field $nombre_usuario is using invalid characters.</h4>";
}
}

// universal cleaner function


function uc($mensaje)
{

if (ereg("^[a-zA-Z0-9\-_]{3,20}$", $mensaje)) {
// echo "El campo $mensaje es correcto<br>";
$mensaje = htmlentities(stripslashes(strtolower(trim($mensaje))));
$mensaje = str_replace("'"," ",$mensaje);
$mensaje = str_replace(";"," ",$mensaje);
$mensaje = str_replace("$"," ",$mensaje);
return $mensaje;
} else {
echo "<h4 style=\"color:red;\"><b>Error</b> - The field $nombre_usuario is using invalid characters.</h4>";

}

}

//funcion para ańadir smylies

function caretos($texto,$ruta)
{
$i="<img src=\"$ruta/";
$i_="\" >";
$texto=str_replace(":)",$i."icon_smile.gif".$i_,$texto);
$texto=str_replace(":D",$i."icon_biggrin.gif".$i_,$texto);
$texto=str_replace("^^",$i."icon_cheesygrin.gif".$i_,$texto);

$texto=str_replace("xD",$i."icon_lol.gif".$i_,$texto);
$texto=str_replace("XD",$i."icon_lol.gif".$i_,$texto);

$texto=str_replace(":|",$i."icon_neutral.gif".$i_,$texto);
$texto=str_replace(":(",$i."icon_sad.gif".$i_,$texto);
$texto=str_replace(":'(",$i."icon_cry.gif".$i_,$texto);
Davex
Profil
kuba95:
script mi z nějakého důvodu email nepošle...
Zobrazí se zpráva, že by e-mail odeslán? Neskončí ve spamu?

Hlavička by měla končit odřádkováním:
mail($x["email"], "Password Retrieval - " . $config["site_name"], $message, "From: mail@" . $_SERVER['HTTP_HOST'] . PHP_EOL);
kuba95
Profil
Davex:
Zobrazí se zpráva, že by e-mail odeslán? Neskončí ve spamu?
jo, zpráva o odeslání se v pořádku zobrazí a ve spamu to také není

Hlavička by měla končit odřádkováním:
upravil jsem to podle toho jak píšeš, ale pořád nic...
CZechBoY
Profil
zkoušel si to odeslat na jiný email?
kuba95
Profil
díky všem, už mi to funguje... asi to bylo tím doplněním od Davex. Díky

Vaše odpověď

Mohlo by se hodit


Prosím používejte diakritiku a interpunkci.

Ochrana proti spamu. Napište prosím číslo dvě-sta čtyřicet-sedm:

0