|
|
|
ผมต้องการ อัพโหลดรูปแล้ว จะเขียนคำสั่งให้รูปเข้ามาอยู่ในโฟล์เดอร์เว็บยังไงครับ |
|
|
|
|
|
|
|
นี้โค๊ดครับ
Code (PHP)
<?php session_start(); ?>
<?php require_once('Connections/DbConnect.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
$updateSQL = sprintf("UPDATE member SET al_name=%s, al_lastname=%s, address=%s, province=%s, district=%s, subdistrict=%s, zipcode=%s, tel=%s, email=%s, workplace=%s, position=%s, `pic`=%s WHERE al_no=%s",
GetSQLValueString($_POST['al_name'], "text"),
GetSQLValueString($_POST['al_lastname'], "text"),
GetSQLValueString($_POST['address'], "text"),
GetSQLValueString($_POST['province'], "text"),
GetSQLValueString($_POST['district'], "text"),
GetSQLValueString($_POST['subdistrict'], "text"),
GetSQLValueString($_POST['zipcode'], "text"),
GetSQLValueString($_POST['tel'], "text"),
GetSQLValueString($_POST['email'], "text"),
GetSQLValueString($_POST['workplace'], "text"),
GetSQLValueString($_POST['position'], "text"),
GetSQLValueString($_POST['pic'], "text"),
GetSQLValueString($_POST['al_no'], "text"));
mysql_select_db($database_DbConnect, $DbConnect);
$Result1 = mysql_query($updateSQL, $DbConnect) or die(mysql_error());
$updateGoTo = "profile.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
mysql_select_db($database_DbConnect, $DbConnect);
$query_Recordset1 = "SELECT * FROM member";
$Recordset1 = mysql_query($query_Recordset1, $DbConnect) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
mysql_select_db($database_DbConnect, $DbConnect);
$query_Recordset2 = "SELECT * FROM province";
$Recordset2 = mysql_query($query_Recordset2, $DbConnect) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysql_num_rows($Recordset2);
mysql_select_db($database_DbConnect, $DbConnect);
$query_Recordset3 = "SELECT * FROM district";
$Recordset3 = mysql_query($query_Recordset3, $DbConnect) or die(mysql_error());
$row_Recordset3 = mysql_fetch_assoc($Recordset3);
$totalRows_Recordset3 = mysql_num_rows($Recordset3);
mysql_select_db($database_DbConnect, $DbConnect);
$query_Recordset4 = "SELECT * FROM amphur";
$Recordset4 = mysql_query($query_Recordset4, $DbConnect) or die(mysql_error());
$row_Recordset4 = mysql_fetch_assoc($Recordset4);
$totalRows_Recordset4 = mysql_num_rows($Recordset4);
$colname_showmembers = "-1";
if (isset($_SESSION['MM_Username'])) {
$colname_showmembers = $_SESSION['MM_Username'];
}
mysql_select_db($database_DbConnect, $DbConnect);
$query_showmembers = sprintf("SELECT * FROM member WHERE al_no = %s", GetSQLValueString($colname_showmembers, "text"));
$showmembers = mysql_query($query_showmembers, $DbConnect) or die(mysql_error());
$row_showmembers = mysql_fetch_assoc($showmembers);
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theVaslue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
?>
<!DOCTYPE HTML>
<html>
<head>
<title>editRegister</title>
<my sql_query("Set NAMES UTF8")
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="css/style.css">
<link rel="stylesheet" href="css/jquery.mobile-1.3.2.min.css">
<link rel="stylesheet" type="text/css" href="css/form.css" />
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="css/bootstrap-theme.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<script src="phonegap.js"></script>
<script src="jquery.mobile-1.3.2.min.js"></script>
<script src="js/bootstrap.min.js"></script>
</head>
<body>
<nav class="navbar navbar-inverse" role="navigation">
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="#contact"></a></li>
<li class="active"><a href="#">หน้าหลัก</a></li>
<li><a href="#contact">เกี่ยวกับเรา</a></li>
<li><a href="#contact">เว็บบอร์ด</a></li>
<li><a href="#contact">กิจกรรม</a></li>
</ul>
<form action="logout.php" methord="get" class="navbar-form navbar-right" role="form">
<div class="form-group">
<FONT COLOR=WHITE> Hello <?php echo $row_showmembers['al_gender']; ?>.<?php echo $row_showmembers['al_name']; ?> </FONT>
<button type="submit" class="btn btn-default">Logout</button>
</form>
</div>
</nav>
</div>
<center> <img src= "photo/img-01.jpg"> </center>
<!-- ====================================================================================================================================== -->
<h2 class="page-header">Profile</h2>
<center>
<div class="bs-example">
<br></br>
<div class="col-sm-6 col-md-4">
<div><img src="img/<?php echo $row_showmembers['pic']; ?>" width="163" height="257" border="0" /></div>
</div>
</center>
<div class="col-sm-6 col-md-5">
<div class="thumbnail">
<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
<table align="center">
<tr valign="baseline">
<td nowrap align="right">เลขทะเบียน:</td>
<td><?php echo $row_showmembers['al_no']; ?></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">ชือ:</td>
<td><input type="text" name="al_name" value="<?php echo htmlentities($row_showmembers['al_name'], ENT_COMPAT, 'utf-8'); ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">นามสกุล:</td>
<td><input type="text" name="al_lastname" value="<?php echo htmlentities($row_showmembers['al_lastname'], ENT_COMPAT, 'utf-8'); ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">ที่อยู่:</td>
<td><input type="text" name="address" value="<?php echo htmlentities($row_showmembers['address'], ENT_COMPAT, 'utf-8'); ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">จังหวัด:</td>
<td><label for="province"></label>
<select name="province" id="province">
<option value="-">เลือกจังหวัด</option>
<?php
do {
?>
<option value="<?php echo $row_Recordset2['PROVINCE_NAME']?>"><?php echo $row_Recordset2['PROVINCE_NAME']?></option>
<?php
} while ($row_Recordset2 = mysql_fetch_assoc($Recordset2));
$rows = mysql_num_rows($Recordset2);
if($rows > 0) {
mysql_data_seek($Recordset2, 0);
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
}
?>
</select></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">เขต:</td>
<td><label for="district"></label>
<select name="district" id="district">
<option value="-">เลือกเขต</option>
<?php
do {
?>
<option value="<?php echo $row_Recordset4['AMPHUR_NAME']?>"><?php echo $row_Recordset4['AMPHUR_NAME']?></option>
<?php
} while ($row_Recordset4 = mysql_fetch_assoc($Recordset4));
$rows = mysql_num_rows($Recordset4);
if($rows > 0) {
mysql_data_seek($Recordset4, 0);
$row_Recordset4 = mysql_fetch_assoc($Recordset4);
}
?>
</select></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">แขวง:</td>
<td><label for="subdistrict"></label>
<select name="subdistrict" id="subdistrict">
<option value="-">เลือกแขวง</option>
<?php
do {
?>
<option value="<?php echo $row_Recordset3['DISTRICT_NAME']?>"><?php echo $row_Recordset3['DISTRICT_NAME']?></option>
<?php
} while ($row_Recordset3 = mysql_fetch_assoc($Recordset3));
$rows = mysql_num_rows($Recordset3);
if($rows > 0) {
mysql_data_seek($Recordset3, 0);
$row_Recordset3 = mysql_fetch_assoc($Recordset3);
}
?>
</select></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">รหัสไปรษณีย์:</td>
<td><input type="text" name="zipcode" value="<?php echo htmlentities($row_showmembers['zipcode'], ENT_COMPAT, 'utf-8'); ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">เบอรืโทรศัพท์:</td>
<td><input type="text" name="tel" value="<?php echo htmlentities($row_showmembers['tel'], ENT_COMPAT, 'utf-8'); ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">E-mail:</td>
<td><input type="text" name="email" value="<?php echo htmlentities($row_showmembers['email'], ENT_COMPAT, 'utf-8'); ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">สถานที่ทำงาน:</td>
<td><input type="text" name="workplace" value="<?php echo htmlentities($row_showmembers['workplace'], ENT_COMPAT, 'utf-8'); ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">ตำแหน่งงาน:</td>
<td><input type="text" name="position" value="<?php echo htmlentities($row_showmembers['position'], ENT_COMPAT, 'utf-8'); ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">เปลี่ยนรูปภาพ:</td>
<td><input type="file" name="file" /></td>
</tr>
<tr valign="baseline">
<td nowrap align="right"> </td>
<td><input type="submit" value="ยืนยัน"></td>
</tr>
</table>
<input type="hidden" name="MM_update" value="form1">
<input type="hidden" name="al_no" value="<?php echo $row_showmembers['al_no']; ?>">
</form>
<p> </p>
</div>
</div>
</div>
</div>
<script src="js/jquery-1.10.2.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script>
$(document).ready(function (){
$(".tool").tooltip();
});
</script>
</body>
</html>
<?php
mysql_free_result($Recordset1);
mysql_free_result($Recordset4);
mysql_free_result($Recordset2);
mysql_free_result($Recordset3);
?>
|
|
|
|
|
Date :
2014-10-20 02:47:53 |
By :
peekungbaba |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|