Announcement

Collapse
No announcement yet.

PHP MYSQL Query to HTML in BlueVoda

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • PHP MYSQL Query to HTML in BlueVoda

    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
    Re: PHP MYSQL Query to HTML in BlueVoda

    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

    Comment


    • #3
      Re: PHP MYSQL Query to HTML in BlueVoda

      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

      Comment


      • #4
        Re: PHP MYSQL Query to HTML in BlueVoda

        Make sure that there is only a index.php in the directory. if you type in



        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

        Comment


        • #5
          Re: PHP MYSQL Query to HTML in BlueVoda

          Thanks for your help, that works!

          Comment


          • #6
            Re: PHP MYSQL Query to HTML in BlueVoda

            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

            Comment


            • #7
              Re: PHP MYSQL Query to HTML in BlueVoda

              it should work. write your full Url address include http://

              Code:
               
              <META HTTP-EQUIV="Refresh" CONTENT="0; URL=http://www.sawelder.com/index.php">
              or you can set your sawelder.co.za domain as a parked domain in control panel
              .
              .
              Nyoman

              Comment


              • #8
                Re: PHP MYSQL Query to HTML in BlueVoda

                thanks!

                Comment

                Working...
                X