downloads-script

Gesponsorde koppelingen

PHP script bestanden

  1. downloads-script

« Lees de omschrijving en reacties

config.php

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
<?php
//session_start();    <---- Handig voor als je sessions gebruikt, staat het altijd boven aan je pagina! :)
//Bij dit script is het niet nodig.

 
$host = "localhost";
$username = "USERNAME";
$password = "PASSWORD";
$db = "DATABASE";
@
mysql_connect($host,$username,$password) or die ("error");
@
mysql_select_db($db) or die("error");
?>



downloads_cats.php

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?
require("config.php");

$sql = "SELECT DISTINCT(`category`) FROM `downloads`";
$res = mysql_query($sql);


if (mysql_num_rows($res) >= 1)
    {

    while ($row = mysql_fetch_array($res))
    {

$category=$row['category'];
echo "<a href='downloads_overview.php?category=$category'>$category</a><br>";
    }    
    

}

            
        
        else
        {
            echo "There are no downloads yet.";
            }

            ?>


downloads_overview.php

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?
require("config.php");

$category = $_GET['category'];

$sql = "SELECT * FROM downloads WHERE category = '$category'";
$res = mysql_query($sql);

while ($overview = mysql_fetch_array($res))
{


echo "<a href='download.php?id=$overview[id]'>$overview[downloadname]</a>by $overview[postedby] at $overview[postedat]<br>";
}

?>


download.php

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?
require("config.php");



$id = $_GET['id'];

$sql = "SELECT downloadname,description,postedby,DATE_FORMAT(postedat, '%d/%m/%Y %T') AS postedat ,link,category FROM downloads WHERE id = $id";
$res = mysql_query($sql);

while ($download = mysql_fetch_array($res))
{

?>


<table width="300" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><div align="center">
      <table width="100%"  border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td><div align="center"><strong><?=$download['downloadname']; ?></strong></div></td>
        </tr>
      </table>
      <table width="100%"  border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="34%">By:</td>
          <td width="66%"><div align="right"><?=$download['postedby']; ?></div></td>
        </tr>
      </table>
      <table width="100%"  border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td>At:</td>
          <td><div align="right"><?=$download['postedat']; ?></div></td>
        </tr>
      </table>
      <table width="100%"  border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td>Category:</td>
          <td><div align="right"><?=$download['category']; ?></div></td>
        </tr>
      </table>
            <table width="100%"  border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td><div align="center">Description:</div></td>
        </tr>
        <tr>
          <td><?=nl2br($download['description']); ?></td>
        </tr>
      </table>
      <table width="100%"  border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td><div align="center">Links:</div></td>
        </tr>
        <tr>
          <td><?=nl2br($download['link']); ?></td>
        </tr>
      </table>
        </div></td>
  </tr>
</table>

<?
}
?>

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.