function processForm()
{
    $db = new DB_Functions();
    $error_msg = "";
    //validate user input
    if ($_POST['currency'] == "") {
        printForm();
        echo "Invalid Currency Entered.\n";
        return;
    } else {
        if ($_POST['buyingRate'] == "") {
            printForm();
            echo "Invalid Buying Rate.\n";
            return;
        } else {
            if ($_POST['sellingRate'] == "") {
                printForm();
                echo "Invalid Selling Rate.\n";
                return;
            }
        }
    }
    //save data to table
    $result = $db->addExchangeRate($_POST['currency'], $_POST['buyingRate'], $_POST['sellingRate']);
    if (!$result == false) {
        //data was successfully saved to database
        header('Location: http://localhost/eserver/account.php');
    } else {
        $error_msg = "Data could not be saved in database.\n";
        printForm();
    }
}
Esempio n. 2
0
function handleForm()
{
    global $db;
    $firstname = $_POST['firstname'];
    $lastname = $_POST['lastname'];
    $email = $_POST['email'];
    $role = $_POST['role'];
    $f = $s = $e = $r = "";
    if (isset($_POST['save'])) {
        //save one record
        $statement = "INSERT INTO users (firstname, lastname, email, type) VALUES\n    ('{$firstname}','{$lastname}','{$email}','{$role}')";
        if ($result = mysqli_query($db, $statement)) {
            echo "<h3 style='color: green'>One row added to the database</h3>";
        } else {
            echo "<h3 style='color: red'>There was a problem saving your data</h3>";
        }
    } elseif (isset($_POST['amend'])) {
        //alter one record
        $statement = "UPDATE users SET firstname='{$firstname}', lastname='{$lastname}', type='{$role}' WHERE email='{$email}'";
        if ($result = mysqli_query($db, $statement)) {
            echo "<h3 style='color: green'>Database updated successfully</h3>";
        } else {
            echo "<h3 style='color: red'>There was a problem updating your data</h3>";
        }
    } elseif (isset($_POST['delete'])) {
        //delete one record
        $statement = "DELETE FROM users WHERE email='{$email}'";
        if ($result = mysqli_query($db, $statement)) {
            echo "<h3 style='color: green'>One row deleted from the database</h3>";
        } else {
            echo "<h3 style='color: red'>There was a problem deleting your data. Make sure that you entered the correct email address.</h3>";
        }
    } elseif (isset($_POST['view'])) {
        //view one record
        $statement = "SELECT * FROM users WHERE email='{$email}'";
        if ($result = mysqli_query($db, $statement)) {
            echo "<h3>Your query returned</h3>";
            $data = mysqli_fetch_object($result);
            $f = $data->firstname;
            $s = $data->lastname;
            $e = $data->email;
            $r = $data->type;
        } else {
            echo "<h3 style='color: red'>There was a problem finding the row. Please check that you entered the correct email address</h3>";
        }
    } else {
        //must be showall
        $statement = "SELECT * FROM users";
        if ($result = mysqli_query($db, $statement)) {
            echo "<h3>Your query returned</h3><table border='1'>";
            while ($data = mysqli_fetch_object($result)) {
                echo "<tr><td>{$data->firstname}</td><td>{$data->lastname}</td>\n          <td>{$data->email}</td><td>{$data->type}</td></tr>";
            }
            echo "</table>";
        } else {
            echo "<h3 style='color: red'>There was a problem retrieving data.</h3>";
        }
    }
    printForm($f, $s, $e, $r);
}
Esempio n. 3
0
function checkForm()
{
    global $name, $pwd;
    if ($_POST['show']) {
        echo "<h3>Cookie contains " . $_COOKIE["UserDetails"] . "</h3>";
    } else {
        if (!$name || !$pwd) {
            echo "<h3>Please enter username and password</h3>";
        } else {
            echo "<h3>You submitted {$name} and {$pwd}</h3>";
        }
    }
    printForm();
}
Esempio n. 4
0
function checkForm()
{
    global $name, $pwd;
    if (isset($_POST['show'])) {
        echo "<h3>Session contains " . $_SESSION["user"] . " and " . $_SESSION["pwd"] . "</h3>";
        echo "<h3>You have logged on " . $_SESSION["counter"] . " times</h3>";
    } else {
        if (!$name || !$pwd) {
            echo "<h3>Please enter username and password</h3>";
        } else {
            echo "<h3>You submitted {$name} and {$pwd}</h3>";
        }
    }
    printForm();
}
Esempio n. 5
0
      </style> 
   </head>
   <body> 
      <?php 
extract($_REQUEST);
// create form variables
error_reporting(E_ALL & ~E_NOTICE);
// get rid of runtime notices
error_reporting(E_ALL ^ E_DEPRECATED);
$sql = "SELECT * FROM yang_ning_artists";
connect();
$result = mysql_query($sql, $conn);
mysql_close();
if (!$result) {
    createTables();
    printForm();
} else {
    $action = isset($_REQUEST['switch']) ? $_REQUEST['switch'] : null;
    switch ($action) {
        case '1':
            printform();
            break;
        case '2':
            // add artist into db
            $artist = $_REQUEST['artist'];
            // get data
            $sql = "INSERT INTO yang_ning_artists VALUES( NULL, '{$artist}')";
            // write query
            connect();
            // write to db
            $result = mysql_query($sql, $conn) or die("<br>Error storing Artist to db in Case 2: " . mysql_error());
Esempio n. 6
0
 public function __construct()
 {
     $message = $this->testTheEnvironment();
     if (is__writable("./") && !file_exists(".htaccess")) {
         file_put_contents(".htaccess", htaccess());
     }
     $this->generateSiteUrl();
     if (!empty($message)) {
         printHeader();
         echo $message;
         echo "</body>";
         echo "</html>";
     } elseif ($this->runForm()) {
         unlink(__FILE__);
         header("Location:" . $this->siteUrl . "add/post");
         exit;
     } else {
         $updater = new Updater();
         $version = $updater->getInfos();
         printHeader($version);
         printForm();
         echo "</body>";
         echo "</html>";
     }
 }
function processForm()
{
    $db = new DB_Functions();
    //validate user input
    if ($_POST['rangeFrom'] == "") {
        printForm();
        echo "Invalid From Range.\n";
        return;
    } else {
        if ($_POST['rangeTo'] == "") {
            printForm();
            echo "Invalid Invalid Range To.\n";
            return;
        } else {
            if ($_POST['1MonthPa'] == "") {
                printForm();
                echo "Invalid 1 month pa Value.\n";
                return;
            } else {
                if ($_POST['3MonthPa'] == "") {
                    printForm();
                    echo "Invalid 3 month pa Value.\n";
                    return;
                } else {
                    if ($_POST['6MonthPa'] == "") {
                        printForm();
                        echo "Invalid 6 month pa Value.\n";
                        return;
                    } else {
                        if ($_POST['1YearPa'] == "") {
                            printForm();
                            echo "Invalid 1 Year pa Value.\n";
                            return;
                        }
                    }
                }
            }
        }
    }
    //save data to table
    $result = $db->addFixedDepositRate($_POST['rangeFrom'], $_POST['rangeTo'], $_POST['1MonthPa'], $_POST['3MonthPa'], $_POST['6MonthPa'], $_POST['1YearPa']);
    if (!$result == false) {
        //data was successfully saved to database
        header('Location: http://localhost/eserver/account.php');
    } else {
        $error_msg = "Data could not be saved in database.\n";
        printForm();
    }
}
Esempio n. 8
0
function processForm()
{
    $db = new DB_Functions();
    $error_msg = "";
    //validate user input
    if ($_POST['ad'] == "") {
        printForm();
        echo "Invalid Adert value.\n";
        return;
    } else {
        if ($_POST['ad_url'] == "") {
            printForm();
            echo "Invalid Advert URL value.\n";
            return;
        } else {
            if ($_POST['ad_category'] == "") {
                printForm();
                echo "Invalid Advert category value.\n";
                return;
            }
        }
    }
    //save data to table
    $result = $db->addNewAdvert($_POST['ad'], $_POST['ad_url'], $_POST['ad_category']);
    if (!$result == false) {
        //data was successfully saved to database
        header('Location: http://localhost/eserver/account.php');
    } else {
        $error_msg = "Data could not be saved in database.\n";
        printForm();
    }
}
Esempio n. 9
0
$tag = isset($_GET["tag"]) ? $_GET["tag"] : '';
if (!isValidTag($tag)) {
    $message = "The tag that was requested (<code>" . htmlentities($tag) . "</code>) is not a valid tag. You can request a new tag.";
    printError($message);
} elseif (!tagExists($tag)) {
    $message = "The tag that was requested (<code>" . $tag . "</code>) does not exist in the Stacks project. You can request a new tag.";
    printError($message);
} else {
    $meta = json_decode(file_get_contents("http://" . $_SERVER["HTTP_HOST"] . href("data/tag/" . $tag . "/meta")));
    if (in_array($meta->type, array("lemma", "proposition", "remark", "remarks", "theorem"))) {
        print "<p>You can suggest a slogan for <a href='" . href("tag/" . $tag) . "'>tag <code>" . $tag . "</code></a> (label: <code style='font-size: .9em'>" . $meta->label . "</code>), located in<br>";
        $id = explode(".", $meta->book_id);
        print "&nbsp&nbsp;Chapter " . $id[0] . ": " . parseAccents($meta->chapter_name) . "<br>";
        print "&nbsp&nbsp;Section " . $id[1] . ": " . parseAccents($meta->section_name);
        printStatement($tag);
        printForm($tag);
        $slogans = getSlogans($tag);
        if (!empty($slogans) or $meta->slogan != "") {
            printSlogans($slogans, $meta->slogan);
        }
    } else {
        $message = "The tag that was requested (<code>" . $tag . "</code>) is of type <code>" . $meta->type . "</code>, but it is impossible to write slogans for tags of this type.";
        printError($message);
    }
}
?>

<script type="text/javascript" src="slogan.js"></script>
<?php 
if (isset($_SESSION["tag"]) && isset($_GET["tag"])) {
    print "<script type='text/javascript'>";
Esempio n. 10
0
<html>
<head>
<?php 
if ($term) {
    echo "<title>" . rawurldecode($term) . " - mookie's minisearch</title>";
} else {
    echo "<title>mookie's minisearch</title>";
}
?>
<link rel="stylesheet" type="text/css" media="screen" href="style.css"/>
<link rel="search" type="application/opensearchdescription+xml" title="moookie's minisearch" href="minisearch.xml">
</head>
<body>
<div id="wrap">
<?php 
printForm($term);
if ($term && $type == 'both') {
    print "<div id=\"main\">";
    searchFor($term, $start, $count, $appid, $type);
    print "</div>";
    print "<div id=\"sidebar\">";
    print "<b>Results from <a href=\"http://www.twitter.com\">Twitter</a>...</b>";
    searchTwitterFor($term, $start, $count, $type);
    print "</div>";
    print "</div>";
    printFoot();
} else {
    if ($term && $type == 'twitter') {
        $count = $count * $twitMulti;
        print "<div id=\"single\">";
        searchTwitterFor($term, $start, $count, $type);
Esempio n. 11
0
</form>
</body>
</html>
END;
}
if (isset($_POST['pass'])) {
    if ($_POST['pass'] == $password) {
        // Successfully logged in.
        // Continue to page content.
        $_SESSION['LOGIN'] = "******";
    } else {
        // Wrong password submitted.
        printForm('Wrong password');
        exit;
    }
} else {
    if (isset($_GET['logout'])) {
        unset($_SESSION['LOGIN']);
        session_destroy();
        printForm('Logged Out');
        exit;
    } else {
        if (isset($_SESSION['LOGIN'])) {
            // Cookie already set login not required.
            // Continue to page content.
        } else {
            printForm('Please login');
            exit;
        }
    }
}
Esempio n. 12
0
        fclose($fp);
        rptout("数据文件" . $bakfile . "恢复成功!\n");
        $fileid++;
    }
    mysql_close($link);
    unlink('include/mall_config.tmp.php');
    unlink('migtask.txt');
    unlink('mig.php');
    $dirhandle = @opendir('databack');
    while ($file_name = @readdir($dirhandle)) {
        if (substr($file_name, 0, 4) == 'mig_') {
            unlink("databack/{$file_name}");
        }
    }
} else {
    printForm('');
}
//mysqldump
class Mysqldumper
{
    var $_host;
    var $_dbuser;
    var $_dbpassword;
    var $_dbname;
    var $_isDroptables;
    var $tableid;
    //数据表ID
    var $startid;
    var $tablearr;
    var $nodata;
    function Mysqldumper($host = "localhost", $dbuser = "", $dbpassword = "", $dbname = "")
function processForm()
{
    $db = new DB_Functions();
    $error_msg = "";
    //validate user input
    if ($_POST['companyName'] == "") {
        printForm();
        echo "Invalid Company Name.\n";
        return;
    } else {
        if ($_POST['lastTradedPrice'] == "") {
            printForm();
            echo "Invalid Last Traded Price Value.\n";
            return;
        } else {
            if ($_POST['previousPrice'] == "") {
                printForm();
                echo "Invalid Previous Price Value.\n";
                return;
            }
        }
    }
    //save data to table
    $change = $_POST['lastTradedPrice'] - $_POST['previousPrice'];
    $result = $db->addShareListingEntry($_POST['companyName'], $_POST['lastTradedPrice'], $_POST['previousPrice'], $change);
    if (!$result == false) {
        //data was successfully saved to database
        header('Location: http://localhost/eserver/account.php');
    } else {
        $error_msg = "Data could not be saved in database.\n";
        printForm();
    }
}
function processForm()
{
    $db = new DB_Functions();
    $error_msg = "";
    //validate user input
    if ($_POST['adminname'] == "") {
        printForm();
        echo "Invalid Name.\n";
        return;
    } else {
        if ($_POST['idNo'] == "") {
            printForm();
            echo "Invalid IdNo.\n";
            return;
        } else {
            if ($_POST['password'] == "") {
                printForm();
                echo "Invalid Password.\n";
                return;
            } else {
                if ($_POST['password'] != $_POST['passwordConfirm']) {
                    printForm();
                    echo "Passwords do not match!\n";
                    return;
                } else {
                    if ($_POST['username'] == "") {
                        printForm();
                        echo "Invalid Username.\n";
                        return;
                    }
                }
            }
        }
    }
    //save data to table
    $result = $db->administratorSignUp($_POST['username'], md5($_POST['password']), $_POST['idNo'], $_POST['adminname']);
    if (!$result == false) {
        //data was successfully saved to database
        header('Location: http://localhost/eserver/account.php');
    } else {
        $error_msg = "Data could not be saved in database.\n";
        printForm();
    }
}
Esempio n. 15
0
        $z = new PHPZip();
        $z->Zip($files, TARGET, "pictures/big/big." . $vol . ".zip");
        unset($z);
        rptout("volume \t\t" . $vol . " (" . $_REQUEST['total'] . ") finished!");
        //下一卷,控制从0开始,
        $vol++;
        //停3秒,不然服务器会挂掉
        sleep(3);
        jump("?act=do&vol=" . $vol . "&total=" . $_REQUEST['total']);
    } else {
        printForm("<hr><b>Total " . $_REQUEST['total'] . " volumes all done!</b>");
    }
}
if ($_REQUEST['submit'] != '' && $_REQUEST['act'] == '') {
    if (!file_exists(TARGET)) {
        printForm('Folder not exists!');
    }
    # Create File List
    $filelist = array();
    $filelist = GetFileList(TARGET);
    # Put all files from file list in ZIP archive
    foreach ($filelist as $val) {
        $content .= $val . "\r\n";
    }
    $fp = fopen("tmp/filelist.log", "w+");
    fwrite($fp, $content, strlen($content));
    fclose($fp);
    $totalvol = ceil(count($filelist) / LENGTH);
    rptout("应该有 " . $totalvol . " 个备份,现在开始备份...<hr>");
    //备份从这里起跳
    jump('?act=do&vol=0&total=' . $totalvol);
Esempio n. 16
0
        $text = "[This message has been brought to you via " . PEAR_CHANNELNAME . ".]\n\n";
        $text .= wordwrap($_POST['text'], 72);
        if ($auth_user) {
            $text .= "\n\nvia PEAR account:";
            $text .= print_r(array('email' => $auth_user->email, 'name' => $auth_user->name), true);
        }
        $_SESSION['last_email_sent'] = time();
        if (@mail($row['email'], $_POST['subject'], $text, 'From: "' . $_POST['name'] . '" <' . $_POST['email'] . '>', '-f bounce-no-user@php.net')) {
            report_success('Your message was successfully sent.');
            if (!empty($_POST['copy_me'])) {
                $text = "This is a copy of your mail sent to " . $row['email'] . ":\n\n" . $text;
                @mail($_POST['email'], $_POST['subject'], $text, 'From: "' . $_POST['name'] . '" <' . $_POST['email'] . '>', '-f bounce-no-user@php.net');
            }
        } else {
            report_error('The server could not send your message, sorry.');
        }
    } else {
        printForm($_POST);
    }
} else {
    echo '<p>If you want to get in contact with one of the PEAR contributors,' . ' you can do this by filling out the following form.</p>';
    echo '<p style="font-weight: bold; font-size: 110%; color: red;">' . 'Do not send email to this developer if you are in need of support for' . ' any of his/her package(s), instead we recommend' . ' emailing ' . PEAR_GENERAL_EMAIL . ' where you are more likely to get answer.<br />' . ' You can subscribe to the pear-general mailinglist from the ' . make_link('/support/lists.php', 'Support - Mailinglist') . ' page.</p>';
    // Guess the user if he is logged in
    if ($auth_user) {
        $data = array('email' => $auth_user->email, 'name' => $auth_user->name);
    } else {
        $data = array();
    }
    printForm($data);
}
response_footer();
Esempio n. 17
0
	
	$dt = PdoDataAccess::runquery("select e.*,p.ElementValue
		from PLN_Elements e
		left join PLN_PlanItems p on(PlanID=? AND p.ElementID=e.ElementID)
		
		where GroupID=? AND ParentID=0 
		group by ElementID
		order by ElementID", array($PlanID, $GroupID));
	
	for($i=0; $i < count($dt); $i++)
	{
		if($dt[$i]["ElementType"] == "grid")
			printGrid($PlanID, $dt[$i]["ElementID"]);
		
		if($dt[$i]["ElementType"] == "panel")
			printForm($dt[$i]["ElementID"], $dt[$i]["ElementValue"]);		
	}
}

function printGrid($PlanID, $ParentID){

	$columns = PdoDataAccess::runquery("select * from PLN_Elements e 
		where ParentID=? order by ElementID", array($ParentID));
	
	echo "<center><table class=form border=1><tr>";
	foreach($columns as $col)
		echo "<td class=titles>" . $col["ElementTitle"] . "</td>";
	echo "</tr>";
	
	$data = PdoDataAccess::runquery("select ElementValue from PLN_PlanItems where PlanID=? AND ElementID=?",
		array($PlanID, $ParentID));