Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Ham xu ly thoi gian. VD: 20140212 -> 2014/02/12
- function format_date2($input){
- //$input = "20140215";
- $nam = substr($input,0,4);
- $thang = substr($input,-4,2);
- $ngay = substr($input,-2,2);
- $output = $nam . "/" . $thang . "/" . $ngay;
- return $output;
- }
- // Ham lay chuoi cuoi. VD: spain/la-liga-highlights -> la-liga-highlights
- function getStrEnd($strInput){
- if (strlen($strInput)<1){
- return "null";
- }
- $mang = explode("/", $strInput);
- if ( strlen($mang[count($mang)-1])<1 ){
- return $mang[count($mang)-2];
- } else {
- return $mang[count($mang)-1];
- }
- }
- // Truyen tham so vao
- include "ClassDownload.php";
- require '/var/www/9football.net/wp-config.php';
- $conn = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD) or die("Can't connect this database");
- mysql_select_db(DB_DATABASE, $conn);
- $sql = "SELECT * FROM ourmatch WHERE LENGTH(videoserver1)<5";
- $result = mysql_query($sql);
- if ($result) {
- // select thanh cong
- while ($row = mysql_fetch_array($result)) {
- $i++;
- echo "<br><br><br>";
- echo $i . " " . $row["ten"];
- $downlink = $row["video1"];
- $thumuc = format_date2($row["thoigian"]) . "/" . getStrEnd($row["chuyenmuc"]);
- echo "<br>";
- echo $thumuc;
- $down = new ClassDownload($downlink, $thumuc);
- $linkserver = $down->getLinkdaup();
- echo "<br>";
- echo $linkserver;
- $pid = $row["pid"];
- $sqlupdate = "UPDATE ourmatch SET videoserver1='$linkserver' WHERE pid='$pid'";
- mysql_query($sqlupdate);
- }
- if ($i<1){
- echo "<br>Khong them bai viet nao do khong co bai viet moi<br>";
- }
- } else {
- echo "Sai cau lenh SQL";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment