Insert php code in webpage (html)

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

    • Jul 2005
    • 17

    Insert php code in webpage (html)

    Need help !!!!!!

    Where to insert php code:

    <?
    $filecnt = "ISOcnt.txt";
    if (file_exists($filecnt)) {
    $fp = fopen($filecnt,"r");
    $count = (int)fread($fp,24);
    fclose($fp);
    $count++;
    } else {
    $count = 1;
    }
    $fp = fopen($filecnt , "w");
    fwrite($fp,$count);
    fclose($fp);
    echo $count;
    ?>

    in the following html:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML><HEAD><TITLE>Untitled Page</TITLE>
    <META http-equiv=Content-Type content="text/html; charset=windows-1252">
    <META content="MSHTML 6.00.2900.2668" name=GENERATOR></HEAD>
    <BODY text=#000000 bgColor=#ffffff>
    <DIV style="LEFT: 0px; OVERFLOW: hidden; POSITION: absolute; TOP: 0px"
    align=left><IMG height=600 src="FCount_files/m219a.gif" width=700 align=top
    border=0> </DIV></BODY></HTML>

    in order $count appears on page ?
    Thanks!
  • Pablo
    Moderator

    • May 2005
    • 507

    #2
    Your question doesn't seem to be related to BlueVoda (the html is Internet Explorer generated code).

    The PHP code can be inserted into BlueVoda anywhere you like. All it does is open a text file and increase the page counter. Not a very effecient way of keeping statistics though... It will only slow down the server is you ask me :(
    Forum Moderator
    BlueVoda Spe******t

    Comment

    • ali
      Corporal

      • Jul 2005
      • 17

      #3
      Make efficient

      Hello,

      How to make it effecient ? Please a hint. Thanks.





      Originally posted by Pablo
      Your question doesn't seem to be related to BlueVoda (the html is Internet Explorer generated code).

      The PHP code can be inserted into BlueVoda anywhere you like. All it does is open a text file and increase the page counter. Not a very effecient way of keeping statistics though... It will only slow down the server is you ask me :(

      Comment

      • Pablo
        Moderator

        • May 2005
        • 507

        #4
        Why not use simply use the page statistics of vodahost? It already keeps track of all your page hits, and much more than that.
        Forum Moderator
        BlueVoda Spe******t

        Comment

        • ali
          Corporal

          • Jul 2005
          • 17

          #5
          Page statistics of vodahost ?

          Hello,

          Where to find page statistics of vodahost ? I looked for in the page properties,
          but could not find.


          Originally posted by Pablo
          Why not use simply use the page statistics of vodahost? It already keeps track of all your page hits, and much more than that.

          Comment

          • Steven.H
            Lieutenant Colonel

            • Jul 2005
            • 500

            #6
            Personally, I like to have a counter on my website for the users to see. It is not just about stats.

            The stat programs are located in the Cpanel.
            ::Steven.H::

            Comment

            • ali
              Corporal

              • Jul 2005
              • 17

              #7
              Statistics not real time

              Hello,

              Page statistics of vodahost are not real time. Updated in 24 hours.
              Is it true ?


              Originally posted by Pablo
              Why not use simply use the page statistics of vodahost? It already keeps track of all your page hits, and much more than that.

              Comment

              • Pablo
                Moderator

                • May 2005
                • 507

                #8
                Yes, that's true.
                But the PHP script you're using will slow down the server, since it opens and updates the file with each page hit. You better off using a database table to store the results because MYSQL will cache your query/updates.
                Forum Moderator
                BlueVoda Spe******t

                Comment

                • Gray
                  Sergeant

                  • Jul 2005
                  • 30

                  #9
                  How to Insert PHP into HTML

                  I personally reccomend using IFRAMES.

                  Here it is Step by Step:

                  1. Open Notepad.

                  2. Copy and Paste this in Notepad:

                  <?
                  $filecnt = "ISOcnt.txt";
                  if (file_exists($filecnt)) {
                  $fp = fopen($filecnt,"r");
                  $count = (int)fread($fp,24);
                  fclose($fp);
                  $count++;
                  } else {
                  $count = 1;
                  }
                  $fp = fopen($filecnt , "w");
                  fwrite($fp,$count);
                  fclose($fp);
                  echo $count;
                  ?>

                  3. Save this as counter.php

                  4. Upload it to your HTML Documents folder on your FTP server.

                  5. Now, Insert HTML into your page in BlueVoda.

                  6. Paste this in the HTML box:

                  <IFRAME name="inlineframe" src="counter.php" width=122 height=40 marginwidth=0 marginheight=0 frameborder=0 scrolling=no></IFRAME>

                  7. Adjust your the size of the IFRAME using Width and Height.

                  8. Publish the page and check to see if it works!

                  -- I Hope this Works for You! --
                  The Eagle Radio! Playing the Best Hits From Rock to Oldies!

                  Click Here to Tune In Using Winamp Player!

                  Click Here to Tune in Using Real Player!

                  Comment

                  Working...
                  X