ط*طµط±ظٹط§: ط´ط±ط* طھط*ظˆظٹظ„ ط±ظˆط§ط¨ط· ط³ظƒط±ط¨طھ 4images ظ…ظ† php ط§ظ„ظ‰ HTML



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



توبيكات | منتديات جلنار

السكربت: 4images
تحويل صفحات السكربت من php الى HTML
باستخدام: mod_rewrite

هذا الشرح طريقة ...

1- أفتح ملف (includes/sessions.php)
أبحث عن :
رمز PHP:
<code style="white-space:nowrap"> <code> function url($url, $amp = "&amp;") {
global
$l;
$dummy_array = explode("#", $url);
$url = $dummy_array&#91;0&#93;;

if (
$this->mode == "get" && !preg_match("/".SESSION_NAME."=/i", $url)) {
$url .= preg_match("/\?/", $url) ? "$amp" : "?";
$url .= SESSION_NAME."=".$this->session_id;
}

if (!empty(
$l)) {
$url .= preg_match("/\?/", $url) ? "$amp" : "?";
$url .= "l=".$l;
}

$url .= (isset($dummy_array&#91;1&#93) ? "#".$dummy_array&#91;1&#93; : "";
return
$url;
}
</code> </code>

أستبدله بــ

رمز PHP:
<code style="white-space:nowrap"> <code> /* ORIGINAL CODE
function url($url, $amp = "&amp;") {
global $l;
$dummy_array = explode("#", $url);
$url = $dummy_array&#91;0&#93;;

if ($this->mode == "get" && !preg_match("/".SESSION_NAME."=/i", $url)) {
$url .= preg_match("/\?/", $url) ? "$amp" : "?";
$url .= SESSION_NAME."=".$this->session_id;
}

if (!empty($l)) {
$url .= preg_match("/\?/", $url) ? "$amp" : "?";
$url .= "l=".$l;
}

$url .= (isset($dummy_array&#91;1&#93) ? "#".$dummy_array&#91;1&#93; : "";
return $url;
}
*/
function url($url, $amp = "&amp;") {
global
$l, $user_info;
$dummy_array = explode("#", $url);
$url = $dummy_array&#91;0&#93;;
$url = str_replace('&amp;', '&', $url);
if (!
defined('IN_CP')) {
if (
strstr($url, 'index.php')) {
$url = str_replace('index.php', '', $url);
}
elseif (
strstr($url, 'search.php')) {
if (
strstr($url, 'page=')) {
preg_match('#page=(&#91;0-9&#93;+)&?#', $url, $matches);
if (isset(
$matches&#91;1&#93) {
$split = explode('?', $url);
$url = $split&#91;0&#93;;
$query = @$split&#91;1&#93;;
$url = str_replace('search.php', 'search.'.$matches&#91;1&#93;.'.htm', $url);
$query = str_replace('page='.$matches&#91;1&#93;.'&', '', $query);
$query = str_replace('&page='.$matches&#91;1&#93;, '', $query);
$query = str_replace('page='.$matches&#91;1&#93;, '', $query);
if (!empty(
$query)) {
$url .= '?' . $query;
}
}
}
else {
$url = str_replace('search.php', 'search.htm', $url);
}
}
elseif (
strstr($url, 'lightbox.php')) {
if (
strstr($url, 'page=')) {
preg_match('#page=(&#91;0-9&#93;+)&?#', $url, $matches);
if (isset(
$matches&#91;1&#93) {
$split = explode('?', $url);
$url = $split&#91;0&#93;;
$query = @$split&#91;1&#93;;
$url = str_replace('lightbox.php', 'lightbox.'.$matches&#91;1&#93;.'.htm', $url);
$query = str_replace('page='.$matches&#91;1&#93;.'&', '', $query);
$query = str_replace('&page='.$matches&#91;1&#93;, '', $query);
$query = str_replace('page='.$matches&#91;1&#93;, '', $query);
if (!empty(
$query)) {
$url .= '?' . $query;
}
}
}
else {
$url = str_replace('lightbox.php', 'lightbox.htm', $url);
}
}
elseif (
strstr($url, 'categories.php')) {
if (
strstr($url, 'cat_id=') && strstr($url, 'page=')) {
preg_match('#cat_id=(&#91;0-9&#93;+)&?#', $url, $matches1);
preg_match('#page=(&#91;0-9&#93;+)&?#', $url, $matches2);
if (isset(
$matches1&#91;1&#93 && isset($matches2&#91;1&#93) {
$split = explode('?', $url);
$url = $split&#91;0&#93;;
$query = @$split&#91;1&#93;;
$url = str_replace('categories.php', 'cat'.$matches1&#91;1&#93;.'.'.$matches2&#91;1&#93;.'.htm', $url);
$query = str_replace('cat_id='.$matches1&#91;1&#93;.'&', '', $query);
$query = str_replace('&cat_id='.$matches1&#91;1&#93;, '', $query);
$query = str_replace('cat_id='.$matches1&#91;1&#93;, '', $query);
$query = str_replace('page='.$matches2&#91;1&#93;.'&', '', $query);
$query = str_replace('&page='.$matches2&#91;1&#93;, '', $query);
$query = str_replace('page='.$matches2&#91;1&#93;, '', $query);
if (!empty(
$query)) {
$url .= '?' . $query;
}
}
}
elseif (
strstr($url, 'cat_id=')) {
preg_match('#cat_id=(&#91;0-9&#93;+)&?#', $url, $matches);
if (isset(
$matches&#91;1&#93) {
$split = explode('?', $url);
$url = $split&#91;0&#93;;
$query = @$split&#91;1&#93;;
$url = str_replace('categories.php', 'cat'.$matches&#91;1&#93;.'.htm', $url);
$query = str_replace('cat_id='.$matches&#91;1&#93;.'&', '', $query);
$query = str_replace('&cat_id='.$matches&#91;1&#93;, '', $query);
$query = str_replace('cat_id='.$matches&#91;1&#93;, '', $query);
if (!empty(
$query)) {
$url .= '?' . $query;
}
}
}
else {
$url = str_replace('categories.php', 'cat.htm', $url);
}
}
elseif (
strstr($url, 'details.php?image_id=')) {
if (
strstr($url, 'image_id=') && strstr($url, 'mode=')) {
preg_match('#image_id=(&#91;0-9&#93;+)&?#', $url, $matches1);
preg_match('#mode=(&#91;a-zA-Z0-9&#93;+)&?#', $url, $matches2);
if (isset(
$matches1&#91;1&#93 && isset($matches2&#91;1&#93) {



$split = explode('?', $url);
$url = $split&#91;0&#93;;
$query = @$split&#91;1&#93;;
$url = str_replace('details.php', 'img'.$matches1&#91;1&#93;.'.'.$matches2&#91;1&#93;.'.htm', $url);
$query = str_replace('image_id='.$matches1&#91;1&#93;.'&', '', $query);
$query = str_replace('&image_id='.$matches1&#91;1&#93;, '', $query);
$query = str_replace('image_id='.$matches1&#91;1&#93;, '', $query);
$query = str_replace('mode='.$matches2&#91;1&#93;.'&', '', $query);
$query = str_replace('&mode='.$matches2&#91;1&#93;, '', $query);
$query = str_replace('mode='.$matches2&#91;1&#93;, '', $query);
if (!empty(
$query)) {
$url .= '?' . $query;
}
}
}
else {
preg_match('#image_id=(&#91;0-9&#93;+)&?#', $url, $matches);
if (isset(
$matches&#91;1&#93) {
$split = explode('?', $url);
$url = $split&#91;0&#93;;
$query = @$split&#91;1&#93;;
$url = str_replace('details.php', 'img'.$matches&#91;1&#93;.'.htm', $url);
$query = str_replace('image_id='.$matches&#91;1&#93;.'&', '', $query);
$query = str_replace('&image_id='.$matches&#91;1&#93;, '', $query);
$query = str_replace('image_id='.$matches&#91;1&#93;, '', $query);
if (!empty(
$query)) {
$url .= '?' . $query;
}
}
}
}
elseif (
strstr($url, 'postcards.php?image_id=')) {
preg_match('#image_id=(&#91;0-9&#93;+)&?#', $url, $matches);
if (isset(
$matches&#91;1&#93) {
$split = explode('?', $url);
$url = $split&#91;0&#93;;
$query = @$split&#91;1&#93;;
$url = str_replace('postcards.php', 'postcard.img'.$matches&#91;1&#93;.'.htm', $url);
$query = str_replace('image_id='.$matches&#91;1&#93;.'&', '', $query);
$query = str_replace('&image_id='.$matches&#91;1&#93;, '', $query);
$query = str_replace('image_id='.$matches&#91;1&#93;, '', $query);
if (!empty(
$query)) {
$url .= '?' . $query;
}
}
}
}
if (
$this->mode == "get" && strstr($url, $this->session_id)) {
$url .= strpos($url, '?') !== false ? '&' : '?';
$url .= SESSION_NAME."=".$this->session_id;
}
if (!empty(
$l)) {
$url .= strpos($url, '?') ? '&' : '?';
$url .= "l=".$l;
}
$url = str_replace('&', $amp, $url);
$url .= isset($dummy_array&#91;1&#93 ? "#".$dummy_array&#91;1&#93; : "";
return
$url;
}
</code> </code>



ثم أفتح ملف txt جديد و سمه .htaccess
و ضع فيه هذا :

رمز PHP:
<code style="white-space:nowrap"> <code> # Begin search engine friendly links code
RewriteEngine On
#RewriteBase /
RewriteRule ^lightbox.htm$ lightbox.php?%{QUERY_STRING}
RewriteRule ^lightbox.(&#91;0-9&#93;+).htm$ lightbox.php?page=$1&%{QUERY_STRING}

RewriteRule ^search.htm$ search.php?%{QUERY_STRING}
RewriteRule ^search.(&#91;0-9&#93;+).htm$ search.php?page=$1&%{QUERY_STRING}

RewriteRule ^cat.htm$ categories.php?%{QUERY_STRING}
RewriteRule ^cat(&#91;0-9&#93;+).(&#91;0-9&#93;+).htm$ categories.php?cat_id=$1&page=$2&%{QUERY_STRING}
RewriteRule ^cat(&#91;0-9&#93;+).htm$ categories.php?cat_id=$1&%{QUERY_STRING}

RewriteRule ^img(&#91;0-9&#93;+).htm$ details.php?image_id=$1&%{QUERY_STRING}
RewriteRule ^img(&#91;0-9&#93;+).(&#91;a-zA-Z0-9&#93;+).htm$ details.php?image_id=$1&mode=$2&%{QUERY_STRING}

RewriteRule ^postcard(&#91;a-zA-Z0-9&#93;+).htm$ postcards.php?postcard_id=$1&%{QUERY_STRING}
RewriteRule ^postcard.img(&#91;0-9&#93;+).htm$ postcards.php?image_id=$1&%{QUERY_STRING}

# End search engine friendly links code
</code> </code>



عندك السطر : #RewriteBase /
أكتب أسم المجلد الذي فيه السكربت ( مثال : RewriteBase /gallery/
تم نقل الشرح طريقة من الشركة الأم

HTACCESS.zip (388
sessions.zip (5.3


تم النقـل من: http://forum.scriptat.com/showthread.php?t=3436

آتمنـى انه يعجبكم






التعديل الأخير كان بواسطة chevo; 12 - 01 - 2014 الساعة 02:39


الملفات المرفقة [TR]
HTACCESS.zip (388 بايت, عدد مرات المشاهدة 128 مرة) [/TR]
[TR]
sessions.zip (5.3 كيلوبايت, عدد مرات المشاهدة 120 مرة) [/TR]



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