/** * */ function validate_request() { global $_REQUEST; $errors = array(); $link = @mysql_connect($_REQUEST['dbhost'], $_REQUEST['dbuser'], $_REQUEST['dbpass']); if (!$link) { $errors['db'][] = "Unable to connect to the database. Please check your credentials and try again."; } if (!mysql_select_db($_REQUEST['dbname'])) { $errors['db'][] = "The database name you specified does not exist."; } require_once "include/class.twitter.php"; $twitter = new twitter(); $twitter->username = $_REQUEST['twuser']; $twitter->password = $_REQUEST['twpass']; if (!$twitter->verifyCredentials()) { $errors['twitter'][] = 'The Twitter username and password you entered is incorrect. Do you need <a href="http://twitter.com/account/resend_password">a reminder of your password</a>?'; } // make sure tag has a value // make sure title and subtitle exists // make sure cache is writable if (count($errors) == 0) { return NULL; } return $errors; }
<?php foreach ($_REQUEST as $k => $v) { error_log($k . ' => ' . $v); } function connect($host, $user, $pass) { return @mysql_connect($host, $user, $pass); } if ($_REQUEST['method'] == "twitter") { require "class.twitter.php"; $twitter = new twitter(); $twitter->username = $_REQUEST['username']; $twitter->password = $_REQUEST['password']; error_log("verifying twitter username and password"); $result = $twitter->verifyCredentials(); if ($result->{'error'}) { echo "false"; } else { echo "true"; } } else { if ($_REQUEST['method'] == "dbauth") { $link = connect($_REQUEST['dbhost'], $_REQUEST['dbuser'], $_REQUEST['dbpass']); if (!$link) { error_log('fail auth!!'); echo "false"; } echo "true"; } else { if ($_REQUEST['method'] == "dbname") {