📄 rss2sql_admin.php
字号:
<?php//// rss2sql.php Store RSS feeds into SQL//// Copyright 2006-2007 NotePage, Inc.// http://www.feedforall.com//// NotePage, Inc. grants registerd users of our FeedForAll and/or// FeedForAll Mac product(s) the right to install and use the// rss2sql.php script free of charge.// Please refer to the EULA included in the download for full license// terms and conditions.//// $Id: rss2sql_admin.php,v 3.0 2007/04/16 14:23:04 housley Exp $//// ==========================================================================// Below this point of the file there are no user editable options. Your// are welcome to make any modifications that you wish to any of the code// below, but that is not necessary for normal use.// ==========================================================================$ConfigFilename = "rss2sql_SampleConfig.php";if (isset($_REQUEST["CONFIGFILE"])) { if (stristr($_REQUEST["CONFIGFILE"], "file"."://")) { // Not allowed ; } elseif (stristr($_REQUEST["CONFIGFILE"], "://")) { // Not allowed ; } else { // It is local and must be in the same directory $ConfigFilename = basename($_REQUEST["CONFIGFILE"]); }}//// Read in the configuration file$config = Array();ob_start();@include_once($ConfigFilename);@include_once($config["DBconfigFile"]);@include_once("FeedForAll_database.inc.php");ob_end_clean();// SESSION VARIABLES//// Make sure "transparent sid" support is enabled//if (ini_get("session.use_trans_sid") == 0) { ini_set("session.use_trans_sid", "1");}ini_set("session.gc_maxlifetime", "14400");session_name("rss2sql_admin");session_start();Function StoreLogin( $username, $password, $delete = 0 ) { $_SESSION["session_username"] = $username; $_SESSION["session_password"] = $password; if( $delete ) { unset($_SESSION["session_username"]); unset($_SESSION["session_password"]); }}Function ProcessLogin() { GLOBAL $config; if (empty($_SESSION["session_username"]) || empty($_SESSION["session_password"])) { if (!isset($_POST["login_username"]) && !isset($_POST["login_password"])) { StoreLogin("","","",1); } else { if (($config["AdminUsername"] == $_POST["login_username"]) && ($config["AdminPassword"] == $_POST["login_password"])) { StoreLogin($_POST["login_username"], $_POST["login_password"]); } else { StoreLogin("","","",1); } } }}ProcessLogin();if (!empty($_SESSION["session_username"]) && !empty($_SESSION["session_password"])) { echo "<FORM METHOD=\"POST\" ACTION=\"$_SERVER[PHP_SELF]\">\n"; echo "<input type=\"Submit\" name=\"logout\" value=\"Logout\">\n"; echo "</form>"; if (FeedForAll_database_connect($config)) { if (isset($_POST["submit"])) { if ($_SERVER["REQUEST_METHOD"] == "POST") { if ($_REQUEST["mode"] == "feed") { if ($_REQUEST["edit"] == -1) { FeedForAll_database_query($config, "INSERT INTO $config[feedInfo] ($config[feedURL],$config[updateInterval],$config[feedActive]) VALUES ('$_POST[URL]','$_POST[updateInterval]','$_POST[active]')"); echo mysql_error()."<br>\n"; $_REQUEST["mode"] = ""; } else { FeedForAll_database_query($config, "UPDATE $config[feedInfo] SET $config[feedURL]='$_POST[URL]',$config[updateInterval]='$_POST[updateInterval]',$config[feedActive]='$_POST[active]' WHERE $config[feedID]='$_REQUEST[edit]'"); } } } } if (isset($_REQUEST["mode"])) { if ($_REQUEST["mode"] == "feed") { if (isset($_REQUEST["delete"])) { FeedForAll_database_query($config, "DELETE FROM $config[feedInfo] WHERE $config[feedID]='$_REQUEST[delete]'"); } elseif (isset($_REQUEST["approve"])) { FeedForAll_database_query($config, "UPDATE $config[feedInfo] SET $config[feedActive]='1',nextUpdate='0' WHERE $config[feedID]='$_REQUEST[approve]'"); } elseif (isset($_REQUEST["reject"])) { FeedForAll_database_query($config, "UPDATE $config[feedInfo] SET $config[feedActive]='0' WHERE $config[feedID]='$_REQUEST[reject]'"); } $feedURL = ""; $updateInterval = 86400; $lastUpdate = 0; $nextUpdate = 0; $updateStatus = ""; $updateStatusCount = ""; $active = 1; if (isset($_REQUEST["edit"]) && ($_REQUEST["edit"] != "-1")) { if (($sql = FeedForAll_database_query($config, "SELECT * FROM $config[feedInfo] WHERE $config[feedID]='$_REQUEST[edit]'")) !== FALSE) { if (($rv = FeedForAll_database_fetch($config, $sql)) !== FALSE) { $feedURL = $rv[$config["feedURL"]]; $updateInterval = $rv[$config["updateInterval"]]; $lastUpdate = $rv[$config["lastUpdate"]]; $nextUpdate = $rv[$config["nextUpdate"]]; $updateStatus = $rv[$config["updateStatus"]]; $active = $rv[$config["feedActive"]]; } } } if (isset($_REQUEST["edit"])) { echo "<h3>Work with a feed</h3>\n"; echo "<form method=\"post\" action=\"$_SERVER[PHP_SELF]?mode=feed&edit=$_REQUEST[edit]\">\n"; echo "<table border=\"0\">\n"; echo "<tr><td>Feed URL:</td><td><input type=\"text\" name=\"URL\" value=\"$feedURL\" size=\"64\" maxlength=\"250\"></td></tr>\n"; echo "<tr><td>Update Interval:</td><td><input type=\"text\" name=\"updateInterval\" value=\"$updateInterval\" size=\"12\"> in seconds (86400 is one day)</td></tr>\n"; echo "<tr><td>Next Update:</td><td>$nextUpdate</td></tr>\n"; echo "<tr><td>Last Update:</td><td>$lastUpdate</td></tr>\n"; echo "<tr><td>Update Status:</td><td>$updateStatus"; if (($updateStatusCount != "") && ($updateStatusCount != 0)) echo " x $updateStatusCount"; echo "</td></tr>\n"; echo "<tr><td>Status:</td><td>"; echo "Active <input type=\"radio\" name=\"active\" value=\"1\""; if ($active) { echo " CHECKED"; } echo "> "; echo "Disabled <input type=\"radio\" name=\"active\" value=\"0\""; if (!$active) { echo " CHECKED"; } echo "> "; echo "</td></tr>\n"; echo "</table>\n"; echo "<input type=\"submit\" name=\"submit\" value=\"Submit\">"; echo "</form>\n"; } echo "<p> </p>\n"; } } echo "<h3>Actions</h3>\n"; echo "<a href=\"$_SERVER[PHP_SELF]?mode=feed&edit=-1\">Add New Feed</a><br><br>\n"; echo "<table border=\"1\">\n"; echo "<tr><th>Activate</th><th>Delete</th><th>Feed Info</th><th>Edit/Details</th></tr>\n"; if (($sql = FeedForAll_database_query($config, "SELECT * FROM $config[feedInfo] ORDER BY $config[feedActive]")) !== FALSE) { while (($rv = FeedForAll_database_fetch($config, $sql)) != FALSE) { echo "<tr><td align=\"top\">"; if ($rv[$config["feedActive"]]) { echo "<a href=\"$_SERVER[PHP_SELF]?mode=feed&reject=".$rv[$config["feedID"]]."\">Deactivate</a>"; } else { echo "<a href=\"$_SERVER[PHP_SELF]?mode=feed&approve=".$rv[$config["feedID"]]."\">Activate</a>"; } echo "</td><td align=\"top\"><a href=\"$_SERVER[PHP_SELF]?mode=feed&delete=".$rv[$config["feedID"]]."\">Delete</a></td>"; echo "<td>".$rv[$config["feedURL"]].""; if (($rv["updateStatusCount"] != "") && ($rv["updateStatusCount"] != 0)) { echo "<br>"<b><span style=\"color: red;\">$rv[updateStatus]</b>" x $rv[updateStatusCount]</span>"; } echo "</td><td align=\"top\"><a href=\"$_SERVER[PHP_SELF]?mode=feed&edit=".$rv[$config["feedID"]]."\">Edit/Details</a></td></tr>\n"; } } echo "</table>\n"; } else { echo "<p style=\"color: red; font-weight: bolder; font-size: larger;\">Database connection failed. Please recheck all settings</p>\n"; }} else { StoreLogin("","","","",1); // // Main view: Login //?> <form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="POST"> <DIV ALIGN="CENTER"> <table border="1"><tr><td> <table border="0" cellspacing="0"> <tr><td BGCOLOR="#C0C0C0" colspan="2"><b>Please enter your user information</b></td></tr> <tr> <td align="right">Username:</td> <td><input name="login_username"></td> </tr> <tr> <td align="right">Password:</td> <td><input name="login_password" type=password></td> </tr> <tr> <td colspan="2" align="center"> <HR> <input type="submit" name="AuthValues" value="Log In"> </td> </tr> </table> </td></tr></table> </DIV> </FORM><?php}?> <BR> <BR> </BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -