| Server IP : 103.48.194.25 / Your IP : 216.73.217.33 Web Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.33 System : Linux VMHostDefault 3.10.0-1160.42.2.el7.x86_64 #1 SMP Tue Sep 7 14:49:57 UTC 2021 x86_64 User : sieuthimay ( 1016) PHP Version : 8.2.20 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/nhadatkhangdien.net-bk/public_html/ |
Upload File : |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php
error_reporting(E_ALL) ;
//$web = new makeIndex("216.246.1.27","ypvnvn_ypvn","bhnq65s","ypvnvn_yellowpages") ;
$web = new makeIndex("localhost","meg54475","mB@dfg78@#","nhadatkhangdien") ;
$act = isset($_REQUEST["act"]) ? htmlspecialchars($_REQUEST["act"]) : '';
switch ($act){
case "doedit":
$web->do_edit();
break;
default:
$web->showform(0,"Hãy nhập số dòng update") ;
}
class makeIndex
{
var $sqlSelect = '' ;
var $sqlUpdate = '' ;
function showform($num=0,$msg='Hãy nhập số lần update.')
{
echo '
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<form name="form1" method="post" action="?act=doedit">
<table width="40%" border="1" align="center" cellpadding="5" cellspacing="2" bordercolor="#FFFFFF" bgcolor="#CCCCCC">
<tr>
<th colspan=2>'.$msg.' </th>
</tr>
<tr>
<td align="right">Num:</td>
<td><input name="num" type="text" id="num" size="17" value='.$num.'></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Submit" value="Submit"></td>
</tr>
</table>
</form> ';
echo '<script language="javascript">
if(document.getElementById("num").value != 0) {
document.form1.submit() ;
}
</script>';
}
function do_edit()
{
$num = isset($_REQUEST["num"]) ? intval($_REQUEST["num"]) : 10 ;
$sql = "select * from table_product where noidung=''" ;
$sql = $sql." LIMIT 0,".$num ;
$result = $this->mysqli->query($sql) or die($sql) ;
$count = $result->num_rows; //trit($count);
if($count > 0 )
{
while($rs=$result->fetch_object())
{
$this->mysqli->set_charset("utf8");
$sql1 = "select * from table_baivietsp where id_product ='".$rs->id."' order by stt" ;
$result1 = $this->mysqli->query($sql1) or die($sql1) ;
//$rs1=$result1->fetch_object();
$str = '' ;
while($rs1=$result1->fetch_object())
{
$str .= '<h3>'.$rs1->ten .'</h3>'.$rs1->noidung ; //trit($str);
}
$str = $str? $str : 1 ;
$sql_update = "UPDATE table_product SET noidung='".$str."' where id='".$rs->id."'" ;
$this->mysqli->query($sql_update) or die($this->mysqli->error.'<br>Not update'.$sql_update);
}
}
else $num = 0 ;
$result->close(); //trit($sql_update) ;
$msg = 'Hãy nhập số lần update';
$this->showform($num,$msg) ;
}
/*function update_flag($id)
{
$sql = 'update class set flag=1 where class_id="'.$id.'"' ;
mysqli_query($sql) or die('not update flag') ;
}*/
function makeIndex($host,$user,$pass,$data)
{
$this->mysqli = new mysqli($host,$user,$pass,$data) ;
}
}
/*Function phụ trợ*/
function trit($o="", $num=0)
{
echo "<pre>" ; print_r($o) ;
if($num==0) die();
}
?>