malik_horani
14-10-2002, 11:59 PM
سكربت لمدير الموقع لمعرفة مواقع الزائرين في الموقع
هذا الكود يعطي مدير الموقع معرفه تامه بأماكن الزائرين والاعضاء في الموقع وكذلك يخبره بعدد الضربات التي تمت على لنك معين في الموقع
مثل كم عدد المرات التي زاروا فيها صفحه معينه
This will count your outgoing hits so you know where people are going from your site. This was created quickly to manage outgoing hits, perhaps it'll be of some use. I heavily commented it so hopefully all will understand its logic. It is a very simple script. It just tracks url and number of hits
انظر هنا
http://www.theprojects.org/scripts/linkTracker/
http://codewalkers.com/getcode.php?id=14
وهذا هو الكود
<?php
// : Filename : go.php
// : Version 0.0.1d
/*-----------------------------------------------------------------
BEGIN USER CONFIGURATIONS
-----------------------------------------------------------------*/
// If go.php is called directly, goes to default_url.
$default_url = ' ضع هنا موقع الداتابيس الخاص بك ';
// Your database settings. You should include these from a secure
// location (out of your web root) but it's up to you :-)
$db_host = 'localhost'; // usually localhost
$db_name = '';
$db_user = '';
$db_pass = '';
$db_table = ''; // table holding url and hits fields.
// Debug TRUE or FALSE. If you're debuggin, set to TRUE
$debug = FALSE;
/*-----------------------------------------------------------------
END USER CONFIGURATIONS
------------------------------------------------------------------*/
// Db connect function
function db_connect()
{
global $db_host,$db_name,$db_user,$db_pass,$db_table,$con nected;
global $err;
$conn = mysql_connect($db_host, $db_user, $db_pass);
if ($conn) {
$db_link = mysql_select_db($db_name,$conn);
if ($db_link) {
$connected = TRUE;
} else {
$err .= '[Db not being selected]';
}
} else {
$err .= '[Db not being connected]';
}
}
// This connects to db. In future consider more 'useful' placement
// for this function.
db_connect();
// If $url is not empty then process request
if (!empty($url)) {
// If connected to database then insert info into database otherwise
// just redirect url.
if ($connected) {
$msg .= '[$connected is TRUE, database being query'd]';
// Select current hit count from db where field url equals url
$r = mysql_query ("select hits from $db_table WHERE url='$url'");
// Return the results from above query
$hits = @mysql_result($r,0);
// If not yet in database (0 hits) then insert new url, value=1 hit
if ($hits == 0) {
$q = "INSERT INTO $db_table (url,hits) VALUES('$url','1')";
// Else use current hit count plus 1 as we just got a hit
} else {
$q = "UPDATE $db_table SET hits = $hits+1 WHERE url='$url'";
}
// And finally, put info into the database
mysql_query($q);
}
// Else $url is empty so set as default $host
} else {
$url = "$default_url";
}
// If debug is TRUE then show debug information and do not redirect.
if ($debug) {
print '<li>$url is ' . $url;
print '<li>$hits is ' . $hits;
print '<li>$q is ' . $q;
print '<li>db_connect is ' . print db_connect();
// If $msg and $err are not empty then print them out.
if (!empty($msg)) { print '<li>Messages are ' . $msg; }
if (!empty($err)) { print '<li>Errors are ' . $err; }
} else {
// Do redirection. To be paranoid (for no good reason), clear
// cache first.
header ("Pragma: no-cache");
header ("Cache-Control: no-cache, must-revalidate");
header ("Location: http://$url");
exit;
}
?>
هذا الكود يعطي مدير الموقع معرفه تامه بأماكن الزائرين والاعضاء في الموقع وكذلك يخبره بعدد الضربات التي تمت على لنك معين في الموقع
مثل كم عدد المرات التي زاروا فيها صفحه معينه
This will count your outgoing hits so you know where people are going from your site. This was created quickly to manage outgoing hits, perhaps it'll be of some use. I heavily commented it so hopefully all will understand its logic. It is a very simple script. It just tracks url and number of hits
انظر هنا
http://www.theprojects.org/scripts/linkTracker/
http://codewalkers.com/getcode.php?id=14
وهذا هو الكود
<?php
// : Filename : go.php
// : Version 0.0.1d
/*-----------------------------------------------------------------
BEGIN USER CONFIGURATIONS
-----------------------------------------------------------------*/
// If go.php is called directly, goes to default_url.
$default_url = ' ضع هنا موقع الداتابيس الخاص بك ';
// Your database settings. You should include these from a secure
// location (out of your web root) but it's up to you :-)
$db_host = 'localhost'; // usually localhost
$db_name = '';
$db_user = '';
$db_pass = '';
$db_table = ''; // table holding url and hits fields.
// Debug TRUE or FALSE. If you're debuggin, set to TRUE
$debug = FALSE;
/*-----------------------------------------------------------------
END USER CONFIGURATIONS
------------------------------------------------------------------*/
// Db connect function
function db_connect()
{
global $db_host,$db_name,$db_user,$db_pass,$db_table,$con nected;
global $err;
$conn = mysql_connect($db_host, $db_user, $db_pass);
if ($conn) {
$db_link = mysql_select_db($db_name,$conn);
if ($db_link) {
$connected = TRUE;
} else {
$err .= '[Db not being selected]';
}
} else {
$err .= '[Db not being connected]';
}
}
// This connects to db. In future consider more 'useful' placement
// for this function.
db_connect();
// If $url is not empty then process request
if (!empty($url)) {
// If connected to database then insert info into database otherwise
// just redirect url.
if ($connected) {
$msg .= '[$connected is TRUE, database being query'd]';
// Select current hit count from db where field url equals url
$r = mysql_query ("select hits from $db_table WHERE url='$url'");
// Return the results from above query
$hits = @mysql_result($r,0);
// If not yet in database (0 hits) then insert new url, value=1 hit
if ($hits == 0) {
$q = "INSERT INTO $db_table (url,hits) VALUES('$url','1')";
// Else use current hit count plus 1 as we just got a hit
} else {
$q = "UPDATE $db_table SET hits = $hits+1 WHERE url='$url'";
}
// And finally, put info into the database
mysql_query($q);
}
// Else $url is empty so set as default $host
} else {
$url = "$default_url";
}
// If debug is TRUE then show debug information and do not redirect.
if ($debug) {
print '<li>$url is ' . $url;
print '<li>$hits is ' . $hits;
print '<li>$q is ' . $q;
print '<li>db_connect is ' . print db_connect();
// If $msg and $err are not empty then print them out.
if (!empty($msg)) { print '<li>Messages are ' . $msg; }
if (!empty($err)) { print '<li>Errors are ' . $err; }
} else {
// Do redirection. To be paranoid (for no good reason), clear
// cache first.
header ("Pragma: no-cache");
header ("Cache-Control: no-cache, must-revalidate");
header ("Location: http://$url");
exit;
}
?>