function set_status($id, $status) { $time = date('Y-m-d H:i:s', time()); $sql = "UPDATE `person` SET `STATUS`='{$status}' WHERE `ID`='{$id}'"; mysql_query($sql); set_updatetime($id); }
$emails = get_person_contact($organization_id, 8); $email = mysql_fetch_assoc($emails); if ($email) { if ($_POST["organization_mail"] != $email["CONTACT_STRING"]) { del_contact($email['ID']); if (!empty($_POST["organization_mail"])) { add_contact($organization_id, $_POST["organization_mail"], '', 8); } } } else { if (!empty($_POST["organization_mail"])) { add_contact($organization_id, $_POST["organization_mail"], '', 8); } } $webs = get_person_contact($organization_id, 7); $web = mysql_fetch_assoc($webs); if ($web) { if ($_POST["organization_web"] != $web["CONTACT_STRING"]) { del_contact($web['ID']); if (!empty($_POST["organization_web"])) { add_contact($organization_id, $_POST["organization_web"], '', 7); } } } else { if (!empty($_POST["organization_web"])) { add_contact($organization_id, $_POST["organization_web"], '', 7); } } set_updatetime($id); header('Location:../view/detail_organization.php?id=' . $id); // back page
} } else { if (move_uploaded_file($_FILES["picture"]["tmp_name"], $target_file)) { echo $sql = "INSERT INTO `picture`( `PICTURE_OWNER_ID`, `PICTURE_NAME`, `PICTURE_FROM_DATE`) VALUES ('{$data_id}','" . $newfilename . "','{$time}')"; mysql_query($sql); echo "not old ,The file " . basename($_FILES["picture"]["name"]) . " has been uploaded."; } else { echo "Sorry, there was an error uploading your file."; } } //$time = date('Y-m-d H:i:s', time()); //$target_dir = "../../picture/"; //$target_file = $target_dir . basename($_FILES["picture"]["name"]); //echo "รูป " . $target_file; //if (move_uploaded_file($_FILES["picture"]["tmp_name"], $target_file)) { //// $sql = "SELECT * FROM `picture` WHERE `PICTURE_OWNER_ID`='$id' and `PICTURE_NAME`='" . basename($_FILES["picture"]["name"]) . "'"; //// //// $res = mysql_query($sql); //// $result_name = mysql_fetch_assoc($res); //// if (!$result_name) { //// $sql = "INSERT INTO `picture`( `PICTURE_OWNER_ID`, `PICTURE_NAME`, `PICTURE_FROM_DATE`) VALUES ('$id','" . basename($_FILES["picture"]["name"]) . "','$time')"; //// set_updatetime($id); //// mysql_query($sql); //// } // echo "The file " . basename($_FILES["picture"]["name"]) . " has been uploaded."; //} else { // echo "Sorry, there was an error uploading your file."; //} set_updatetime($data_id); } header('Location:' . $_SERVER['HTTP_REFERER']);