sql_query("SELECT * FROM ANN_news"); $ANN_news = $db->sql_fetchrow($result); if (!$ANN_news) { @$db->sql_query("CREATE TABLE ANN_news (last_query INT UNSIGNED NOT NULL, news TEXT NOT NULL)"); @$db->sql_query("INSERT INTO ANN_news VALUES (0, ' ')"); } // If the news were last updated more than one hour ago, re-update them if ($ANN_news['last_query'] < time() - 3600 or trim($annNews['news']) == "") { // Fetch the news from ANN // You need to put your own username and password here // CAREFUL: it should look like ?u=qwe&p=123 , NOT like ?u=[qwe]&p=[123] $a = file("https://www.animenewsnetwork.com/newsfeed/getnews.php?u=[u]&p=[p]"); $n = addslashes(trim(implode("",$a))); // Save the news to the database $query = "UPDATE ANN_news SET last_query=UNIX_TIMESTAMP()"; if ($n) { $query .= ", news='$n'"; $ANN_news['news'] = stripslashes($n); } $db->sql_query($query); } // Display the news $content = 'News provided by AnimeNewsNetwork.com'.$ANN_news['news']; ?>