Example #1
0
function getUserProfile($email, $rowID, $url, $user, $pwd, $db)
{
    $test = new MonarchPressDb($url, $user, $pwd, $db);
    if ($result = $test->search_user_by_email($email)) {
        /* fetch object array */
        while ($row = $result->fetch_assoc()) {
            return $row[$rowID];
        }
        /* free result set */
        $result->close();
    }
}
<?php

include "MonarchPressDb.php";
$test = new MonarchPressDb('128.82.11.37', 'root', 'w@t3rg@t3', 'wordpress');
if ($result = $test->search_user_by_username('ekennedy')) {
    /* fetch object array */
    while ($row = $result->fetch_row()) {
        foreach ($row as &$value) {
            printf("[%s] ", $value);
        }
        echo "\n\n";
    }
    /* free result set */
    $result->close();
}
?>

<?php

//Update DB according to input and users email
$password = $_POST['password'];
$squestion = $_POST['squestion'];
$sanswer = $_POST['sanswer'];
$twit_id = $_POST['twit_username'];
$email = $_POST['email'];
if ($_POST && isset($_POST['submit'])) {
    echo "Test";
    $email = '*****@*****.**';
    include "MonarchPressDb.php";
    $conn = new MonarchPressDb('128.82.11.37', 'root', 'w@t3rg@t3', 'wordpress');
    if (!empty($password)) {
        $conn->update_userPassword($email, $password);
    }
    if (!empty($squestion)) {
        $conn->update_userQuestion($email, $squestion);
    }
    if (!empty($sanswer)) {
        $conn->update_userAnswer($email, $sanswer);
    }
    if (!empty($twit_id)) {
        $conn->update_userTwitterHandle($email, $twit_id);
    }
}
?>
<html>
<head>

</head>