function upload_file($name) { global $image_dir_path; if (isset($_FILES[$name])) { $filename = $_FILES[$name]['name']; if (empty($filename)) { return; } $source = $_FILES[$name]['tmp_name']; $target = $image_dir_path . DIRECTORY_SEPARATOR . $filename; move_uploaded_file($source, $target); // create the '400', '250', and '100' versions of the image process_image($image_dir_path, $filename); } }
//display_ad_intro(); //echo $error; display_ad_form(1, $mode, ''); } else { insert_ad_data(true); // admin mode $prams = load_ad_values($_REQUEST['ad_id']); update_blocks_with_ad($_REQUEST['ad_id'], $prams['user_id']); display_ad_form(1, "edit", $prams); // disapprove the pixels because the ad was modified.. if (AUTO_APPROVE != 'Y') { // to be approved by the admin disapprove_modified_order($prams['order_id'], $BID); } if (AUTO_PUBLISH == 'Y') { process_image($BID); publish_image($BID); process_map($BID); //echo 'published.'; } echo 'Ad Saved. <A href="ads.php?BID=' . $prams['banner_id'] . '"><< Go to the Ad List</a>'; echo "<hr>"; } } else { $prams = load_ad_values($_REQUEST['ad_id']); display_ad_form(1, 'edit', $prams); } $prams = load_ad_values($_REQUEST['ad_id']); $sql = "select * FROM users where ID='" . $prams['user_id'] . "' "; $result = mysql_query($sql); $u_row = mysql_fetch_array($result);
/* 清除缓存 */ clear_cache_files(); die($json->encode($result)); } } else { if ($result['module_no'] == 1 && $result['do_album'] == 1) { //商品相册 $count = $GLOBALS['db']->GetOne("SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('goods_gallery') . ' AS album ' . $album_where); if ($result['page'] <= ceil($count / $result['page_size'])) { $start_time = gmtime(); // 开始执行时间 /* 开始处理 */ if ($proc_thumb) { process_image_ex($result['page'], $result['page_size'], $result['module_no'], $result['thumb'], $result['watermark'], $result['change'], $result['silent']); } else { process_image($result['page'], $result['page_size'], $result['module_no'], $result['thumb'], $result['watermark'], $result['change'], $result['silent']); } $end_time = gmtime(); $result['row']['pre_id'] = 'time_' . $result['total']; $result['row']['pre_time'] = $end_time > $start_time ? $end_time - $start_time : 1; $result['row']['pre_time'] = sprintf($_LANG['time_format'], $result['row']['pre_time']); $result['row']['cur_id'] = 'time_' . ($result['total'] + 1); $result['page']++; $result['row']['new_page'] = sprintf($_LANG['page_format'], $result['page']); $result['row']['new_total'] = sprintf($_LANG['total_format'], ceil($count / $result['page_size'])); $result['row']['new_time'] = $_LANG['wait']; $result['total']++; } else { $result['row']['pre_id'] = 'time_' . $result['total']; $result['row']['cur_id'] = 'time_' . ($result['total'] + 1); $result['row']['new_page'] = sprintf($_LANG['page_format'], $result['page']);
$BID = 1; # Banner ID. if ($_REQUEST['process'] == '1') { if ($_REQUEST['banner_list'][0] == 'all') { // process all $sql = "select * from banners "; $result = mysql_query($sql) or die(mysql_error() . $sql); while ($row = mysql_fetch_array($result)) { echo process_image($row['banner_id']); publish_image($row['banner_id']); process_map($row['banner_id']); } } else { // process selected foreach ($_REQUEST['banner_list'] as $key => $banner_id) { echo process_image($banner_id); publish_image($banner_id); process_map($banner_id); } } echo "<br>Finished.<hr>"; } ####################### # Process images ?> <script language="JavaScript" type="text/javascript"> function confirmLink(theLink, theConfirmMsg) { if (theConfirmMsg == '' || typeof(window.opera) != 'undefined') { return true;
<?php /* * An example PHP upload script for CamanJS. This expects a base64 * encoded string which represents the modified image data. It converts * it back to binary and saves it to a file. */ ini_set('display_errors', 1); error_reporting(E_ALL); define('UPLOAD_PATH', 'uploads/'); if (!$_POST['photo']) { exit; } $image = process_image($_POST['photo']); if (!$image) { exit; } // Just use a unique ID for the filename for this example $filename = uniqid() . '.' . $image['type']; if (is_writable(UPLOAD_PATH) && !file_exists(UPLOAD_PATH . $filename)) { if (file_put_contents(UPLOAD_PATH . $filename, $image['data']) !== false) { echo "1"; } else { echo "0"; } } else { echo "0"; } // Processes the encoded image data and returns the decoded image function process_image($photo) {
$discount_percent = filter_input(INPUT_POST, 'discount_percent', FILTER_VALIDATE_FLOAT); // Validate inputs if (empty($code) || empty($name) || empty($description) || $price === false || $discount_percent === false) { $error = 'Invalid product data. Check all fields and try again.'; include '../../errors/error.php'; } else { $categories = get_categories(); update_product($product_id, $code, $name, $description, $price, $discount_percent, $category_id); $product = get_product($product_id); include 'product_view.php'; } break; case 'upload_image': $product_id = filter_input(INPUT_POST, 'product_id', FILTER_VALIDATE_INT); $product = get_product($product_id); $product_code = $product['productCode']; $image_filename = $product_code . '.png'; $image_dir = $doc_root . $app_path . 'images/'; if (isset($_FILES['file1'])) { $source = $_FILES['file1']['tmp_name']; $target = $image_dir . DIRECTORY_SEPARATOR . $image_filename; // save uploaded file with correct filename move_uploaded_file($source, $target); // add code that creates the medium and small versions of the image process_image($image_dir, $image_filename); // display product with new image include 'product_view.php'; } break; }
} } else { return false; } } else { global $NoFileError; $NoFileError = "You did not upload any file"; } } ?> <?php $update = ""; if ($ln || $ag || $genUsername && $password || $fn || $cn || $ptn || $gdr || $about) { if ($_FILES["passport"]["name"]) { if (process_image()) { // change this to an alert of something else $update = "Your Profile Registration is complete.<br/><a href ='profile.php'>Continue</ a>"; // showPassport(); // $insert_details = "INSERT INTO user_profile (LastName, FirstName, Username, Password, PwrdRcvryQtn, RcvryAns, Age, CompanyName, Gender, Position, Email, Address, Employed, Phone, AboutYourself, Date )" // . "VALUES ('$ln', '$fn', '$genUsername', '$password', '$pwrdrcvryqtn' '$ans', '$ag', '$cn', '$gdr', '$ptn', '$email', '$address', '$employed', '$phone', '" . mysqli_escape_string($con, $about) . "','$date')" // . "WHERE Passport = ''"; $insert_details = "UPDATE user_profile SET LastName = '{$ln}', FirstName = '{$fn}', Username = '******', Password = '******', PwrdRcvryQtn = '{$pwrdrcvryqtn}', RcvryAns = '{$ans}', Age = '{$ag}', CompanyName = '{$cn}', Gender = '{$gdr}', Position = '{$ptn}', Email = '{$email}', Address = '{$address}', Employed = '{$employed}', Phone = '{$phone}', AboutYourself = '" . mysqli_escape_string($con, $about) . "', Date = '{$date}' " . "WHERE Passport = '" . mysqli_real_escape_string($con, $target_path) . "'"; if (!mysqli_query($con, $insert_details)) { echo mysqli_error($con); echo "Something went wrong with of upload"; } } else { $update = "Sorry, something went wrong with registration, please try again"; } } else {
function complete_renew_order($order_id) { global $label; $sql = "SELECT * from orders where order_id='{$order_id}' and status='renew_paid' "; $result = mysql_query($sql) or die(mysql_error() . $sql); $order_row = mysql_fetch_array($result); if ($order_row['status'] != 'completed') { $now = gmdate("Y-m-d H:i:s"); $sql = "UPDATE orders set status='completed', date_published=NULL, date_stamp='{$now}' WHERE order_id=" . $order_id; mysql_query($sql) or die(mysql_error() . $sql); // update pixel's order_id $sql = "UPDATE blocks SET order_id='" . $order_row['order_id'] . "' WHERE order_id='" . $order_row['original_order_id'] . "' AND banner_id='" . $row['banner_id'] . "' "; mysql_query($sql) or die(mysql_error() . $sql); // update ads' order id $sql = "UPDATE ads SET order_id='" . $order_row['order_id'] . "' WHERE order_id='" . $order_row['original_order_id'] . "' AND banner_id='" . $row['banner_id'] . "' "; mysql_query($sql) or die(mysql_error() . $sql); // mark pixels as sold. $sql = "SELECT * from orders where order_id='{$order_id}' "; $result = mysql_query($sql) or die(mysql_error() . $sql); $order_row = mysql_fetch_array($result); $blocks = explode(",", $order_row['blocks']); foreach ($blocks as $key => $val) { $sql = "UPDATE blocks set status='sold' where block_id='{$val}' and banner_id=" . $order_row['banner_id']; mysql_query($sql) or die(mysql_error() . $sql); } $sql = "SELECT * from users where ID='{$user_id}' "; $result = mysql_query($sql) or die(mysql_error() . $sql); $user_row = mysql_fetch_array($result); if ($order_row['days_expire'] == 0) { $order_row['days_expire'] = $label['advertiser_ord_never']; } $label["order_completed_renewal_email_template"] = str_replace("%SITE_NAME%", SITE_NAME, $label["order_completed_renewal_email_template"]); $label["order_completed_renewal_email_template"] = str_replace("%FNAME%", $user_row[FirstName], $label["order_completed_renewal_email_template"]); $label["order_completed_renewal_email_template"] = str_replace("%LNAME%", $user_row[LastName], $label["order_completed_renewal_email_template"]); $label["order_completed_renewal_email_template"] = str_replace("%ORDER_ID%", $order_row[order_id], $label["order_completed_renewal_email_template"]); $label["order_completed_renewal_email_template"] = str_replace("%ORIGINAL_ORDER_ID%", $order_row[original_order_id], $label["order_completed_renewal_email_template"]); $label["order_completed_renewal_email_template"] = str_replace("%PIXEL_COUNT%", $order_row[quantity], $label["order_completed_renewal_email_template"]); $label["order_completed_renewal_email_template"] = str_replace("%PIXEL_DAYS%", $order_row[days_expire], $label["order_completed_renewal_email_template"]); $label["order_completed_renewal_email_template"] = str_replace("%PRICE%", convert_to_default_currency_formatted($order_row[currency], $order_row[price]), $label["order_completed_renewal_email_template"]); $label["order_completed_renewal_email_template"] = str_replace("%SITE_CONTACT_EMAIL%", SITE_CONTACT_EMAIL, $label["order_completed_renewal_email_template"]); $label["order_completed_renewal_email_template"] = str_replace("%SITE_URL%", BASE_HTTP_PATH, $label["order_completed_renewal_email_template"]); $message = $label["order_completed_renewal_email_template"]; $to = trim($user_row['Email']); $subject = $label['order_completed_email_subject']; if (EMAIL_USER_ORDER_COMPLETED == 'YES') { if (USE_SMTP == 'YES') { $mail_id = queue_mail(addslashes($to), addslashes($user_row[FirstName] . " " . $user_row[LastName]), addslashes(SITE_CONTACT_EMAIL), addslashes(SITE_NAME), addslashes($subject), addslashes($message), '', 8); process_mail_queue(2, $mail_id); } else { send_email($to, $user_row[FirstName] . " " . $user_row[LastName], SITE_CONTACT_EMAIL, SITE_NAME, $subject, $message, '', 1); } } // send a copy to admin if (EMAIL_ADMIN_ORDER_COMPLETED == 'YES') { if (USE_SMTP == 'YES') { $mail_id = queue_mail(addslashes(SITE_CONTACT_EMAIL), addslashes($user_row[FirstName] . " " . $user_row[LastName]), addslashes(SITE_CONTACT_EMAIL), addslashes(SITE_NAME), addslashes($subject), addslashes($message), '', 8); process_mail_queue(2, $mail_id); } else { send_email(SITE_CONTACT_EMAIL, $user_row[FirstName] . " " . $user_row[LastName], SITE_CONTACT_EMAIL, SITE_NAME, $subject, $message, '', 1); } } // process the grid, if auto_publish is on $b_row = load_banner_row($order_row['banner_id']); if ($b_row['auto_publish'] == 'Y') { process_image($order_row['banner_id']); publish_image($order_row['banner_id']); process_map($order_row['banner_id']); } } }
if (sizeof($_REQUEST['users']) > 0) { foreach ($_REQUEST['users'] as $user_id) { $sql = "UPDATE blocks set approved='N' WHERE user_id=" . $user_id . " {$bid_sql}"; mysql_query($sql) or die(mysql_error() . $sql); $sql = "UPDATE orders set approved='N' WHERE user_id=" . $user_id . " {$bid_sql}"; mysql_query($sql) or die(mysql_error() . $sql); } echo "Advertiser(s) Disapproved.<br>"; } } if ($_REQUEST['do_it_now'] == 'true') { // process all grids $sql = "select * from banners "; $result = mysql_query($sql) or die(mysql_error() . $sql); while ($row = mysql_fetch_array($result)) { echo process_image($row['banner_id']); publish_image($row['banner_id']); process_map($row['banner_id']); } } /* if ($_REQUEST['all_go']!='') { $sql = "UPDATE blocks set approved='Y' "; mysql_query ($sql) or die (mysql_error().$sql); $sql = "select * from banners "; $result = mysql_query ($sql) or die (mysql_error().$sql); while ($row = mysql_fetch_array($result)) { process_image($row['banner_id']); publish_image($row['banner_id']); process_map($row['banner_id']); }
//get the temp location $tempPath = $_FILES['myFile']['tmp_name']; //get the filename $filename = $_FILES['myFile']['name']; // create a unique tag for the filename $tag = time() . rand(); // get the file extension $ext = pathinfo($_FILES['myFile']['name'], PATHINFO_EXTENSION); // get the base filename $basename = pathinfo($_FILES['myFile']['name'], PATHINFO_FILENAME); // create a new filename incorporating the unique tag $new_filename = $basename . "-" . $tag . "." . $ext; //echo("Base name : ".$basename ."\n"); //echo("Extension : ".$ext ."\n"); //echo ("target file2 ".$targetFile."\n"); process_image($new_filename, $tempPath, $new_filename, $ext); //move_uploaded_file( $tempPath, $upload_path.$filename ); } else { echo 'No files'; } function process_image($new_filename, $tempFile, $new_name, $ext) { ini_set('max_execution_time', 700); $upload_img_thumb = $_SERVER['DOCUMENT_ROOT'] . "/images/portfolio/img_thumb/"; $upload_img_large = $_SERVER['DOCUMENT_ROOT'] . "/images/portfolio/img_large/"; //$root = $_SERVER['DOCUMENT_ROOT']; //$uploadDir_images_md = $upload_path; //$uploadDir_images_std = $root.'/resources/crm_images/listing_images/images_std/'; //$uploadDir_thumbs_sm = $root.'/resources/crm_images/listing_images/thumbs_sm/'; //$uploadDir_thumbs_std = $root.'/resources/crm_images/listing_images/thumbs_std/'; switch ($ext) {
$action = filter_input(INPUT_POST, 'action'); if ($action == NULL) { $action = filter_input(INPUT_GET, 'action'); if ($action == NULL) { $action = ''; } } switch ($action) { case 'upload': if (isset($_FILES['file1'])) { $filename = $_FILES['file1']['name']; if (empty($filename)) { break; } $source = $_FILES['file1']['tmp_name']; $target = $image_dir_path . DIRECTORY_SEPARATOR . $filename; move_uploaded_file($source, $target); // create the '400' and '100' versions of the image process_image($image_dir_path, $filename); } break; case 'delete': $filename = filter_input(INPUT_GET, 'filename', FILTER_SANITIZE_STRING); $target = $image_dir_path . DIRECTORY_SEPARATOR . $filename; if (file_exists($target)) { unlink($target); } break; } $files = get_file_list($image_dir_path); include 'uploadform.php';
$path = $parent_path . $request_path; debug("path: " . $path); if (is_dir($path)) { list_dir($path); } else { $path_parts = pathinfo($path); $ext = strtolower($path_parts['extension']); $type = get_content_type($ext); if (is_in_zip($path, $ext)) { process_file_in_zip($path, $type); } else { if (is_in_rar($path, $ext)) { process_file_in_rar($path, $type); } else { if (in_array($ext, $image_ext)) { process_image($path, $type); } else { if ($ext == "zip" || $ext == "cbz") { process_zip($path); } else { if ($ext == "rar" || $ext == "cbr") { process_rar($path); } else { return; } } } } } } ################################################################################
function do_page($reqPosts) { //global $selectedposts, $onepost; echo '<div class="container"><!-- Page -->'; // If, posting is required, then do it. if (isset($_POST['doit'])) { if (!$_POST['post_id']) { awfuck('Post submitted with no post_id!'); } switch ($_POST['doit']) { case "Submit Edit": $thequery = sprintf('UPDATE posts SET section_id = %s, category_id = %s, status = %s, title = "%s", content = "%s", date = "%s", time = "%s" WHERE post_id = %s', mysql_real_escape_string($_POST['section_id']), mysql_real_escape_string($_POST['category_id']), mysql_real_escape_string($_POST['status']), mysql_real_escape_string($_POST['title']), mysql_real_escape_string($_POST['content']), mysql_real_escape_string($_POST['sort_date']), mysql_real_escape_string($_POST['sort_time']), mysql_real_escape_string($_POST['post_id'])); shitbugs(sprintf('<b>Query is:</b><br />%s', $thequery)); if (mysql_query($thequery)) { happymsg('<h4>Post has been updated</h4>', $_POST['post_id']); } else { awfuck(mysql_error()); } display_posts(array('post' => $_POST['post_id']), "display"); break; case "Submit New": echo "- NEWPOST<br>"; $thequery = sprintf('INSERT INTO posts (section_id, category_id, status, title, content, date, time) VALUES (%s, %s, %s, "%s", "%s", "%s", "%s")', mysql_real_escape_string($_POST['section_id']), mysql_real_escape_string($_POST['category_id']), mysql_real_escape_string($_POST['status']), mysql_real_escape_string($_POST['title']), mysql_real_escape_string($_POST['content']), mysql_real_escape_string($_POST['sort_date']), mysql_real_escape_string($_POST['sort_time'])); if (mysql_query($thequery)) { printf('Post #%s has been created. <a href="phux0red.php?page=dostuff&edit&post=%s">Edit it again?</a>', mysql_insert_id(), mysql_insert_id()); } display_posts(array('post' => mysql_insert_id()), "display"); break; case "Attach Image": echo "- ATTACH IMAGE<br>"; foreach ($_FILES as $file) { print_r($file); echo '<br><br>'; if ($file['tmp_name'] > '') { list($filebase, $fileext) = explode(".", strtolower($file['name']), 2); $small_filename = sprintf('gallery/small/%s-s.%s', $filebase, $fileext); $medium_filename = sprintf('gallery/medium/%s-m.%s', $filebase, $fileext); switch ($fileext) { case "dll": echo "F**K YOU!"; break; case "jpg": echo "Type is JPEG<br>"; $imagetoprocess = imagecreatefromjpeg($file['tmp_name']); imagejpeg(process_image($imagetoprocess, 200, 200), $small_filename, 100); imagejpeg(process_image($imagetoprocess, 800, 600), $medium_filename, 100); $thequery = sprintf('INSERT INTO post_img (post_id, filename, caption, description) VALUES (%s, "%s", "%s", "%s")', mysql_real_escape_string($_POST['post_id']), mysql_real_escape_string($filebase), mysql_real_escape_string($_POST['caption']), mysql_real_escape_string($_POST['description'])); if (mysql_query($thequery)) { printf('Image has been uploaded. <a href="phux0red.php?post=%s">View post</a>', $_POST['post_id']); } break; } } } move_uploaded_file($_FILES['image_to_upload']['tmp_name'], "gallery/large/{$_FILES['image_to_upload']['name']}"); break; default: echo "- " . $_post['doit']; break; } } else { echo "NOT POSTING ANYTHING, SO...<br>"; } // End posting stuff. echo "FINISHED DECIDING WHAT TO DO<br>"; if (isset($_GET['edit'])) { if (isset($_GET['post'])) { edit_post($onepost['0']); } } elseif (isset($_GET['newpost'])) { edit_post(0); } elseif (isset($_GET['addimg'])) { if (isset($_GET['post'])) { edit_images($onepost['0']); } } else { echo "<h3>Drafts:</h3>"; display_posts(array('status' => '1'), "list"); echo "<h3>Published Posts:</h3>"; display_posts(array('status' => '2'), "list"); echo "<h3>Deleted Posts:</h3>"; display_posts(array('status' => '3'), "list"); } ?> </div><!-- Page --> <?php }
while (1) { $s = fread($in, 1024); if (!empty($s)) { echo "\n"; system('bash -c "su -c \\"ffplay -showmode 0 -t 0.35 sound_camera.wav -autoexit\\" diod >>/tmp/aura.log 2>&1 &"'); system('bash -c "gxmessage -geometry 400x200 -sticky -center \\"Идет поиск...\\" >>/tmp/aura.log 2>&1 &"'); sleep(1); $ret = 0; //1800 system('wmctrl -a gxmessage -e "0,440,400,400,200"', $ret); echo "wmctrl: " . $ret . "\n"; $id = date('Ymd-his'); $f = capture_image($id); $res = upload_image($id, $f); echo "res: " . $res . "\n"; process_image($f); sleep(5); system('killall gxmessage'); } $s = fread($in, 1024); $tm = date('Y-m-d H:i:s'); echo "\r" . $tm . ": "; sleep(1); } function capture_image($id) { $fs = "images/{$id}_src.jpg"; $f = "images/{$id}.jpg"; $ret = 0; system("numlockx on"); system("ffmpeg -f v4l2 -video_size 1280x960 -i /dev/video0 -ss 2.5 -frames 1 output%03d.png", $ret);
$rc = $db->Execute("SELECT id,columnname,datatype,thumb_x_size FROM {$tableinfo->desname} WHERE datatype='file' OR datatype='image'"); while (!$rc->EOF) { if ($_FILES[$rc->fields['columnname']]['name'][0]) { // delete all existing files //delete_column_file ($db,$tableinfo->id,$rc->fields['id'],$_POST['id'],$USER); // store the file uploaded by the user $fileid = upload_files($db, $tableinfo->id, $_POST['id'], $rc->fields['id'], $rc->fields['columnname'], $USER, $system_settings); if ($rc->fields['datatype'] == 'file') { // try to convert it to an html file if ($fileid) { $htmlfileid = process_file($db, $fileid, $system_settings); } } elseif ($rc->fields['datatype'] == 'image') { // make thumbnails and do image specific stuff if ($fileid) { process_image($db, $fileid, $rc->fields['thumb_x_size']); } } } $rc->MoveNext(); } // to not interfere with search form unset($_POST); } } elseif (isset($submit) && $submit == 'Cancel') { // to not interfere with search form unset($_POST); } elseif ($_POST) { reset($_POST); while (list($key, $val) = each($_POST)) { if (substr($key, 0, 3) == 'del' && $val == 'Remove') {