註冊資料更新 [會員資料檢視]
'; }
else
{ echo '電話號碼:' . $Telephone . ' (符合電話格式)' . '
';}
// 抓取欄位值
$Name = $_REQUEST['Name'];
$Account = $_REQUEST['Account'];
$Email = $_REQUEST['Email'];
$Address = $_REQUEST['Address'];
$file = 'member.txt';
if (file_exists($file)) {
$member_data = json_decode(file_get_contents($file));
}
$member_data[] = $Student_id . PHP_EOL . $Name;
file_put_contents($file, json_encode($member_data));
//echo "
"; foreach($member_data as $message) { //echo '', $message . '
'; } // -------------------------------------------------------------------- // 上傳檔案處理程式 //echo 'File -> ' . $_FILES['file']; $Photo_file = ''; // 預防使用者沒有上傳檔名,會造成新增資料錯誤 echo '暫存檔檔名 : ' . ($_FILES['file']['tmp_name']) . '
'; if (is_uploaded_file($_FILES['file']['tmp_name'])) { if (!file_exists('images')) { mkdir('images'); //如果upload目錄不存在,就新增upload目錄 } $Photo_file='images/'.basename($_FILES['file']['name']); if (move_uploaded_file($_FILES['file']['tmp_name'], $Photo_file)) { echo '上傳檔案: ', $Photo_file, ' 上傳成功', '
'; echo ''; } else { echo '上傳失敗 !!!'; } } else { echo '請選擇檔案 !!!'; } ?> prepare('update member set Student_id=?, Name=?, Account=?, Password=?, Telephone=?, Email=?, Address=?, Create_date=?, Photo=? where id=?'); if ($sql->execute([$Student_id, $Name, $Account, md5($Password), $Telephone, $Email, $Address, $MyCreate_date, $Photo_file, $id])) { echo '更新成功 ! ' . '
'; } else { echo '更新失敗 !' . '
'; } ?>