コード例 #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
ファイル: global_function.php プロジェクト: yfg2014/yangphp_4
function databaseSync($folderpath, $realitivePath = '')
{
    global $database;
    // get files from $folderpath and put them in array
    if (is_dir($folderpath)) {
        if ($dh = opendir($folderpath)) {
            while (($file = readdir($dh)) !== false) {
                #echo "$file";
                if ($file != '.' && $file != '..' && filetype($folderpath . '/' . $file) == 'file' && substr($file, 0, 1) != '.') {
                    $fileid = fileid($folderpath, $file);
                    $files[$file] = array($fileid, 'exist');
                    #echo "1 $file<br>";
                }
            }
            closedir($dh);
        }
    }
    // get files from database
    $query = "select * from {$GLOBALS['tablePrefix']}filesystem where path=\"" . mysql_escape_string($folderpath) . "\" and status=\"found\"";
    $result = mysql_query($query, $database);
    while ($dirinfo = mysql_fetch_assoc($result)) {
        $filename = $dirinfo['filename'];
        $fileid = $dirinfo['id'];
        if (isset($files[$filename]) && $files[$filename][0] == $dirinfo['id']) {
            $files[$filename][1] = 'done';
        } else {
            databaseLost($fileid);
        }
    }
    if (isset($files)) {
        $ak = array_keys($files);
        for ($i = 0; $i < sizeof($ak); $i++) {
            $filename = $ak[$i];
            if ($files[$filename][1] != 'done') {
                #echo "$filename to search<br>";
                if (databaseSearch($folderpath, $filename)) {
                    databaseUpdate($folderpath, $filename, $realitivePath);
                } else {
                    databaseAdd($folderpath, $filename, $realitivePath);
                }
            }
        }
    }
}