Example #1
0
      echo 'Image Link: ' . $manga->image() . '<br />';
      echo '<br /><br />';
      */
    $image = $manga->image();
    $desc = $manga->desc();
    if (!empty($image)) {
        //echo '<b>Image:</b> ' . $mangamerge['Image'] . '<br />';
        $url = explode("?", $manga->image());
        $newurl = file_get_contents($url[0]);
        $img_path = './images/cover/' . preg_replace('/[^\\da-z]/i', "", strtolower($manga->title())) . mt_rand() . '.jpg';
        file_put_contents($img_path, $newurl);
        $image = $img_path;
    }
    if (!empty($desc)) {
        $desc = mysqli_real_escape_string($conn, $manga->desc());
        $sql = "INSERT INTO manga(title, description, status, genre, author, release_date, cover, latest_chapter, url, added_date) VALUES \n      ('" . $manga->title() . "','" . $desc . "','" . $manga->status() . "', '" . $manga->genre() . "', '" . $manga->author() . "', '" . $manga->release() . "', '" . $image . "', '0', '" . $href . "', '" . date("Y-m-d") . "')";
        //mysqli_query($con,$sql);
        //echo $sql;
    } else {
        $sql = "INSERT INTO manga(title, description, status, genre, author, release_date, cover, latest_chapter, url, added_date) VALUES \n      ('" . $manga->title() . "','No Description','" . $manga->status() . "', '" . $manga->genre() . "', '" . $manga->author() . "', '" . $manga->release() . "', '" . $image . "', '0', '" . $href . "', '" . date("Y-m-d") . "')";
        //mysqli_query($con,$sql);
        //echo $sql;
    }
    if ($conn->query($sql) === TRUE) {
        echo '<b>Added:</b> ' . $manga->title() . '<br />';
    } else {
        echo 'Error inserting series' . $conn->error;
    }
    unset($sql);
}
echo 'F**K YES ALL DONE!!';