/new/PHPtemplate/formtimkiem.php
PHP | 178 lines | 146 code | 19 blank | 13 comment | 17 complexity | dd86cdfd8b5efaa0ca2327a66ead365c MD5 | raw file
- <div id="hightsearch">
- <form action="index.php?mode=search" method="post" name="timkiem">
- <div>
- <table width="400px">
-
- <tr>
- <td width="100px">Tęn manga </td>
- <td> <input type ="text" id ="txtMangaName" name="txtMangaName" width="120"/></td>
- </tr>
- <tr>
- <td width ="100px">Tác gi? </td>
- <td> <input type ="text" id="txtAuthor" name="txtAuthor" width="120"/></td>
- </tr>
- </table>
- </div>
- <div>
- <label>Xem nh?ng manga ?ă hoŕn t?t</label>
- <input name="checkboxht" type='checkbox' value="1" />
- </div>
- <?php
- include('PHPSource/dbconfig.php');
- $strSQL2 = "select * from category";
- $result2 = mysql_query ($strSQL2,$connection);
- $i = 0;
- while ($row = mysql_fetch_array($result2))
- {
- echo "<div>";
- echo "<input name='checkid[]' type='checkbox' value='$row[0]' />";
- echo "<label>" . $row['CategogyName'] . "</label>";
- echo "</div>";
- $i++;
- }
- ?>
- <div>
- <tr>
- <td>
- <input type="submit" name="Search" id="search" value="Search" class="serbutton"/>
- </td>
- </tr>
- </div>
- </form>
- </div>
- <?php
- $flag = false;
- session_start();
- $strTmp ="";
- if(isset($_POST["Search"]))
- {
- $flag = true;
- $TenMG = $_POST["txtMangaName"];
- //echo "TenMG";
- $TenTG=$_POST["txtAuthor"];
- //echo "TenTG";
- $cbHT = $_POST["checkboxht"] ;
- if ((isset($_POST['checkid'])) && ($_POST['checkid'] != ""))
- {
- $count = $_POST['checkid'];
-
- foreach($count as $key=>$value)
- {
- $strTmp .= " or (categogyId = '$value')";
- }
- }
- }
-
-
-
-
- $strSubSQL = "";
-
-
- if (!empty ($TenMG))
- {
- $strSubSQL .= " and MangaName like '%$TenMG%' ";
-
- }
- if (!empty ($TenTG))
- {
- $TenTG = trim($TenTG);
- $strSubSQL .= " and Author like '%$TenTG%' ";
-
- }
- if($cbHT == 1)
- {
- $strSubSQL .= "and Status = '0'";
- }
-
- //echo "$strSubSQL";
-
-
-
- //echo "$strTmp";
- if( $strTmp == "")
- {
- $strmanga = "select MID from catagorylist";
- }
- else
- {
- $strmanga = "select MID from catagorylist where categogyID = '-1'" .$strTmp;
-
- }
- //echo "$strSubSQL";
- ///////////////New///////////////////////////
-
- $strSQL = "select * from Manga where (MID in (" . $strmanga . "))" .$strSubSQL ;
- ////////////////////////////////////////////////////////////////////////////////////////
- //echo "$strSQL";
- $connection = mysql_connect ("localhost","root","");
- if (!$connection)
- {
- die('Not connected : ' .mysql_error());
- }
- $issuccess = mysql_select_db("db_manga",$connection);
- if(!$issuccess)
- {
- die('Can not selected database :' .mysql_error());
- }
- $result = mysql_query ($strSQL,$connection);
- $Count = mysql_num_rows($result);
- if($Count ==0)
- {
- echo "<div class = \"alert\">";
- echo "Không těm th?y k?t qu? nŕo!!!Xin th? l?i v?i key word khác!!";
- echo "</div>";
- }
- else
- {
- //echo "<div class = \"alert\">";
- //echo "?ă těm th?y $Count k?t qu? cho t? khóa nŕy!!!";
- //echo "</div>";
- //echo "<h2 align ='center'>?ă těm th?y $Count k?t qu? cho t? khóa nŕy!!!</h2> <br>";
- if($flag == true)
- {
- echo "<div class = \"alert\">";
- echo "?ă těm th?y $Count k?t qu? cho t? khóa nŕy!!!";
- echo "</div>";
- echo "<div id='mainContent'>";
- echo "<div class='maininside'>";
- echo "<div id='mangalist'>";
- echo " <table class='sample'>";
- echo" <tr >";
- echo "<th>Tęn manga</th>";
- echo "<th>Ngŕy thęm</th>";
- echo "<th>S? chap</th>";
- echo "</tr>";
-
-
- $Cout = mysql_num_rows($result);
- for($i=0;$i<$Cout;$i++)
- {
- $row = mysql_fetch_array($result);
- $tenManga = $row[1];
- $DateAdded = $row[2];
- $mid = $row[0];
- $DateAdded=strtotime($DateAdded);
- $DateAdded=date("d-m-Y",$DateAdded);
- $sql_1 = "select count(*) from chapter where MID = $mid";
- $result_1 = mysql_query($sql_1);
- $row_1 = mysql_fetch_array($result_1);
- $chap_num = $row_1[0];
- echo "<tr><td class='images'><p><a href='index.php?mode=chitietmanga&id=$row[0]'>";
- echo"$tenManga"." ";
- echo"<span class='new'>new</span></td></p><td width=\"150\">";
- //echo"<span class='hot'>hot</span></td></p> //lop truyen hot
- echo "$DateAdded";
- echo "</td>";
- echo "<td> $chap_num chap</td>";
- echo "</tr>";
- }
- mysql_close($connection);
-
- echo"</table>";
- echo"</div>";
- echo"</div>";
- echo"</div>";
- }
- }
- ?>