Advertisement
RieqyNS13

help 1

Oct 28th, 2012
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.93 KB | None | 0 0
  1. <?php
  2. $judul = null;
  3. $author = null;
  4. $date = null;
  5. $link = @mysql_connect('127.0.0.1', 'root', '') or die("Gagal menyambung server");
  6. mysql_set_charset('utf8', $link);
  7. if(!(@mysql_select_db('cms', $link))){
  8. $result = "Gagal menyambung database";}
  9. $query = mysql_query("SELECT * FROM cms;");
  10. while($hasil = mysql_fetch_array($query)){
  11. $judul.= "&bull;<a href=".$_SERVER['PHP_SELF']."?id=".$hasil['id'].">".$hasil['judul']."</a><br>";
  12. }
  13.  
  14. if(!isset($_GET['id'])){
  15. $get = null;
  16. $row = null;
  17. $title = null;
  18. }else{
  19. $get = abs((int) $_GET['id']);
  20. $query2 = mysql_query("SELECT * FROM cms WHERE id=$get;");
  21. while($row = ($cek=@mysql_fetch_array($query2))){
  22. if(!($get)){
  23. $content = "Not Found !";
  24. $title = "Not Found";}else{
  25. $content =  $row['content'];
  26. $title = $row['judul'];
  27. $author = $row['author'];
  28. $date = $row['tanggal'];
  29. }}
  30. }
  31. ?>
  32. <html>
  33. <head>
  34. <meta name="author" content="RieqyNS13">
  35. <meta http-equiv="Content-type" content="text/html;charset=UTF-8">
  36. <style type="text/css">
  37. body, td{
  38. background-color:#000;
  39. color:#0F0;
  40. font-family:"Courier New";
  41. }
  42. table#tbl1{
  43. border:solid #0F0 2px;
  44. width:200px;
  45. padding:2;
  46. text-align:center;
  47. text-decoration:none;
  48. length:1000px;
  49. }
  50. table#tbl2{
  51. border:solid #0F0 2px;
  52. width:1000px;
  53. text-align:left;
  54. }
  55. table td{
  56. color:#0F0;
  57. border-spacing:5px;
  58. font-size:12px;
  59. text-decoration:none;
  60. text-align:left;
  61. }
  62. a:link{
  63. color:#060;
  64. text-decoration:none;
  65. }
  66. a:visited{
  67. color:#060;
  68. text-decoration:none;
  69. }
  70. a:hover{
  71. color:#060;
  72. text-decoration:underline;
  73. }
  74. a:active{
  75. color:#060;
  76. text-decoration:none;
  77. }
  78. </style>
  79. <title><?php echo $title; ?></title>
  80. </head>
  81. <body>
  82. <table id="tbl1">
  83. <th>Content</th>
  84. <tr><td><?php echo $judul; ?></td></tr>
  85. </table>
  86. &nbsp;<table id="tbl2">
  87. <tr><td>Author  : <?php echo $author; ?></td></tr>
  88. <tr><td>Tanggal: <?php echo $date; ?></td></tr>
  89. <tr><td>Content: </td></tr>
  90. <tr><td><?php echo $content; ?></td></tr>
  91. </table>
  92. </body>
  93. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement