فرم فرستادن دعوت برای یک دوست

poyaazim

Member
دوستان, من با استفاده از یه script اماده یه فرمی برای ارسال دعوت ساختم, همه چیز عالی کار میکنه, فقط میخوام موقعی که شخصی این صفحه رو به دوستش ارسال میکنه من هم یک نسخه از این ایمیل رو دریافت کنم. لطفا راهنماییم کنید.

این لینک فرم: http://www.jcspa.com/scripts/refer/pda.php

اینم کد PHP
<?php
error_reporting(E_ALL&(~E_NOTICE));
session_start();
/*

*/

################################# Configuration Options ###################################

$mailtype="text/html"; // "text/html" or "text/plain";
$verification=true; // true or false - to display verification code or not
$subject="%FNAME% says: Interested in PDA?";


############# Do not change anything below unless you know what you are doing ##############

function send_mail($from,$to,$subject,$message,$ctype='text/html')
{
$mail_mime .= "MIME-Version: 1.0\n";
$mail_mime .= "Content-Type: $ctype;\n";
$texte .=$message;
if(!mail($to, $subject, $texte,"Reply-to: $from\nFrom: $from\n".$mail_mime)) echo ("Cannot send mail.");
}

//same function like in JS
function display_code($seed,$seed2)
{
$code="";
$code=($seed * 8 - 39) - ($seed*7 +78);
$code=$code-$seed2;

if($code<0) $code=0-$code;

return $code;
}



if(!empty($_POST[ok]))
{
$all_ok=1;

if($verification)
{
//check verification code
$scode=display_code($_SESSION[seed],$_SESSION[seed2]);

if($scode!=$_POST
کد:
)
		{
			$all_ok=0;			
		}
		
		//clear the seeds from session
		$_SESSION[seed]="";
		$_SESSION[seed2]="";
	}
}

if($all_ok)
{
	//actually send it
	$subject=str_replace("%FNAME%",$_POST[yourname],$subject);

	$message="Hello $_POST[friendname],<p>

This is $_POST[yourname],I thought you might be interested in PDA so I am sending this brief introduction to the association and how you could benefit from becoming a PDA member.<p>

Our profession seems to change almost daily. But one thing does not change: The importance of pertinent and trustworthy information remains paramount. For decades, PDA has provided professionals like us with professional and career development resources full of information to help us deliver effective medicines as quickly and safely as possible.<p>

What would you get by becoming a PDA member?  You would interact with our member network of approximately 24,000 professional peers. You would qualify for significant member discounts on almost all PDA offerings. You would have access to exclusive “Members-only” functions of our website, such as the Job Bank and Membership Directory. And you would receive practical and informative publications, such as PDA’s official publication, the scholarly, multidisciplinary peer-reviewed “Drug Information Journal,” and member newsletter, “PDA Today.”<p>

What would you pay to become a PDA member? Annual membership costs $130 (US), 130 Euros, or 14,000 yen, plus pertinent taxes in Europe and Japan.<p>

I invite you to learn more about the benefits of becoming a PDA member by visiting www.pda.org/join or by contacting [email protected] for more information.
 \n\n<br><br>";

	$message.=nl2br($_POST[message]);

	send_mail($_POST[youremail],$_POST[friendemail],$subject,$message);

	echo "<script language=\"javascript\">
	alert('Thank you! Your email has been sent');
	window.location='$_POST[url]';
	</script>";
}
else
{
	//prepare the URL
	if($_GET[comefrom])
	{
		$url=str_replace("^^^","&",$_GET[comefrom]);
	}
	else
	{
		$url=$_SERVER[HTTP_REFERER];
	}
	
	//prepare 2 seed numbers
	$seed=mt_rand(1000,9999);
	$_SESSION[seed]=$seed;
	$seed2=mt_rand(1000,9999);
	$_SESSION[seed2]=$seed2;

	//display the page
	require_once("refer.html");
}

?>
 

poyaazim

Member
لینک فرم و فایل Php رو گذاشتم دیگه. چیز دیگهای برای دانلود نداره.
 

poyaazim

Member
همه فایلهارو زیپ کردم. حالا کسی نیست که راهنمایی بکنه ???
 

پیوست ها

  • Doost.rar
    5.5 کیلوبایت · بازدیدها: 13

amir01

Well-Known Member
به چه ایمیلی باید بفرسته؟؟ یعنی همون ایمیل شما...؟
 

amir01

Well-Known Member
این فایلی که برات پیوست کردم رو جایگزین کن...
اول فایل یه جا یه متغیر به عنوان YourMail$ اضافه کردم که جلوی اون ایمیل خودت رو بنویس...یاحق...
 

پیوست ها

  • send.zip
    1.3 کیلوبایت · بازدیدها: 10
آخرین ویرایش:

poyaazim

Member
سلام امیر جان. فایل رو جایگزین کردم, ایمیل خودم رو هم جلوی متغیر نوشتم. بعد از اینکه اپلود کردم این ارور رو داد:
Parse error: parse error, unexpected T_IF in /home/jcspa/public_html/scripts/refer/send.php on line 24


اینم لینکش:
http://www.jcspa.com/scripts/refer/send.php
 

NabiKAZ

Well-Known Member
سلام ،
کد amir01 دو تا اشکال واضح داشت یکی آخر خط ; نذاشته بود. یکی هم متغییر رو global تعریف نکرده بود.
که به اضافه کمی تغییر کد رو ضمیمه کردم.

موفق باشید
 

پیوست ها

  • send2.zip
    1.3 کیلوبایت · بازدیدها: 11

poyaazim

Member
سلام به همه دوستان علی الخصوص به استاد بزرگ اقا نبی. نبی جان به خاطرت هست که چند وقت پیش این فرم ارسال به یک دوست رو برای من ادیت کردید که یه کپی از مطالب به ایمیل خودم هم ارسال بشه? همه چیز مثل ساعت کار میکنه, تنها مسئله ای که هست اینه که وقتی من کپی اطلاعات فرم رو دریافت میکنم, ایمیل شخصی که invite بهش ارسال شده رو نمیبینم. من میخوام تو ایمیلی که به من میشه اطلاعات کامل رو داشته باشم, میخوام ببینم که چه کسی این دعوت رو به کی فرستاده. واقعا یک دنیا ممنونت میشم اگر کمکم کنید. خیلی خوشحالم میکنید اگر بگید که چجوری بتونم از خجالتتون در بیام.
 

پیوست ها

  • refer.rar
    6.6 کیلوبایت · بازدیدها: 4
آخرین ویرایش:

NabiKAZ

Well-Known Member
سلام ،

خواهش میکنم ، ما تازه شاگردیم، شما محبت دارید.

براحتی با اضافه کردن فقط یک خط کد میتونستید به مقصودتون برسید ، دونستن کمی برنامه نویسی(خیلی کم) برای یه کاربر اینترنت، مثل دونستن کمی مکانیک ماشین برای یه رانندست، گاهی توی یه بیابون آدمو نجات میده!
در هر صورت تغییرات مورد نیازتون رو اعمال کردم و ارسال و دریافت کننده انتهای پیام ظاهر خواهد شد ، نام و ایمیل ارسال کننده و دریافت کننده رو هم ادغام کردم تا صورت بهتری داشته باشد.


PHP:
<?php
error_reporting(E_ALL&(~E_NOTICE));
session_start();
/*

*/

################################# Configuration Options ###################################

$mailtype="text/html"; // "text/html" or "text/plain";
$verification=true; // true or false - to display verification code or not
$subject="%FNAME% wants to share invaluable industry resources with you.";
$YourMail = "[email protected]";


############# Do not change anything below unless you know what you are doing ##############

function send_mail($from_name, $from_mail, $to_name, $to_mail, $subject, $message, $ctype='text/html')
{
   global $YourMail;
   $mail_mime .= "MIME-Version: 1.0\n";
   $mail_mime .= "Content-Type: $ctype;\n";  
   if(@mail("$to_name <$to_mail>", $subject, $message, "Reply-to: $from_name <$from_mail>\nFrom: $from_name <$from_mail>\n".$mail_mime)) {
       $message .= "<hr>from: $from_name ($from_mail)\n<br>to: $to_name ($to_mail)\n<br>";
       @mail($YourMail, $subject, $message,"Reply-to: $from_name <$from_mail>\nFrom: $from_name <$from_mail>\n".$mail_mime); 
   }else{
    echo ("Cannot send mail.");
   }
}

//same function like in JS
function display_code($seed,$seed2)
{
   $code="";  
   $code=($seed * 8 - 39) - ($seed*7 +78);
   $code=$code-$seed2;

   if($code<0) $code=0-$code;
   
   return $code;
}



if(!empty($_POST[ok]))
{
    $all_ok=1;

    if($verification)
    {
        //check verification code
        $scode=display_code($_SESSION[seed],$_SESSION[seed2]);
        
        if($scode!=$_POST[code])
        {
            $all_ok=0;            
        }
        
        //clear the seeds from session
        $_SESSION[seed]="";
        $_SESSION[seed2]="";
    }
}

if($all_ok)
{
    //actually send it
    $subject=str_replace("%FNAME%",$_POST[yourname],$subject);

    $message="Hello $_POST[friendname],<p>

This is $_POST[yourname]. My <a href=\"http://www.pda.org/webmodules/webarticles/templates/new_membership_benefits.aspx?articleid=136&zoneid=72\">PDA membership</a> has provided me with industry resources I highly value and I know they will benefit you as well. PDA is the recognized authoritative voice and leading organization in the field of pharmaceutical and biopharmaceutical science and technology. PDA membership puts you on the cutting edge of your profession with direct access to leading decision makers, the latest technical reports and scientific information you won�t find anywhere else.<p>
<a href=\"http://www.pda.org/webmodules/webarticles/templates/new_membership_benefits.aspx?articleid=136&zoneid=72\">Learn More</a> |  <a href=\"https://store.pda.org/membership/registration/member_registration_app.asp\">Become a PDA member</a><p> 
 \n\n<br><br>";

    $message.=nl2br($_POST[message]);

    send_mail($_POST[yourname], $_POST[youremail], $_POST[friendname], $_POST[friendemail], $subject, $message);

    echo "<script language=\"javascript\">
    alert('Thank you! Your email has been sent');
    window.location='$_POST[url]';
    </script>";
}
else
{
    //prepare the URL
    if($_GET[comefrom])
    {
        $url=str_replace("^^^","&",$_GET[comefrom]);
    }
    else
    {
        $url=$_SERVER[HTTP_REFERER];
    }
    
    //prepare 2 seed numbers
    $seed=mt_rand(1000,9999);
    $_SESSION[seed]=$seed;
    $seed2=mt_rand(1000,9999);
    $_SESSION[seed2]=$seed2;

    //display the page
    require_once("refer.html");
}

?>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-2768727-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>
ضمناً دوست عزیز نیازی به جبران نیست. اینجا یک محیط برای تبادل اطلاعات و کمک به یکدیگر اون هم بدون منت است. هر کسی در حد توانش به دیگری کمک میکنه و مطمئناً هدف اصلی همینه. :) مطمئناً یک روز هم من به مشکل برمیخورم که شاید شما به من کمک خواهید کرد ;)

تشکر
نبی
 
آخرین ویرایش:

poyaazim

Member
نبی جان, کاملا حق با شماست. دونستن حتی کمی برنامه نویسی هیچ ضرری نداره و من تازه این کار رو شروع کردم. خیلی ازت ممنونم بخاطر همه زحمتها. یه نکته ای که به نظرم رسید اینه که در یه همچین مواردی خیلی عالی میشه اگر راجع به تغییراتی که اعمال میشه هم یه توضیح کوچیکی داده بشه, فکر میکنم این نکته به یادگیری ما تازه کارها خیلی کمک بکنه. بازم ازت ممنونم, ایشالا بتونم جبران کنم.
 

NabiKAZ

Well-Known Member
خواهش میکنم.

عمده تغییری که داده بودم این خط بود:
کد:
$message .= "<hr>from: $from_name ($from_mail)\n<br>to: $to_name ($to_mail)\n<br>";
که متغییر های ارسال و دریافت کننده رو در قالب html به متغییر message اضافه میکنه و این متغییر برای ارسال به کاربر به تابع mail ارسال میشه

موفق باشید
 

جدیدترین ارسال ها

بالا