รบกวนช่วยดู code ให้หน่อยคับ
ถาม-ตอบ แนะนำไอเดียว โค้ดตัวอย่าง แนวทาง วิธีแก้ปัญหา รบกวนช่วยดู code ให้หน่อยคับ
รบกวนช่วยดู code ให้หน่อยคับ
Copy
พอดี hosting อัพเกรดเป็น php4 ตัวโค๊ดที่เคยเขียนไว้มันเลยเพี้ยน ในส่วนเวลาจะ update รูปคับ มัน up แล้วรูปไม่เปลี่ยน
<?php session_start();
if($_SESSION['member_id'] == "")
{
header("Location: index.php");
}
error_reporting(0);
include("../config.php");
include("../function.php");
include ("class.upload.php");
if(isset($_GET['uid']) && (!isset($_POST['gallery_catname']))){
$gallery_catid = $_GET['uid'];
$SQL = "select * from gallery_cat where gallery_catid = '$gallery_catid' ";
$RS = mysql_query($SQL);
$arr = mysql_fetch_array($RS);
$gallery_catname = $arr['gallery_catname'];
$gallery_catpic = $arr['gallery_catpic'];
$gallery_date = $arr['gallery_date'];
$btn ="Update";
//...
}else if(isset($_GET['uid']) && (isset($_POST['gallery_catname']))){
if($_REQUEST[op]=='update'){
$SQL ="UPDATE gallery_cat SET
gallery_catname = '$_POST[gallery_catname]',
gallery_date='$_REQUEST[gallery_date]'
where gallery_catid ='$_REQUEST[gallery_catid]'";
if ((isset($_POST["ok"])) && ($_POST["ok"] == "ok_pass") && ($gallery_catpic != "") ){
$upload_image = new upload($_FILES['gallery_catpic'] ) ;
if ( $upload_image->uploaded ) {
$upload_image->process( "gallery" );
if ( $upload_image->processed ) {
$gallery_catpic = $upload_image->file_dst_name ;
$upload_image->clean();
}
} $sql = "update gallery_cat set gallery_catpic='$gallery_catpic' where gallery_catid = '$_REQUEST[gallery_catid]' ";
$result = mysql_query($sql) or die("Err gallery_catpic") ;
}
mysql_query($SQL);
}///end op=update
msgbox("ข้อมูลของคุณได้ถูกบันทึกใหม่แล้วครับ");
redirect("manage-gallery-cat.php");
}else if(isset($_POST['gallery_catname']) && (!isset($_GET['uid']))){
$gallery_catname = $_POST['gallery_catname'];
$gallery_catpic = $_POST['gallery_catpic'];
$gallery_date = date('Y/m/d H:i:s');
if ((isset($_POST["ok"])) && ($_POST["ok"] == "ok_pass")) {
$upload_image = new upload($_FILES['gallery_catpic']) ;
if ( $upload_image->uploaded ) {
$upload_image->process( "gallery" );
if ( $upload_image->processed ) {
$gallery_catpic = $upload_image->file_dst_name ;
$upload_image->clean();
}
}
}
$SQL ="INSERT INTO gallery_cat (gallery_catid,gallery_catname,gallery_catpic,gallery_date)
VALUES ('$gallery_catid','$gallery_catname','$gallery_catpic','$gallery_date'); ";
//echo $SQL;
mysql_query($SQL);
msgbox("ขอบคุณมากครับ");
redirect("manage-gallery-cat.php");
}else{
$gallery_catname="";
$btn ="Add";
}
?>
<!DOCTYPE html>
<!--
Template Name: Metronic - Responsive Admin Dashboard Template build with Twitter Bootstrap 3.1.1
Version: 2.0.2
Author: KeenThemes
Website: http://www.keenthemes.com/
Contact: [email protected]
Purchase: http://themeforest.net/item/metronic-responsive-admin-dashboard-template/4021469?ref=keenthemes
License: You must have a valid license purchased only from themeforest(the above link) in order to legally use the theme for your project.
-->
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en" class="no-js">
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
<meta charset="utf-8"/>
<title>ระบบจัดการข้อมูล</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1" name="viewport"/>
<meta content="" name="description"/>
<meta content="" name="author"/>
<!-- BEGIN GLOBAL MANDATORY STYLES -->
<link href="http://fonts.googleapis.com/css?family=Open Sans:400,300,600,700&subset=all" rel="stylesheet" type="text/css"/>
<link href="assets/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
<link href="assets/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
<link href="assets/plugins/uniform/css/uniform.default.css" rel="stylesheet" type="text/css"/>
<!-- END GLOBAL MANDATORY STYLES -->
<!-- BEGIN PAGE LEVEL STYLES -->
<link rel="stylesheet" type="text/css" href="assets/plugins/bootstrap-fileinput/bootstrap-fileinput.css"/>
<link rel="stylesheet" type="text/css" href="assets/plugins/bootstrap-switch/css/bootstrap-switch.min.css"/>
<link rel="stylesheet" type="text/css" href="assets/plugins/jquery-tags-input/jquery.tagsinput.css"/>
<link rel="stylesheet" type="text/css" href="assets/plugins/bootstrap-markdown/css/bootstrap-markdown.min.css">
<link rel="stylesheet" type="text/css" href="assets/plugins/typeahead/typeahead.css">
<!-- END PAGE LEVEL STYLES -->
<!-- BEGIN PAGE LEVEL PLUGIN STYLES -->
<link rel="stylesheet" type="text/css" href="assets/plugins/bootstrap-fileinput/bootstrap-fileinput.css"/>
<link rel="stylesheet" type="text/css" href="assets/plugins/bootstrap-switch/css/bootstrap-switch.min.css"/>
<link rel="stylesheet" type="text/css" href="assets/plugins/jquery-tags-input/jquery.tagsinput.css"/>
<link rel="stylesheet" type="text/css" href="assets/plugins/bootstrap-markdown/css/bootstrap-markdown.min.css">
<link rel="stylesheet" type="text/css" href="assets/plugins/typeahead/typeahead.css">
<link href="assets/plugins/gritter/css/jquery.gritter.css" rel="stylesheet" type="text/css"/>
<link href="assets/plugins/bootstrap-daterangepicker/daterangepicker-bs3.css" rel="stylesheet" type="text/css"/>
<link href="assets/plugins/fullcalendar/fullcalendar/fullcalendar.css" rel="stylesheet" type="text/css"/>
<link href="assets/plugins/jqvmap/jqvmap/jqvmap.css" rel="stylesheet" type="text/css"/>
<link href="assets/plugins/jquery-easy-pie-chart/jquery.easy-pie-chart.css" rel="stylesheet" type="text/css"/>
<!-- END PAGE LEVEL PLUGIN STYLES -->
<!-- BEGIN THEME STYLES -->
<link href="assets/css/style-metronic.css" rel="stylesheet" type="text/css"/>
<link href="assets/css/style.css" rel="stylesheet" type="text/css"/>
<link href="assets/css/style-responsive.css" rel="stylesheet" type="text/css"/>
<link href="assets/css/plugins.css" rel="stylesheet" type="text/css"/>
<link href="assets/css/pages/tasks.css" rel="stylesheet" type="text/css"/>
<link href="assets/css/themes/default.css" rel="stylesheet" type="text/css" id="style_color"/>
<link href="assets/css/print.css" rel="stylesheet" type="text/css" media="print"/>
<link href="assets/css/custom.css" rel="stylesheet" type="text/css"/>
<!-- END THEME STYLES -->
<link rel="shortcut icon" href="../style/images/favicon.png" />
</head>
<!-- END HEAD -->
<!-- BEGIN BODY -->
<body class="page-header-fixed">
<!-- BEGIN HEADER -->
<?php include ('header.php'); ?>
<!-- END BEGIN HEADER -->
<div class="clearfix">
</div>
<!-- BEGIN CONTAINER -->
<div class="page-container">
<!-- BEGIN SIDEBAR -->
<?php include ('sidebar.php'); ?>
<!-- END SIDEBAR -->
<!-- BEGIN CONTENT -->
<div class="page-content-wrapper">
<div class="page-content">
<!-- BEGIN SAMPLE PORTLET CONFIGURATION MODAL FORM-->
<div class="modal fade" id="portlet-config" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
<h4 class="modal-title">Modal title</h4>
</div>
<div class="modal-body">
Widget settings form goes here
</div>
<div class="modal-footer">
<button type="button" class="btn blue">Save changes</button>
<button type="button" class="btn default" data-dismiss="modal">Close</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
<!-- END SAMPLE PORTLET CONFIGURATION MODAL FORM-->
<!-- BEGIN PAGE HEADER-->
<div class="row">
<div class="col-md-12">
<!-- BEGIN PAGE TITLE & BREADCRUMB-->
<h3 class="page-title">
Gallery Category <small>Management</small>
</h3>
<ul class="page-breadcrumb breadcrumb">
<li>
<i class="fa fa-home"></i>
<a href="home.php">
Home
</a>
<i class="fa fa-angle-right"></i>
</li>
<li>
<a href="#">
Gallery Category
</a>
</li>
</ul>
<!-- END PAGE TITLE & BREADCRUMB-->
</div>
</div>
<!-- END PAGE HEADER-->
<div class="clearfix"></div>
<div class="row ">
<div class="col-md-12">
<!-- BEGIN VALIDATION STATES-->
<div class="portlet box blue">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-reorder"></i>Gallery Category (Size 440x340 px)
</div>
<div class="tools">
<a href="javascript:;" class="collapse">
</a>
<a href="javascript:;" class="reload">
</a>
</div>
</div>
<div class="portlet-body form">
<!-- BEGIN FORM-->
<form action="" class="form-horizontal" method="post" enctype="multipart/form-data">
<div class="form-body">
<div class="alert alert-danger display-hide">
<button class="close" data-close="alert"></button>
You have some form errors. Please check below.
</div>
<div class="alert alert-success display-hide">
<button class="close" data-close="alert"></button>
Your form validation is successful!
</div>
<div class="form-group">
<label class="control-label col-md-3">Gallery Name
<span class="required">
*
</span>
</label>
<div class="col-md-3">
<input type="text" name="gallery_catname" value="<?php echo $gallery_catname;?>" data-required="1" class="form-control" required="required"/>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3">Pic </label>
<div class="col-md-9">
<div class="fileinput fileinput-new" data-provides="fileinput">
<div class="input-group input-large">
<div class="form-control uneditable-input span3" data-trigger="fileinput">
<i class="fa fa-file fileinput-exists"></i>
<span class="fileinput-filename">
</span>
</div>
<span class="input-group-addon btn default btn-file">
<span class="fileinput-new">
Select file
</span>
<span class="fileinput-exists">
Change
</span>
<input type="file" name="gallery_catpic" value="<?php echo $gallery_catpic;?>">
</span>
<a href="#" class="input-group-addon btn default fileinput-exists" data-dismiss="fileinput">
Remove
</a>
</div>
Use <? if($arr["gallery_catpic"]<>""){ ?><img src="gallery/<?php echo $gallery_catpic;?>" width="50"><? }else{ print""; }?>
</div>
</div>
</div>
<div class="form-actions fluid">
<div class="col-md-offset-3 col-md-9">
<input type="submit" class="btn yellow" value="<?php echo $btn;?>" />
<input type="hidden" name="ok" value="ok_pass" class="btn yellow"/>
<input name="gallery_catid" type="hidden" id="gallery_catid" value="<?=$_REQUEST[uid]?>" />
<input name="op" type="hidden" id="op" value="update" />
<input type="reset" class="btn gray" value="Cancle" />
</div>
</div>
</form>
<!-- END FORM-->
</div>
<!-- END VALIDATION STATES-->
</div>
</div>
</div>
</div>
<!-- END CONTENT -->
</div>
<!-- END CONTAINER -->
<!-- BEGIN FOOTER -->
<?php include ('footer.php'); ?>
<!-- END FOOTER -->
<!-- BEGIN JAVASCRIPTS(Load javascripts at bottom, this will reduce page load time) -->
<!-- BEGIN CORE PLUGINS -->
<!--[if lt IE 9]>
<script src="assets/plugins/respond.min.js"></script>
<script src="assets/plugins/excanvas.min.js"></script>
<![endif]-->
<script src="assets/plugins/jquery-1.10.2.min.js" type="text/javascript"></script>
<script src="assets/plugins/jquery-migrate-1.2.1.min.js" type="text/javascript"></script>
<script src="assets/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="assets/plugins/bootstrap-hover-dropdown/bootstrap-hover-dropdown.min.js" type="text/javascript"></script>
<script src="assets/plugins/jquery-slimscroll/jquery.slimscroll.min.js" type="text/javascript"></script>
<script src="assets/plugins/jquery.blockui.min.js" type="text/javascript"></script>
<script src="assets/plugins/jquery.cokie.min.js" type="text/javascript"></script>
<script src="assets/plugins/uniform/jquery.uniform.min.js" type="text/javascript"></script>
<!-- END CORE PLUGINS -->
<!-- BEGIN PAGE LEVEL PLUGINS -->
<script type="text/javascript" src="assets/plugins/jquery-validation/dist/jquery.validate.min.js"></script>
<script type="text/javascript" src="assets/plugins/jquery-validation/dist/additional-methods.min.js"></script>
<script type="text/javascript" src="assets/plugins/select2/select2.min.js"></script>
<script type="text/javascript" src="assets/plugins/bootstrap-wysihtml5/wysihtml5-0.3.0.js"></script>
<script type="text/javascript" src="assets/plugins/bootstrap-wysihtml5/bootstrap-wysihtml5.js"></script>
<script type="text/javascript" src="assets/plugins/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="assets/plugins/bootstrap-markdown/js/bootstrap-markdown.js"></script>
<script type="text/javascript" src="assets/plugins/bootstrap-markdown/lib/markdown.js"></script>
<script type="text/javascript" src="assets/plugins/fuelux/js/spinner.min.js"></script>
<script type="text/javascript" src="assets/plugins/bootstrap-fileinput/bootstrap-fileinput.js"></script>
<script type="text/javascript" src="assets/plugins/jquery-inputmask/jquery.inputmask.bundle.min.js"></script>
<script type="text/javascript" src="assets/plugins/jquery.input-ip-address-control-1.0.min.js"></script>
<script src="assets/plugins/jquery.pwstrength.bootstrap/src/pwstrength.js" type="text/javascript"></script>
<script src="assets/plugins/bootstrap-switch/js/bootstrap-switch.min.js" type="text/javascript"></script>
<script src="assets/plugins/jquery-tags-input/jquery.tagsinput.min.js" type="text/javascript"></script>
<script src="assets/plugins/bootstrap-maxlength/bootstrap-maxlength.min.js" type="text/javascript"></script>
<script src="assets/plugins/bootstrap-touchspin/bootstrap.touchspin.js" type="text/javascript"></script>
<script src="assets/plugins/typeahead/handlebars.min.js" type="text/javascript"></script>
<script src="assets/plugins/typeahead/typeahead.min.js" type="text/javascript"></script>
<!-- END PAGE LEVEL PLUGINS -->
<!-- BEGIN PAGE LEVEL STYLES -->
<script src="assets/scripts/core/app.js"></script>
<script src="assets/scripts/custom/form-validation.js"></script>
<!-- END PAGE LEVEL STYLES -->
<script>
jQuery(document).ready(function() {
// initiate layout and plugins
App.init();
FormValidation.init();
});
</script>
<!-- END JAVASCRIPTS -->
</body>
<!-- END BODY -->
</html>
คำแนะนำ และการใช้งาน
สมาชิก กรุณา ล็อกอินเข้าระบบ เพื่อตั้งคำถามใหม่ หรือ ตอบคำถาม สมาชิกใหม่ สมัครสมาชิกได้ที่ สมัครสมาชิก
- ถาม-ตอบ กรุณา ล็อกอินเข้าระบบ
เว็บไซต์ของเราให้บริการเนื้อหาบทความสำหรับนักพัฒนา โดยพึ่งพารายได้เล็กน้อยจากการแสดงโฆษณา
โปรดสนับสนุนเว็บไซต์ของเราด้วยการปิดการใช้งานตัวปิดกั้นโฆษณา (Disable Ads Blocker) ขอบคุณครับ