[ظƒظ„ط§ط³] ط§طھطµظ„ ط¨ظ†ط§ | ظ„ط§ طھط¶ظٹط¹ ظˆظ‚طھظƒ



بسم الله الرحمن الرحيم
بفضل الله سويت كلاس اخر لى
بعد كلاس الاتصال بقاعدة البيانات
اريد نقدكم بالنسبة للكلاس

هذا هو الكلاس مع الشرح طريقة
رمز PHP:
<code style="white-space:nowrap"> <code> <?php

/**
* @author dr-support
* @copyright 2014
*/
class contact {




public
$name ;
// the name oh the sender
public $email;
// email of the sender
public $message;
// the message
public $des ;
// design of the form
public $error_mes ;
// the error_message
public $succes_mes ;
// the succes message
public $send_to ;
//
public $name_mes;
//
// this function to check the var about in empty and sec it ..
function check ($var)
{
if(
$var ='')
{
echo
$this ->error_mes ;
exit;
}
$var = trim ($var);
$var = strip_tags($var);
return
$var ;
}
// this function to send the message ..
function con ($name,$email,$send_to,$name_mes,$message,$des,$error_mes,$succes_mes)
{
$this ->name = $name ;
$this ->email = $email ;
$this ->message =$message ;
$this ->des = $des ;
$this ->error_mes = $error_mes ;
$this ->succes_mes = $succes_mes ;
$this ->name_mes = $name_mes ;
$this ->send_to = $send_to ;
//

if ($_POST == 'submit')
{
$name = $_POST&#91;'name'&#93;;
$this ->check($name);
$email = $_POST&#91;'email'&#93;;
$this ->check($email);
$message = $_POST&#91;'message'&#93;;
$this ->check($message);
$send_to = $_POST&#91;'send_to'&#93;;
$this ->check($send_to);
$name_mes = $_POST&#91;'name_mes'&#93;;
$this ->check ($name_mes);
$headers = "From: $name\r\n";
$headers .= "Content-type: text\r\n";
if(
mail ( "$send_to" , "$name_mes" , "$message" , "$header" ))
{
echo
$succes_mes ;
}
else {
echo
$error_mes ;
}


}
else{

if (
file_exists($des))
{
include
"$des";
}
else
"error";
}
}
}


// for use it ,,
$drsupport = new contact ();
$drsupport ->name = 'dr-support' ;
$drsupport ->email = '[email protected]';
$drsupport ->message = 'i love php';
$drsupport ->des = 'form.html';
$drsupport ->error_mes ='oooops ! you must complete all the feilds';
$drsupport ->succes_mes ='message sent succesufly';
$drsupport ->send_to = '[email protected]';
$drsupport ->con();
// other method ..
$drsupport = new contact('dr-support','[email protected]','i love php','form.html','oooops ! you must complete all the feilds','message sent succesufly','[email protected]');
$drsupport ->con();
// my best wishes ,,
?>
</code> </code>

الكلاس وبكل بساطة
اثناء عمل اسكرب كبير او صغير
لن يوجد وقت لتضيعو فى اشياء سهلة بعض الشىء
يجب ان تكون جاهزة معك
فقط عليك ان تمرر لها الاشياء اللازمة لعملها فقط
----------------
شو هالكلام الكبير
----------------------
نبى نقدكم قبل مدحكم
سلام عليكم










©المشاركات المنشورة تعبر عن وجهة نظر صاحبها فقط، ولا تُعبّر بأي شكل من الأشكال عن وجهة نظر إدارة المنتدى©