Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Ham xu ly thoi gian
- function format_date($input){
- //$input = "20140215";
- $nam = substr($input,0,4);
- $thang = substr($input,-4,2);
- $ngay = substr($input,-2,2);
- $output = $ngay . "/" . $thang . "/" . $nam;
- return $output;
- }
- // Ham lay ID chuyen muc
- function getIDChuyenMuc($ten){
- $input = $ten;
- $output = 1;
- if ($input == "germany/bundesliga-highlights") {
- //$output = 4;
- $output = "Bundesliga";
- }
- if ($input == "spain/la-liga-highlights") {
- //$output = 3;
- $output = "La Liga";
- }
- if ($input == "france/ligue-1-highlights") {
- //$output = 6;
- $output = "Ligue 1";
- }
- if ($input == "england/premier-league-highlights") {
- //$output = 2;
- $output = "Premier League";
- }
- if ($input == "italy/serie-a-highlights") {
- //$output = 5;
- $output = "Serie A";
- }
- if ($input == "europe/uefa-champions-league-highlights") {
- //$output = 9;
- $output = "UEFA Champion League";
- }
- if ($input == "europe/uefa-europa-league-highlights") {
- //$output = 10;
- $output = "UEFA Europa League";
- }
- return $output;
- }
- // Truyen tham so vao
- 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 bookmark=0 ORDER BY thoigian ASC";
- $result = mysql_query($sql);
- include("xxxxClassGetIDPhoto.php");
- include('xxxxClassXMLRPClientWordPress.php');
- $objXMLRPClientWordPress = new XMLRPClientWordPress("http://9football.net/xmlrpc.php" , "thieumao" , "12345678a@");
- if ($result) {
- // select thanh cong
- while ($row = mysql_fetch_array($result)) {
- $pid = $row["pid"];
- $title = $row["ten"];
- $body = "";
- //$category = $row["chuyenmuc"];
- $category = getIDChuyenMuc($row["chuyenmuc"]);
- echo "----------> " . $category;
- $introtext = "";
- $imageFull = $row["anhserver"];
- //$thumbnail = $imageFull;
- $linksource = $row["video1"];
- $linkserver = "";
- $linkyoutube= "";
- $linkdropbox = "";
- //$matchtime = $row["thoigian"];
- $matchtime = format_date($row["thoigian"]);
- $ishot = "";
- // Copy va Lay ID hinh anh vao wordpress
- $layid = new xxxxClassGetIDPhoto($imageFull);
- $idhinhanh = $layid->getIdanh();
- echo $row["pid"];
- echo $row["ten"];
- $objXMLRPClientWordPress->create_post_football('clip', $title, $body, $category, $introtext, $idhinhanh, $idhinhanh, $linksource, $linkserver, $linkyoutube, $linkdropbox, $matchtime, $ishot);
- $i++;
- echo "Thanh cong $i <br>";
- $sqlupdate = "UPDATE ourmatch SET bookmark=1 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