<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>مدونة مبرمج مغربي &#187; دروس برمجية</title>
	<atom:link href="http://www.bp.ma/category/%d8%af%d8%b1%d9%88%d8%b3-%d8%a8%d8%b1%d9%85%d8%ac%d9%8a%d8%a9/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bp.ma</link>
	<description>مدونة برمجية اقوم باضافة اخر ما ابرمجه من برمجيات حرة ودروس واخبار تقنية</description>
	<lastBuildDate>Thu, 12 Aug 2010 11:12:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>دورة في لغة Objective-C لانشاء تطبيقات أيفون</title>
		<link>http://www.bp.ma/2010/07/14/%d8%af%d9%88%d8%b1%d8%a9-%d9%81%d9%8a-%d9%84%d8%ba%d8%a9-objective-c-%d9%84%d8%a7%d9%86%d8%b4%d8%a7%d8%a1-%d8%aa%d8%b7%d8%a8%d9%8a%d9%82%d8%a7%d8%aa-%d8%a3%d9%8a%d9%81%d9%88%d9%86/</link>
		<comments>http://www.bp.ma/2010/07/14/%d8%af%d9%88%d8%b1%d8%a9-%d9%81%d9%8a-%d9%84%d8%ba%d8%a9-objective-c-%d9%84%d8%a7%d9%86%d8%b4%d8%a7%d8%a1-%d8%aa%d8%b7%d8%a8%d9%8a%d9%82%d8%a7%d8%aa-%d8%a3%d9%8a%d9%81%d9%88%d9%86/#comments</comments>
		<pubDate>Wed, 14 Jul 2010 13:33:55 +0000</pubDate>
		<dc:creator>عبد الواحد البشيري</dc:creator>
				<category><![CDATA[اخبار تقنية]]></category>
		<category><![CDATA[دروس برمجية]]></category>
		<category><![CDATA[cours]]></category>
		<category><![CDATA[ihpone]]></category>
		<category><![CDATA[learn]]></category>
		<category><![CDATA[objective-C]]></category>
		<category><![CDATA[الأيفون]]></category>
		<category><![CDATA[برمجة ايفون]]></category>
		<category><![CDATA[تعلم]]></category>

		<guid isPermaLink="false">http://www.bp.ma/?p=444</guid>
		<description><![CDATA[بسم الله الرحمن الرحيم وصلني بريد الكتروني من الأخ فيصل لكي اساعده على اخبار زوار المدونة  عن الدورة حقيقة المنتدى الذي تم وضع الدورة فيه لم اكن اعرفه من قبل للأمانة وانا لا اتحمل ما يوجد في المنتدى فقط اعطيكم رابط الدورة والذي اشكر كاتبها والاخ فيصل رابط الدورة اولا ثلاث دروس جمعتها في ملف [...]]]></description>
			<content:encoded><![CDATA[<p>بسم الله الرحمن الرحيم</p>
<p>وصلني بريد الكتروني من الأخ فيصل لكي اساعده على اخبار زوار المدونة  عن الدورة</p>
<p>حقيقة المنتدى الذي تم وضع الدورة فيه لم اكن اعرفه من قبل للأمانة وانا لا اتحمل ما يوجد في المنتدى</p>
<p>فقط اعطيكم رابط الدورة والذي اشكر كاتبها والاخ فيصل</p>
<p><a href="http://www.adslgate.com/dsl/showthread.php?t=581683" target="_blank">رابط الدورة </a></p>
<p>اولا <a href="http://bp.ma/wp-content/iphone/Objective-C.zip">ثلاث دروس</a> جمعتها في ملف مضغوط</p>
<p>والله الموفق</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bp.ma/2010/07/14/%d8%af%d9%88%d8%b1%d8%a9-%d9%81%d9%8a-%d9%84%d8%ba%d8%a9-objective-c-%d9%84%d8%a7%d9%86%d8%b4%d8%a7%d8%a1-%d8%aa%d8%b7%d8%a8%d9%8a%d9%82%d8%a7%d8%aa-%d8%a3%d9%8a%d9%81%d9%88%d9%86/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>التعامل مع الـ models في codeigniter</title>
		<link>http://www.bp.ma/2010/02/19/%d8%a7%d9%84%d8%aa%d8%b9%d8%a7%d9%85%d9%84-%d9%85%d8%b9-%d8%a7%d9%84%d9%80-models-%d9%81%d9%8a-codeigniter/</link>
		<comments>http://www.bp.ma/2010/02/19/%d8%a7%d9%84%d8%aa%d8%b9%d8%a7%d9%85%d9%84-%d9%85%d8%b9-%d8%a7%d9%84%d9%80-models-%d9%81%d9%8a-codeigniter/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 12:17:45 +0000</pubDate>
		<dc:creator>عبد الواحد البشيري</dc:creator>
				<category><![CDATA[framwork]]></category>
		<category><![CDATA[دروس برمجية]]></category>
		<category><![CDATA[codeifniter]]></category>
		<category><![CDATA[model]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[اطار عمل]]></category>
		<category><![CDATA[درس]]></category>

		<guid isPermaLink="false">http://www.bp.ma/?p=396</guid>
		<description><![CDATA[بسم الله الرحمن الرحيم الموديل او Model وضيفته هي التحكم في البيانات الموجودة في القاعدة وهذا فقط للتنظيم لنعد الى موضعنا الان ... مسار الموديل هو application/models وداخله يتم وضع ملفات php باسم مثلا news_model.php ويكون على هذا المسار application/models/news_model.php طريقة انشاء كلاس الموديل هي على الشكل التالي PLAIN TEXT PHP: class News_model extends Model&#123; [...]]]></description>
			<content:encoded><![CDATA[<p>بسم الله الرحمن الرحيم</p>
<p>الموديل او Model وضيفته هي التحكم في البيانات الموجودة في القاعدة وهذا فقط للتنظيم  </p>
<p>لنعد الى موضعنا الان ... مسار الموديل هو application/models وداخله يتم وضع ملفات php باسم مثلا news_model.php ويكون على هذا المسار application/models/news_model.php<br />
طريقة انشاء كلاس الموديل هي على الشكل التالي<br />
<span id="more-396"></span></p>
<div class="igBar"><span id="lphp-11"><a href="#" onclick="javascript:showPlainTxt('php-11'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-11">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">class</span> News_model extends Model<span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> News_model<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; parent::<span style="color:#006600;">Model</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
طيب لنفرض انه لدينا جدول اخبار في القاعدة ونريد ان ننشئ دالة تقوم بعملية اظهار الأخبار ودالة اظهار خبر واحد ودالة مسح و دالة تعديل واضافة...<br />
هذا هو التنظيم والبرمجة النظيقة والمتعة ايضا.<br />
 اذا تابع معي ...</p>
<p>سنصنع كلاس يقوم بما ذكرت انفا</p>
<div class="igBar"><span id="lphp-12"><a href="#" onclick="javascript:showPlainTxt('php-12'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-12">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">class</span> News_model extends Model<span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">//هذه الدالة ضرورية لمنداة model ويمكن استخدام دالة __construct لـ php5</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> News_model<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; parent::<span style="color:#006600;">Model</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">//اظهار&nbsp; اخر عشرة اخبار مضافة</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> last_ten_news<span style="color:#006600; font-weight:bold;">&#40;</span> <span style="color:#0000FF;">$tbl</span> <span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$query</span>=<span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">db</span>-&gt;<span style="color:#006600;">order_by</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'id'</span>,<span style="color:#FF0000;">'desc'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$query</span>=<span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">db</span>-&gt;<span style="color:#006600;">get</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$tbl</span>,<span style="color:#CC66CC;color:#800000;">10</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">return</span> <span style="color:#0000FF;">$query</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// اظهار خبر واحد بدلالة رقمه</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> news_by_id<span style="color:#006600; font-weight:bold;">&#40;</span> <span style="color:#0000FF;">$tbl</span>,<span style="color:#0000FF;">$id</span> <span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$query</span>=<span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">db</span>-&gt;<span style="color:#006600;">where</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'id'</span>,<span style="color:#0000FF;">$id</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$query</span>=<span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">db</span>-&gt;<span style="color:#006600;">get</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$tbl</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">return</span> <span style="color:#0000FF;">$query</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// اضافة بيانات الى القاعدة</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> add<span style="color:#006600; font-weight:bold;">&#40;</span> <span style="color:#0000FF;">$tbl</span>,<span style="color:#0000FF;">$data</span>=<a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">db</span>-&gt;<span style="color:#006600;">insert</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$tbl</span>,<span style="color:#0000FF;">$data</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// تعديل البيانات بدلالة رقم الصف في القاعدة</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> edit<span style="color:#006600; font-weight:bold;">&#40;</span> <span style="color:#0000FF;">$tbl</span>,<span style="color:#0000FF;">$data</span>=<a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>,<span style="color:#0000FF;">$id</span> <span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">db</span>-&gt;<span style="color:#006600;">where</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'id'</span>,<span style="color:#0000FF;">$id</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">db</span>-&gt;<span style="color:#006600;">update</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$tbl</span>,<span style="color:#0000FF;">$data</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">//يرجع عدد الصفوف التي تم مسحها في حالتنا واحد واذا اعطانا صفر فانه لم يحذف اي صف</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">return</span> <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">db</span>-&gt;<span style="color:#006600;">affected_rows</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">//مسح صف في القاعدة بدلالة رقمه</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> delete<span style="color:#006600; font-weight:bold;">&#40;</span> <span style="color:#0000FF;">$tbl</span>,<span style="color:#0000FF;">$id</span> <span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">db</span>-&gt;<span style="color:#006600;">where</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'id'</span>,<span style="color:#0000FF;">$id</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">db</span>-&gt;<span style="color:#006600;">delete</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$tbl</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">//يرجع عدد الصفوف التي تم مسحها في حالتنا واحد واذا اعطانا صفر فانه لم يحذف اي صف</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">return</span> <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">db</span>-&gt;<span style="color:#006600;">affected_rows</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
الأن انتهينا من ملف الموديل ونذهب لملف التحكم  لنطلب ملف الموديل ونستخدم الدوال التي كتبناها</p>
<p>ننشئ دالة داخل كلاس ملف التحكم</p>
<div class="igBar"><span id="lphp-13"><a href="#" onclick="javascript:showPlainTxt('php-13'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-13">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">function</span> insert<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// المفتاح news هو اسم الحقل في القاعدة </span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$data</span>=<a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'news'</span>=&gt;<span style="color:#FF0000;">'نص الخبر هنا نص الخبر هنا'</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">news_model</span>-&gt;<span style="color:#006600;">add</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'news'</span>,<span style="color:#0000FF;">$data</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
دالة add تقوم بادخال البيانات الى القاعدة وترجع الينا عدد الصفوف التي تم ادخالها كما شرحت من قبل<br />
والان سنضع شرط اذا تم الادخال نطبع رسالة نجاح</p>
<div class="igBar"><span id="lphp-14"><a href="#" onclick="javascript:showPlainTxt('php-14'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-14">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">function</span> insert<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// code html</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$data</span>=<a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'news'</span>=&gt;<span style="color:#FF0000;">'نص الخبر هنا نص الخبر هنا'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span> <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">news_model</span>-&gt;<span style="color:#006600;">add</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'news'</span>,<span style="color:#0000FF;">$data</span><span style="color:#006600; font-weight:bold;">&#41;</span>&gt; <span style="color:#CC66CC;color:#800000;">0</span> <span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">'تم اضافة الخبر بنجاح'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#616100;">else</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">'لم يتم اضافة اي شيئ'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
لاضافة البيانات ستطلب هذا الرابط http://localhost/index.php/news/insert<br />
كذلك يمكن استقبال مصفوفة $_POST ووضعها مكان $data عندما يتم اضافة الخبر من form</p>
<p>الأن نريد اظهار اخر عشرة اخبار تم اضافتهم وسنستخدم التي صنعناها في الموديل<br />
سيكون الكود كالتالي</p>
<div class="igBar"><span id="lphp-15"><a href="#" onclick="javascript:showPlainTxt('php-15'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-15">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">function</span> view<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">//قمنا بتخزين النتائج في مصفوفة لنعرضها داخل ملف view</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$data</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'last_ten_news'</span><span style="color:#006600; font-weight:bold;">&#93;</span>=<span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">news_model</span>-&gt;<span style="color:#006600;">last_ten_news</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'news'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">//اعطينا المصفوفة لملف view وسميته ب last_ten_news.php داخل مجلد /views</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">load</span>-&gt;<span style="color:#006600;">view</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'last_ten_news'</span>,<span style="color:#0000FF;">$data</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
وملف الـ view باسم last_ten_news.php داخل مجلد /views وسيكون بسيط كالتالي</p>
<div class="igBar"><span id="lphp-16"><a href="#" onclick="javascript:showPlainTxt('php-16'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-16">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#616100;">foreach</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$last_ten_news</span>-&gt;<span style="color:#006600;">result</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#616100;">as</span> <span style="color:#0000FF;">$news</span> <span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;p style=<span style="color:#FF0000;">"background:silver;"</span>&gt;&lt;?php <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#0000FF;">$news</span>-&gt;<span style="color:#006600;">news</span>; ?&gt;&lt;/p&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#006600; font-weight:bold;">&#125;</span> <span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>والأن اذهب الى  http://localhost/index.php/news/view<br />
واذا اردنا اظهار خبر واحد يكفي ان نكتب هذه الدالة </p>
<div class="igBar"><span id="lphp-17"><a href="#" onclick="javascript:showPlainTxt('php-17'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-17">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">function</span> view_id<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$id</span>=<span style="color:#FF0000;">''</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">//قمنا بتخزين النتائج في مصفوفة لنعرضها داخل ملف view</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$data</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'last_ten_news'</span><span style="color:#006600; font-weight:bold;">&#93;</span>=<span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">news_model</span>-&gt;<span style="color:#006600;">news_by_id</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'news'</span>,<span style="color:#0000FF;">$id</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">//اعطينا المصفوفة لملف view وسميته ب last_ten_news.php داخل مجلد /views</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">load</span>-&gt;<span style="color:#006600;">view</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'last_ten_news'</span>,<span style="color:#0000FF;">$data</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
ونطلب الخبر عن طريق الرابط http://localhost/index.php/news/view_id/1</p>
<p>الأن لحذف اي صف من صفوف الجدول في القاعدة سنستخدم دالة الحذف وتكون كالتالي</p>
<div class="igBar"><span id="lphp-18"><a href="#" onclick="javascript:showPlainTxt('php-18'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-18">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">function</span> delete<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$id</span>=<span style="color:#FF0000;">''</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span> <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">news_model</span>-&gt;<span style="color:#006600;">delete</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'news'</span>,<span style="color:#0000FF;">$id</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">'تم المسح بنجاح '</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#616100;">else</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">'لم يتم المسح او انه غير موجود'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
طبعا سيتم حفظ الكود داخل ملف التحكم news وسيتم منادة الرابط http://localhost/index.php/news/delete/1<br />
غير رقم واحد الى اي رقم صف في القادة وسيتم حذفه</p>
<p>الأن مع التعديل</p>
<div class="igBar"><span id="lphp-19"><a href="#" onclick="javascript:showPlainTxt('php-19'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-19">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">function</span> edit<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$id</span>=<span style="color:#FF0000;">''</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#0000FF;">$id</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#0000FF;">$data</span>=<a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'news'</span>=&gt;<span style="color:#FF0000;">'تعديل النص من جديد'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span> <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">news_model</span>-&gt;<span style="color:#006600;">edit</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'news'</span>,<span style="color:#0000FF;">$data</span>,<span style="color:#0000FF;">$id</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">'تم التعديل بنجاح '</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#616100;">else</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">'لم يتم التعديل'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
لاحظت انني اضفت مدخل لكل من الدوال  delete و view_id و edit باسم $id<br />
نعم انه الرقم الذي نكتبه في الرابط يتم التعرف عليه تلقائيا </p>
<p>http://localhost/index.php/news/delete/1</p>
<p>وفي الأخير سيكون شكل ملف التحكم </p>
<div class="igBar"><span id="lphp-20"><a href="#" onclick="javascript:showPlainTxt('php-20'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-20">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">class</span> News extends Controller<span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> News<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; parent::<span style="color:#006600;">Controller</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#FF9933; font-style:italic;">// نقوم بطلب قاعدة البيانات</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">load</span>-&gt;<span style="color:#006600;">database</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#FF9933; font-style:italic;">// نطلب ملف الموديل</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">load</span>-&gt;<span style="color:#006600;">model</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'news_model'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;<span style="color:#000000; font-weight:bold;">function</span> index<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;<span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> view<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">//قمنا بتخزين النتائج في مصفوفة لنعرضها داخل ملف view</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$data</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'last_ten_news'</span><span style="color:#006600; font-weight:bold;">&#93;</span>=<span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">news_model</span>-&gt;<span style="color:#006600;">last_ten_news</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'news'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">//اعطينا المصفوفة لملف view وسميته ب last_ten_news.php داخل مجلد /views</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">load</span>-&gt;<span style="color:#006600;">view</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'last_ten_news'</span>,<span style="color:#0000FF;">$data</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;<span style="color:#000000; font-weight:bold;">function</span> view_id<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$id</span>=<span style="color:#FF0000;">''</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">//قمنا بتخزين النتائج في مصفوفة لنعرضها داخل ملف view</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$data</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'last_ten_news'</span><span style="color:#006600; font-weight:bold;">&#93;</span>=<span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">news_model</span>-&gt;<span style="color:#006600;">news_by_id</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'news'</span>,<span style="color:#0000FF;">$id</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">//اعطينا المصفوفة لملف view وسميته ب last_ten_news.php داخل مجلد /views</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">load</span>-&gt;<span style="color:#006600;">view</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'last_ten_news'</span>,<span style="color:#0000FF;">$data</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> insert<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// code html</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$data</span>=<a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'news'</span>=&gt;<span style="color:#FF0000;">'نص الخبر هنا نص الخبر هنا'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span> <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">news_model</span>-&gt;<span style="color:#006600;">add</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'news'</span>,<span style="color:#0000FF;">$data</span><span style="color:#006600; font-weight:bold;">&#41;</span>&gt; <span style="color:#CC66CC;color:#800000;">0</span> <span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">'تم اضافة الخبر بنجاح'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#616100;">else</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">'لم يتم اضافة اي شيئ'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> delete<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$id</span>=<span style="color:#FF0000;">''</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span> <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">news_model</span>-&gt;<span style="color:#006600;">delete</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'news'</span>,<span style="color:#0000FF;">$id</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">'تم المسح بنجاح '</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#616100;">else</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">'لم يتم المسح او انه غير موجود'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> edit<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$id</span>=<span style="color:#FF0000;">''</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#0000FF;">$data</span>=<a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'news'</span>=&gt;<span style="color:#FF0000;">'تعديل النص من جديد'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span> <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">news_model</span>-&gt;<span style="color:#006600;">edit</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'news'</span>,<span style="color:#0000FF;">$data</span>,<span style="color:#0000FF;">$id</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">'تم التعديل بنجاح '</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#616100;">else</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">'لم يتم التعديل'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>درسنا القادم سيتكلم عن <del datetime="2010-02-20T10:57:54+00:00">الكائن db</del> المكتبات في codeigniter وجميع استخداماته والذي يسهل عليك الكثير من الوقت </p>
<p>هذا فان اصبت فمن الله عز وجل وان اخطات فمن نفسي ومن الشيطان</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bp.ma/2010/02/19/%d8%a7%d9%84%d8%aa%d8%b9%d8%a7%d9%85%d9%84-%d9%85%d8%b9-%d8%a7%d9%84%d9%80-models-%d9%81%d9%8a-codeigniter/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>الثوابت او define في php</title>
		<link>http://www.bp.ma/2010/02/18/%d8%a7%d9%84%d8%ab%d9%88%d8%a7%d8%a8%d8%aa-%d8%a7%d9%88-define-%d9%81%d9%8a-php/</link>
		<comments>http://www.bp.ma/2010/02/18/%d8%a7%d9%84%d8%ab%d9%88%d8%a7%d8%a8%d8%aa-%d8%a7%d9%88-define-%d9%81%d9%8a-php/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 10:12:35 +0000</pubDate>
		<dc:creator>عبد الواحد البشيري</dc:creator>
				<category><![CDATA[php  البي اتش بي]]></category>
		<category><![CDATA[دروس برمجية]]></category>
		<category><![CDATA[define]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[ثابت]]></category>
		<category><![CDATA[ثوابت]]></category>

		<guid isPermaLink="false">http://www.bp.ma/?p=392</guid>
		<description><![CDATA[بسم الله الرحمن الرحيم الثوابت تقوم بتخزين قيمة مثلها مثل المتغيرات ولكن من خلال اسم 'ثابت' يتبادر الى ذهننا ان الثابت لا يتغير عكس المتغير الذي يتغير كلما اعطيته قيمة جديدة بمعنى اننا اذا انشأنا ثابتا لا نستطيع اضافة ثابت اخر بنفس الاسم كما انه حساس لحالة الأحرف الا اذا اضفنا اليه مدخل true .. [...]]]></description>
			<content:encoded><![CDATA[<p>بسم الله الرحمن الرحيم</p>
<p>الثوابت تقوم بتخزين قيمة مثلها مثل المتغيرات ولكن من خلال اسم 'ثابت' يتبادر الى ذهننا ان الثابت لا يتغير عكس المتغير الذي يتغير كلما اعطيته قيمة جديدة<br />
بمعنى اننا اذا انشأنا ثابتا لا نستطيع اضافة ثابت اخر بنفس الاسم كما انه حساس لحالة الأحرف الا اذا اضفنا اليه مدخل true ..  اعرف ان هذا غير مفهوم ولكنك ستفهم من خلال الأمثلة<br />
<span id="more-392"></span></p>
<div class="igBar"><span id="lphp-26"><a href="#" onclick="javascript:showPlainTxt('php-26'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-26">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/define"><span style="color:#000066;">define</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'NAME'</span>,<span style="color:#FF0000;">'abdelouahid elbachiri'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
اذا اردنا طباعة الثابت يكفي ان تكتب</p>
<div class="igBar"><span id="lphp-27"><a href="#" onclick="javascript:showPlainTxt('php-27'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-27">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> NAME;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>ولكن مذا لو نسيت وكتبت الثابت بأحرف صغيرة مع اننا عندما انشأنا الثابت اعطينه اسم بالحروف الكبيرة</p>
<div class="igBar"><span id="lphp-28"><a href="#" onclick="javascript:showPlainTxt('php-28'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-28">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> name;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
سيطبع رسالة انه غير موجود ويطبع معه اسم name بكل بساطة<br />
اذا هل يوجد حل ؟ ,, بالطبع لغة بي اتش بي مليئة بالحلول  والسهولة<br />
  وكما قلت من قبل سنضيف الي الثابت مدخل اخر وسيكون الثابت هكذا</p>
<div class="igBar"><span id="lphp-29"><a href="#" onclick="javascript:showPlainTxt('php-29'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-29">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/define"><span style="color:#000066;">define</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'NAME'</span>,<span style="color:#FF0000;">'abdelouahid elbachiri'</span>,<span style="color:#000000; font-weight:bold;">true</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p> </p>
<p>والأن قم بكتابة اسم الثابت كما تشاء</p>
<p>لماذا استخدم الثوابت ومتى ؟</p>
<p>ان استخدام الثوابت يقلل من استهلاك الذاكرة وغالبا ما يتم استخدامها في ملفات اللغة  وعلى حسب كل برنامج ترى انه من مصلحته ان يستخدم الثابت</p>
<p>يمكن انشاء الثابت بهذه الطريقة ادناه على php 5.3.0</p>
<div class="igBar"><span id="lphp-30"><a href="#" onclick="javascript:showPlainTxt('php-30'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-30">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">const NAME =<span style="color:#FF0000;">'abdelouahid elbachiri'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> NAME;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>هذا فان اصبت فمن الله عز وجل وان اخطأت فمن نفسي ومن الشيطان</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bp.ma/2010/02/18/%d8%a7%d9%84%d8%ab%d9%88%d8%a7%d8%a8%d8%aa-%d8%a7%d9%88-define-%d9%81%d9%8a-php/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>التعامل مع ملفات التصميم في codeigniter</title>
		<link>http://www.bp.ma/2010/02/05/%d8%a7%d9%84%d8%aa%d8%b9%d8%a7%d9%85%d9%84-%d9%85%d8%b9-%d9%85%d9%84%d9%81%d8%a7%d8%aa-%d8%a7%d9%84%d8%aa%d8%b5%d9%85%d9%8a%d9%85-%d9%81%d9%8a-codeigniter/</link>
		<comments>http://www.bp.ma/2010/02/05/%d8%a7%d9%84%d8%aa%d8%b9%d8%a7%d9%85%d9%84-%d9%85%d8%b9-%d9%85%d9%84%d9%81%d8%a7%d8%aa-%d8%a7%d9%84%d8%aa%d8%b5%d9%85%d9%8a%d9%85-%d9%81%d9%8a-codeigniter/#comments</comments>
		<pubDate>Fri, 05 Feb 2010 17:48:48 +0000</pubDate>
		<dc:creator>عبد الواحد البشيري</dc:creator>
				<category><![CDATA[framwork]]></category>
		<category><![CDATA[دروس برمجية]]></category>
		<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[اطار عمل]]></category>

		<guid isPermaLink="false">http://www.bp.ma/?p=381</guid>
		<description><![CDATA[بسم الله الرحمن الرحيم سأبين في هذا الدرس كيف يتم التعامل مع القوالب او ملفات التصميم من خلال ال CONTROLLER لكي نقوم باظهار نص داخل قالب ما عن طريق المتحكم سننشئ ملف ونسميه بـ phonebook.php وسنجعله عبارة عن دليل الهاتف ويكون داخل مجلد /application/controllers ونكتب داخله الشفرة التالية PLAIN TEXT PHP: &#60;?php class Phonebook extends [...]]]></description>
			<content:encoded><![CDATA[<p>بسم الله الرحمن الرحيم</p>
<p>سأبين في هذا الدرس كيف يتم التعامل مع القوالب او ملفات التصميم من خلال ال CONTROLLER<br />
لكي نقوم باظهار نص داخل قالب ما عن طريق المتحكم<br />
سننشئ ملف ونسميه بـ phonebook.php وسنجعله عبارة عن دليل الهاتف ويكون داخل مجلد /application/controllers<br />
ونكتب داخله الشفرة التالية<br />
<span id="more-381"></span></p>
<div class="igBar"><span id="lphp-33"><a href="#" onclick="javascript:showPlainTxt('php-33'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-33">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">class</span> Phonebook extends controller<span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> Phonebook<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; parent::<span style="color:#006600;">controller</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> index<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// هنا يتم طباعة الصفحة الرئيسية لـ phonebook</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> view<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$data</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'phonebook'</span><span style="color:#006600; font-weight:bold;">&#93;</span>=<a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'احمد'</span>=&gt;<span style="color:#FF0000;">'342342353453'</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; ,<span style="color:#FF0000;">'محمد'</span>=&gt;<span style="color:#FF0000;">'34531231'</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; ,<span style="color:#FF0000;">'عبد الواحد'</span>=&gt;<span style="color:#FF0000;">'4554545'</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; ,<span style="color:#FF0000;">'عبد القادر'</span>=&gt;<span style="color:#FF0000;">'232323232'</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; ,<span style="color:#FF0000;">'طارق'</span>=&gt;<span style="color:#FF0000;">'865348903'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// نقوم بجلب ملف التصميم لكي يتم طباعة البيانات داخل جدول </span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">load</span>-&gt;<span style="color:#006600;">view</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'phone_table'</span>,<span style="color:#0000FF;">$data</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
طيب هناك شيئ غير مفهوم ... نعم انه phone_table ... حسنا هذا الأسم هو ملف التصميم الذي تحدثنا عليه ويكون في الأصل بامتداد .php<br />
يجب ان نذهب سريعا الى application/views وننشئ دخاله ملف phone_table.php ويكون بداخله هذه الكود</p>
<div class="igBar"><span id="lphp-34"><a href="#" onclick="javascript:showPlainTxt('php-34'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-34">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;table width=<span style="color:#FF0000;">"50%"</span> border=<span style="color:#FF0000;">"0"</span> cellspacing=<span style="color:#FF0000;">"1"</span> cellpadding=<span style="color:#FF0000;">"1"</span> style=<span style="color:#FF0000;">"direction:rtl;background:#E9ABAB"</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;tr style=<span style="color:#FF0000;">"background:#A57B7B"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;td&gt;الاسم &lt;/td&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;td&gt;رقم الهاتف&lt;/td&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;/tr&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> <span style="color:#616100;">foreach</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$phonebook</span> <span style="color:#616100;">as</span> <span style="color:#0000FF;">$name</span> =&gt; <span style="color:#0000FF;">$number</span><span style="color:#006600; font-weight:bold;">&#41;</span> : <span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;tr style=<span style="color:#FF0000;">"background:#F77777"</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;td&gt;&lt;?=<span style="color:#0000FF;">$name</span>;?&gt;&lt;/td&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;td&gt;&lt;?=<span style="color:#0000FF;">$number</span>;?&gt;&lt;/td&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;/tr&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span> endforeach; <span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/table&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>وستكون النتيجة هكذا</p>
<table width="50%" border="0" cellspacing="1" cellpadding="1" style="direction:rtl;background:#E9ABAB">
<tr style="background:#A57B7B">
<td>الاسم </td>
<td>رقم الهاتف</td>
</tr>
<tr style="background:#F77777">
<td>احمد</td>
<td>342342353453</td>
</tr>
<tr style="background:#F77777">
<td>محمد</td>
<td>34531231</td>
</tr>
<tr style="background:#F77777">
<td>عبد الواحد</td>
<td>4554545</td>
</tr>
<tr style="background:#F77777">
<td>عبد القادر</td>
<td>232323232</td>
</tr>
<tr style="background:#F77777">
<td>طارق</td>
<td>865348903</td>
</tr>
</table>
<p> هذه طريقة بسيطة جدا لتتعرف على كيفية التعامل مع ملفات التصميم </p>
<p>لكن لا تخف فان هذا الاطار يوفر لك اخي المبرمج على ادوات تساعدك في بناء برامجك في اقل مما تتوقعه وذلك عن طريق المكتبات والدوال التي تأتي مع المنصة كل ذلك سنتكلم عليه في الدروس القادمة ان شاء الله</p>
<p>هذا فان اصبت فمن الله عز وجل وان اخطأت فمن نفسي ومن الشيطان</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bp.ma/2010/02/05/%d8%a7%d9%84%d8%aa%d8%b9%d8%a7%d9%85%d9%84-%d9%85%d8%b9-%d9%85%d9%84%d9%81%d8%a7%d8%aa-%d8%a7%d9%84%d8%aa%d8%b5%d9%85%d9%8a%d9%85-%d9%81%d9%8a-codeigniter/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>اول برنامج لك بواسطة codeigniter</title>
		<link>http://www.bp.ma/2010/02/05/%d8%a7%d9%88%d9%84-%d8%a8%d8%b1%d9%86%d8%a7%d9%85%d8%ac-%d9%84%d9%83-%d8%a8%d9%88%d8%a7%d8%b3%d8%b7%d8%a9-codeigniter/</link>
		<comments>http://www.bp.ma/2010/02/05/%d8%a7%d9%88%d9%84-%d8%a8%d8%b1%d9%86%d8%a7%d9%85%d8%ac-%d9%84%d9%83-%d8%a8%d9%88%d8%a7%d8%b3%d8%b7%d8%a9-codeigniter/#comments</comments>
		<pubDate>Fri, 05 Feb 2010 11:04:34 +0000</pubDate>
		<dc:creator>عبد الواحد البشيري</dc:creator>
				<category><![CDATA[framwork]]></category>
		<category><![CDATA[دروس برمجية]]></category>
		<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[اطار عمل]]></category>

		<guid isPermaLink="false">http://www.bp.ma/?p=377</guid>
		<description><![CDATA[بسم الله الرحمن الرحيم في هذا الدرس سأشرح كيفية انشاء اول برنامج على المنصة قبل الذهاب الى الشفرات البرمجة سأشرح لك بعض الأمور التي لابد من معرفتها قبل البدء كما قلنا سابقا ان النظام مبني على تقنية MVC واعتقد أنك قرأت عنه ولو القليل ... m = Model v = View c= Controller عندما تدخل [...]]]></description>
			<content:encoded><![CDATA[<p>بسم الله الرحمن الرحيم</p>
<p>في  هذا الدرس سأشرح كيفية انشاء اول برنامج على المنصة</p>
<p>قبل الذهاب الى الشفرات البرمجة سأشرح لك بعض الأمور التي لابد من معرفتها قبل البدء</p>
<p>كما قلنا سابقا ان النظام مبني على تقنية MVC واعتقد أنك قرأت عنه ولو القليل ...<br />
m = Model<br />
v = View<br />
c= Controller</p>
<p>عندما تدخل على مجلد system وتدخل ايضا على application ستجد ان هناك مجلدات ومن بينها التي ذكرتها في الأعلى .. مجلد Model يتم وضع فيه ملفاتك البرمجية التي تقوم بعمليات مع قاعدة البيانات ومجلد view تضع فيه ملفات التصميم اما مجلد Controller فيتم وضع فيه ملفات التحكم في البرنامج وسيتم شرح كل نقطة ...</p>
<p>حسنا في ملفك البرمجي الذي ستنشئه داخل مجلد التحكم controllers سيكون عبارة عن كلاس وبداخله دوال ...<br />
اسم الكلاس سيكون في الرابط هكذا http://youSite.com/index.php/class_name واسم الدالة يأتي بعد الكلاس هكذا </p>
<p>http://youSite.com/index.php/class_name/function_name</p>
<p>طيب الان سنذهب الى مجلد system/application/controllers وننشئ ملف باسم news.php وننشئ داخله كلاس بنفس اسم الملف وهذا ضروري جدا<br />
وتكون الشفرة هكذا</p>
<div class="igBar"><span id="lphp-38"><a href="#" onclick="javascript:showPlainTxt('php-38'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-38">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// يجب كتابة اول حرف من اسم الكلاس كبير كما هو موجود تحت</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">class</span> News extends Controller<span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// هذه الدالة يجب وضعها دائما في الأول اذا كنت تستخدم php4 اما اذا كنت تستخدم php5 فاستخدم</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// دالة __construct مكان News ووضيفتهما هي جلب المتحكم بمجرد طلب الصفحة وهذا ضروري</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> News<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; parent::<span style="color:#006600;">Controller</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> index<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">'مرحبا بكم في اول برنامج لي '</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>الأن يمكنك طلب الكلاس بهذه الطريقة http://youSite.com/index.php/news وستجد العبارة الترحيبية امامك <img src='http://www.bp.ma/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
كذالك تستطيع جلبها هكذا http://youSite.com/index.php/news/index<br />
الأن نريد ان يكون الرابط هكذا http://youSite.com/index.php/news/view بكل بساطة سنضيف دالة اخرى تحت دالة index وتكون هكذا</p>
<div class="igBar"><span id="lphp-39"><a href="#" onclick="javascript:showPlainTxt('php-39'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-39">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// يجب كتابة اول حرف من اسم الكلاس كبير كما هو موجود تحت</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">class</span> News extends Controller<span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> News<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; parent::<span style="color:#006600;">Controller</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> index<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">'مرحبا بكم في اول برنامج لي '</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> view<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">'مرحبا بك الى صفحة اظهار الأخبار'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// وهنا تقوم بعملية جلب البيانات من القاعدة وطباعتها</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>طيب الأن نريد مثلا اظهار خبر واحد بدلالة رقمه سيكون الرابط هكذا 12/http://youSite.com/index.php/news/view<br />
ونجعل دالة view تأخذ براميتر ID وتكون الدالة هكذا</p>
<p>نتحقق من   المعرف ID اذا كان فارغا نقوم بادراج الأخبار ,, اي المقتتطفات كما تحب</p>
<p> واما اذا كان رقما سنتحقق منه ونستخرج من القاعدة خبرا يحمل نفس الرقم </p>
<div class="igBar"><span id="lphp-40"><a href="#" onclick="javascript:showPlainTxt('php-40'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-40">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// يجب كتابة اول حرف من اسم الكلاس كبير كما هو موجود تحت</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">class</span> News extends Controller<span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> News<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; parent::<span style="color:#006600;">Controller</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> index<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">'مرحبا بكم في اول برنامج لي '</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> view<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$ID</span>=<span style="color:#FF0000;">''</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span> <a href="http://www.php.net/empty"><span style="color:#000066;">empty</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$ID</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// سنقوم بطباعة عناوين الأخبار</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#616100;">else</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// نتحقق من الرقم ونقوم بطباعة الخبر الذي يحمل نفس الرقم</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#0000FF;">$ID</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>عندما تقوم بزيارة الرابط http://yourSite.com/index.php يتم اظهار المتحكم welcome  بشكل ألي لتجنب اظهاره سنذهب الى ملف<br />
system/application/config/routes.php وتذهب الى السطر 43 وتقم بتغيير welcome الى المتحكم الذي تريده ان يظهر في الصفحة الأولى<br />
لنقل اننا نريد اظهار news</p>
<p>هذا فان اصبت فمن الله عز وجل وان اخطأت فمن نفسي ومن الشيطان</p>
<p>الدرس القادم سأبين كيفية اظهار البيانات باستخدام ملفات التصميم التي توضع في مجلد view</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bp.ma/2010/02/05/%d8%a7%d9%88%d9%84-%d8%a8%d8%b1%d9%86%d8%a7%d9%85%d8%ac-%d9%84%d9%83-%d8%a8%d9%88%d8%a7%d8%b3%d8%b7%d8%a9-codeigniter/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>ما معنى دالة وكيف يتم انشائها واستخدامها</title>
		<link>http://www.bp.ma/2009/07/10/%d9%85%d8%a7-%d9%85%d8%b9%d9%86%d9%89-%d8%af%d8%a7%d9%84%d8%a9-%d9%88%d9%83%d9%8a%d9%81-%d9%8a%d8%aa%d9%85-%d8%a7%d9%86%d8%b4%d8%a7%d8%a6%d9%87%d8%a7-%d9%88%d8%a7%d8%b3%d8%aa%d8%ae%d8%af%d8%a7%d9%85/</link>
		<comments>http://www.bp.ma/2009/07/10/%d9%85%d8%a7-%d9%85%d8%b9%d9%86%d9%89-%d8%af%d8%a7%d9%84%d8%a9-%d9%88%d9%83%d9%8a%d9%81-%d9%8a%d8%aa%d9%85-%d8%a7%d9%86%d8%b4%d8%a7%d8%a6%d9%87%d8%a7-%d9%88%d8%a7%d8%b3%d8%aa%d8%ae%d8%af%d8%a7%d9%85/#comments</comments>
		<pubDate>Fri, 10 Jul 2009 10:38:37 +0000</pubDate>
		<dc:creator>عبد الواحد البشيري</dc:creator>
				<category><![CDATA[php  البي اتش بي]]></category>
		<category><![CDATA[دروس برمجية]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[انشاء]]></category>
		<category><![CDATA[تعلم]]></category>
		<category><![CDATA[دالة]]></category>
		<category><![CDATA[وظيفة]]></category>

		<guid isPermaLink="false">http://www.bp.ma/?p=360</guid>
		<description><![CDATA[بسم الله الرحمن الرحيم الدالة او الوظيفة وجهان لعملة واحدة حيث يتم الاستفادة من الدالة في امور كثيرة في البرنامج الذي نبرمجه لغة php هي اصلا تعتمد على الدوال او الوظائف هذه الدوال مكتوبة بالغة التي كتبت بها لغة php حيث تتعد وظائفها من التأكد من الأرقام والنصوص وهكذا... الدالة عبارة عن وظيفة تقوم بعملها [...]]]></description>
			<content:encoded><![CDATA[<p>بسم الله الرحمن الرحيم</p>
<p>الدالة او الوظيفة وجهان لعملة واحدة حيث يتم الاستفادة من الدالة في امور كثيرة في البرنامج الذي نبرمجه<br />
لغة php هي اصلا تعتمد على الدوال او الوظائف هذه الدوال مكتوبة بالغة التي كتبت بها لغة php حيث تتعد وظائفها من التأكد من الأرقام  والنصوص  وهكذا...</p>
<p>الدالة عبارة عن وظيفة تقوم بعملها مثلا بحكم  ان مهنتي الخياطة فان الة الخياطة تعتبر دالة لماذا ؟ سأشرحها بالتفصيل<br />
<span id="more-360"></span></p>
<p>الة الخياطة تأخذ متغيرين وهما الخيط الذي يظهر فوق القماش والخيط الذي يظهر اسفله<br />
لنفرض ان الخيط الأسفل احمر والخيط الذي يظهر فوق لونه اخضر الأن سنقوم بخياطة القماش  وعند الانتهاء سنرى ان الثوب من فوق لون المسار الذي اتبعته الة الخياطة<br />
لونه اخضر ومن الأسفل  لونه احمر</p>
<p>اذا الة الماكينة دالة<br />
الأن مثال برمجي<br />
سننشئ دالة تحمل متغيرين  وهما الألوان</p>
<div class="igBar"><span id="lphp-45"><a href="#" onclick="javascript:showPlainTxt('php-45'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-45">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">function</span> txt_color<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$color1</span>,<span style="color:#0000FF;">$color2</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">"&lt;div style='background:"</span>.<span style="color:#0000FF;">$color1</span>.<span style="color:#FF0000;">";color:"</span>.<span style="color:#0000FF;">$color2</span>.<span style="color:#FF0000;">"'&gt;تجربة اظهار النص والخلفية بلونين مختلفين&lt;/div&gt;"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>وطريقة استخدام الدالة</p>
<div class="igBar"><span id="lphp-46"><a href="#" onclick="javascript:showPlainTxt('php-46'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-46">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">txt_color<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'red'</span>,<span style="color:#FF0000;">'green'</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>الأن ماذا لو اردن تغيير النص بشكل دينامكي حسب حاجتنا دون التعديل على الدالة في كل مرة</p>
<p>تعمدت في المثال النظري فوق عدم ذكر متغير اخر تحمله الة الخياطة ... انه الثوب فهو يتغير في كل مرة مثله مثل الخيط</p>
<p>اذا الدالة البرمجية ستحمل ثلاث متغيرات وهما<br />
لون الخلفية<br />
لون النص<br />
النص</p>
<p>وستكون هكذا</p>
<div class="igBar"><span id="lphp-47"><a href="#" onclick="javascript:showPlainTxt('php-47'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-47">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">function</span> txt_color<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$color1</span>,<span style="color:#0000FF;">$color2</span>,<span style="color:#0000FF;">$txt</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">"&lt;div style='background:"</span>.<span style="color:#0000FF;">$color1</span>.<span style="color:#FF0000;">";color:"</span>.<span style="color:#0000FF;">$color2</span>.<span style="color:#FF0000;">"'&gt;"</span>.<span style="color:#0000FF;">$txt</span>.<span style="color:#FF0000;">"&lt;/div&gt;"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>وطريقة استخدام الدالة</p>
<div class="igBar"><span id="lphp-48"><a href="#" onclick="javascript:showPlainTxt('php-48'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-48">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">txt_color<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'red'</span>,<span style="color:#FF0000;">'green'</span>,<span style="color:#FF0000;">'تجربة اظهار النص والخلفية بلونين مختلفين'</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>هذه فان اخطأت فمن نفسي والشيطان وان اصبت فمن الله عز وجل</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bp.ma/2009/07/10/%d9%85%d8%a7-%d9%85%d8%b9%d9%86%d9%89-%d8%af%d8%a7%d9%84%d8%a9-%d9%88%d9%83%d9%8a%d9%81-%d9%8a%d8%aa%d9%85-%d8%a7%d9%86%d8%b4%d8%a7%d8%a6%d9%87%d8%a7-%d9%88%d8%a7%d8%b3%d8%aa%d8%ae%d8%af%d8%a7%d9%85/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>دالة ارسال  البريد الالكتروني الى الوارد وليس الى الرسائل المزعجة</title>
		<link>http://www.bp.ma/2009/06/20/%d8%af%d8%a7%d9%84%d8%a9-%d8%a7%d8%b1%d8%b3%d8%a7%d9%84%d8%a9-%d8%a7%d9%84%d8%a8%d8%b1%d9%8a%d8%af-%d8%a7%d9%84%d8%a7%d9%84%d9%83%d8%aa%d8%b1%d9%88%d9%86%d9%8a-%d8%a7%d9%84%d9%89-%d8%a7%d9%84%d9%88/</link>
		<comments>http://www.bp.ma/2009/06/20/%d8%af%d8%a7%d9%84%d8%a9-%d8%a7%d8%b1%d8%b3%d8%a7%d9%84%d8%a9-%d8%a7%d9%84%d8%a8%d8%b1%d9%8a%d8%af-%d8%a7%d9%84%d8%a7%d9%84%d9%83%d8%aa%d8%b1%d9%88%d9%86%d9%8a-%d8%a7%d9%84%d9%89-%d8%a7%d9%84%d9%88/#comments</comments>
		<pubDate>Sat, 20 Jun 2009 08:42:36 +0000</pubDate>
		<dc:creator>عبد الواحد البشيري</dc:creator>
				<category><![CDATA[php  البي اتش بي]]></category>
		<category><![CDATA[دروس برمجية]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[no spam]]></category>
		<category><![CDATA[send]]></category>
		<category><![CDATA[ارسال]]></category>
		<category><![CDATA[البريد]]></category>
		<category><![CDATA[دالة]]></category>
		<category><![CDATA[سبام]]></category>

		<guid isPermaLink="false">http://www.bp.ma/?p=342</guid>
		<description><![CDATA[بسم الله الرحمن الرحيم كما في العنوان فان الرسالة تصل مباشرة الى صفحة الرسائل لا تستخدم هذه الدالة في ما يغضب الله PLAIN TEXT PHP: function send_mail&#40;$to,$from,$subject,$msg&#41;&#123; &#160; &#160; /* &#160; &#160; function name : send_mail &#160; &#160; author&#160; &#160; &#160; &#160; : abdelouahid el bachiri &#160; &#160; email&#160; &#160; &#160; &#160; &#160;: elbachiri @ [...]]]></description>
			<content:encoded><![CDATA[<p>بسم الله الرحمن الرحيم</p>
<p>كما في العنوان فان الرسالة تصل مباشرة الى صفحة الرسائل</p>
<p>لا تستخدم هذه الدالة في ما يغضب الله</p>
<div class="igBar"><span id="lphp-51"><a href="#" onclick="javascript:showPlainTxt('php-51'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-51">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">function</span> send_mail<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$to</span>,<span style="color:#0000FF;">$from</span>,<span style="color:#0000FF;">$subject</span>,<span style="color:#0000FF;">$msg</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#008000;">/*</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp; function name : send_mail</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp; author&nbsp; &nbsp; &nbsp; &nbsp; : abdelouahid el bachiri</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp; email&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: elbachiri @ gmail . com</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp; site&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : www.bp.ma</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp; date&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : 20.06.2009 09:38:29</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp; */</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$headers</span> =<span style="color:#FF0000;">"MIME-Version: 1.0 <span style="color:#000099; font-weight:bold;">\r</span><span style="color:#000099; font-weight:bold;">\n</span>"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$headers</span>.=<span style="color:#FF0000;">"from: $from&nbsp; $subject&nbsp; <span style="color:#000099; font-weight:bold;">\r</span><span style="color:#000099; font-weight:bold;">\n</span>"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$headers</span>.=<span style="color:#FF0000;">"Content-type: text/html;charset=utf-8 <span style="color:#000099; font-weight:bold;">\r</span><span style="color:#000099; font-weight:bold;">\n</span>"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$headers</span>.=<span style="color:#FF0000;">"X-Priority: 3<span style="color:#000099; font-weight:bold;">\r</span><span style="color:#000099; font-weight:bold;">\n</span>"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$headers</span>.=<span style="color:#FF0000;">"X-Mailer: smail-PHP "</span>.<a href="http://www.php.net/phpversion"><span style="color:#000066;">phpversion</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#FF0000;">"<span style="color:#000099; font-weight:bold;">\r</span><span style="color:#000099; font-weight:bold;">\n</span>"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$msg</span>&nbsp; &nbsp; =<span style="color:#FF0000;">'</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">&nbsp; &nbsp; &lt;div style=&quot;text-align:right&quot;&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">&nbsp; &nbsp; &lt;h2&gt;'</span>.<span style="color:#0000FF;">$subject</span>.<span style="color:#FF0000;">'&lt;/h2&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">&nbsp; &nbsp; '</span>.<span style="color:#0000FF;">$msg</span>.<span style="color:#FF0000;">'</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">&nbsp; &nbsp; &lt;/div&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">&nbsp; &nbsp; '</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span> <a href="http://www.php.net/mail"><span style="color:#000066;">mail</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$to</span>,<span style="color:#0000FF;">$subject</span>,<span style="color:#0000FF;">$msg</span>,<span style="color:#0000FF;">$headers</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">return</span> <span style="color:#000000; font-weight:bold;">true</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#616100;">else</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">return</span> <span style="color:#000000; font-weight:bold;">false</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>طريقة الاستخدام</p>
<div class="igBar"><span id="lphp-52"><a href="#" onclick="javascript:showPlainTxt('php-52'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-52">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$to</span>&nbsp; =<span style="color:#FF0000;">"example@example.com"</span>; <span style="color:#FF9933; font-style:italic;">// البريد الذي سيستقبل الرسالة</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$from</span>=<span style="color:#FF0000;">"from@example.com"</span>; <span style="color:#FF9933; font-style:italic;">// البريد المرسل</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$subject</span>=<span style="color:#FF0000;">"عنوان الرسالة"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$text</span>&nbsp; &nbsp;=<span style="color:#FF0000;">"نص الرسالة"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span> send_mail<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$to</span>,<span style="color:#0000FF;">$from</span>,<span style="color:#0000FF;">$subject</span>,<span style="color:#0000FF;">$text</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">'تم ارسالة الرسالة بنجاح'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#616100;">else</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">'لم يتم ارسال الرسالة'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>هذه فان اخطأت فمن نفسي والشيطان وان اصبت  فمن الله عز وجل</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bp.ma/2009/06/20/%d8%af%d8%a7%d9%84%d8%a9-%d8%a7%d8%b1%d8%b3%d8%a7%d9%84%d8%a9-%d8%a7%d9%84%d8%a8%d8%b1%d9%8a%d8%af-%d8%a7%d9%84%d8%a7%d9%84%d9%83%d8%aa%d8%b1%d9%88%d9%86%d9%8a-%d8%a7%d9%84%d9%89-%d8%a7%d9%84%d9%88/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>تعرف على التعليقات او الرسائل المزعجة من خلا هذه الدالة البسيطة</title>
		<link>http://www.bp.ma/2009/05/02/%d8%aa%d8%b9%d8%b1%d9%81-%d8%b9%d9%84%d9%89-%d8%a7%d9%84%d8%aa%d8%b9%d9%84%d9%8a%d9%82%d8%a7%d8%aa-%d8%a7%d9%88-%d8%a7%d9%84%d8%b1%d8%b3%d8%a7%d8%a6%d9%84-%d8%a7%d9%84%d9%85%d8%b2%d8%b9%d8%ac%d8%a9/</link>
		<comments>http://www.bp.ma/2009/05/02/%d8%aa%d8%b9%d8%b1%d9%81-%d8%b9%d9%84%d9%89-%d8%a7%d9%84%d8%aa%d8%b9%d9%84%d9%8a%d9%82%d8%a7%d8%aa-%d8%a7%d9%88-%d8%a7%d9%84%d8%b1%d8%b3%d8%a7%d8%a6%d9%84-%d8%a7%d9%84%d9%85%d8%b2%d8%b9%d8%ac%d8%a9/#comments</comments>
		<pubDate>Sat, 02 May 2009 20:38:20 +0000</pubDate>
		<dc:creator>عبد الواحد البشيري</dc:creator>
				<category><![CDATA[CSS XHTML HTML]]></category>
		<category><![CDATA[classes  الكائنات]]></category>
		<category><![CDATA[php  البي اتش بي]]></category>
		<category><![CDATA[دروس برمجية]]></category>
		<category><![CDATA[expression]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[regular]]></category>
		<category><![CDATA[spam]]></category>
		<category><![CDATA[spams]]></category>
		<category><![CDATA[التعابير]]></category>
		<category><![CDATA[القياسية]]></category>
		<category><![CDATA[تعلم]]></category>
		<category><![CDATA[دالة]]></category>
		<category><![CDATA[درس]]></category>
		<category><![CDATA[دروس]]></category>
		<category><![CDATA[رصد]]></category>
		<category><![CDATA[عناوين]]></category>
		<category><![CDATA[عنوان]]></category>
		<category><![CDATA[مزعج]]></category>

		<guid isPermaLink="false">http://www.bp.ma/?p=271</guid>
		<description><![CDATA[بسم الله الرحمن الرحيم لابد وانك برمجت موقع للمقالات او الأخبار او الاتصال بنا وواجهتك مشكلة التعليقات المزعجة التي تحتوي على روابط كثيرة ... اليوم سنكتب سطر بمجي يحل المشكلة بسهولة سنستخدم التعابير القياسية لرصد العناوين الموجودة داخل النص المرسل جرب هذا الكود PLAIN TEXT PHP: // تجربة كتبة عناوين باشكال مختلفة $text=" hello my [...]]]></description>
			<content:encoded><![CDATA[<p>بسم الله الرحمن الرحيم<br />
لابد وانك برمجت موقع للمقالات او الأخبار او الاتصال بنا وواجهتك مشكلة التعليقات المزعجة التي تحتوي على روابط كثيرة ...<br />
اليوم سنكتب سطر بمجي يحل المشكلة بسهولة</p>
<p>سنستخدم التعابير القياسية لرصد العناوين الموجودة داخل النص المرسل</p>
<p><span id="more-271"></span></p>
<p>جرب هذا الكود</p>
<div class="igBar"><span id="lphp-55"><a href="#" onclick="javascript:showPlainTxt('php-55'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-55">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// تجربة كتبة عناوين باشكال مختلفة</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$text</span>=<span style="color:#FF0000;">"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">hello my friends i'm here now&nbsp; in my site web</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">his&nbsp; &nbsp;name www.bp.ma</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">or http://www.bp.ma</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">or http://bp.ma</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">or bp.ma</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">and other site www.rifpress.net</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">and market.ma</span></div>
</li>
<li style="font-weight: bold;color:#26536A;"></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">/*</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">* شرح التعبير القياسي الذي يتأكد من الرابط</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">([www.|http://|http://www.]*) يتأكد من بداية عنوان الموقع</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">[a-zA-Z0-9-.]+&nbsp; حروف&nbsp; &nbsp; &nbsp; &nbsp;كبيرة وصغيرة انجليزية وارقام علامة ناقص ونقطة</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">\. النقطة التي تكتب بين اسم الدومين والامتداد مثل .com .net .org</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">[a-zA-Z.]{2,5} عدد حروف الامتداد يجب ان يكون بين اثنين الى خمس حروف مثال .ma .net .com .co.uk</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">*/</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/preg_match_all"><span style="color:#000066;">preg_match_all</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"#([www.|http://|http://www.]*)[a-zA-Z0-9-.]+<span style="color:#000099; font-weight:bold;">\.</span>[a-zA-Z.]{2,5}#"</span>,<span style="color:#0000FF;">$text</span>,<span style="color:#0000FF;">$cnt</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a><span style="color:#FF0000;">"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">&lt;pre&gt;"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/print_r"><span style="color:#000066;">print_r</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$cnt</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">/*</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"></li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">(</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"></li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [0] =&amp;gt; www.bp.ma</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"></li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [1] =&amp;gt; http://www.bp.ma</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"></li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [2] =&amp;gt; http://bp.ma</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"></li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [3] =&amp;gt; bp.ma</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"></li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [4] =&amp;gt; www.rifpress.net</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"></li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [5] =&amp;gt; market.ma</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"></li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp; &nbsp; &nbsp; )</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"></li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">*/</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">?&amp;gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>طيب الأن سننشئ دالة تقوم بحساب عدد العناوين لكي نعرف هل الرسالة مزعجة ام لا</p>
<div class="igBar"><span id="lphp-56"><a href="#" onclick="javascript:showPlainTxt('php-56'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-56">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">function</span> is_spam<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$text</span>,<span style="color:#0000FF;">$max</span>=<span style="color:#CC66CC;color:#800000;">2</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#008000;">/*</span></div>
</li>
<li style="font-weight: bold;color:#26536A;"></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp; &nbsp;$text = النص</span></div>
</li>
<li style="font-weight: bold;color:#26536A;"></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp; &nbsp;$max&nbsp; = العدد المسموح به لكي لا يكون النص مزعج</span></div>
</li>
<li style="font-weight: bold;color:#26536A;"></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; الرقم مبدئيا هو 2 ولكن يمك تعديله عند تشغيل الدالة</span></div>
</li>
<li style="font-weight: bold;color:#26536A;"></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp; &nbsp;*/</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.php.net/preg_match_all"><span style="color:#000066;">preg_match_all</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"#([www.|http://|http://www.]*)[a-zA-Z0-9-.]+<span style="color:#000099; font-weight:bold;">\.</span>[a-zA-Z.]{2,5}#"</span>,<span style="color:#0000FF;">$text</span>,<span style="color:#0000FF;">$cnt</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;<span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span> <a href="http://www.php.net/count"><span style="color:#000066;">count</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$cnt</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC66CC;color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>&amp;gt; <span style="color:#0000FF;">$max</span> <span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#616100;">return</span> <span style="color:#000000; font-weight:bold;">true</span>; <span style="color:#FF9933; font-style:italic;">// عدد العناوين التي تم رصدها تجاوزت العدد المسموح</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;<span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#616100;">else</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#616100;">return</span> <span style="color:#000000; font-weight:bold;">false</span>; <span style="color:#FF9933; font-style:italic;">// لم يتجاوز العدد المسموح</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;<span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;<span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// طريقة الاستخدام</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$message</span>=<span style="color:#FF0000;">"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;"></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">hello my friends i'm here now&nbsp; in my site web</span></div>
</li>
<li style="font-weight: bold;color:#26536A;"></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">his&nbsp; &nbsp;name www.bp.ma</span></div>
</li>
<li style="font-weight: bold;color:#26536A;"></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">or http://www.bp.ma</span></div>
</li>
<li style="font-weight: bold;color:#26536A;"></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">or http://bp.ma</span></div>
</li>
<li style="font-weight: bold;color:#26536A;"></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">or bp.ma</span></div>
</li>
<li style="font-weight: bold;color:#26536A;"></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">and other site www.rifpress.net</span></div>
</li>
<li style="font-weight: bold;color:#26536A;"></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">and market.ma</span></div>
</li>
<li style="font-weight: bold;color:#26536A;"></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">&nbsp; &nbsp; "</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span> is_spam<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$message</span>,<span style="color:#CC66CC;color:#800000;">3</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">"spam"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#616100;">else</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">"not spam"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">?&amp;gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>اذا ما هو تعليقك على هذا الدرس ؟ هل هناك مشاكل لم الاحظها ؟</p>
<p>والسلام عليكم</p>
<p>هذا فان اخطأت فمن نفسي والشيطان وان اصبت فمن الله عز وجل</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.bp.ma/2009/05/02/%d8%aa%d8%b9%d8%b1%d9%81-%d8%b9%d9%84%d9%89-%d8%a7%d9%84%d8%aa%d8%b9%d9%84%d9%8a%d9%82%d8%a7%d8%aa-%d8%a7%d9%88-%d8%a7%d9%84%d8%b1%d8%b3%d8%a7%d8%a6%d9%84-%d8%a7%d9%84%d9%85%d8%b2%d8%b9%d8%ac%d8%a9/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>كيفية اخفاء رسائل الأخطاء واظهارها عند وقوع الخطأ  &#8220;بالجافاسكريبت&#8221;</title>
		<link>http://www.bp.ma/2009/05/01/%d9%83%d9%8a%d9%81%d9%8a%d8%a9-%d8%a7%d8%ae%d9%81%d8%a7%d8%a1-%d8%b1%d8%b3%d8%a7%d8%a6%d9%84-%d8%a7%d9%84%d8%a3%d8%ae%d8%b7%d8%a7%d8%a1-%d9%88%d8%a7%d8%b8%d9%87%d8%a7%d8%b1%d9%87%d8%a7-%d8%b9%d9%86-2/</link>
		<comments>http://www.bp.ma/2009/05/01/%d9%83%d9%8a%d9%81%d9%8a%d8%a9-%d8%a7%d8%ae%d9%81%d8%a7%d8%a1-%d8%b1%d8%b3%d8%a7%d8%a6%d9%84-%d8%a7%d9%84%d8%a3%d8%ae%d8%b7%d8%a7%d8%a1-%d9%88%d8%a7%d8%b8%d9%87%d8%a7%d8%b1%d9%87%d8%a7-%d8%b9%d9%86-2/#comments</comments>
		<pubDate>Fri, 01 May 2009 20:36:12 +0000</pubDate>
		<dc:creator>عبد الواحد البشيري</dc:creator>
				<category><![CDATA[JavaScript Ajax]]></category>
		<category><![CDATA[دروس برمجية]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[validation]]></category>
		<category><![CDATA[التحقق]]></category>
		<category><![CDATA[حقل]]></category>
		<category><![CDATA[فارغ]]></category>

		<guid isPermaLink="false">http://www.bp.ma/?p=256</guid>
		<description><![CDATA[بسم الله الرحمن الرحيم بعد ان شرحت كيفية اخفاء واظهار الأخطاء عن الحاجة في الدرس السابق، في هذا الدرس سأقوم بشرح نفس الفكرة ولكن باستخدام جافاسكريبت سيكون لدينا نموذج تسجيل الدخول مثل الموجود في الدرس السابق ولكننا سنضيف اليه الحدث onSubmit الحدث المذكور يقوم بالعمل فور الضغط على زر الارسال حيث اننا سنضع داخله دالة [...]]]></description>
			<content:encoded><![CDATA[<p>بسم الله الرحمن الرحيم</p>
<p>بعد ان شرحت كيفية اخفاء واظهار الأخطاء عن الحاجة في الدرس السابق، في هذا الدرس سأقوم بشرح نفس الفكرة ولكن باستخدام جافاسكريبت</p>
<p>سيكون لدينا نموذج تسجيل الدخول مثل الموجود في الدرس السابق  ولكننا سنضيف  اليه الحدث onSubmit</p>
<p>الحدث المذكور يقوم بالعمل فور الضغط على زر الارسال حيث اننا سنضع داخله دالة من صنعنا لتأكد من الحقول هل هي فارغة ام لا</p>
<p>الأن نموذج تسجيل الدخول</p>
<p><span id="more-256"></span></p>
<div class="igBar"><span id="lphp-64"><a href="#" onclick="javascript:showPlainTxt('php-64'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-64">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;div style=<span style="color:#FF0000;">"border:1px solid #4A98AC;text-align:right;padding:5px;"</span>&gt;&lt;!-- تم التعديل في هذا السطر واضافة اليه الحدث&nbsp; كذالك اسمينا الفورم باسم myform--&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;form action=<span style="color:#FF0000;">"check.php"</span> method=<span style="color:#FF0000;">"post"</span>&gt;اسم الدخول</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;input name=<span style="color:#FF0000;">"username"</span> type=<span style="color:#FF0000;">"text"</span> /&gt;كلمة المرور</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;input name=<span style="color:#FF0000;">"password"</span> type=<span style="color:#FF0000;">"password"</span> /&gt; &lt;input type=<span style="color:#FF0000;">"submit"</span> value=<span style="color:#FF0000;">"دخول"</span> /&gt; &lt;/form&gt;&lt;/div&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p>
الأن سننشئ دالة جافاسكريبت للتأكد من الحقول هل هي فارغة ام معبئة</p>
<div class="igBar"><span id="lphp-65"><a href="#" onclick="javascript:showPlainTxt('php-65'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-65">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">function</span> check<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// اذا كان حقل الاسم فارغ</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span> document.send.username.value&nbsp; == <span style="color:#FF0000;">""</span> <span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">document.getElementById<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'error_user'</span><span style="color:#006600; font-weight:bold;">&#41;</span>.style.display=<span style="color:#FF0000;">''</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">document.send.username.focus<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;&nbsp; <span style="color:#FF9933; font-style:italic;">// وضع مؤشر الفأرة داخل حقل اسم الدخول</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">return</span> <span style="color:#000000; font-weight:bold;">false</span>&nbsp; &nbsp;<span style="color:#FF9933; font-style:italic;">// سيتم ايقاف الفورم عن الارسال لكي لا ينتقل</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#616100;">else</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">document.getElementById<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'error_user'</span><span style="color:#006600; font-weight:bold;">&#41;</span>.style.display=<span style="color:#FF0000;">'none'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//اذا كان حقل كلمة المرور فارغ</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span> document.send.password.value == <span style="color:#FF0000;">""</span> <span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">document.getElementById<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'error_pass'</span><span style="color:#006600; font-weight:bold;">&#41;</span>.style.display=<span style="color:#FF0000;">''</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">document.send.password.focus<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#FF9933; font-style:italic;">// وضع مؤشر الفأرة داخل حقل كلمة المرور</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">return</span> <span style="color:#000000; font-weight:bold;">false</span>&nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// سيتم ايقاف الفورم عن الارسال لكي لا ينتقل</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#616100;">else</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">document.getElementById<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'error_pass'</span><span style="color:#006600; font-weight:bold;">&#41;</span>.style.display=<span style="color:#FF0000;">'none'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>بعدها ستكون الصفحة كما يلي</p>
<div class="igBar"><span id="lphp-66"><a href="#" onclick="javascript:showPlainTxt('php-66'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-66">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;script type=<span style="color:#FF0000;">"text/javascript"</span>&gt;&lt;!--</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">function</span> check<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span> document.send.username.value&nbsp; == <span style="color:#FF0000;">""</span> <span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; document.getElementById<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'error_user'</span><span style="color:#006600; font-weight:bold;">&#41;</span>.style.display=<span style="color:#FF0000;">''</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; document.send.username.focus<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;&nbsp; <span style="color:#FF9933; font-style:italic;">// وضع مؤشر الفأرة داخل حقل اسم الدخول</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;<span style="color:#616100;">return</span> <span style="color:#000000; font-weight:bold;">false</span>&nbsp; &nbsp;<span style="color:#FF9933; font-style:italic;">// سيتم ايقاف الفورم عن الارسال لكي لا ينتقل</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#616100;">else</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;document.getElementById<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'error_user'</span><span style="color:#006600; font-weight:bold;">&#41;</span>.style.display=<span style="color:#FF0000;">'none'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span> document.send.password.value == <span style="color:#FF0000;">""</span> <span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; document.getElementById<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'error_pass'</span><span style="color:#006600; font-weight:bold;">&#41;</span>.style.display=<span style="color:#FF0000;">''</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; document.send.password.focus<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#FF9933; font-style:italic;">// وضع مؤشر الفأرة داخل حقل كلمة المرور</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <span style="color:#616100;">return</span> <span style="color:#000000; font-weight:bold;">false</span>&nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// سيتم ايقاف الفورم عن الارسال لكي لا ينتقل</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#616100;">else</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;document.getElementById<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'error_pass'</span><span style="color:#006600; font-weight:bold;">&#41;</span>.style.display=<span style="color:#FF0000;">'none'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// --&gt;&lt;/script&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;!--&nbsp; حقل الاسم فارغ--&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;div id=<span style="color:#FF0000;">"error_user"</span> style=<span style="color:#FF0000;">"text-align:right;color:red;display:none"</span>&gt;يجب تعبئة حقل الاسم&lt;/div&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;!--&nbsp; حقل كلمة المرور فارغ--&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;div id=<span style="color:#FF0000;">"error_pass"</span> style=<span style="color:#FF0000;">"text-align:right;color:red;display:none"</span>&gt;يجب تعبئة حقل كلمة المرور&lt;/div&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;div style=<span style="color:#FF0000;">"border:1px solid #4A98AC;text-align:right;padding:5px;"</span>&gt;&lt;!-- تم التعديل في هذا السطر واضافة اليه الحدث&nbsp; كذالك اسمينا الفورم باسم myform--&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;form method=<span style="color:#FF0000;">"post"</span>&gt;اسم الدخول</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;input name=<span style="color:#FF0000;">"username"</span> type=<span style="color:#FF0000;">"text"</span> /&gt;كلمة المرور</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;input name=<span style="color:#FF0000;">"password"</span> type=<span style="color:#FF0000;">"password"</span> /&gt; &lt;input type=<span style="color:#FF0000;">"submit"</span> value=<span style="color:#FF0000;">"دخول"</span> /&gt; &lt;/form&gt;&lt;/div&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>كذالك يمك جعل الشرط يتعرف على عدد الحروف مثلا ان يكون اكثر من ثلاث حروف</p>
<p>وبذالك نستبدل هذا السطر</p>
<div class="igBar"><span id="lphp-67"><a href="#" onclick="javascript:showPlainTxt('php-67'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-67">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span> document.send.username.value&nbsp; == <span style="color:#FF0000;">""</span> <span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>بهذا</p>
<div class="igBar"><span id="lphp-68"><a href="#" onclick="javascript:showPlainTxt('php-68'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-68">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span> document.send.username.value.length &gt; <span style="color:#CC66CC;color:#800000;">3</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>كذالك مع حقل كلمة المرور</p>
<div class="igBar"><span id="lphp-69"><a href="#" onclick="javascript:showPlainTxt('php-69'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-69">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span> document.send.password.value&nbsp; == <span style="color:#FF0000;">""</span> <span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
بهذا</p>
<div class="igBar"><span id="lphp-70"><a href="#" onclick="javascript:showPlainTxt('php-70'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-70">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span> document.send.password.value.length &gt; <span style="color:#CC66CC;color:#800000;">3</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>عندما نريد حساب عدد الحروف في حقل ما نضيف اليه length كما هو مكتوب في الأعلى</p>
<p>والسلام عليكم<br />
هذا فان اخطأت فمن نفسي والشيطان وان اصبت فمن الله عز وجل</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bp.ma/2009/05/01/%d9%83%d9%8a%d9%81%d9%8a%d8%a9-%d8%a7%d8%ae%d9%81%d8%a7%d8%a1-%d8%b1%d8%b3%d8%a7%d8%a6%d9%84-%d8%a7%d9%84%d8%a3%d8%ae%d8%b7%d8%a7%d8%a1-%d9%88%d8%a7%d8%b8%d9%87%d8%a7%d8%b1%d9%87%d8%a7-%d8%b9%d9%86-2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>كيفية اخفاء رسائل الأخطاء واظهارها عند وقوع الخطأ</title>
		<link>http://www.bp.ma/2009/04/25/%d9%83%d9%8a%d9%81%d9%8a%d8%a9-%d8%a7%d8%ae%d9%81%d8%a7%d8%a1-%d8%b1%d8%b3%d8%a7%d8%a6%d9%84-%d8%a7%d9%84%d8%a3%d8%ae%d8%b7%d8%a7%d8%a1-%d9%88%d8%a7%d8%b8%d9%87%d8%a7%d8%b1%d9%87%d8%a7-%d8%b9%d9%86/</link>
		<comments>http://www.bp.ma/2009/04/25/%d9%83%d9%8a%d9%81%d9%8a%d8%a9-%d8%a7%d8%ae%d9%81%d8%a7%d8%a1-%d8%b1%d8%b3%d8%a7%d8%a6%d9%84-%d8%a7%d9%84%d8%a3%d8%ae%d8%b7%d8%a7%d8%a1-%d9%88%d8%a7%d8%b8%d9%87%d8%a7%d8%b1%d9%87%d8%a7-%d8%b9%d9%86/#comments</comments>
		<pubDate>Sat, 25 Apr 2009 20:29:30 +0000</pubDate>
		<dc:creator>عبد الواحد البشيري</dc:creator>
				<category><![CDATA[php  البي اتش بي]]></category>
		<category><![CDATA[دروس برمجية]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[اخطاء]]></category>
		<category><![CDATA[تعلم]]></category>
		<category><![CDATA[خطأ]]></category>
		<category><![CDATA[رسالة]]></category>
		<category><![CDATA[كيفية]]></category>

		<guid isPermaLink="false">http://www.bp.ma/?p=241</guid>
		<description><![CDATA[بسم الله الرحمن الرحيم كما تعلمون ان الطرق البرمجية كثيرة جدا وكل واحد كيف يحب ان يكتب الشفرة البرمجية ولكن دائما هناك طرق ممتازة وهناك ما دون ذالك حسب مستوى المبرمج اليوم سنطبق طريقة جميلة جدا حسب رأيي عندما نستقبل معلومات نموذج تسجيل الدخول نتحقق من الحقول هل هي فارغة ام لا هذا اولا ثانيا [...]]]></description>
			<content:encoded><![CDATA[<p>بسم الله الرحمن الرحيم</p>
<p>كما تعلمون ان الطرق البرمجية كثيرة جدا وكل واحد كيف يحب ان يكتب الشفرة البرمجية<br />
ولكن دائما هناك طرق ممتازة وهناك ما دون ذالك حسب مستوى المبرمج<br />
اليوم سنطبق طريقة جميلة جدا حسب رأيي</p>
<p>عندما نستقبل معلومات نموذج تسجيل الدخول  نتحقق من الحقول هل هي فارغة ام لا هذا اولا<br />
ثانيا نتحقق من الاسم وكلمة المرور نقارنها في تعليمة مع قواعد البيانات<br />
ونطبع هذه الأخطاء مباشرة في ملف بي اتش بي او نجلب دالة مخصصة لذالك الغرض وتكون منسقة من قبل<br />
كل هذا جميل<br />
الأن لنجرب هذه الطريقة</p>
<p><span id="more-241"></span><br />
اولا ملف النموذج form.html</p>
<div class="igBar"><span id="lphp-75"><a href="#" onclick="javascript:showPlainTxt('php-75'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-75">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;div style=<span style="color:#FF0000;">"border:1px solid #4A98AC;text-align:right;padding:5px;"</span>&gt;&lt;form action=<span style="color:#FF0000;">"check.php"</span> method=<span style="color:#FF0000;">"post"</span>&gt;اسم الدخول</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;input name=<span style="color:#FF0000;">"username"</span> type=<span style="color:#FF0000;">"text"</span> /&gt;كلمة المرور</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;input name=<span style="color:#FF0000;">"password"</span> type=<span style="color:#FF0000;">"password"</span> /&gt; &lt;input type=<span style="color:#FF0000;">"submit"</span> value=<span style="color:#FF0000;">"دخول"</span> /&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/form&gt;&lt;/div&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p>
ثانيا ملف بي اتش بي check.php</p>
<div class="igBar"><span id="lphp-76"><a href="#" onclick="javascript:showPlainTxt('php-76'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-76">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">include</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'config.php'</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#FF9933; font-style:italic;">// ملف الاتصال بالقاعدة</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$username</span>=<span style="color:#0000FF;">$_POST</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'username'</span><span style="color:#006600; font-weight:bold;">&#93;</span>; <span style="color:#FF9933; font-style:italic;">// اسم الدخول انا لم اقم بحمايته لان هذا فقط مثال</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$password</span>=<span style="color:#0000FF;">$_POST</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'password'</span><span style="color:#006600; font-weight:bold;">&#93;</span>;&nbsp; <span style="color:#FF9933; font-style:italic;">// غير محمي</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span> <span style="color:#0000FF;">$_SERVER</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'REQUEST_METHOD'</span><span style="color:#006600; font-weight:bold;">&#93;</span> == <span style="color:#FF0000;">'POST'</span> <span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span> <a href="http://www.php.net/empty"><span style="color:#000066;">empty</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$username</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">'يجب تعبئة حقل الاسم'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">'&lt;a href=&quot;form.html&quot;&gt;رجوع&lt;/a&gt;'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#616100;">else</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span> <a href="http://www.php.net/empty"><span style="color:#000066;">empty</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$password</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">'يجب تعبئة حقل كلمة المرور'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">'&lt;a href=&quot;form.html&quot;&gt;رجوع&lt;/a&gt;'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#616100;">else</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// اذا تم التأكد حقول الاسم وكلمة المرور سيتم التأكد من خلال القاعدة</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$check</span>=<a href="http://www.php.net/mysql_query"><span style="color:#000066;">mysql_query</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">" select username,password from users where username='$username' and password='$password' "</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// اذا لم يتم التطابق مع ما يوجد في جدول users</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span> <a href="http://www.php.net/mysql_num_rows"><span style="color:#000066;">mysql_num_rows</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$check</span><span style="color:#006600; font-weight:bold;">&#41;</span> == <span style="color:#CC66CC;color:#800000;">0</span> <span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">'اسم الدخول او كلمة المرور غير صحيحين'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">'&lt;a href=&quot;form.html&quot;&gt;رجوع&lt;/a&gt;'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#616100;">else</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// هنا يتم تسجيل جلسة او كعكة</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// $_SESSION['username'] = $username;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// ويتم ارساله الى الصفحة المحمية او ادراجها مباشرة كل هذا لا يهمنا في هذا الدرس</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// ما يهمنا هنا هو طريقة ادراج رسائل الأخطاء</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#616100;">else</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">include</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'form.html'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">?&amp;gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>والأن سنطبق طريقة سهلة وظريفة</p>
<p>اولا ملف check.php<br />
ويكون هكذا</p>
<div class="igBar"><span id="lphp-77"><a href="#" onclick="javascript:showPlainTxt('php-77'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-77">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>php<span style="color:#006600; font-weight:bold;">&#93;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">include</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'config.php'</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#FF9933; font-style:italic;">// ملف الاتصال بالقاعدة</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$username</span>=<span style="color:#0000FF;">$_POST</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'username'</span><span style="color:#006600; font-weight:bold;">&#93;</span>; <span style="color:#FF9933; font-style:italic;">// اسم الدخول انا لم اقم بحمايته لان هذا فقط مثال</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$password</span>=<span style="color:#0000FF;">$_POST</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'password'</span><span style="color:#006600; font-weight:bold;">&#93;</span>;&nbsp; <span style="color:#FF9933; font-style:italic;">// غير محمي</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span> <span style="color:#0000FF;">$_SERVER</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'REQUEST_METHOD'</span><span style="color:#006600; font-weight:bold;">&#93;</span> == <span style="color:#FF0000;">'POST'</span> <span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span> <a href="http://www.php.net/empty"><span style="color:#000066;">empty</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$username</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$error_user</span> =&nbsp; <span style="color:#FF0000;">'يجب تعبئة حقل الاسم'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">include</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'form.html'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#616100;">else</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span> <a href="http://www.php.net/empty"><span style="color:#000066;">empty</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$password</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$error_password</span> = <span style="color:#FF0000;">'يجب تعبئة حقل كلمة المرور'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">include</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'form.html'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#616100;">else</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// اذا تم التأكد حقول الاسم وكلمة المرور سيتم التأكد من خلال القاعدة</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$check</span>=<a href="http://www.php.net/mysql_query"><span style="color:#000066;">mysql_query</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">" select username,password from users where username='$username' and password='$password' "</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// اذا لم يتم التطابق مع ما يوجد في جدول users</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span> <a href="http://www.php.net/mysql_num_rows"><span style="color:#000066;">mysql_num_rows</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$check</span><span style="color:#006600; font-weight:bold;">&#41;</span> == <span style="color:#CC66CC;color:#800000;">0</span> <span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$error_check_user</span> =&nbsp; <span style="color:#FF0000;">'اسم الدخول او كلمة المرور غير صحيحين'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">include</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'form.html'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#616100;">else</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// هنا يتم تسجيل جلسة او كعكة</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// $_SESSION['username'] = $username;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// ويتم ارساله الى الصفحة المحمية او ادراجها مباشرة كل هذا لا يهمنا في هذا الدرس</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// ما يهمنا هنا هو طريقة ادراج رسائل الأخطاء</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#616100;">else</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">include</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'form.html'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">?&amp;gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>والأن مع ملف نموذج الدخول form.html</p>
<p>حيث يتم حصر الأخطاء في ملف النموذج او التصميم واظهاره عن وقوع الخطأ</p>
<div class="igBar"><span id="lphp-78"><a href="#" onclick="javascript:showPlainTxt('php-78'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-78">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;div style=<span style="color:#FF0000;">"border:1px solid #4A98AC;text-align:right;padding:5px;"</span>&gt;&lt;!--&nbsp; حقل الاسم فارغ--&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;p style=<span style="color:#FF0000;">"color:red"</span>&gt;&lt;/p&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;!--&nbsp; حقل كلمة المرور فارغ--&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;p style=<span style="color:#FF0000;">"color:red"</span>&gt;&lt;/p&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;!-- اسم الدخول او كلمة المرور غير صحيحين --&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;p style=<span style="color:#FF0000;">"color:red"</span>&gt;&lt;/p&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;form action=<span style="color:#FF0000;">"check.php"</span> method=<span style="color:#FF0000;">"post"</span>&gt;اسم الدخول</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;input name=<span style="color:#FF0000;">"username"</span> type=<span style="color:#FF0000;">"text"</span> /&gt;كلمة المرور</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;input name=<span style="color:#FF0000;">"password"</span> type=<span style="color:#FF0000;">"password"</span> /&gt; &lt;input type=<span style="color:#FF0000;">"submit"</span> value=<span style="color:#FF0000;">"دخول"</span> /&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/form&gt;&lt;/div&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p>
والسلام عليكم<br />
هذا فان اخطأت فمن نفسي والشيطان وان اصبت فمن الله عز وجل</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bp.ma/2009/04/25/%d9%83%d9%8a%d9%81%d9%8a%d8%a9-%d8%a7%d8%ae%d9%81%d8%a7%d8%a1-%d8%b1%d8%b3%d8%a7%d8%a6%d9%84-%d8%a7%d9%84%d8%a3%d8%ae%d8%b7%d8%a7%d8%a1-%d9%88%d8%a7%d8%b8%d9%87%d8%a7%d8%b1%d9%87%d8%a7-%d8%b9%d9%86/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
