heelo all im bow and Iv come on this forum for all your experties to help please.


Thanks all

bow

Heelo Bow, nice to meet you :)

cheers thanks maceman

I was wondering if you could help me with a problem.
As I just sorted out a loging scritp to. I can't seem to add a downloading counter within the members page. So say for example after when the user logs and then wants to view the speacial page the download counter should appear but it is not apperaing and need to some help intgrating it. The code shown below.

This is the page that comes up after when the user has loged in.

PHP Syntax (Toggle Plain Text)

   1.
      <?php
   2.
      session_name('tzLogin');
   3.
      session_set_cookie_params(2*7*24*60*60);
   4.
      session_start();
   5.
      ?>
   6.
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
   7.
      <html xmlns="http://www.w3.org/1999/xhtml">
   8.
      <head>
   9.
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  10.
      <title>Partners Area</title>
  11.
      <link rel="stylesheet" type="text/css" href="demo.css" media="screen" />
  12.
      </head>
  13.
      <body>
  14.
      <div id="main">
  15.
      <div class="container">
  16.
      <h1>Partners Area</h1>
  17.
      <h2>Login to view this resource!</h2>
  18.
      </div>
  19.
      <div class="container">
  20.
      <?php
  21.
       
  22.
      if($_SESSION['id'])
  23.
      echo '<h1>Hello, '.$_SESSION['usr'].'! You are logged in!</h1>';
  24.
      else echo '<h1>Please, <a href="demo.php">login</a> and come back later!</h1>';
  25.
       
  26.
      ?>
  27.
      </div>
  28.
      <div class="container tutorial-info"> Please click here to return back to the main page to logout <a href="http://www.sumwebsite.org.uk/logster/demo.php" target="_self">Main Partners Page</a>.</div>
  29.
      </div>
  30.
      </body>
  31.
      </html>

I want to integrate this page within the above code:

PHP Syntax (Toggle Plain Text)

   1.
      <?php
   2.
       
   3.
      error_reporting(E_ALL^E_NOTICE);
   4.
       
   5.
      require 'connectdm.php';
   6.
       
   7.
      $extension='';
   8.
      $files_array = array();
   9.
       
  10.
       
  11.
      /* Opening the thumbnail directory and looping through all the thumbs: */
  12.
       
  13.
      $dir_handle = @opendir($directory) or die("There is an error with your file directory!");
  14.
       
  15.
      while ($file = readdir($dir_handle))
  16.
      {
  17.
      /* Skipping the system files: */
  18.
      if($file{0}=='.') continue;
  19.
       
  20.
      /* end() returns the last element of the array generated by the explode() function: */
  21.
      $extension = strtolower(end(explode('.',$file)));
  22.
       
  23.
      /* Skipping the php files: */
  24.
      if($extension == 'php') continue;
  25.
       
  26.
      $files_array[]=$file;
  27.
      }
  28.
       
  29.
      /* Sorting the files alphabetically */
  30.
      sort($files_array,SORT_STRING);
  31.
       
  32.
      $file_downloads=array();
  33.
       
  34.
      $result = mysql_query("SELECT * FROM download_manager");
  35.
       
  36.
      if(mysql_num_rows($result))
  37.
      while($row=mysql_fetch_assoc($result))
  38.
      {
  39.
      /* The key of the $file_downloads array will be the name of the file,
  40.
      and will contain the number of downloads: */
  41.
       
  42.
      $file_downloads[$row['filename']]=$row['downloads'];
  43.
      }
  44.
       
  45.
      ?>
  46.
       
  47.
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  48.
      <html xmlns="http://www.w3.org/1999/xhtml">
  49.
      <head>
  50.
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  51.
      <title></title>
  52.
       
  53.
      <link rel="stylesheet" type="text/css" href="dm.css" />
  54.
      <link rel="stylesheet" type="text/css" href="fancybox/jquery.fancybox-1.2.6.css" media="screen" />
  55.
       
  56.
      <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
  57.
      <script type="text/javascript" src="script.js"></script>
  58.
       
  59.
      </head>
  60.
       
  61.
      <body>
  62.
      <div id="file-manager">
  63.
       
  64.
      <ul class="manager">
  65.
      <?php
  66.
       
  67.
      foreach($files_array as $key=>$val)
  68.
      {
  69.
      echo '<li><a href="download.php?file='.urlencode($val).'">'.$val.'
  70.
      <span class="download-count" title="Times Downloaded">'.(int)$file_downloads[$val].'</span> <span class="download-label">download</span></a>
  71.
      </li>';
  72.
      }
  73.
       
  74.
      ?>
  75.
      </ul>
  76.
       
  77.
      </div>
  78.
      </body>
  79.
      </html>

Anyhelp would be good and much apprecieated.

Kind Regards

Bow103

I have also tryed this;

echo file_get_contents("dm.php");

but i get an error or shows some php code

# $val) { echo ''.$val.' '.(int)$file_downloads[$val].' download
'; } ?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.