![]() |
|
| |||||||
| Notices |
| mySQL & PHP Discussions, information and help with mySQL and PHP. |
![]() |
| | LinkBack | Thread Tools |
|
#1
| |||
| |||
|
Hi I am trying to add a php script which queries a mysql table for my hit counter. When I upload the whole script as a seperate page to my website it works, but I'd like to integrate as html on my main website page just to see the counter. I've included the script, any help would really be appreciated. Thanks Theo include('config.php'); $date = date("d-m-Y" ); $time = time(); $select = "SELECT * FROM " . $pre . "counter WHERE ip = '$ip' AND date = '$date'"; $query = mysql_query($select); while($l = mysql_fetch_object($query)){ $time2 = $l->time; if($time2 > $time - $Dtime) $noentry = 1 ; } if(!$noentry){ $insert = "INSERT INTO " . $pre . "counter (ip, date, time) VALUES('$ip', '$date', '$time')"; $query = mysql_query($insert) or die(mysql_error()); } $select = "SELECT * FROM " . $pre . "counter"; $query = mysql_query($select); $num = mysql_num_rows($query); $iparray = array(); $i = 0; while($l = mysql_fetch_object($query)){ $ip2 = $l->ip; $isin = 0; $count = count($iparray); if(!$count) $isin = 0; for($j = 1; $j < $count + 1; $j++ ){ if($iparray[$j] == "$ip2") $isin = 1; } if(!$isin){ $i++; $iparray[$i] = "$ip2"; } } $count = count($iparray); echo "Hits: " . $num . "<br>"; echo"Unique hits: " . $count; echo'<br /><a href="image.php">This month\'s chart</a>'; ?> |
|
#2
| ||||
| ||||
|
Just create a html box in blue voda, enter in that complete php script. In the page properties change the file to have a .php extension and publish the page. Change any links to reflect the change from a .html to a .php extention and it should work
__________________ Register/Login Script Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script |
|
#3
| |||
| |||
|
Hi Thanks for that info, it worked! Problem is now I don't know how to change my site to using index.php in stead of index.html. I tried deleting index.html using the FTP manager, it's gone, but my default home page still opens the html page and not the php page. Any help would be great Theo |
|
#4
| ||||
| ||||
|
Make sure that there is only a index.php in the directory. if you type in www.yoursite.com It will attempt to open index.html first, if it doesn't exist, it will check for index.php and use that if it exists. If you are still having issues then recreate index.html, and enter this on it <META HTTP-EQUIV="Refresh" CONTENT="0; URL=index.php"> This will do an automatic redirect to index.php when index.html loads
__________________ Register/Login Script Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script |
|
#6
| |||
| |||
|
Hi I am trying to adapt the code you gave me to re-direct my site to index.php. I have another domain, where the previous one is question is .com, this one is .co.za . I would only like to have one page on my .co.za domain, which redirects to the .com one. If I use the script as is my index.html on .com domain, it redirects to the following: http://www.sawelder.co.za/www.sawelder.com/index.php I just need it to go to www.sawelder.com, from www.sawelder.co.za . Excuse my ignorance, but I am very much a newby. Kind Regards Theo Groenewald |
|
#7
| |||
| |||
|
it should work. write your full Url address include http:// Code: <META HTTP-EQUIV="Refresh" CONTENT="0; URL=http://www.sawelder.com/index.php"> |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |