الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

كيف يمكن وضع الصلاحيات للأعضاء المسجلين ؟؟

بدأه الداهية2 في 28 يوليو 2007 · 8 رد · 1,364 مشاهدة · في منتدى تطوير المواقع بـ PHP
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

الاخوة الكرام .

السلام عليكم ورحمة الله وبركاته .

كيف يمكن لي وضع صلاحيات للأعضاء المسجلين في جدول اليوزر مثلا .. من حيث التعديل والحذف والاضافة على قاعدة البيانات ...

... سبق وبحثت عن طريقة ووجدت انه يجب عمل حقل في جدول اليوزر يحوي الارقام من 1- 5 مثلا حيت ان :

1- عضو غير مفعل لا يمكن له التعديل والحذف الإضافة .

2- عضو يستطيع الإضافة فقط .

3- عضو يستطيع الإضافة والتعديل .

4- عضو يستطيع الإضافة والتعديل والحذف .

5- الأدمن

ولكنني لم استطع عمل الشروط هذه ..

أرجو ممن لديه القدرة مساعدتي بوضع الكود ولكم مني جزيل الشكر والعرفان .

19dfa5a542.gif

سبحان الله بحمده :: سبحان الله العظيم

#2

تستطيع تمييز الأعضاء بحفظ مستوياتهم في متغير session بحيث يظهر لأحد الأعضاء ما لا يظهر للآخر

أو تعمل متغير تتم قرائته في كل صفحة يحفظ قيمة مستوى العضو بعد أن يتم تسجيل الدخول وهكذا

بالتوفيق

sign3.jpg
#3

استاذي عبدالله عياش

اشكرك كل الشكر على ردك ومتابعتك الرااائعة ...

ولكن كيف يمكن وضع متغير في السيسون وقرائته في الصفحات ؟؟؟ ارجو ان توافيني بالصغة ان امكن ..

وبارك الله فيك وجزاك الله عنا كل خير .

19dfa5a542.gif

سبحان الله بحمده :: سبحان الله العظيم

#4

أي استخدام للسيشن يبدأ بـ session_start، ثم تبدأ في تسجيل أسماء السيشنز اللتي تريدها وخذ الفكرة من هذا المثال:

<?php
 session_start(); // بداية الصفحة ويجب أن لا يسبقها أي أمر print أو echo أو header
if(isset($_POST['submit'])) {
-
-
- // هنا تضع كود التأكد من أن المستخدم أدخل معلوماته وتمت مقارنتها بالمعلومات من قاعدة البيانات
if(empty($errors)) { // طبعا يفترض أن تكون هذه الجزئية بعد أن يتم التأكد من أن المستخدم أدخل معلومات الدخول الصحيحة
   session_register('user_name', 'user_level'); // تستطيع إضافة المزيد حسب احتياجك
   $_SESSION['user_name'] = $result['user_name']; // result على افتراض أنها المعلومات من كويري قاعدة البيانات
   $_SESSION['user_level'] = $result['user_leve']; // هذا مستوى المستخدم
  } // إنهاء if الثانية
} // إنهاء if الأولى
?>

تم الآن تسجيل جلستين الأولى لاسم المستخدم في حال احتجت تتبع وجوده في الصفحات والثانية لمستوى المستخدم في حال أردت التحكم بالمتحوى بناءا على المستوى

على سبيل المثال:

<?php
   session_start(); // يجب أن تكون في كل صفحة تستخدم فيها السشن وبنفس الشروط السابقة
if($_SESSION['user_level'] == 1) {
   echo "انت المدير بتاع كله";
} elseif($_SESSION['user_level'] == 2) {
  echo "انت مستخدم زيك زي غيرك";
}
?>

في المثال أعلاه سيطبع النتيجة الأولى في حال كان المستخدم يحمل الرقم واحد في سجلاته بقاعدة البيانات أو النتيجة الثانية في حال كان مستواه 2

بالتوفيق

sign3.jpg
#5

استاذي عبد الله عياش

ربي يجزاك عنا كل خير ...

ويعلم الله اني مهما اقول احس اني لا اوفيك حقك ...

بارك الله فيك وفي ذريتك واصلحهم الله لك .. وزادك الله من علمه .

سوف اقوم بالتجربة وان شاء الله تُفرج .

19dfa5a542.gif

سبحان الله بحمده :: سبحان الله العظيم

#6

اخواني كيف اعطي الصلاحيات

مثلاً هذه القاعدة التي سويتها


-- version 2.9.1.1
-- http://www.phpmyadmin.net
--
-- المزود: localhost
-- أنشئ في: 31 ديسمبر 2007 الساعة 12:46
-- إصدارة المزود: 5.0.22
-- PHP إصدارة: 4.4.4
--
-- قاعدة البيانات: `AD`
--

-- --------------------------------------------------------

--
-- بنية الجدول `registered_members`
--

CREATE TABLE `registered_members` (
`id` int(4) NOT NULL auto_increment,
`username` varchar(65) NOT NULL,
`password` varchar(65) NOT NULL,
`realname` varchar(65) NOT NULL,
`email` varchar(65) NOT NULL,
`level` varchar(65) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=cp1256 AUTO_INCREMENT=4;

--

-- phpMyAdmin SQL Dump

هنا صفحة تسجيل الدخول

main_login.php


<table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<form name="form1" method="post" action="checklogin.php">
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF" dir="rtl">
<tr>
<td colspan="3"><strong>تسجيل الدخول</strong></td>
</tr>
<tr>
<td width="68">إسم المستخدم</td>
<td width="4">:</td>
<td width="204"><input name="username" type="text" id="username"></td>
</tr>
<tr>
<td>الرقم السري</td>
<td>:</td>
<td><input name="password" type="text" id="password"></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><input type="submit" name="Submit" value="Login"></td>
</tr>
</table>
</td>
</form>
</tr>
</table>

<br><br><br><br>

checklogin.php


// شرح بوصالح جرافيكس
// www.tsmim.com
$host="localhost"; // المستضيف
$username="root"; // اسم مستخدم قاعدة البيانات
$password=""; //الباسورد لمستخدم قاعدة البيانات
$db_name="AD"; // اسم قاعدة البيانات
$tbl_name="registered_members"; // الجدول

// هنا يتم الاتصال بقاعدة البيانات
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");



// هنا تعرف المدخلات كمتغيرات
$username=$_POST['username'];
$password=$_POST['password'];

// هنا يتم تشفير الباسورد
$encrypted_mypassword=md5($mypassword);

$sql="SELECT * FROM $tbl_name WHERE username='$username' and password='$encrypted_password'";
$result=mysql_query($sql);


// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
// If result matched $username and $password, table row must be 1 row

if($count==1){
// Register $username, $password and redirect to file "login_success.php"
session_register("username");
session_register("password");
header("location:login_success.php");
}
else {
echo "هناك خطأ حاول مره اخرى";
}
?>


<?php

login_success.php


// هنا للتحقق اذا كان قد تم تسجيل الدخول ام لا

session_start();
if(!session_is_registered(username)){
header("location:main_login.php");
}
// واذا لم يتم تسجيل الدخول سوف يتم تحويله مره اخرى الى صفحة
//main_login.php
?>

<html>
<body>
<div align="center"><b>تم تسجيل الدخول بنجاح</b></div>
<p align="center"><b><span lang="ar-sa"><a href="index.php">
<span style="text-decoration: none">أنقر هنا للذهاب الى الرئيسية</span></a></span></b></p>



</body>
</html>
<?

كيف اعدل على تسجيل الدخول بإستخدام الصلاحيات

#7

اخواني كيف اعطي الصلاحيات

مثلاً هذه القاعدة التي سويتها


-- version 2.9.1.1
-- http://www.phpmyadmin.net
--
-- المزود: localhost
-- أنشئ في: 31 ديسمبر 2007 الساعة 12:46
-- إصدارة المزود: 5.0.22
-- PHP إصدارة: 4.4.4
--
-- قاعدة البيانات: `AD`
--

-- --------------------------------------------------------

--
-- بنية الجدول `registered_members`
--

CREATE TABLE `registered_members` (
`id` int(4) NOT NULL auto_increment,
`username` varchar(65) NOT NULL,
`password` varchar(65) NOT NULL,
`realname` varchar(65) NOT NULL,
`email` varchar(65) NOT NULL,
`level` varchar(65) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=cp1256 AUTO_INCREMENT=4;

--

-- phpMyAdmin SQL Dump

هنا صفحة تسجيل الدخول

main_login.php


<table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<form name="form1" method="post" action="checklogin.php">
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF" dir="rtl">
<tr>
<td colspan="3"><strong>تسجيل الدخول</strong></td>
</tr>
<tr>
<td width="68">إسم المستخدم</td>
<td width="4">:</td>
<td width="204"><input name="username" type="text" id="username"></td>
</tr>
<tr>
<td>الرقم السري</td>
<td>:</td>
<td><input name="password" type="text" id="password"></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><input type="submit" name="Submit" value="Login"></td>
</tr>
</table>
</td>
</form>
</tr>
</table>

<br><br><br><br>

checklogin.php


// شرح بوصالح جرافيكس
// www.tsmim.com
$host="localhost"; // المستضيف
$username="root"; // اسم مستخدم قاعدة البيانات
$password=""; //الباسورد لمستخدم قاعدة البيانات
$db_name="AD"; // اسم قاعدة البيانات
$tbl_name="registered_members"; // الجدول

// هنا يتم الاتصال بقاعدة البيانات
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");



// هنا تعرف المدخلات كمتغيرات
$username=$_POST['username'];
$password=$_POST['password'];

// هنا يتم تشفير الباسورد
$encrypted_mypassword=md5($mypassword);

$sql="SELECT * FROM $tbl_name WHERE username='$username' and password='$encrypted_password'";
$result=mysql_query($sql);


// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
// If result matched $username and $password, table row must be 1 row

if($count==1){
// Register $username, $password and redirect to file "login_success.php"
session_register("username");
session_register("password");
header("location:login_success.php");
}
else {
echo "هناك خطأ حاول مره اخرى";
}
?>


<?php

login_success.php


// هنا للتحقق اذا كان قد تم تسجيل الدخول ام لا

session_start();
if(!session_is_registered(username)){
header("location:main_login.php");
}
// واذا لم يتم تسجيل الدخول سوف يتم تحويله مره اخرى الى صفحة
//main_login.php
?>

<html>
<body>
<div align="center"><b>تم تسجيل الدخول بنجاح</b></div>
<p align="center"><b><span lang="ar-sa"><a href="index.php">
<span style="text-decoration: none">أنقر هنا للذهاب الى الرئيسية</span></a></span></b></p>



</body>
</html>
<?

كيف اعدل على تسجيل الدخول بإستخدام الصلاحيات على هذه الصفحة

برقم1 و 2 لايدخلون level بحيث اصحاب الـ

برقم3 و 4 و 5 يستطيعوا مشاهدة الصفحة level بحيث اصحاب الـ


session_start();
if(!session_is_registered(myusername)){
header("location:index.php");
}
?>

<html>
<head>
<title>now</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script language="JavaScript" fptype="dynamicanimation">
<!--
function dynAnimation() {}
function clickSwapImg() {}
//-->
</script>
<script language="JavaScript1.2" fptype="dynamicanimation" src="animate.js">
</script>
</head>
<body bgcolor="#93CFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload="dynAnimation()" language="Javascript1.2">

<div align="center">
<table id="Table_01" width="768" height="1001" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="14">
<img src="images/faleh_01.jpg" width="767" height="7" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="7" alt=""></td>
</tr>
<tr>
<td colspan="2" rowspan="2">
<img src="images/faleh_02.jpg" width="26" height="101" alt=""></td>
<td>
<a href="logout.php">
<img border="0" src="images/faleh_03.jpg" width="32" height="46"></a></td>
<td rowspan="2">
<img src="images/faleh_04.jpg" width="35" height="101" alt=""></td>
<td>
<a href="Contact.php">
<img border="0" src="images/faleh_05.jpg" width="31" height="46"></a></td>
<td rowspan="2">
<img src="images/faleh_06.jpg" width="29" height="101" alt=""></td>
<td>
<a href="stc.php">
<img border="0" src="images/faleh_07.jpg" width="62" height="46"></a></td>
<td colspan="7" rowspan="2">
<img src="images/faleh_08.jpg" width="552" height="101" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="46" alt=""></td>
</tr>
<tr>
<td>
<img src="images/faleh_09.jpg" width="32" height="55" alt=""></td>
<td>
<img src="images/faleh_10.jpg" width="31" height="55" alt=""></td>
<td>
<img src="images/faleh_11.jpg" width="62" height="55" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="55" alt=""></td>
</tr>
<tr>
<td rowspan="2">
<img src="images/faleh_12.jpg" width="14" height="90" alt=""></td>
<td colspan="7">
<iframe name="I1" src="wellcome.php" height="69" width="312" border="0" frameborder="0">
لا يدعم المستعرض الذي تستخدمه الإطارات المضمنة أو تمت تهيئته حالياً حتى لا يدعم الإطارات المضمنة.
</iframe></td>
<td colspan="6" rowspan="2">
<img src="images/faleh_14.jpg" width="441" height="90" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="69" alt=""></td>
</tr>
<tr>
<td colspan="7">
<img src="images/faleh_15.jpg" width="312" height="21" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="21" alt=""></td>
</tr>
<tr>
<td colspan="9" rowspan="19">
<iframe name="I2" src="Search.php" height="746" width="535" border="0" frameborder="0">
لا يدعم المستعرض الذي تستخدمه الإطارات المضمنة أو تمت تهيئته حالياً حتى لا يدعم الإطارات المضمنة.
</iframe></td>
<td colspan="5">
<img src="images/faleh_17.jpg" width="232" height="48" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="48" alt=""></td>
</tr>
<tr>
<td rowspan="19">
<img src="images/faleh_18.jpg" width="5" height="702" alt=""></td>
<td colspan="3">
<a href="addstaff.php" onmouseover="var img=document['fpAnimswapImgFP1'];img.imgRolln=img.src;img.src=img.lowsrc?img.lowsrc:img.getAttribute?img.getAttribute('lowsrc'):img.src;" onmouseout="document['fpAnimswapImgFP1'].src=document['fpAnimswapImgFP1'].imgRolln">
<img border="0" src="images/faleh_19.jpg" width="220" height="32" id="fpAnimswapImgFP1" name="fpAnimswapImgFP1" dynamicanimation="fpAnimswapImgFP1" lowsrc="images/faleh2_19.jpg"></a></td>
<td rowspan="19">
<img src="images/faleh_20.jpg" width="7" height="702" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="32" alt=""></td>
</tr>
<tr>
<td colspan="3">
<img src="images/faleh_21.jpg" width="220" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="1" alt=""></td>
</tr>
<tr>
<td colspan="3">
<a href="dataamendment.php" onmouseover="var img=document['fpAnimswapImgFP2'];img.imgRolln=img.src;img.src=img.lowsrc?img.lowsrc:img.getAttribute?img.getAttribute('lowsrc'):img.src;" onmouseout="document['fpAnimswapImgFP2'].src=document['fpAnimswapImgFP2'].imgRolln">
<img border="0" src="images/faleh_22.jpg" width="220" height="28" id="fpAnimswapImgFP2" name="fpAnimswapImgFP2" dynamicanimation="fpAnimswapImgFP2" lowsrc="images/faleh2_22.jpg"></a></td>
<td>
<img src="images/spacer.gif" width="1" height="28" alt=""></td>
</tr>
<tr>
<td colspan="3">
<img src="images/faleh_23.jpg" width="220" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="1" alt=""></td>
</tr>
<tr>
<td colspan="3">
<a href="reviewdata.php" onmouseover="var img=document['fpAnimswapImgFP3'];img.imgRolln=img.src;img.src=img.lowsrc?img.lowsrc:img.getAttribute?img.getAttribute('lowsrc'):img.src;" onmouseout="document['fpAnimswapImgFP3'].src=document['fpAnimswapImgFP3'].imgRolln">
<img border="0" src="images/faleh_24.jpg" width="220" height="28" id="fpAnimswapImgFP3" name="fpAnimswapImgFP3" dynamicanimation="fpAnimswapImgFP3" lowsrc="images/faleh2_24.jpg"></a></td>
<td>
<img src="images/spacer.gif" width="1" height="28" alt=""></td>
</tr>
<tr>
<td colspan="3">
<img src="images/faleh_25.jpg" width="220" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="1" alt=""></td>
</tr>
<tr>
<td colspan="3">
<a href="leave.php" onmouseover="var img=document['fpAnimswapImgFP4'];img.imgRolln=img.src;img.src=img.lowsrc?img.lowsrc:img.getAttribute?img.getAttribute('lowsrc'):img.src;" onmouseout="document['fpAnimswapImgFP4'].src=document['fpAnimswapImgFP4'].imgRolln">
<img border="0" src="images/faleh_26.jpg" width="220" height="28" id="fpAnimswapImgFP4" name="fpAnimswapImgFP4" dynamicanimation="fpAnimswapImgFP4" lowsrc="images/faleh2_26.jpg"></a></td>
<td>
<img src="images/spacer.gif" width="1" height="28" alt=""></td>
</tr>
<tr>
<td colspan="3">
<img src="images/faleh_27.jpg" width="220" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="1" alt=""></td>
</tr>
<tr>
<td colspan="3">
<a href="absence.php" onmouseover="var img=document['fpAnimswapImgFP5'];img.imgRolln=img.src;img.src=img.lowsrc?img.lowsrc:img.getAttribute?img.getAttribute('lowsrc'):img.src;" onmouseout="document['fpAnimswapImgFP5'].src=document['fpAnimswapImgFP5'].imgRolln">
<img border="0" src="images/faleh_28.jpg" width="220" height="28" id="fpAnimswapImgFP5" name="fpAnimswapImgFP5" dynamicanimation="fpAnimswapImgFP5" lowsrc="images/faleh2_28.jpg"></a></td>
<td>
<img src="images/spacer.gif" width="1" height="28" alt=""></td>
</tr>
<tr>
<td colspan="3">
<img src="images/faleh_29.jpg" width="220" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="1" alt=""></td>
</tr>
<tr>
<td colspan="3">
<a href="delay.php" onmouseover="var img=document['fpAnimswapImgFP6'];img.imgRolln=img.src;img.src=img.lowsrc?img.lowsrc:img.getAttribute?img.getAttribute('lowsrc'):img.src;" onmouseout="document['fpAnimswapImgFP6'].src=document['fpAnimswapImgFP6'].imgRolln">
<img border="0" src="images/faleh_30.jpg" width="220" height="28" id="fpAnimswapImgFP6" name="fpAnimswapImgFP6" dynamicanimation="fpAnimswapImgFP6" lowsrc="images/faleh2_30.jpg"></a></td>
<td>
<img src="images/spacer.gif" width="1" height="28" alt=""></td>
</tr>
<tr>
<td colspan="3">
<img src="images/faleh_31.jpg" width="220" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="1" alt=""></td>
</tr>
<tr>
<td colspan="3">
<a href="eststaf.php" onmouseover="var img=document['fpAnimswapImgFP7'];img.imgRolln=img.src;img.src=img.lowsrc?img.lowsrc:img.getAttribute?img.getAttribute('lowsrc'):img.src;" onmouseout="document['fpAnimswapImgFP7'].src=document['fpAnimswapImgFP7'].imgRolln">
<img border="0" src="images/faleh_32.jpg" width="220" height="28" id="fpAnimswapImgFP7" name="fpAnimswapImgFP7" dynamicanimation="fpAnimswapImgFP7" lowsrc="images/faleh2_32.jpg"></a></td>
<td>
<img src="images/spacer.gif" width="1" height="28" alt=""></td>
</tr>
<tr>
<td colspan="3">
<img src="images/faleh_33.jpg" width="220" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="1" alt=""></td>
</tr>
<tr>
<td colspan="3">
<a href="Irregularities.php" onmouseover="var img=document['fpAnimswapImgFP8'];img.imgRolln=img.src;img.src=img.lowsrc?img.lowsrc:img.getAttribute?img.getAttribute('lowsrc'):img.src;" onmouseout="document['fpAnimswapImgFP8'].src=document['fpAnimswapImgFP8'].imgRolln">
<img border="0" src="images/faleh_34.jpg" width="220" height="34" id="fpAnimswapImgFP8" name="fpAnimswapImgFP8" dynamicanimation="fpAnimswapImgFP8" lowsrc="images/faleh2_34.jpg"></a></td>
<td>
<img src="images/spacer.gif" width="1" height="34" alt=""></td>
</tr>
<tr>
<td colspan="3">
<img src="images/faleh_35.jpg" width="220" height="183" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="183" alt=""></td>
</tr>
<tr>
<td rowspan="3">
<img src="images/faleh_36.jpg" width="37" height="278" alt=""></td>
<td>
<a href="admin.php">
<img border="0" src="images/faleh_37.jpg" width="177" height="94"></a></td>
<td rowspan="3">
<img src="images/faleh_38.jpg" width="6" height="278" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="94" alt=""></td>
</tr>
<tr>
<td rowspan="2">
<img src="images/faleh_39.jpg" width="177" height="184" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="180" alt=""></td>
</tr>
<tr>
<td colspan="9">
<img src="images/faleh_40.jpg" width="535" height="4" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="4" alt=""></td>
</tr>
<tr>
<td colspan="14">
<img src="images/faleh_41.jpg" width="767" height="52" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="52" alt=""></td>
</tr>
<tr>
<td>
<img src="images/spacer.gif" width="14" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="12" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="32" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="35" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="31" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="29" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="62" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="111" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="209" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="5" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="37" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="177" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="6" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="7" height="1" alt=""></td>
<td></td>
</tr>
</table>
</div>

</body>
</html>
<?
#8
man in dark كتب:

اخواني كيف اعطي الصلاحيات

مثلاً هذه القاعدة التي سويتها


-- version 2.9.1.1
-- http://www.phpmyadmin.net
--
-- المزود: localhost
-- أنشئ في: 31 ديسمبر 2007 الساعة 12:46
-- إصدارة المزود: 5.0.22
-- PHP إصدارة: 4.4.4
--
-- قاعدة البيانات: `AD`
--

-- --------------------------------------------------------

--
-- بنية الجدول `registered_members`
--

CREATE TABLE `registered_members` (
`id` int(4) NOT NULL auto_increment,
`username` varchar(65) NOT NULL,
`password` varchar(65) NOT NULL,
`realname` varchar(65) NOT NULL,
`email` varchar(65) NOT NULL,
`level` varchar(65) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=cp1256 AUTO_INCREMENT=4;

--

-- phpMyAdmin SQL Dump

هنا صفحة تسجيل الدخول

main_login.php


<table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<form name="form1" method="post" action="checklogin.php">
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF" dir="rtl">
<tr>
<td colspan="3"><strong>تسجيل الدخول</strong></td>
</tr>
<tr>
<td width="68">إسم المستخدم</td>
<td width="4">:</td>
<td width="204"><input name="username" type="text" id="username"></td>
</tr>
<tr>
<td>الرقم السري</td>
<td>:</td>
<td><input name="password" type="text" id="password"></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><input type="submit" name="Submit" value="Login"></td>
</tr>
</table>
</td>
</form>
</tr>
</table>

<br><br><br><br>

checklogin.php


// شرح بوصالح جرافيكس
// www.tsmim.com
$host="localhost"; // المستضيف
$username="root"; // اسم مستخدم قاعدة البيانات
$password=""; //الباسورد لمستخدم قاعدة البيانات
$db_name="AD"; // اسم قاعدة البيانات
$tbl_name="registered_members"; // الجدول

// هنا يتم الاتصال بقاعدة البيانات
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");



// هنا تعرف المدخلات كمتغيرات
$username=$_POST['username'];
$password=$_POST['password'];

// هنا يتم تشفير الباسورد
$encrypted_mypassword=md5($mypassword);

$sql="SELECT * FROM $tbl_name WHERE username='$username' and password='$encrypted_password'";
$result=mysql_query($sql);


// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
// If result matched $username and $password, table row must be 1 row

if($count==1){
// Register $username, $password and redirect to file "login_success.php"
session_register("username");
session_register("password");
header("location:login_success.php");
}
else {
echo "هناك خطأ حاول مره اخرى";
}
?>


<?php

login_success.php


// هنا للتحقق اذا كان قد تم تسجيل الدخول ام لا

session_start();
if(!session_is_registered(username)){
header("location:main_login.php");
}
// واذا لم يتم تسجيل الدخول سوف يتم تحويله مره اخرى الى صفحة
//main_login.php
?>

<html>
<body>
<div align="center"><b>تم تسجيل الدخول بنجاح</b></div>
<p align="center"><b><span lang="ar-sa"><a href="index.php">
<span style="text-decoration: none">أنقر هنا للذهاب الى الرئيسية</span></a></span></b></p>



</body>
</html>
<?

كيف اعدل على تسجيل الدخول بإستخدام الصلاحيات على هذه الصفحة

برقم1 و 2 لايدخلون level بحيث اصحاب الـ

برقم3 و 4 و 5 يستطيعوا مشاهدة الصفحة level بحيث اصحاب الـ


session_start();
if(!session_is_registered(myusername)){
header("location:index.php");
}
?>

<html>
<head>
<title>now</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script language="JavaScript" fptype="dynamicanimation">
<!--
function dynAnimation() {}
function clickSwapImg() {}
//-->
</script>
<script language="JavaScript1.2" fptype="dynamicanimation" src="animate.js">
</script>
</head>
<body bgcolor="#93CFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload="dynAnimation()" language="Javascript1.2">

<div align="center">
<table id="Table_01" width="768" height="1001" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="14">
<img src="images/faleh_01.jpg" width="767" height="7" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="7" alt=""></td>
</tr>
<tr>
<td colspan="2" rowspan="2">
<img src="images/faleh_02.jpg" width="26" height="101" alt=""></td>
<td>
<a href="logout.php">
<img border="0" src="images/faleh_03.jpg" width="32" height="46"></a></td>
<td rowspan="2">
<img src="images/faleh_04.jpg" width="35" height="101" alt=""></td>
<td>
<a href="Contact.php">
<img border="0" src="images/faleh_05.jpg" width="31" height="46"></a></td>
<td rowspan="2">
<img src="images/faleh_06.jpg" width="29" height="101" alt=""></td>
<td>
<a href="stc.php">
<img border="0" src="images/faleh_07.jpg" width="62" height="46"></a></td>
<td colspan="7" rowspan="2">
<img src="images/faleh_08.jpg" width="552" height="101" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="46" alt=""></td>
</tr>
<tr>
<td>
<img src="images/faleh_09.jpg" width="32" height="55" alt=""></td>
<td>
<img src="images/faleh_10.jpg" width="31" height="55" alt=""></td>
<td>
<img src="images/faleh_11.jpg" width="62" height="55" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="55" alt=""></td>
</tr>
<tr>
<td rowspan="2">
<img src="images/faleh_12.jpg" width="14" height="90" alt=""></td>
<td colspan="7">
<iframe name="I1" src="wellcome.php" height="69" width="312" border="0" frameborder="0">
لا يدعم المستعرض الذي تستخدمه الإطارات المضمنة أو تمت تهيئته حالياً حتى لا يدعم الإطارات المضمنة.
</iframe></td>
<td colspan="6" rowspan="2">
<img src="images/faleh_14.jpg" width="441" height="90" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="69" alt=""></td>
</tr>
<tr>
<td colspan="7">
<img src="images/faleh_15.jpg" width="312" height="21" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="21" alt=""></td>
</tr>
<tr>
<td colspan="9" rowspan="19">
<iframe name="I2" src="Search.php" height="746" width="535" border="0" frameborder="0">
لا يدعم المستعرض الذي تستخدمه الإطارات المضمنة أو تمت تهيئته حالياً حتى لا يدعم الإطارات المضمنة.
</iframe></td>
<td colspan="5">
<img src="images/faleh_17.jpg" width="232" height="48" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="48" alt=""></td>
</tr>
<tr>
<td rowspan="19">
<img src="images/faleh_18.jpg" width="5" height="702" alt=""></td>
<td colspan="3">
<a href="addstaff.php" onmouseover="var img=document['fpAnimswapImgFP1'];img.imgRolln=img.src;img.src=img.lowsrc?img.lowsrc:img.getAttribute?img.getAttribute('lowsrc'):img.src;" onmouseout="document['fpAnimswapImgFP1'].src=document['fpAnimswapImgFP1'].imgRolln">
<img border="0" src="images/faleh_19.jpg" width="220" height="32" id="fpAnimswapImgFP1" name="fpAnimswapImgFP1" dynamicanimation="fpAnimswapImgFP1" lowsrc="images/faleh2_19.jpg"></a></td>
<td rowspan="19">
<img src="images/faleh_20.jpg" width="7" height="702" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="32" alt=""></td>
</tr>
<tr>
<td colspan="3">
<img src="images/faleh_21.jpg" width="220" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="1" alt=""></td>
</tr>
<tr>
<td colspan="3">
<a href="dataamendment.php" onmouseover="var img=document['fpAnimswapImgFP2'];img.imgRolln=img.src;img.src=img.lowsrc?img.lowsrc:img.getAttribute?img.getAttribute('lowsrc'):img.src;" onmouseout="document['fpAnimswapImgFP2'].src=document['fpAnimswapImgFP2'].imgRolln">
<img border="0" src="images/faleh_22.jpg" width="220" height="28" id="fpAnimswapImgFP2" name="fpAnimswapImgFP2" dynamicanimation="fpAnimswapImgFP2" lowsrc="images/faleh2_22.jpg"></a></td>
<td>
<img src="images/spacer.gif" width="1" height="28" alt=""></td>
</tr>
<tr>
<td colspan="3">
<img src="images/faleh_23.jpg" width="220" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="1" alt=""></td>
</tr>
<tr>
<td colspan="3">
<a href="reviewdata.php" onmouseover="var img=document['fpAnimswapImgFP3'];img.imgRolln=img.src;img.src=img.lowsrc?img.lowsrc:img.getAttribute?img.getAttribute('lowsrc'):img.src;" onmouseout="document['fpAnimswapImgFP3'].src=document['fpAnimswapImgFP3'].imgRolln">
<img border="0" src="images/faleh_24.jpg" width="220" height="28" id="fpAnimswapImgFP3" name="fpAnimswapImgFP3" dynamicanimation="fpAnimswapImgFP3" lowsrc="images/faleh2_24.jpg"></a></td>
<td>
<img src="images/spacer.gif" width="1" height="28" alt=""></td>
</tr>
<tr>
<td colspan="3">
<img src="images/faleh_25.jpg" width="220" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="1" alt=""></td>
</tr>
<tr>
<td colspan="3">
<a href="leave.php" onmouseover="var img=document['fpAnimswapImgFP4'];img.imgRolln=img.src;img.src=img.lowsrc?img.lowsrc:img.getAttribute?img.getAttribute('lowsrc'):img.src;" onmouseout="document['fpAnimswapImgFP4'].src=document['fpAnimswapImgFP4'].imgRolln">
<img border="0" src="images/faleh_26.jpg" width="220" height="28" id="fpAnimswapImgFP4" name="fpAnimswapImgFP4" dynamicanimation="fpAnimswapImgFP4" lowsrc="images/faleh2_26.jpg"></a></td>
<td>
<img src="images/spacer.gif" width="1" height="28" alt=""></td>
</tr>
<tr>
<td colspan="3">
<img src="images/faleh_27.jpg" width="220" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="1" alt=""></td>
</tr>
<tr>
<td colspan="3">
<a href="absence.php" onmouseover="var img=document['fpAnimswapImgFP5'];img.imgRolln=img.src;img.src=img.lowsrc?img.lowsrc:img.getAttribute?img.getAttribute('lowsrc'):img.src;" onmouseout="document['fpAnimswapImgFP5'].src=document['fpAnimswapImgFP5'].imgRolln">
<img border="0" src="images/faleh_28.jpg" width="220" height="28" id="fpAnimswapImgFP5" name="fpAnimswapImgFP5" dynamicanimation="fpAnimswapImgFP5" lowsrc="images/faleh2_28.jpg"></a></td>
<td>
<img src="images/spacer.gif" width="1" height="28" alt=""></td>
</tr>
<tr>
<td colspan="3">
<img src="images/faleh_29.jpg" width="220" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="1" alt=""></td>
</tr>
<tr>
<td colspan="3">
<a href="delay.php" onmouseover="var img=document['fpAnimswapImgFP6'];img.imgRolln=img.src;img.src=img.lowsrc?img.lowsrc:img.getAttribute?img.getAttribute('lowsrc'):img.src;" onmouseout="document['fpAnimswapImgFP6'].src=document['fpAnimswapImgFP6'].imgRolln">
<img border="0" src="images/faleh_30.jpg" width="220" height="28" id="fpAnimswapImgFP6" name="fpAnimswapImgFP6" dynamicanimation="fpAnimswapImgFP6" lowsrc="images/faleh2_30.jpg"></a></td>
<td>
<img src="images/spacer.gif" width="1" height="28" alt=""></td>
</tr>
<tr>
<td colspan="3">
<img src="images/faleh_31.jpg" width="220" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="1" alt=""></td>
</tr>
<tr>
<td colspan="3">
<a href="eststaf.php" onmouseover="var img=document['fpAnimswapImgFP7'];img.imgRolln=img.src;img.src=img.lowsrc?img.lowsrc:img.getAttribute?img.getAttribute('lowsrc'):img.src;" onmouseout="document['fpAnimswapImgFP7'].src=document['fpAnimswapImgFP7'].imgRolln">
<img border="0" src="images/faleh_32.jpg" width="220" height="28" id="fpAnimswapImgFP7" name="fpAnimswapImgFP7" dynamicanimation="fpAnimswapImgFP7" lowsrc="images/faleh2_32.jpg"></a></td>
<td>
<img src="images/spacer.gif" width="1" height="28" alt=""></td>
</tr>
<tr>
<td colspan="3">
<img src="images/faleh_33.jpg" width="220" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="1" alt=""></td>
</tr>
<tr>
<td colspan="3">
<a href="Irregularities.php" onmouseover="var img=document['fpAnimswapImgFP8'];img.imgRolln=img.src;img.src=img.lowsrc?img.lowsrc:img.getAttribute?img.getAttribute('lowsrc'):img.src;" onmouseout="document['fpAnimswapImgFP8'].src=document['fpAnimswapImgFP8'].imgRolln">
<img border="0" src="images/faleh_34.jpg" width="220" height="34" id="fpAnimswapImgFP8" name="fpAnimswapImgFP8" dynamicanimation="fpAnimswapImgFP8" lowsrc="images/faleh2_34.jpg"></a></td>
<td>
<img src="images/spacer.gif" width="1" height="34" alt=""></td>
</tr>
<tr>
<td colspan="3">
<img src="images/faleh_35.jpg" width="220" height="183" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="183" alt=""></td>
</tr>
<tr>
<td rowspan="3">
<img src="images/faleh_36.jpg" width="37" height="278" alt=""></td>
<td>
<a href="admin.php">
<img border="0" src="images/faleh_37.jpg" width="177" height="94"></a></td>
<td rowspan="3">
<img src="images/faleh_38.jpg" width="6" height="278" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="94" alt=""></td>
</tr>
<tr>
<td rowspan="2">
<img src="images/faleh_39.jpg" width="177" height="184" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="180" alt=""></td>
</tr>
<tr>
<td colspan="9">
<img src="images/faleh_40.jpg" width="535" height="4" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="4" alt=""></td>
</tr>
<tr>
<td colspan="14">
<img src="images/faleh_41.jpg" width="767" height="52" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="52" alt=""></td>
</tr>
<tr>
<td>
<img src="images/spacer.gif" width="14" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="12" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="32" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="35" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="31" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="29" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="62" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="111" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="209" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="5" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="37" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="177" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="6" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="7" height="1" alt=""></td>
<td></td>
</tr>
</table>
</div>

</body>
</html>
<?

#9

الرجاء من اخواني الرد

وشكرا

مواضيع مشابهة

عدد الزوار حالياً

المتواجدون خلال آخر دقيقتين · يتحدّث كل ٣٠ ثانية

—الإجمالي—أعضاء مسجّلون—زوار بدون تسجيل

جارٍ التحقق من المتواجدين…