login  Naam:   Wachtwoord: 
Registreer je!
 Scripts:

Scripts > PHP > Link/Download systemen > Linktoevoeg systeem(simpel)

Linktoevoeg systeem(simpel)

Auteur: sasser - 31 augustus 2004 - 12:59 - Gekeurd door: Dennisvb - Hits: 10145 - Aantal punten: 3.17 (6 stemmen)



Dit simpele script is om mensen links aan je site toevoegen.

Code:
########## Database tabel ##########

  1. CREATE TABLE links (
  2. id int(2) NOT NULL auto_increment,
  3. titel varchar(255) NOT NULL default '0',
  4. url text NOT NULL default '',
  5. PRIMARY KEY (id)
  6. ) TYPE=MyISAM;



########## Config.php ##########

  1. <?php
  2. mysql_connect ("localhost","nickname","password");
  3. mysql_select_db("db_name");
  4. ?>


########## Links.php ##########

  1. <?php
  2. require ('config.php');
  3. $sql = "SELECT * FROM links ORDER BY id DESC";
  4. $query = mysql_query($sql) or die(mysql_error());
  5. ?>
  6. </font></p>
  7. <table width="100%" border="0" cellpadding="0" cellspacing="0" bordercolor="#FF0000">
  8. <tr>
  9. <td width="66%" align="center">&nbsp;</td>
  10. </tr>
  11. <?php
  12. include('config.php');
  13. $sql = "SELECT * FROM links ORDER BY id ASC";
  14. $query = mysql_query($sql) or die(mysql_error());
  15. while ($obj = mysql_fetch_object($query)){
  16. echo '
  17. <tr>
  18. <td width="100%"><center><font
  19. size="4"><a href="'.$obj->url.'">'.$obj->titel.'</font></a><center</td>
  20. </tr>';}?>
  21. </table>
  22. <p align="center"> <font face="Mirror">
  23. <?php
  24. include ("config.php");
  25.  
  26. if ($_POST['Registreer'])
  27. { $datum =date('d/m/Y'); //datum
  28. $check_url=mysql_query("SELECT url FROM links WHERE url='$url'") or die (mysql_error());
  29. $aantal_url=mysql_num_rows($check_url);
  30. if ($aantal_url > 0)
  31. $error = "De url is al in gebruik";
  32. $check_titel=mysql_query("SELECT titel FROM links WHERE titel='$titel'") or die (mysql_error());
  33. $aantal_titel=mysql_num_rows($check_titel);
  34. if ($aantal_titel > 0)
  35. $error = "Deze titel is al in gebruik";
  36. if (!$error)
  37. { //als er geen error is dan maken we de query
  38. $query ="INSERT INTO links (titel, url)
  39. VALUES ('$titel', '$url')";
  40.  
  41. mysql_query($query) or die (mysql_error());
  42. //query uitoefenen
  43.  
  44. echo"<div align=center>Je link is toegevoegd<br></div>";
  45.  
  46. } elseif ($error) {
  47. ?>
  48. </font></p>
  49. <div align="center">
  50. <table width="51%" border="1" cellspacing="0" cellpadding="2">
  51. <tr>
  52. <td bordercolor="#000000" bgcolor="#990000" height="36"> <div align="center">
  53. <p><font color=black size=-1 face=Mirror><b><?php echo $error; ?></b></font></p>
  54. </div>
  55. <form method="post" action="javascript:history.go(-1)">
  56. <div align=center> <font face="Mirror">
  57. <input type="submit" name="Terug" value="Terug">
  58. </font></div>
  59. </form></td>
  60. </tr>
  61. </table>
  62. <font face="Mirror">
  63. <?php
  64. }
  65. }
  66. if (!$_POST['Registreer'])
  67. { ?>
  68. </font>
  69. <form method="post" action="">
  70. <div align="center"><font size="4" face="Mirror">Titel</font> <font face="Mirror"><br>
  71. <input name="titel" type="text"
  72. size="20" maxlength="20">
  73. </font>
  74. <p></p>
  75. </div>
  76. <p align="center"> <font face="Mirror"><strong>Url</strong> <br>
  77. <input name="url" type="text" value="http://"
  78. size="35" maxlength="500">
  79. </font></p>
  80. <p align="center"> <font face="Mirror">
  81. <input type="submit" name="Registreer" value="Voeg link toe">
  82. </font></p>
  83. <div align="center"></div>
  84. </form>
  85. <font face="Mirror">
  86. <?php } ?>
  87. </font>

Download code! Download code (.txt)

 Bekijk een voorbeeld van dit script!
 Stemmen
Niet ingelogd.

 Reacties
Post een reactie
Lees de reacties (4)
© 2002-2024 Sitemasters.be - Regels - Laadtijd: 0.044s