Hello guys!! I want to know that how can we get counting numbers like which site is referring us the most? for example: 5 sites have linked to us and i linked to them: so, on my page i have shown: sitea.com {inhits: 4} siteb.com {inhits: 1} up to so on i hope you get it.. any solution?
<?php if (isset($_SERVER['HTTP_REFERER']) AND $referer = @parse_url($_SERVER['HTTP_REFERER'])) { $referer['host'] = mysql_real_escape_string($referer['host']); mysql_query(" UPDATE table_name SET hits = hits + 1 WHERE hostname = '" . $referer['host'] . "' LIMIT 1 ") OR die(mysql_error()); if (!mysql_affected_rows()) { mysql_query(" INSERT INTO table_name (hostname) VALUES ('" . $referer['host'] . "') ") OR die(mysql_error()); } } ?> PHP: Raw, untested example.
well thanks for code, but i don't know even a b c of mysql. First i want to know more in php. I think we can also give some write command to put it in a text as counter. Cant u write a code which stores the inhits in a text file? and we call it from that file? or please tell me how can i implement the above code in my page..