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

ما هو الفرق بين PHP 5.2 و PHP 5.3 ؟

بدأه dqmus في 18 مايو 2012 · 9 رد · 1,542 مشاهدة · في منتدى تطوير المواقع بـ PHP
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

ما هو الفرق بين PHP 5.2 و PHP 5.3 ؟

لماذا هذا الكود يعمل على PHP 5.2

جرب هنا

http://happyboat.freeiz.com/school2/

و لا يعمل على PHP 5.3

أم المشكلة ليست بنسخة PHP !!


//*
// login.php
// All Sections
// Process login for user
//*

// Include configuration
include_once "configuration.php";

session_start();
//Check if the user comes from the index page
// if(!$_SERVER['HTTP_REFERER'] == "http://www.swifttide.info/SMS/index.php"){
// header("Location: index.php?action=notauth");
// exit();
// };
if($_SESSION['tryattempts']>=_MAX_ATTEMPTS){
header("Location: index.php?action=attempt");
exit();
};
//Inizialize database functions
include_once "ez_sql.php";
//Include global functions
include_once "common.php";

//Gather form posts
$username= get_param("username");
$password= get_param("password");
//Validate fields
if(!strlen($username)){
set_session("tryattempts", ($_SESSION['tryattempts']+1));
header("Location: index.php?action=errlog");
exit();
};
if(!strlen($password)){
set_session("tryattempts", ($_SESSION['tryattempts']+1));
header("Location: index.php?action=errlog");
exit();
};
//Check if uname/pwd match
$sSQL="SELECT * FROM web_users WHERE web_users_username =" . tosql($username, "Text") . " AND web_users_password=" . tosql($password, "Text")." and active = 1";
if($isuser=$db->get_row($sSQL)){
$current_year=$db->get_var("SELECT current_year FROM tbl_config WHERE id=1");
$user_type=$isuser->web_users_type;
$user_id=$isuser->web_users_id;
$year_name=$db->get_var("SELECT school_years_desc FROM school_years WHERE school_years_id=$current_year");
switch ($user_type){
case "A" :
set_session("UserType", "A");
set_session("UserID", $user_id);
set_session("CurrentYear", $current_year);
set_session("YearName", $year_name);
$redirurl="admin_main_menu.php";
break;
case "T" :
$tid=$isuser->web_users_relid;
$teacher=$db->get_row("SELECT * FROM teachers WHERE teachers_id=$tid");
$tlname=$teacher->teachers_lname;
$tfname=$teacher->teachers_fname;
$tschool=$teacher->teachers_school;
set_session("UserType", "T");
set_session("UserID", $user_id);
set_session("teacherid", $tid);
set_session("tfname", $tfname);
set_session("tlname", $tlname);
set_session("tschool", $tschool);
set_session("CurrentYear", $current_year);
set_session("YearName", $year_name);
$redirurl="teachers_menu.php";
break;
case "N" :
$tid=$isuser->web_users_relid;
$teacher=$db->get_row("SELECT * FROM teachers WHERE teachers_id=$tid");
$tlname=$teacher->teachers_lname;
$tfname=$teacher->teachers_fname;
$tschool=$teacher->teachers_school;
set_session("UserType", "N");
set_session("UserID", $user_id);
set_session("tfname", $tfname);
set_session("tlname", $tlname);
set_session("tschool", $tschool);
set_session("CurrentYear", $current_year);
set_session("YearName", $year_name);
$redirurl="health_menu.php";
break;
case "C" :
$cid=$isuser->web_users_relid;
$contact=$db->get_row("SELECT studentcontact_lname, studentcontact_fname FROM studentcontact WHERE studentcontact_id=$cid");
$clname=$contact->studentcontact_lname;
$cfname=$contact->studentcontact_fname;
set_session("UserType", "C");
set_session("UserID", $cid);
set_session("cfname", $cfname);
set_session("clname", $clname);
set_session("CurrentYear", $current_year);
set_session("YearName", $year_name);
$redirurl="contacts_menu.php";
break;
};
header("Location: " . $redirurl);
exit;
}else{
set_session("tryattempts", ($_SESSION['tryattempts']+1));
header("Location: index.php?action=errlog");
exit;
};
?>
<?php

تم تعديل هذه المشاركة بواسطة dqmus في 18 مايو 2012 في 12:28

#2

ممكن رسالة الخطأ الي تظهر لك !!

M.B.O

Mohamed Bin Othman

إبن المكلا

يابني البشر ماذا فعلتم بالبشر !!

إسـألـنـي

#3

ارفق المثال كامل مع توضيح رسالة الخطاء التي تظهر لكي يتسنى لنا مساعدتك .

وشكرا

#4
Saleh.Al-Thiyab كتب:

ارفق المثال كامل مع توضيح رسالة الخطاء التي تظهر لكي يتسنى لنا مساعدتك .

وشكرا

شكرا جزيلا لكم أيها الاخوة الكرام على حرصكم على المساعدة

رسالة الخطأ هي عند تسجيل الدخول السكريبت لا يستجيب أبدا فلا يمكنني من الدخول ذلك على PHP5.3

لكن عند تركيبه على نسخة PHP 5.2 فهو يعمل بطريقة ممتازة

السؤال هل الكود المرفق غير متوافق مع PHP5.3

خاصة


$password= get_param("password");
$username= get_param("username");

فهناك من إقترح أن أقوم بإستعمال

$_POST['username']

مكان


get_param("username");

لكن لا أعرف كيف أقوم بذلك

شكرا

هذا هو index


//*
// index.php
// All Sections
// Main login page
//*
//This is GPL software, licensed under version 2.0 of the GPL license. For a copy of the GPL
//license, read LICENSE.TXT in this directory, or visit http://www.fsf.org
//
//Version 1.5.01

//Include global functions
include_once "common.php";
//Initiate database functions
include_once "ez_sql.php";
// Include configuration
include_once "configuration.php";
// get version
include_once "installation/version.php";

$action=get_param("action");
//Set errors if any
if ($action=="errlog")
$msgLogin="Username/Password Incorrect";
else if ($action=="notauth")
$msgLogin="Not Authorized";
else if ($action=="notfound")
$msgLogin="That Email Address is not on Record";
else if ($action=="gotpass")
$msgLogin="Your Password Was Emailed to You";
else if ($action=="attempt")
$msgLogin="Exceeded Attempts";
else $msgLogin="";

//Start a session to check repetitive attempts to login
session_start();
$tryattempts = $_SESSION['tryattempts'];

if(!strlen($tryattempts)){
set_session("tryattempts", "0");
};

//Get general message
$msgall=$db->get_var("SELECT messageto_all FROM tbl_config WHERE id=1");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<title><?php echo "School Management System";?></title>
<style type="text/css" media="all">@import "student.css";</style>

<link rel="icon" href="favicon.ico" type="image/x-icon"><link rel="shortcut icon" href="favicon.ico" type="image/x-icon"><script type="text/javascript" language="JavaScript" src="sms.js"></script>
</head>

<body onLoad="document.forms.login.username.focus()">
<!--
<img src="images/<?php echo _LOGO?>" border="0">
<div id="Header">
<table width="100%">
<tr>
<td align="left" width="100%"><?php echo "Version " . $release; ?></td>
<td align="right" width="100%"><?php echo $reldate; ?></td>
</tr>
</table>
</div>
-->

<div id="loginerr">
<?php echo $msgLogin; ?>
</div>
<div id="login">
<form name="login" method="POST" action="login.php">

<!-- <img src="images/sms_logo_small.gif" border="0" class="smlogo"><br>  ---- Tony Sodano - 05.02.05 -->

<div align=center>
<table border=0><tr>
<td align=center colspan=2>
</td></tr>
<tr>
<td align=right>
<?php echo "Username";?> :</td>
<td align=left>
<input type="text" onchange="this.value=this.value.toLowerCase();" name="username" size="20">
</td></tr>
<tr>
<td align=right>
<?php echo "Password";?> :</td>
<td align=left>
<input type="password" name="password" onchange="this.value=this.value.toLowerCase();" size="20">
</td></tr>
</table>
</div>
<br>
<input type="submit" name="submit" value="<?php echo "Login";?>"
class="frmlogin"></form><br><a class="forgot"
href="forgot_password.php"><?php echo "Forgot Password?";?> ?</a>
</div>
<div id="loginmsg">
<?php echo $msgall; ?>
</div>
</body>

</html>


<?php

و هذا login


//*
// login.php
// All Sections
// Process login for user
//*

// Include configuration
include_once "configuration.php";

session_start();
//Check if the user comes from the index page
// if(!$_SERVER['HTTP_REFERER'] == "http://www.swifttide.info/SMS/index.php"){
// header("Location: index.php?action=notauth");
// exit();
// };
if($_SESSION['tryattempts']>=_MAX_ATTEMPTS){
header("Location: index.php?action=attempt");
exit();
};
//Inizialize database functions
include_once "ez_sql.php";
//Include global functions
include_once "common.php";

//Gather form posts
$username= get_param("username");
$password= get_param("password");
//Validate fields
if(!strlen($username)){
set_session("tryattempts", ($_SESSION['tryattempts']+1));
header("Location: index.php?action=errlog");
exit();
};
if(!strlen($password)){
set_session("tryattempts", ($_SESSION['tryattempts']+1));
header("Location: index.php?action=errlog");
exit();
};
//Check if uname/pwd match
$sSQL="SELECT * FROM web_users WHERE web_users_username =" . tosql($username, "Text") . " AND web_users_password=" . tosql($password, "Text")." and active = 1";
if($isuser=$db->get_row($sSQL)){
$current_year=$db->get_var("SELECT current_year FROM tbl_config WHERE id=1");
$user_type=$isuser->web_users_type;
$user_id=$isuser->web_users_id;
$year_name=$db->get_var("SELECT school_years_desc FROM school_years WHERE school_years_id=$current_year");
switch ($user_type){
case "A" :
set_session("UserType", "A");
set_session("UserID", $user_id);
set_session("CurrentYear", $current_year);
set_session("YearName", $year_name);
$redirurl="admin_main_menu.php";
break;
case "T" :
$tid=$isuser->web_users_relid;
$teacher=$db->get_row("SELECT * FROM teachers WHERE teachers_id=$tid");
$tlname=$teacher->teachers_lname;
$tfname=$teacher->teachers_fname;
$tschool=$teacher->teachers_school;
set_session("UserType", "T");
set_session("UserID", $user_id);
set_session("teacherid", $tid);
set_session("tfname", $tfname);
set_session("tlname", $tlname);
set_session("tschool", $tschool);
set_session("CurrentYear", $current_year);
set_session("YearName", $year_name);
$redirurl="teachers_menu.php";
break;
case "N" :
$tid=$isuser->web_users_relid;
$teacher=$db->get_row("SELECT * FROM teachers WHERE teachers_id=$tid");
$tlname=$teacher->teachers_lname;
$tfname=$teacher->teachers_fname;
$tschool=$teacher->teachers_school;
set_session("UserType", "N");
set_session("UserID", $user_id);
set_session("tfname", $tfname);
set_session("tlname", $tlname);
set_session("tschool", $tschool);
set_session("CurrentYear", $current_year);
set_session("YearName", $year_name);
$redirurl="health_menu.php";
break;
case "C" :
$cid=$isuser->web_users_relid;
$contact=$db->get_row("SELECT studentcontact_lname, studentcontact_fname FROM studentcontact WHERE studentcontact_id=$cid");
$clname=$contact->studentcontact_lname;
$cfname=$contact->studentcontact_fname;
set_session("UserType", "C");
set_session("UserID", $cid);
set_session("cfname", $cfname);
set_session("clname", $clname);
set_session("CurrentYear", $current_year);
set_session("YearName", $year_name);
$redirurl="contacts_menu.php";
break;
};
header("Location: " . $redirurl);
exit;
}else{
set_session("tryattempts", ($_SESSION['tryattempts']+1));
header("Location: index.php?action=errlog");
exit;
};
?>
<?php

و هذا logout


//*
// logout.php
// All Sections
// Logout user and return to login page
//*


session_start();
session_unregister("UserID");
session_unregister("UserType");
header("Location: index.php");
?>
<?php

تم تعديل هذه المشاركة بواسطة dqmus في 21 مايو 2012 في 12:09

#5

لقد تواصلت مع صاحب السكريبت

المبرمج و كانت اجابته

اقتباس
I would imagine the problem is indeed related to session management,

something I need to go through and clean up.

For now, I would advise you to stay on the older version of xampp

لم أفهم ماذا يقصد بسيشن

هل يقصد ان المشكل هنا


header("Location: index.php?action=attempt");
exit();
};
if($_SESSION['tryattempts']>=_MAX_ATTEMPTS){

http://groups.google.com/group/swifttide/browse_thread/thread/236074e696cc75b9

تم تعديل هذه المشاركة بواسطة dqmus في 21 مايو 2012 في 12:48

#6

ما هو الفرق بين PHP 5.2 و PHP 5.3 ؟

هل استعمال PHP 5.2 لا يطرح مشكل مع المستضيف و هل كل المستضفين يدعمون PHP 5.2

تم تعديل هذه المشاركة بواسطة dqmus في 21 مايو 2012 في 13:09

#7
dqmus كتب:

ما هو الفرق بين PHP 5.2 و PHP 5.3 ؟

هل استعمال PHP 5.2 لا يطرح مشكل مع المستضيف و هل كل المستضفين يدعمون PHP 5.2

اخي الفاضل بخصوص سؤالك اعلاه .. لا يوجد مشكلة بأستخدام اصدار 5.2 اما بخصوص الاستضافة فهذة يفيدك بها المستضيف الخاص بك مع العلم بأن اغلب مواقع الاستضافة العربية تستخدم اصدارات قديمة php

اما بخصوص مشكلة الرئيسية اتمنى منك ارفاق الملفات التالية لكي اساعدك بتغير نظام ادارة الجلسات لديك

common.php

ez_sql.php

configuration.php

installation/version.php

#8
Saleh.Al-Thiyab كتب:

اخي الفاضل بخصوص سؤالك اعلاه .. لا يوجد مشكلة بأستخدام اصدار 5.2 اما بخصوص الاستضافة فهذة يفيدك بها المستضيف الخاص بك مع العلم بأن اغلب مواقع الاستضافة العربية تستخدم اصدارات قديمة php

اما بخصوص مشكلة الرئيسية اتمنى منك ارفاق الملفات التالية لكي اساعدك بتغير نظام ادارة الجلسات لديك

common.php

ez_sql.php

configuration.php

installation/version.php

common.php

<?php
include_once "configuration.php";
//-----------------------------
//Define mail constants
//-----------------------------
// define("SMTP_SERVER", "111.112.113.11");  //ip address of smtp server
// define("SMTP_USER", "username");   //username to login to server
// define("SMTP_PASSWORD", "password");   //password for account
// define("SMTP_SMS_ADMIN_EMAIL", "admin_user@user.com");  //mail will come from this account
// define("SMTP_FOLIO_ADMIN_EMAIL", "admin_user@user.com");  //not sure, make it same as above
// define("SMTP_SMS_ADMIN_NAME", "School Principal");  //messages say they are from this entry

//-------------------------------
//the number of custom fields to display on various pages
//added by Joshua
//-------------------------------
define("CUSTOM_FIELDS_STUDENT", 20);
define("CUSTOM_FIELDS_DISCIPLINE", 3);
define("CUSTOM_FIELDS_ATTENDANCE", 3);
define("CUSTOM_FIELDS_GRADE", 3);

//------------------------------
//Program Constants
define("VERSION", "2.0.0");
//------------------------------

//-------------------------------
// Obtain specific URL Parameter from URL string
//-------------------------------
function get_param($param_name)
{
  global $HTTP_POST_VARS;
  global $HTTP_GET_VARS;

  $param_value = "";
  if(isset($HTTP_POST_VARS[$param_name])) {
    $param_value = $HTTP_POST_VARS[$param_name];
  } else if(isset($HTTP_GET_VARS[$param_name])) {
    $param_value = $HTTP_GET_VARS[$param_name];
  }
  return $param_value;
}
//-------------------------------
// Convert value for use with SQL statament
//-------------------------------
function tosql($value, $type)
{
  if(!strlen($value))
    return "NULL";
  else
    if($type == "Number")
      return str_replace (",", ".", doubleval($value));
    else
    {
      if(get_magic_quotes_gpc() == 0)
      {
        $value = str_replace("'","''",$value);
        $value = str_replace("\\","\\\\",$value);
      }
      else
      {
        $value = str_replace("\\'","''",$value);
        $value = str_replace("\\\"","\"",$value);
      }

      return "'" . $value . "'";
    }
}

function strip($value)
{
  if(get_magic_quotes_gpc() == 0)
    return $value;
  else
    return stripslashes($value);
}

class email

{

	function valida($str)
	{
        if (ereg("^[a-z0-9-]+(\.[a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+$", $str))
		{
           return 1;
        }
        else 
		{
           return 0;
		}
    }
}

function set_session($param_name, $param_value)
{
//   if (isset($_SESSION[$param_name])) 
//   {
//      unset($_SESSION[$param_name]);
//   }
   $_SESSION[$param_name] = $param_value;
}

//for fixing the dates that the datepicker generates to something the db likes
function fix_date($date) {
	$tc = 0;
	$tok = strtok($date, "/");
	while ($tok) {
		$td[$tc] = $tok;
		$tc++;   			
  	$tok = strtok("/");
  }
  return ($td[2]."-".$td[0]."-".$td[1]);
}

function break_date($date) {
	$tc = 0;
	$tok = strtok($date, "-");
	while ($tok) {
		$td[$tc] = $tok;
		$tc++;   			
  	$tok = strtok("-");
  }
  return ($td[1]."/".$td[2]."/".$td[0]);
}

/*
function UserNameIs($_SESSION){
  $usertype=$_SESSION['UserType'];
  switch($usertype){
        case "A":               
$forumuser=$_SESSION['aname']."".substr($_SESSION['aname'],0,1).".";
                break;
        case "C":

$forumuser=$_SESSION['clname']."".substr($_SESSION['cfname'],0,1).".";
                break;
        case "T":

$forumuser=$_SESSION['tlname']."".substr($_SESSION['tfname'],0,1).".";
                break;
        case "N":
                $forumuser=$_SESSION['tlname']." 
".substr($_SESSION['tfname'],0,1).".";
                break;
};
return $forumuser;
}
*/

function userNameIs()
{
    // THE RETURN VALUE
    $r = FALSE;

    // WE ARE NOT ASSUMING THAT THIS IS SET
    if ($_SESSION['UserType'])
    {
        switch($_SESSION['UserType'])
        {
            case "A": $r = $_SESSION['aname']  . substr($_SESSION['aname'],0,1)  . 
'.'; break;
            case "C": $r = $_SESSION['clname'] . substr($_SESSION['cfname'],0,1) . 
'.'; break;
            case "T": $r = $_SESSION['tlname'] . substr($_SESSION['tfname'],0,1) . 
'.'; break;
            case "N": $r = $_SESSION['tlname'] . ' ' . 
substr($_SESSION['tfname'],0,1) . '.'; break;
            default:  $r = FALSE;
        }
    }
    return $r;
}
?>

<?php
include_once "configuration.php";

	// ==================================================================
	//  Author: Justin Vincent (justin@visunet.ie)
	//	Web: 	http://www.justinvincent.com
	//	Name: 	ezSQL
	// 	Desc: 	Class to make it very easy to deal with mySQL database connections.


	// ==================================================================
	// User Settings -- CHANGE HERE

	define("EZSQL_DB_USER", $db_user);		// <-- mysql db user
	define("EZSQL_DB_PASSWORD", $db_password);		// <-- mysql db password
	define("EZSQL_DB_NAME", $db_name);	// <-- mysql dbname
	define("EZSQL_DB_HOST", $db_server);		// <-- mysql server host

	// ==================================================================
	//	ezSQL Constants
	define("EZSQL_VERSION","1.01");
	define("OBJECT","OBJECT",true);
	define("ARRAY_A","ARRAY_A",true);
	define("ARRAY_N","ARRAY_N",true);

	// ==================================================================
	//	The Main Class

	class db {

		// ==================================================================
		//	DB Constructor - connects to the server and selects a database

		function db($dbuser, $dbpassword, $dbname, $dbhost)
		{

			$this->dbh = @mysql_connect($dbhost,$dbuser,$dbpassword);

			if ( ! $this->dbh )
			{
				$this->print_error("<ol><b>Error establishing a database connection!</b><li>Are you sure you have the correct user/password?<li>Are you sure that you have typed the correct hostname?<li>Are you sure that the database server is running?</ol>");
			}


			$this->select($dbname);

		}

		// ==================================================================
		//	Select a DB (if another one needs to be selected)

		function select($db)
		{
			if ( !@mysql_select_db($db,$this->dbh))
			{
				$this->print_error("<ol><b>Error selecting database <u>$db</u>!</b><li>Are you sure it exists?<li>Are you sure there is a valid database connection?</ol>");
			}
		}

		// ==================================================================
		//	Print SQL/DB error.

		function print_error($str = "")
		{

			if ( !$str ) $str = mysql_error();

			// If there is an error then take note of it
			print "<blockquote><font face=arial size=2 color=ff0000>";
			print "<b>SQL/DB Error --</b> ";
			print "[<font color=000077>$str</font>]";
			print "</font></blockquote>";	
		}

		// ==================================================================
		//	Basic Query	- see docs for more detail

		function query($query, $output = OBJECT) 
		{

			// Log how the function was called
			$this->func_call = "\$db->query(\"$query\", $output)";		

			// Kill this
			$this->last_result = null;
			$this->col_info = null;

			// Keep track of the last query for debug..
			$this->last_query = $query;

			// Perform the query via std mysql_query function..
			$this->result = mysql_query($query,$this->dbh);

			if ( mysql_error() ) 
			{

				// If there is an error then take note of it..
				$this->print_error();

			}
			else
			{

				// In other words if this was a select statement..
				if ( $this->result )
				{

					// =======================================================
					// Take note of column info

					$i=0;
					while ($i < @mysql_num_fields($this->result))
					{
						$this->col_info[$i] = @mysql_fetch_field($this->result);
						$i++;
					}

					// =======================================================				
					// Store Query Results

					$i=0;
					while ( $row = @mysql_fetch_object($this->result) )
					{ 

						// Store relults as an objects within main array
						$this->last_result[$i] = $row;

						$i++;
					}

					@mysql_free_result($this->result);

					// If there were results then return true for $db->query
					if ( $i )
					{
						return true;

					}
					else
					{
						return false;
					}

				}

			}
		}

		// ==================================================================
		//	Get one variable from the DB - see docs for more detail

		function get_var($query=null,$x=0,$y=0)
		{

			// Log how the function was called
			$this->func_call = "\$db->get_var(\"$query\",$x,$y)";

			// If there is a query then perform it if not then use cached results..
			if ( $query )
			{
				$this->query($query);
			}

			// Extract var out of cached results based x,y vals
			if ( $this->last_result[$y] )
			{
				$values = array_values(get_object_vars($this->last_result[$y]));
			}

			// If there is a value return it else return null
			return $values[$x]?$values[$x]:null;
		}

		// ==================================================================
		//	Get one row from the DB - see docs for more detail

		function get_row($query=null,$y=0,$output=OBJECT)
		{

			// Log how the function was called
			$this->func_call = "\$db->get_row(\"$query\",$y,$output)";

			// If there is a query then perform it if not then use cached results..
			if ( $query )
			{
				$this->query($query);
			}

			// If the output is an object then return object using the row offset..
			if ( $output == OBJECT )
			{
				return $this->last_result[$y]?$this->last_result[$y]:null;
			}
			// If the output is an associative array then return row as such..
			elseif ( $output == ARRAY_A )
			{
				return $this->last_result[$y]?get_object_vars($this->last_result[$y]):null;	
			}
			// If the output is an numerical array then return row as such..
			elseif ( $output == ARRAY_N )
			{
				return $this->last_result[$y]?array_values(get_object_vars($this->last_result[$y])):null;
			}
			// If invalid output type was specified..
			else
			{
				$this->print_error(" \$db->get_row(string query,int offset,output type) -- Output type must be one of: OBJECT, ARRAY_A, ARRAY_N ");	
			}

		}

		// ==================================================================
		//	Function to get 1 column from the cached result set based in X index
		// se docs for usage and info

		function get_col($query=null,$x=0)
		{

			// If there is a query then perform it if not then use cached results..
			if ( $query )
			{
				$this->query($query);
			}

			// Extract the column values
			for ( $i=0; $i < count($this->last_result); $i++ )
			{
				$new_array[$i] = $this->get_var(null,$x,$i);
			}

			return $new_array;
		}

		// ==================================================================
		// Return the the query as a result set - see docs for more details

		function get_results($query=null, $output = OBJECT)
		{

			// Log how the function was called
			$this->func_call = "\$db->get_results(\"$query\", $output)";

			// If there is a query then perform it if not then use cached results..
			if ( $query )
			{
				$this->query($query);
			}		

			// Send back array of objects. Each row is an object		
			if ( $output == OBJECT )
			{
				return $this->last_result; 
			}
			elseif ( $output == ARRAY_A || $output == ARRAY_N )
			{
				if ( $this->last_result )
				{
					$i=0;
					foreach( $this->last_result as $row )
					{

						$new_array[$i] = get_object_vars($row);

						if ( $output == ARRAY_N )
						{
							$new_array[$i] = array_values($new_array[$i]);
						}

						$i++;
					}

					return $new_array;
				}
				else
				{
					return null;	
				}
			}
		}


		// ==================================================================
		// Function to get column meta data info pertaining to the last query
		// see docs for more info and usage

		function get_col_info($info_type="name",$col_offset=-1)
		{

			if ( $this->col_info )
			{
				if ( $col_offset == -1 )
				{
					$i=0;
					foreach($this->col_info as $col )
					{
						$new_array[$i] = $col->{$info_type};
						$i++;
					}
					return $new_array;
				}
				else
				{
					return $this->col_info[$col_offset]->{$info_type};
				}

			}

		}


		// ==================================================================
		// Dumps the contents of any input variable to screen in a nicely
		// formatted and easy to understand way - any type: Object, Var or Array

		function vardump($mixed)
		{

			echo "<blockquote><font color=000090>";
			echo "<pre><font face=arial>";

			if ( ! $this->vardump_called )
			{
				echo "<font color=800080><b>ezSQL</b> (v".EZSQL_VERSION.") <b>Variable Dump..</b></font>\n\n";
			}

			print_r($mixed);	
			echo "\n\n<b>Last Query:</b> ".($this->last_query?$this->last_query:"NULL")."\n";
			echo "<b>Last Function Call:</b> " . ($this->func_call?$this->func_call:"None")."\n";
			echo "<b>Last Rows Returned:</b> ".count($this->last_result)."\n";
			echo "</font></pre></font></blockquote>";
			echo "\n<hr size=1 noshade color=dddddd>";

			$this->vardump_called = true;

		}

		// Alias for the above function	
		function dumpvars($mixed)
		{
			$this->vardump($mixed);	
		}

		// ==================================================================
		// Displays the last query string that was sent to the database & a 
		// table listing results (if there were any). 
		// (abstracted into a seperate file to save server overhead).

		function debug()
		{

			echo "<blockquote>";

			// Only show ezSQL credits once..
			if ( ! $this->debug_called )
			{
				echo "<font color=800080 face=arial size=2><b>ezSQL</b> (v".EZSQL_VERSION.") <b>Debug..</b></font><p>\n";
			}
			echo "<font face=arial size=2 color=000099><b>Query --</b> ";
			echo "[<font color=000000><b>$this->last_query</b></font>]</font><p>";

				echo "<font face=arial size=2 color=000099><b>Query Result..</b></font>";
				echo "<blockquote>";

			if ( $this->col_info )
			{

				// =====================================================
				// Results top rows

				echo "<table cellpadding=5 cellspacing=1 bgcolor=555555>";
				echo "<tr bgcolor=eeeeee><td nowrap valign=bottom><font color=555599 face=arial size=2><b>(row)</b></font></td>";


				for ( $i=0; $i < count($this->col_info); $i++ )
				{
					echo "<td nowrap align=left valign=top><font size=1 color=555599 face=arial>{$this->col_info[$i]->type} {$this->col_info[$i]->max_length}<br><font size=2><b>{$this->col_info[$i]->name}</b></font></td>";
				}

				echo "</tr>";

				// ======================================================
				// print main results

			if ( $this->last_result )
			{

				$i=0;
				foreach ( $this->get_results(null,ARRAY_N) as $one_row )
				{
					$i++;
					echo "<tr bgcolor=ffffff><td bgcolor=eeeeee nowrap align=middle><font size=2 color=555599 face=arial>$i</font></td>";

					foreach ( $one_row as $item )
					{
						echo "<td nowrap><font face=arial size=2>$item</font></td>";	
					}

					echo "</tr>";				
				}

			} // if last result
			else
			{
				echo "<tr bgcolor=ffffff><td colspan=".(count($this->col_info)+1)."><font face=arial size=2>No Results</font></td></tr>";			
			}

			echo "</table>";		

			} // if col_info
			else
			{
				echo "<font face=arial size=2>No Results</font>";			
			}

			echo "</blockquote></blockquote><hr noshade color=dddddd size=1>";


			$this->debug_called = true;
		}


	}

// $db = new db(EZSQL_DB_USER, EZSQL_DB_PASSWORD, EZSQL_DB_NAME, EZSQL_DB"localhost";);
// use the new format
$db = new db($db_user, $db_password, $db_name, $db_server);

?>

<?php
DEFINE ('_VALID', 1);
date_default_timezone_set('America/New_York');
DEFINE('_LOGO', '../images/sms_en.gif');
DEFINE('_MAX_ATTEMPTS', 5);

$db_server = 'localhost';
$db_name = '';
$db_user = '';
$db_password = '';

$SMTP_SERVER = '';
$SMTP_USER = '';
$SMTP_PASSWORD = '';
$SMTP_FROM_NAME = ' ';
$SMTP_FROM_EMAIL = '';
$SMTP_REPLY_TO = '';
?>

أما فهذا الملف فهو غير مهم كثيرا على ما أعتقد

<?php
/**
* version.php
*/

// no direct access
defined( '_VALID' ) or die( 'Restricted access' );

/**
 * Version information
 * @package SMS
 */
class joomlaVersion {
	/** @var string Product */
	var $PRODUCT 	= 'School Management System';
	/** @var int Main Release Level */
	var $RELEASE 	= '1.99.00';
	/** @var string Development Status */
	var $DEV_STATUS = 'Beta';
	/** @var int Sub Release Level */
	var $DEV_LEVEL 	= '01';
	/** @var int build Number */
	var $BUILD	 	= '';
	/** @var string Codename */
	var $CODENAME 	= 'Maine';
	/** @var string Date */
	var $RELDATE 	= '2010-11-23';
	/** @var string Time */
	var $RELTIME 	= '12:00';
	/** @var string Timezone */
	var $RELTZ 		= 'UTC';
	/** @var string Copyright Text */
	var $COPYRIGHT 	= "Copyright (C) 2010 Open Source Matters. All rights reserved.";
	/** @var string URL */
	var $URL 		= 'SMS - Student Management System';
	/** @var string Whether site is a production = 1 or demo site = 0: 1 is default */
	var $SITE 		= 1;
	/** @var string Whether site has restricted functionality mostly used for demo sites: 0 is default */
	var $RESTRICT	= 0;
	/** @var string Whether site is still in development phase (disables checks for /installation folder) - should be set to 0 for package release: 0 is default */
	var $SVN		= 0;


	/**
	 * @return string Long format version
	 */
	function getLongVersion() {
		return $this->PRODUCT .' '. $this->RELEASE .'.'. $this->DEV_LEVEL .' '
			. $this->DEV_STATUS
			.' [ '.$this->CODENAME .' ] '. $this->RELDATE .' '
			. $this->RELTIME .' '. $this->RELTZ;
	}

	/**
	 * @return string Short version format
	 */
	function getShortVersion() {
		return $this->RELEASE .'.'. $this->DEV_LEVEL;
	}

	/**
	 * @return string Version suffix for help files
	 */
	function getHelpVersion() {
		if ($this->RELEASE > '1.0') {
			return '.' . str_replace( '.', '', $this->RELEASE );
		} else {
			return '';
		}
	}
}
$_VERSION = new joomlaVersion();

$version = $_VERSION->PRODUCT .' '. $_VERSION->RELEASE .'.'. $_VERSION->DEV_LEVEL .' '
. $_VERSION->DEV_STATUS
.' [ '.$_VERSION->CODENAME .' ] '. $_VERSION->RELDATE .' '
. $_VERSION->RELTIME .' '. $_VERSION->RELTZ;

// $release = $_VERSION->RELEASE . '.' . $_VERSION->DEV_LEVEL;
$release = $_VERSION->RELEASE;
$reldate = $_VERSION->RELDATE;

?>

Nouveau dossier.zip

تم تعديل هذه المشاركة بواسطة dqmus في 21 مايو 2012 في 13:31

#9

يمكن يساعدك هذا الرابط للكلاس ezsql

http://jvmultimedia.com/docs/ezsql/ez_sql_help.htm

و لكن وجب التذكير ان هناك تحديث أو اصدار حديث له

https://github.com/jv2222/ezSQL

و هذه البيانات

--
-- Table structure for table `web_users`
--

CREATE TABLE IF NOT EXISTS `web_users` (
  `web_users_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `web_users_type` char(1) DEFAULT NULL,
  `web_users_relid` int(10) unsigned DEFAULT NULL,
  `web_users_username` varchar(15) DEFAULT NULL,
  `web_users_password` varchar(10) DEFAULT NULL,
  `web_users_flname` varchar(60) DEFAULT NULL,
  `web_users_active` int(11) NOT NULL DEFAULT '0',
  `active` tinyint(4) NOT NULL DEFAULT '0',
  PRIMARY KEY (`web_users_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

--
-- Dumping data for table `web_users`
--

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