هديل
10-08-2002, 12:39 AM
مرحبا اخوانى وخواتى
فى موضوع سابق لى وضعت طريقه لعمل ععد زوار بالكتابه
والان طريقه عمل عددا ولاكن يعد بالصور ويسجل رقم الايبي لزائر
وهنا مثال لعداد (http://www.moooon.net/counter1/digits/counter.php)
وهنا لحفظ رقم الايبي (http://www.moooon.net/counter1/digits/ips.txt)
وطريقه التركيب اولا يلزمك موقع يدعم php
اولا قم بعمل مجلد جديد بموقعك وسمه اي مسى مثلcounter وقم بعمل ملف داخل الملجد ملف جديد من نوع php وسمة counter.php وضع فيه الكود التالى
اسخ ماتحت الخط
......................................
<?
////////////////////////////////////////////////////////////
//
// Powered by: absba.org
//
////////////////////////////////////////////////////////////
//
//
// المتغيرات
$file = "count.txt"; // باث ملف التسجيل للعداد
$imgExtension = "gif"; //
$minDigits = 0; // الحد الادنى لتوقف العداد
//
$countOnce = 1; // ضع رقم 1 لتسجيل رقم الايبي
//
$ipFile = "ips.txt"; // باث ملف الايبي (لاتغيره)
//لاتقمب تعديل شي الا اذا كانت لديك خبرة فى php//
// get the current hit count
$fp_count = fopen($file, "r");
$count = fread($fp_count, filesize($file));
fclose($fp_count);
// if the "countOnce" feature is enabled
if ($countOnce) {
// open the IP address file
$fp_ips = fopen($ipFile, "r");
// compare each entry with the user's IP address
while (!feof($fp_ips)) {
// get an entry from the IP file
$ip = fgets($fp_ips, 20);
// if the user's IP matches, set the user to old
if ($ip == $REMOTE_ADDR . "\r\n") {
$is_old = 1;
break;
}
// otherwise, set the user to new
else {
$is_old = 0;
}
}
// close the IP address file
fclose($fp_ips);
// if the user is not old, add his IP to the IP file
if (!$is_old) {
// reopen the IP address file
$fp_ips = fopen($ipFile, "a");
// add the user's IP address
fputs($fp_ips, $REMOTE_ADDR . "\r\n");
// close the IP address file
fclose($fp_ips);
}
}
// if the "countOnce" feature is disabled, set the user to new
else {
$is_old = 0;
}
// if the user is not old, increment the counter
if (!$is_old) {
$count++;
// save the new hit count
$fp_count = fopen($file, "w");
fputs($fp_count, $count);
fclose($fp_count);
}
// count the number of digits in the hit count
$digits = strlen($count);
// if minDigits is set and the number of digits is less than minDigits, add leading zeroes
if ($minDigits && $digits < $minDigits) {
// find the difference between minDigits and the number of digits in the count
$diff = $minDigits - $digits;
// add a number of leading zeroes equal to the difference
for ($i = 0; $i < $diff; $i++) {
$count = "0" . $count;
}
// set digits equal to minDigits
$digits = $minDigits;
}
// print the appropriate image for each digit in the hit count
for ($i = 0; $i < $digits; $i++)
{
// get a digit from the hit count
$digit = substr("$count", $i, 1);
// print the image for that digit
echo "<img src=images/digits/$digit.$imgExtension>";
}
?>
.................................................. .......
الخطوه الثانيه قم بعمل ملف count من نوع txt وخله فاضي ومهم هاذ الملف انه يقوم بتسجيل عدد الزيارت
الخطوه الثالثه قم بعمل ملف ips من نوع txt لحفظ ارقام الايبيات وحفضه وهو فاضي لاتكتب فيه شي
واخر خطوه قم بعمل مجلد جديد باسمimages وقم برسم عشر صور وكل صوره واسمه مثل 1 اكتب داخله 1 الى اخر رقم 9
او قم بتحميل من هنا
http://www.moooon.net/counter1/digits/images.zip
لاتنسى ان تعطي ترخيص 666 لكل الملفات ماعدا مجلد images
لوضع العداد فى صفحتك قم بوضع الكود التالى
<? include("counter.php"); ?>
فى موضوع سابق لى وضعت طريقه لعمل ععد زوار بالكتابه
والان طريقه عمل عددا ولاكن يعد بالصور ويسجل رقم الايبي لزائر
وهنا مثال لعداد (http://www.moooon.net/counter1/digits/counter.php)
وهنا لحفظ رقم الايبي (http://www.moooon.net/counter1/digits/ips.txt)
وطريقه التركيب اولا يلزمك موقع يدعم php
اولا قم بعمل مجلد جديد بموقعك وسمه اي مسى مثلcounter وقم بعمل ملف داخل الملجد ملف جديد من نوع php وسمة counter.php وضع فيه الكود التالى
اسخ ماتحت الخط
......................................
<?
////////////////////////////////////////////////////////////
//
// Powered by: absba.org
//
////////////////////////////////////////////////////////////
//
//
// المتغيرات
$file = "count.txt"; // باث ملف التسجيل للعداد
$imgExtension = "gif"; //
$minDigits = 0; // الحد الادنى لتوقف العداد
//
$countOnce = 1; // ضع رقم 1 لتسجيل رقم الايبي
//
$ipFile = "ips.txt"; // باث ملف الايبي (لاتغيره)
//لاتقمب تعديل شي الا اذا كانت لديك خبرة فى php//
// get the current hit count
$fp_count = fopen($file, "r");
$count = fread($fp_count, filesize($file));
fclose($fp_count);
// if the "countOnce" feature is enabled
if ($countOnce) {
// open the IP address file
$fp_ips = fopen($ipFile, "r");
// compare each entry with the user's IP address
while (!feof($fp_ips)) {
// get an entry from the IP file
$ip = fgets($fp_ips, 20);
// if the user's IP matches, set the user to old
if ($ip == $REMOTE_ADDR . "\r\n") {
$is_old = 1;
break;
}
// otherwise, set the user to new
else {
$is_old = 0;
}
}
// close the IP address file
fclose($fp_ips);
// if the user is not old, add his IP to the IP file
if (!$is_old) {
// reopen the IP address file
$fp_ips = fopen($ipFile, "a");
// add the user's IP address
fputs($fp_ips, $REMOTE_ADDR . "\r\n");
// close the IP address file
fclose($fp_ips);
}
}
// if the "countOnce" feature is disabled, set the user to new
else {
$is_old = 0;
}
// if the user is not old, increment the counter
if (!$is_old) {
$count++;
// save the new hit count
$fp_count = fopen($file, "w");
fputs($fp_count, $count);
fclose($fp_count);
}
// count the number of digits in the hit count
$digits = strlen($count);
// if minDigits is set and the number of digits is less than minDigits, add leading zeroes
if ($minDigits && $digits < $minDigits) {
// find the difference between minDigits and the number of digits in the count
$diff = $minDigits - $digits;
// add a number of leading zeroes equal to the difference
for ($i = 0; $i < $diff; $i++) {
$count = "0" . $count;
}
// set digits equal to minDigits
$digits = $minDigits;
}
// print the appropriate image for each digit in the hit count
for ($i = 0; $i < $digits; $i++)
{
// get a digit from the hit count
$digit = substr("$count", $i, 1);
// print the image for that digit
echo "<img src=images/digits/$digit.$imgExtension>";
}
?>
.................................................. .......
الخطوه الثانيه قم بعمل ملف count من نوع txt وخله فاضي ومهم هاذ الملف انه يقوم بتسجيل عدد الزيارت
الخطوه الثالثه قم بعمل ملف ips من نوع txt لحفظ ارقام الايبيات وحفضه وهو فاضي لاتكتب فيه شي
واخر خطوه قم بعمل مجلد جديد باسمimages وقم برسم عشر صور وكل صوره واسمه مثل 1 اكتب داخله 1 الى اخر رقم 9
او قم بتحميل من هنا
http://www.moooon.net/counter1/digits/images.zip
لاتنسى ان تعطي ترخيص 666 لكل الملفات ماعدا مجلد images
لوضع العداد فى صفحتك قم بوضع الكود التالى
<? include("counter.php"); ?>