/** * _check_photo对上传的照片进行处理 * @access public * @return 返回照片名称 */ function _check_photo() { //类的实例化: include ROOT_PATH . "includes/upphoto.php"; //类的文件名是upphoto.php $up = new upphoto(); $up->get_ph_tmpname($_FILES['photo']['tmp_name']); $up->get_ph_type($_FILES['photo']['type']); $up->get_ph_size($_FILES['photo']['size']); $up->get_ph_name($_FILES['photo']['name']); echo $up->save(); $temp = $up->get_ph_name($_FILES['photo']['name']); //提取出上传后生成的目录和文件名 return $e_image = strrchr($up->get_ph_name($_FILES['photo']['name']), "/"); //去掉目录,只保留文件名及后缀,方便存入数据库 }
if ($rs) { header("Content-Type:text/html;charset=utf-8"); echo "<script>alert('修改成功!');history.back();</script>"; exit; } else { header("Content-Type:text/html;charset=utf-8"); echo "<script>alert('修改失败!');history.back();</script>"; exit; } } $con_mkn = db_connect(); $sql = " update t_user set "; $sql = $sql . "logintime='{$date}',"; if ($_FILES['lc_pic']['name'] != "") { $up = new upphoto(); $up->get_ph_tmpname($_FILES['lc_pic']['tmp_name']); $up->get_ph_type($_FILES['lc_pic']['type']); $up->get_ph_size($_FILES['lc_pic']['size']); $up->get_ph_name($_FILES['lc_pic']['name']); $up->save(); $lc_pic = $up->ph_name; $sql = $sql . "userpic='{$lc_pic}'"; } $sql = $sql . " where userid='{$_SESSION['userid']}'"; $rs = mysqli_query($con_mkn, $sql); if ($rs) { header("Content-Type:text/html;charset=utf-8"); echo "<script>alert('修改成功!');history.back();</script>"; } else { header("Content-Type:text/html;charset=utf-8"); echo "<script>alert('修改失败!');history.back();</script>";
</script> <?php //类的实例化: $up = new upphoto(); $up->ph_path = $_SERVER['DOCUMENT_ROOT'] . "/"; //设定上传路径 $up->ph_name = $_FILES['photo1']['name']; $submit = $_POST['submit1']; if ($submit == "上传") { $up->get_ph_tmpname($_FILES['photo1']['tmp_name']); $up->get_ph_type($_FILES['photo1']['type']); $up->get_ph_size($_FILES['photo1']['size']); $up->get_ph_name($_FILES['photo1']['name']); $up->save(); } $up = new upphoto(); $up->ph_path = $_SERVER['DOCUMENT_ROOT'] . "/"; //设定上传路径 $up->ph_name = $_FILES['photo']['name']; $submit = $_POST['submit']; if ($submit == "上传") { $up->get_ph_tmpname($_FILES['photo']['tmp_name']); $up->get_ph_type($_FILES['photo']['type']); $up->get_ph_size($_FILES['photo']['size']); $up->get_ph_name($_FILES['photo']['name']); $up->save(); } ?> </div>
// } } else { if ($result == FALSE) { echo "b"; exit; } else { echo "c"; exit; } } } } else { if ("post" == $_GET['model']) { // $filename = $_FILES['file']['type']; $up = new upphoto(); $up->get_ph_tmpname($_FILES['file']['tmp_name']); $up->get_ph_type($_FILES['file']['type']); $up->get_ph_size($_FILES['file']['size']); $up->get_ph_name($_FILES['file']['name']); $up->save(); $name = $_POST['name']; $mobile = $_POST['mobile']; $text = $_POST['text']; C::app()->init(); // $time = $helper $data = array('name' => $name, 'mobile' => $mobile, 'filepath' => $up->ph_name, 'note' => $text); C::t("#smart_vote#smart_vote")->insert($data); // include template("smart_vote:post"); } else { if ("detail" == $_GET['model']) { $gid = $_GET['gid'];