Exemplo n.º 1
0
new ConfigParser();
// Get the configuation details and store them as environment variables
$output = "<html><body>\r\n<script src='https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js' type='text/javascript'></script>";
function getLoginForm()
{
    $output = "\r\n\t<script type='text/javascript'>\r\n\tfunction createUser()\r\n\t{\r\n\t\$.ajax( {\r\n\t\ttype :'GET',\r\n\t\turl :'UserAccountCreate.php',\r\n\t\tdata : 'userName='******'&password='******'html',\r\n\t\tasync: false,\r\n        cache: false,\r\n        timeout: 30000,\r\n\t\tsuccess : function(res) {\r\n\t\tif(res=='success'){\r\n\t\tdocument.login.submit();\r\n\t\t}else {\r\n\t\talert(res);\r\n\t\t}},\r\n\t\terror: function(jqXHR, textStatus, errorThrown){\r\n\t\talert('Error: '+textStatus);\r\n\t\t}\r\n\t});\r\n\t}\r\n\t</script>";
    $output .= "<form name='login' action='UserAccountLogin.php'>User Name: <input type='text' name='userName'> Password: <input type='password' name='password'><br><input type='submit' value='Login'><input type='button' value='Create' onClick='createUser();'></form>";
    return $output;
}
if (isset($_REQUEST['userName']) && isset($_REQUEST['password'])) {
    $DBConnection = new DBConnection(mysqlServerIP2, dbname, dbuser, dbpassword);
    $results = $DBConnection->queryDB("Select id from users Where username='******'userName'] . "' AND password='******'password'] . "'");
    $row = $results->fetch_assoc();
    $userID = $row["id"];
    $userAccount = new UserAccount($userID, $DBConnection);
    if ($userAccount->isValid()) {
        $output .= "\r\n\t\t<script type='text/javascript'>\r\n\t\tfunction update(){\r\n\t\tvar formData = 'save=1';\r\n\t\t// store form elements\r\n\t\t var elem = document.accountInfo.elements;\r\n        for(var i = 0; i < elem.length; i++)\r\n        {\r\n        formData+='&'+elem[i].name+'='+elem[i].value;    \r\n        } \r\n        //alert(formData);\r\n\t\t\$.ajax( {\r\n\t\ttype :'GET',\r\n\t\turl :'UserAccountUpdate.php',\r\n\t\tdata : formData,\r\n\t\tdataType :'html',\r\n\t\tasync: false,\r\n        cache: false,\r\n        timeout: 30000,\r\n\t\tsuccess : function(res) {\r\n\t\talert(res);\r\n\t\t},\r\n\t\terror: function(jqXHR, textStatus, errorThrown){\r\n\t\talert('Error: '+textStatus);\r\n\t\t}\r\n\t\t});\r\n\t\t}\r\n\t\t\r\n\t\tfunction passwordChange(){\r\n\t\t\t\$('input[class=\"pw\"]').each(function(index, element) {\r\n\t\t\t//\$('input[type=\"password\"]').each(function(index, element) {\r\n\t\t\t//\$(this).type='text';\r\n\t\t\tif(document.accountInfo.pwBox.checked)\r\n\t\t\t{\r\n\t\t\telement.type='text';\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\telement.type='password';\r\n\t\t\t}\r\n\t\t});\r\n\t\t}\r\n\t\t</script>\r\n\t\t<form name='accountInfo'>\r\n\t\t<input type='hidden' name='userName' value='" . $_REQUEST['userName'] . "'><input type='hidden' name='password' value='" . $_REQUEST['password'] . "'>\r\n\t\t<table border=0 width='50%' align='center'>\r\n\t\t";
        $results = $DBConnection->queryDB("Select location, working, type from uploadsites order by type, location");
        $videoTypeSwitch = false;
        $articleTypeSwitch = false;
        while ($row = $results->fetch_assoc()) {
            $location = $row['location'];
            $working = (bool) $row['working'];
            $type = $row['type'];
            if (strcasecmp("video", $type) === 0 && $videoTypeSwitch == false) {
                $output .= "<tr><th colspan='3'><h1>Video</h1></th></tr>\r\n\t\t\t\t<tr><th>Location</th><th>Username</th><th>Password</th>";
                $videoTypeSwitch = true;
            } else {
                if (strcasecmp("article", $type) === 0 && $articleTypeSwitch == false) {
                    $output .= "<tr><th colspan='3'><h1>Article</h1></th></tr>\r\n\t\t\t\t<tr><th>Location</th><th>Username</th><th>Password</th>";
                    $articleTypeSwitch = true;