コード例 #1
0
    }
    if (is_null($result[0]['contactWebsite']) || empty($result[0]['contactWebsite'])) {
        $result[0]['contactWebsite'] = "Not provided. Please update contact.";
    }
    if (is_null($result[0]['contactNotes']) || empty($result[0]['contactNotes'])) {
        $result[0]['contactNotes'] = "Not provided. Please update contact.";
    }
    //output currently store profile information for user review before updating
    echo "<div class='indUpdate'>\n        <h1>Your Current Contact Profile:</h1>\n        <div class='updateImg'>\n            <h3>Contact Picture:</h3>\n            <img src='{$result[0]['contactImage']}'/>\n        </div>\n        <div class='updateInfo'>\n            <h3>Conact Information:</h3>\n            <h1>{$result[0]['firstname']} {$result[0]['lastname']}</h1>\n            <h3><span>Phone:</span> {$result[0]['contactPhone']}</h3>\n            <h3><span>Primary Email:</span> {$result[0]['contactEmail']}</h3>\n            <h3><span>Other Email:</span> {$result[0]['altEmail']}</h3>\n            <h3><span>Website:</span> {$result[0]['contactWebsite']}</h3>\n            <h3><span>Notes:</span> {$result[0]['contactNotes']}</h3>\n        </div>\n    </div>";
}
//on submit logic
if (isset($_POST['submit'])) {
    $fname = $_POST['first_name'];
    $lname = $_POST['last_name'];
    $phone = $_POST['phone'];
    $primeEml = $_POST['prim_email'];
    $otherEml = $_POST['other_email'];
    $website = $_POST['website'];
    $notes = $_POST['comments'];
    //calls the update image function on submit
    $img = updateImage();
    //creates confirmaiton session message on post
    $_SESSION["message"] = "<div class='confirmed'><h4>Update Successful!</h4></div>";
    //calls update function on any inputed data to form
    databaseUpdate($fname, $lname, $phone, $primeEml, $otherEml, $website, $notes, $img);
    //returns user to index.php page
    header("Location: index.php");
}
echo "\n<!doctype html>\n<html lang='en'>\n<head>\n    <meta charset='UTF-8'>\n    <title>Contact Dashboard</title>\n    <link rel='stylesheet' href='css/normalize.css'>\n    <link rel='stylesheet' href='css/style.css'>\n</head>\n<body>\n<nav>\n    <h1>iForget Contact Manager</h1>\n    <a href='index.php'><button id='cancel'>Cancel</button></a>\n    <button id='showTog2'>Update Contact</button>\n</nav>\n<aside class='showForm'>\n    <div id='formSection'>\n        <h4>Update Contact</h4>\n        <form action='' enctype='multipart/form-data' method='post'>\n            <label for='first_name'>First Name : </label><input id='first_name' type='text' name='first_name' value='' /><br/>\n            <label for='last_name'>Last Name : </label><input  id='last_name' type='text' name='last_name' value='' /><br />\n            <label for='phone'>Phone : XXX-XXX-XXXX </label><input id='phone' type='tel' name='phone' value='' maxlength='20' /><br />\n            <label for='prim_email'>Primary Email : </label><input id='prim_email' type='email' name='prim_email' value='' /><br />\n            <label for='other_email'>Other Email : </label><input id='other_email' type='email' name='other_email' value='' /><br />\n            <label for='website'>Web Site: </label><input id='website' type='url' name='website' value='' /><br />\n            <label for='notes'>Notes:</label><br /><textarea name='comments' id='notes'   maxlength='150'></textarea><br />\n            <label for='img_upload'>Upload Image: </label><input id='img_upload' type='file' name='img_upload' value='upload' /><br />\n            <input type='submit' name='submit' value='submit' />\n            <input type='reset' name='reset' value='reset'' />\n        </form>\n    </div>\n</aside>\n<div class='instructions'>\n    <h1>Update Contacts.<br></h1>\n    <h2>Update your contacts.</h2>\n    <h2>Update whatever field you like.</h2>\n    <h3>Click the update contact button to get started.</h3>\n\n</div>\n\n<section id='update'>";
updateContacts();
echo "</section>\n<script src='https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js'></script>\n<script src='https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js'></script>\n<script language='JavaScript' type='text/javascript' src='js/scripts.js'></script>\n</body>\n</html>\n";
コード例 #2
0
    //        }
    if ($isvisitor) {
        ThreadProcessor::getInstance()->ProcessThread($thread['threadid'], 'visitor_browser_unload');
    }
    show_ok_result("closed");
} elseif ($act == 'rate') {
    if (!$isvisitor) {
        show_error("visitor-only operation");
    }
    $rate = verify_param("rate", "/^-?\\d{1,9}\$/", "0");
    Thread::getInstance()->RateOperator($thread, $rate);
    show_ok_result("rate");
} elseif ($act == "contacts") {
    $name = !empty($_REQUEST['name']) ? smarticonv("UTF-8", WEBIM_ENCODING, $_REQUEST['name']) : "";
    $email = !empty($_REQUEST['email']) ? smarticonv("UTF-8", WEBIM_ENCODING, $_REQUEST['email']) : "";
    Thread::getInstance()->PostMessage($thread['threadid'], KIND_INFO, Resources::Get('contacts.submitted', array($name, $email)));
    updateContacts($name, $email, $phone, $threadid, $thread['visitsessionid']);
    show_ok_result("contacts");
}
function show_ok_result($resid)
{
    Browser::SendXmlHeaders();
    echo "<{$resid}></{$resid}>";
    exit;
}
function show_error($message)
{
    Browser::SendXmlHeaders();
    echo "<error><descr>{$message}</descr></error>";
    exit;
}