Example #1
0
<?php

$users = array('first_name' => "Michael", 'last_name' => "Choi");
function printMsg($items)
{
    echo "There are " . count($items) . " keys in this array: ";
    foreach ($items as $key => $value) {
        echo ' ' . $key;
    }
    echo '<br>';
    foreach ($items as $key => $value) {
        echo "The value in the key " . $key . " is " . $value . "<br>";
    }
}
printMsg($users);
Example #2
0
if ($_GET['action'] == "checklogin") {
    $username = strFilter($_POST['membername']);
    $userpass = strFilter($_POST['memberpass']);
    $userpass = encrypt($username, $userpass);
    if (empty($username) || empty($userpass)) {
        printMsg('signup_required_1');
    }
    $row = $db->row_select_one("members", "membername='{$username}' and memberpass='******'");
    if ($row == false) {
        printMsg('login_namepasserr');
    } else {
        $uobj['logintime'] = time();
        $db->row_update("members", $uobj, "id={$row['id']}");
        $t = -86400 * 365 * 2;
        wSESSION('memberid', $row['id']);
        wSESSION('groupid', $row['groupid']);
        wSESSION('membername', $row['membername'], $t);
        wSESSION('memberpass', $row['memberpass'], $t);
        setCookies("cartid", $row['id'], 3600 * 24 * 7);
        //session_destroy();
        setCookies('membername', $username, $t);
        setCookies('userpass', $userpass, $t);
        setCookies('expire', '', $t);
        wSESSION('memberauth', md5($row['membername'] . $row['memberpass'] . $cache_global['salt']), $t);
        printMsg('login_succeed');
    }
} else {
    require_once './header.php';
    require_once getTemplatePath('login.htm');
    footer();
}
Example #3
0
function dbSearchOutreach($sql, $proxyFields)
{
    $result = db_query($sql, $proxyFields)->fetchAll(PDO::FETCH_ASSOC);
    if ($result) {
        return $result;
    } else {
        printMsg("No results found!");
    }
    return false;
}
Example #4
0
<?php

session_name('authorization');
session_start();
$e = $_SESSION['msg'];
printMsg($e);
function printMsg($str)
{
    echo "\n\t\t<html>\n\t\t<body>\n\t\t<head><title>Message</title></head>\n\t\t" . $str . "\n\t\t</body>\n\t\t</body>";
}
function printTableHeader()
{
    global $showdatecolumn, $self, $reloadlink, $msg;
    echo "<table cellspacing=\"0\">\r\n\t<tr>\r\n\t\t<th>" . printTableHeaderLink(printMsg("tableFile"), "{$self}{$reloadlink}", "name") . " <span class=\"size\">(" . printTableHeaderLink(printMsg("tableSize"), "{$self}{$reloadlink}", "size") . ")</span></th>\r\n\t\t<th class=\"center\">" . printMsg("tableOptions") . "</th>";
    if ($showdatecolumn == 3) {
        echo "\r\n\t\t<th class=\"center\">" . printTableHeaderLink(printMsg("tableDate"), "{$self}{$reloadlink}", "date") . "</th>";
    }
    echo "\r\n\t</tr>";
}
Example #6
0
    $member['signuptime'] = $time;
    $member['logintime'] = $time;
    $member['lastlogintime'] = $time;
    $member['signupip'] = $ip;
    if ($cache_global['issignupverify'] == 0) {
        $member['groupid'] = 1;
    } else {
        if ($cache_global['issignupverify'] == 1) {
            $member['groupid'] = GROUP_NOVERIFY;
        } else {
            if ($cache_global['issignupverify'] == 2) {
                $member['groupid'] = GROUP_NOVERIFY;
            }
        }
    }
    $db->row_insert("members", $member);
    $issignupverify = $cache_global['issignupverify'];
    $d = $_SYS['time'] - 24 * 3600;
    $activecode = md5($member['membername'] . $member['memberpass'] . $_SYS['time'] . mt_rand(1000, 9999));
    $memberfield['memberid'] = $db->insert_id();
    $memberfield['code'] = $activecode;
    $memberfield['createtime'] = $_SYS['time'];
    $memberfield['type'] = 1;
    //重置密码
    $db->row_insert("memberfield", $memberfield);
    printMsg("signup_succeed_{$issignupverify}");
} else {
    require_once './header.php';
    require_once getTemplatePath('signup.htm');
    footer();
}
Example #7
0
	<body>
<?php 
// We have a user ID, so probably a logged in user.
// If not, we'll get an exception, which we handle below.
try {
    // Create an event
    $ret_obj = $facebook->api($user_id . '/events', 'POST', array('name' => $event_name, 'start_time' => $event_start, 'privacy_type' => $event_privacy));
    if (isset($ret_obj['id'])) {
        // Success
        $event_id = $ret_obj['id'];
        printMsg('Event ID: ' . $event_id);
    } else {
        printMsg("Couldn't create event.");
    }
} catch (FacebookApiException $e) {
    // If the user is logged out, you can have a
    // user ID even though the access token is invalid.
    // In this case, we'll get an exception, so we'll
    // just ask the user to login again here.
    $login_url = $facebook->getLoginUrl(array('scope' => 'create_event, rsvp_event'));
    echo 'Error: Please <a href="' . $login_url . '">login.</a>';
    error_log($e->getType());
    error_log($e->getMessage());
    printMsg($e->getMessage());
    $trace = $e->getTrace();
    print_r($trace[0]['line']);
}
$facebook->destroySession();
?>
	</body>
</html>
Example #8
0
        // Creator of the event ("me") should be attending by default
        printMsg('Checking if creator of event (' . $me['name'] . ') is attending');
        $ret_obj = $facebook->api($event_id . '/attending/' . $me['id'], 'GET');
        // If attending, the data[] array will have our ID in it.
        if (isset($ret_obj['data'][0])) {
            printMsg($ret_obj['data'][0]['name'] . ' is attending');
        } else {
            printMsg('Error: Creator of event is not attending ?!');
        }
        // Delete the event
        printMsg('Deleting the event.');
        $ret_val = $facebook->api($event_id, 'DELETE');
        if ($ret_val) {
            printMsg('Event deleted');
        } else {
            printMsg("Error: Couldn't delete event");
        }
    } catch (FacebookApiException $e) {
        // If the user is logged out, you can have a
        // user ID even though the access token is invalid.
        // In this case, we'll get an exception, so we'll
        // just ask the user to login again here.
        $login_url = $facebook->getLoginUrl(array('scope' => 'create_event, rsvp_event'));
        echo 'Please <a href="' . $login_url . '">login.</a>';
        error_log($e->getType());
        error_log($e->getMessage());
    }
} else {
    // No user, so print a link for the user to login
    $login_url = $facebook->getLoginUrl(array('scope' => 'create_event,rsvp_event'));
    echo 'Please <a href="' . $login_url . '">login.</a>';
Example #9
0
<?php

require_once 'inc/init.php';
$t = -86400 * 365 * 2;
uSESSION('memberid');
uSESSION('groupid');
//session_destroy();
setCookies('username', '', $t);
setCookies('userpass', '', $t);
setCookies('expire', '', $t);
setCookies('memberauth', '', $t);
printMsg('logout_succeed');
Example #10
0
function createUser($uname, $pwd)
{
    $id = DBHandler::createUser($uname, $pwd);
    printMsg('Created ' . $uname . " successfully with id " . $id);
}
Example #11
0
$event_id = 0;
$event_name = "New Event API Test Event";
$event_start = time() + rand(1, 100) * rand(24, 64) * 3600;
$event_privacy = "OPEN";
// We'll make it secret so we don't annoy folks.
// We'll create an event in this example.
// We'll need create_event permission for this.
$params = array('name' => $event_name, 'start_time' => $event_start, 'privacy_type' => $event_privacy, 'access_token' => $page_access_token);
// Create an event
$ret_obj = $facebook->api("/{$page_id}/events", 'POST', $params);
if (isset($ret_obj['id'])) {
    // Success
    $event_id = $ret_obj['id'];
    printMsg('Event ID: ' . $event_id);
} else {
    printMsg("Couldn't create event.");
}
// Convenience method to print simple pre-formatted text.
function printMsg($msg)
{
    echo "<pre>{$msg}</pre>";
}
//	$code = $_REQUEST["code"];
//
//   	if(empty($code)) {
//    	$_SESSION['state'] = md5(uniqid(rand(), TRUE)); // CSRF protection
//     	$dialog_url = "https://www.facebook.com/dialog/oauth?display=popup&domain=localhost&locale=en_US&client_id="
//				       . $app_id . "&redirect_uri=" . urlencode($my_url) . "&state="
//				       . $_SESSION['state'];
//
//