upfile.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. //decode by http://dezend.qiling.org QQ 2859470
  3. define('IN_MYMPS', true);
  4. define('IN_AJAX', true);
  5. define('CURSCRIPT', 'upfile');
  6. include dirname(__FILE__) . '/../../include/global.php';
  7. require_once MYMPS_DATA . '/config.inc.php';
  8. require_once MYMPS_DATA . '/config.php';
  9. require_once MYMPS_DATA . '/config.db.php';
  10. require_once MYMPS_INC . '/admin.class.php';
  11. @header('Content-type: text/html; charset=' . $charset);
  12. require_once MYMPS_INC . '/db.class.php';
  13. if (!$mymps_admin->mymps_admin_chk_getinfo()) {
  14. exit('Access Denied!');
  15. } else {
  16. define('IN_ADMIN', true);
  17. }
  18. $destination = isset($destination) ? trim($destination) : '';
  19. $delfile && @unlink(MYMPS_ROOT . trim($delfile));
  20. $id = isset($id) ? trim($id) : 'imgsrc';
  21. if (is_array($_FILES) && submit_check(CURSCRIPT . '_submit')) {
  22. !$destination && ($destination = 'other');
  23. require_once MYMPS_INC . '/upfile.fun.php';
  24. $name_file = 'mymps_img';
  25. check_upimage($name_file);
  26. if ($_FILES[$name_file]['name']) {
  27. $watermark = !empty($watermark) ? $mymps_global['cfg_upimg_watermark'] : 0;
  28. if ($mymps_image = start_upload($name_file, '/' . $destination . '/' . date('Ym') . '/', $watermark, $width, $height)) {
  29. $msg = '图片上传成功!';
  30. $path = $mymps_image;
  31. } else {
  32. $msg = '图片上传失败!';
  33. $path = '';
  34. }
  35. } else {
  36. $msg = '图片上传失败!';
  37. $path = '';
  38. }
  39. echo '<script laguage=javascript>alert(\'' . $msg . '\');window.parent.document.getElementById("' . $id . '").value=\'' . $path . '\';</script><a href=\'?destination=' . $destination . '&watermark=' . $watermark . '&delfile=' . $path . '\' style=\'font-size:12px\'>点此重新上传图片</a>';
  40. } else {
  41. echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\r\n" . '<html xmlns="http://www.w3.org/1999/xhtml">' . "\r\n" . '<head>' . "\r\n" . '<meta http-equiv=\'Content-Type\' content=\'text/html; charset=utf-8\'>' . "\r\n" . '<title>upfile</title>' . "\r\n" . '<link href=\'../css/mymps.css\' rel=\'stylesheet\' type=\'text/css\'>' . "\r\n" . '<script language="javascript" src="../js/vbm.js"></script>' . "\r\n" . '<body style=" margin:0; padding:0px;">' . "\r\n" . ' <table width="100%" border="0" cellpadding="0" cellspacing="0" style="border:1px #c5d8e8 solid; padding:22px; background-color:#f5fbff">' . "\r\n" . '<form name="form1" enctype="multipart/form-data" action="?" method="post">' . "\r\n" . '<input name="destination" value="';
  42. echo $destination;
  43. echo '" type="hidden">' . "\r\n" . '<input name="width" value="';
  44. echo $width;
  45. echo '" type="hidden">' . "\r\n" . '<input name="height" value="';
  46. echo $height;
  47. echo '" type="hidden">' . "\r\n" . '<input name="watermark" value="';
  48. echo $watermark;
  49. echo '" type="hidden">' . "\r\n" . ' <tr>' . "\r\n" . ' <td rowspan="3" width="180"><img src="../template/images/pview.gif" width="150" id="picview" name="picview" /></td>' . "\r\n" . ' <td valign="top"><input name="mymps_img" type="file" id="litpic" style="width:200px; border:1px #999 solid; float:left" onchange="SeePic(document.picview,document.form1.litpic);"/>' . "\r\n" . '</td>' . "\r\n" . ' </tr>' . "\r\n" . ' <tr>' . "\r\n" . ' <td valign="bottom"><input name="upfile_submit" type="submit" value="开始上传" class="gray mini"/></td>' . "\r\n" . ' </tr>' . "\r\n" . '</form>' . "\r\n" . ' </table>' . "\r\n" . '</body>' . "\r\n" . '</html>' . "\r\n";
  50. }