2015-05-29 60 views
-1

想知道如何将线程结合到部分。当我编写新主题发布在家庭和所选分区时如何添加到节[ID],例如如何整合主题和<il>

www.site.com/[Section[id]/[post[ID]

Add_post.php

<html> 
<head> 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    <title>Add New Post</title> 
    <style type="text/css">body{background-color: grey} 
     .border{ 
      border: 5px solid blue; 

      border-width:30px ; 
     }</style> 
</head> 

<?php 
require_once("../clude/conn.php"); //Calls in the previous file we created 

// form not yet submitted 
// display initial form 
if (!$submit) 
{ 

    ?> 
    <center> 

     <div class="border" style=" direction:rtl;margin-right:10px;"> 
      <h1 style="color: red;">Add New Post</h1> 
      <br> 
      <form action="<? echo $PHP_SELF; ?>" method="POST"> 
       <input type="hidden" name="id" value="id"> 
       <h4 style="color: aqua">Title</h4> 
       <input style="border-radius: 5px;color: red;" size="50" maxlength="60" type="text" name="title"><br /> 

       <h4 style="color: aqua">Content</h4> 
       <textarea style="width: 60%; height: 400px" name="content" cols="38" rows="10"></textarea> <br /> 
       <h4 style="color: aqua">Author</h4> 
       <input style="border-radius: 5px;color: red;" size="50" maxlength="250" type="text" name="author"> <br /> 
       <br /> <input style="border: 2px dashed deepskyblue" type="Submit" name="submit" value="Add"> 
      </form> 
     </div> 
    </center> 

<? 

} else { 

//set up error array 
    $err = array(); 
    $count = 0; 

    //validate the user text input fields 
    if (!$title) { $err[$count] = "Invalid entry: title"; $count++; } 

    if (!$content) { $err[$count] = "Invalid entry: content"; $count++; } 

    if (!$author) { $err[$count] = "Invalid entry: author"; $count++; } 

    // if no error found... 
    if (sizeof($err) == 0) { 

     // generate and execute query to insert the post 
     $query = "INSERT INTO exploit(id,title, content, author, date) VALUES(0,'$title', '$content', '$author', NOW())"; 
     $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error()); 

     // print result 
     echo "<center><h1 style='color: aqua'>Post Added</h1><br /><h1 style='color: red'><a href='index.php'>Go To Home</a></h1></center>."; 
    } else { 
     // errors found 
     // print as list 
     echo "<center><h1 style='font-size:100px;color: aqua; text-shadow: 4px 1px 15px red;'>Error in Form</h1></center>"; 
     echo "<ul>"; 
     for ($x=0; $x<sizeof($errorList); $x++) { 
      echo "<li>$errorList[$x]"; 
     } 
     echo "</ul></font>"; 
    } 
} 
?> 

的index.php

<html> 
<head> 
    <meta charset="UTF-8"> 
    <title>Exploit | Database</title> 
    <meta name='keywords' content='exploit,local,remote,arab,lfi,sql injection,buffer overflow,dos,ddos, priv8 exploit, 0day exploit, 2.6.18 kernel exploit 0day, localroot, priv8 exploit, how to deface, hack, how to hack, exploits, 0day exploits , x00x_team , '> 
    <meta name='description' content='Exploit Database Vulnerability reports, 0days, remote exploits, local exploits, security articles, tutorials and more.'> 
    <link rel="stylesheet" type="text/css" href="themes/default/style/style9.css" media="all"> 
    <link rel='stylesheet' href='themes/system.css'> 
    <script src="jquery.min.js"> </script> 
    <style type="text/css"> 
     body{  background:url(img/bg.png) !important; } 
#code { 
padding:5px; 
border:1px dashed; 
background-color:#353535; 

direction: ltr; 
text-align: left; 
height:250px; 
overflow-y:scroll; 
} 
textarea{ 
background-color:#353535; 
color: red; 
border-shadow: 4px 1px 18px white; 
height:100%; 
width:100%; 
} 
    </style> 

    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> 
    <script src="typed.js" type="text/javascript"></script> 
    <script> 
     $(function(){ 

      $("#typed").typed({ 
       strings: ["welcome in <strong>Database</strong> Exploit.", "we <em>have</em> Big Database Exploit.", "And How Close It", "Enjoy in Site!"], 
       typeSpeed: 30, 
       backDelay: 500, 
       loop: false, 
       contentType: 'html', // or text 
       // defaults to false for infinite loop 
       loopCount: false, 
       callback: function(){ foo(); }, 
       resetCallback: function() { newTyped(); } 
      }); 

      $(".reset").click(function(){ 
       $("#typed").typed('reset'); 
      }); 

     }); 

     function newTyped(){ /* A new typed object */ } 

     function foo(){ console.log("Callback"); } 

    </script> 
    <link href="main.css" rel="stylesheet"/> 
    <style> 
     /* code for animated blinking cursor */ 
     .typed-cursor{ 
      opacity: 1; 
      font-weight: 100; 
      -webkit-animation: blink 0.7s infinite; 
      -moz-animation: blink 0.7s infinite; 
      -ms-animation: blink 0.7s infinite; 
      -o-animation: blink 0.7s infinite; 
      animation: blink 0.7s infinite; 
     } 
     @-keyframes blink{ 
     0% { opacity:1; } 
     50% { opacity:0; } 
     100% { opacity:1; } 
     } 
     @-webkit-keyframes blink{ 
      0% { opacity:1; } 
      50% { opacity:0; } 
      100% { opacity:1; } 
     } 
     @-moz-keyframes blink{ 
      0% { opacity:1; } 
      50% { opacity:0; } 
      100% { opacity:1; } 
     } 
     @-ms-keyframes blink{ 
      0% { opacity:1; } 
      50% { opacity:0; } 
      100% { opacity:1; } 
     } 
     @-o-keyframes blink{ 
      0% { opacity:1; } 
      50% { opacity:0; } 
      100% { opacity:1; } 
     } 
    </style> 
    <link rel="icon" href="Radiation.ico" type="image/ico" sizes="16x16"> 
</head> 
<body><style> 
    #wg-rosebar { 
     width:100%; 
     position:fixed; 
     top:0; 
     left:0; 
    } 

    #wg-rosebarbtm { 
     border-bottom:3px solid #000; 
     background-color:#7f103c; 
     overflow:none; 
     width:100%; 
     height:40px; 
     position:fixed; 
     top:0; 
     left:0; 
    } 

    #wg-rosebarbtmdata { 
     color:#fff; 
     padding:5px; 
    } 

    #wg-rosebarbtmhide { 
     position:absolute; 
     top:4px; 
     right:12px; 
     width:20px; 
     height:20px; 
     cursor:pointer; 
    } 

    #wg-rosebarbtmshow { 
     position:absolute; 
     top:0; 
     right:5px; 
     width:30px; 
     height:25px; 
     cursor:pointer; 
     background-color:#F60; 
     padding-top:5px; 
     border-bottom:3px solid #000; 
     border-left:3px solid #000; 
     border-right:3px solid #000; 
     border-bottom-right-radius:5px; 
     border-bottom-left-radius:5px; 
    } 

    .wg-rosebarbtmdownarrow { 
     width:0; 
     height:0; 
     border-left:10px solid transparent; 
     border-right:10px solid transparent; 
     border-top:10px solid #CC5200; 
    } 

    .wg-rosebarbtmblock { 
     width:8px; 
     height:10px; 
     background-color:#CC5200; 
    } 

    .wg-rosebarbtmuparrow { 
     width:0; 
     height:0; 
     border-left:10px solid transparent; 
     border-right:10px solid transparent; 
     border-bottom:10px solid #CC5200; 
    } 
</style> 
<div id="wg-rosebar" > 
    <div id="wg-rosebarbtm" > 
     <style> 

      .wg-ribmenu span { 
       background:#7f103c; 
       display:inline-block; 
       color:#FFFFFF; 


       line-height:40px; 
       padding:0 1em; 
       margin-top:0.0em; 
       position:relative; 
       -webkit-transition: background-color 0.2s, margin-top 0.2s; 
       -moz-transition: background-color 0.2s, margin-top 0.2s; 
       -ms-transition: background-color 0.2s, margin-top 0.2s; 
       -o-transition: background-color 0.2s, margin-top 0.2s; 
       transition: background-color 0.2s, margin-top 0.2s; 
      } 
      .wg-ribmenu a:hover span { 
       background:#FFD204; 
       margin-top:0; 

      } 
      .wg-ribmenu span:before { 
       content: ""; 
       position:absolute; 
       top:40px; 
       right:0; 
       border-left:0.5em solid #9B8651; 
       border-bottom:0.5em solid #7f103c; 
      } 

      .wg-ribmenu span:after { 
       content: ""; 
       position:absolute; 
       top:40px; 
       left:0; 
       border-right:0.5em solid #9B8651; 
       border-bottom:0.5em solid #7f103c; 
      } 
      .wg-ribmenu a:link, .wg-ribmenu a:visited { 
       color:#000; 
       text-decoration:none; 
       float:right; 
       height:40px; 
       overflow:hidden; 
      } 

     </style> 

     <div class='wg-ribmenu'> 
      <a href='/index.html'><span><img class="fa-fa-home"/></span></a> 
      <a href='admin/index.php'><span>Add Post</span></a> 
     </div> 

    </div></div> 
<div class="wrap"> 
    <h1 class="h1" style="color: #ff0000">Welcome in Database</h1> 

    <div class="type-wrap"> 
     <span id="typed" style="white-space:pre;"></span> 
    </div> 
<div class='body'><h1 class='title'><a class='teko' href='index.php' title='Exploit Big Database'>Posts</a></h1><table border='1' align='center' width='98%'> 
    <tr class='trhead'> 
     <td width='10%'>Date</td> 
     <td class='left'>Title</td> 
     <td width='12%'>Author</td> 

    </tr> 
     <?php 

     include_once 'clude/conn.php'; 
     $sql = "SELECT * FROM exploit"; 

     $q = mysql_query($sql); 

     $num_row = mysql_num_rows($q); 
     while($articles = mysql_fetch_array($q)) { 

      ?> 


      <tr class="exploit"> 
       <td><?php echo $articles['date'];?></td> 
       <td><a href="exploit.php?id=<?php echo $articles['id']; ?>"><?php echo $articles['title']; ?></a></td> 
       <td><?php echo $articles['author'];?></td> 
      </tr> 


     <?php 
     } 

     mysql_close(); 
     ?> 
    </table> </div> </div> 
</body> 
</html> 
+0

首先。你应该更新你的代码来使用mysqli或者pdo,而不是使用已过时的mysql,并且很快会被删除。第二点:我无法得到你想要做的事情:在你的索引页面你列出了数据库中的所有帖子,所以线程在哪里进场? –

+0

是的,我知道我会使用pdo,但我键入mysql,例如 我解决了这个问题,我将发布我的解决方案 –

+0

请发布您的真实代码并详细解释您的问题。 –

回答

0

解决是:

<?php 
    include_once 'clude/conn.php'; 
    $sql = "SELECT * FROM posts"; 
    $q = mysql_query($sql); 

    $num_row = mysql_num_rows($q); 
    while($articles = mysql_fetch_array($q)) { 
     ?> 
     <div class="row"><div class="col-md-12"><div class="boxed"> 
        <a href="show_posts.php?post=<?php echo $articles['id']; ?> "> <h1><?php echo $articles['title']; ?></h1></a> 
        <p><?php echo $articles['description']; ?></p> 
        <hr> 
        <?php 
        include_once 'clude/conn.php'; 
        $sql = "SELECT * FROM store"; 
        $w = mysql_query($sql); 

        $num_row = mysql_num_rows($w); 
        while($imagee = mysql_fetch_array($w)) { 
         ?> 

         <img src="<?php echo $imagee['image']; ?>"> 

        <?php 
        } 
        ?> 
        <hr> 


       </div></div></div> 


    <?php 
    } 


    mysql_close(); 
    ?> 

show_cat.php /示例

<tr class="exploit"> 
     <td><?php echo $ar['date']; ?></td> 
     <td><a href="exploit.php?id=<?php echo $ar['id']; ?>"><?php echo $ar['title']; ?></a></td> 
     <td><?php echo $ar['author']; ?></td> 
    </tr> 

    <?php 
    } 


    mysql_close(); 
    ?>