十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
如果是用php处理的话,那就用把第一个input的时间取回来转换成unix timestamp,然后加上三个小时的秒数,然后用date函数格式化成你想要的格式。
创新互联公司服务项目包括高阳网站建设、高阳网站制作、高阳网页制作以及高阳网络营销策划等。多年来,我们专注于互联网行业,利用自身积累的技术优势、行业经验、深度合作伙伴关系等,向广大中小型企业、政府机构等提供互联网行业的解决方案,高阳网站推广取得了明显的社会效益与经济效益。目前,我们服务的客户以成都为中心已经辐射到高阳省份的部分城市,未来相信会继续扩大服务区域并继续获得客户的支持与信任!
要在前台解决的话,js取回来,也是格式化成timestamp,然后加上时间差的秒数,然后格式化回来
你可以用 PHP 的 MySQLi 或 PDO 库来实现。
首先,你需要使用这些库中的函数连接数据库,然后把表单中的字段值插入到相应的数据表中。
例如,如果你使用 MySQLi,你可以这样写:
$conn = mysqli_connect("hostname", "username", "password", "database_name");
$rwid = $_POST['rwid'];
$rwdj = $_POST['rwdj'];
$rwzb = $_POST['rwzb'];
$sql1 = "INSERT INTO table_a (s) VALUES ('$rwid')";
mysqli_query($conn, $sql1);
$sql2 = "INSERT INTO table_b (d) VALUES ('$rwdj')";
mysqli_query($conn, $sql2);
$sql3 = "INSERT INTO table_c (f) VALUES ('$rwzb')";
mysqli_query($conn, $sql3);
如果你使用 PDO,你可以这样写:
$conn = new PDO("mysql:host=hostname;dbname=database_name", "username", "password");
$rwid = $_POST['rwid'];
$rwdj = $_POST['rwdj'];
$rwzb = $_POST['rwzb'];
$stmt1 = $conn-prepare("INSERT INTO table_a (s) VALUES (:s)");
$stmt1-bindParam(':s', $rwid);
$stmt1-execute();
$stmt2 = $conn-prepare("INSERT INTO table_b (d) VALUES (:d)");
$stmt2-bindParam(':d', $rwdj);
$stmt2-execute();
$stmt3 = $conn-prepare("INSERT INTO table_c (f) VALUES (:f)");
$stmt3-bindParam(':f', $rwzb);
$stmt3-execute();
希望这个答案对你有帮助。
JS 实现BASE64_ENCODE 和 BASE64_DECODE
script language='javascript'
/* utf.js - UTF-8 = UTF-16 convertion
*
* Copyright (C) 1999 Masanao Izumo iz@onicos.co.jp
* Version: 1.0
* LastModified: Dec 25 1999
* This library is free. You can redistribute it and/or modify it.
*/
/*
* Interfaces:
* utf8 = utf16to8(utf16);
* utf16 = utf16to8(utf8);
*/
function utf16to8(str) {
var out, i, len, c;
out = "";
len = str.length;
for(i = 0; i len; i++) {
c = str.charCodeAt(i);
if ((c = 0x0001) (c = 0x007F)) {
out += str.charAt(i);
} else if (c 0x07FF) {
out += String.fromCharCode(0xE0 | ((c 12) 0x0F));
out += String.fromCharCode(0x80 | ((c 6) 0x3F));
out += String.fromCharCode(0x80 | ((c 0) 0x3F));
} else {
out += String.fromCharCode(0xC0 | ((c 6) 0x1F));
out += String.fromCharCode(0x80 | ((c 0) 0x3F));
}
}
return out;
}
function utf8to16(str) {
var out, i, len, c;
var char2, char3;
out = "";
len = str.length;
i = 0;
while(i len) {
c = str.charCodeAt(i++);
switch(c 4)
{
case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7:
// 0xxxxxxx
out += str.charAt(i-1);
break;
case 12: case 13:
// 110x xxxx 10xx xxxx
char2 = str.charCodeAt(i++);
out += String.fromCharCode(((c 0x1F) 6) | (char2 0x3F));
break;
case 14:
// 1110 xxxx 10xx xxxx 10xx xxxx
char2 = str.charCodeAt(i++);
char3 = str.charCodeAt(i++);
out += String.fromCharCode(((c 0x0F) 12) |
((char2 0x3F) 6) |
((char3 0x3F) 0));
break;
}
}
return out;
}
/* Copyright (C) 1999 Masanao Izumo iz@onicos.co.jp
* Version: 1.0
* LastModified: Dec 25 1999
* This library is free. You can redistribute it and/or modify it.
*/
/*
* Interfaces:
* b64 = base64encode(data);
* data = base64decode(b64);
*/
var base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var base64DecodeChars = new Array(
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63,
52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1,
-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,
-1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1);
function base64encode(str) {
var out, i, len;
var c1, c2, c3;
len = str.length;
i = 0;
out = "";
while(i len) {
c1 = str.charCodeAt(i++) 0xff;
if(i == len)
{
out += base64EncodeChars.charAt(c1 2);
out += base64EncodeChars.charAt((c1 0x3) 4);
out += "==";
break;
}
c2 = str.charCodeAt(i++);
if(i == len)
{
out += base64EncodeChars.charAt(c1 2);
out += base64EncodeChars.charAt(((c1 0x3) 4) | ((c2 0xF0) 4));
out += base64EncodeChars.charAt((c2 0xF) 2);
out += "=";
break;
}
c3 = str.charCodeAt(i++);
out += base64EncodeChars.charAt(c1 2);
out += base64EncodeChars.charAt(((c1 0x3) 4) | ((c2 0xF0) 4));
out += base64EncodeChars.charAt(((c2 0xF) 2) | ((c3 0xC0) 6));
out += base64EncodeChars.charAt(c3 0x3F);
}
return out;
}
function base64decode(str) {
var c1, c2, c3, c4;
var i, len, out;
len = str.length;
i = 0;
out = "";
while(i len) {
/* c1 */
do {
c1 = base64DecodeChars[str.charCodeAt(i++) 0xff];
} while(i len c1 == -1);
if(c1 == -1)
break;
/* c2 */
do {
c2 = base64DecodeChars[str.charCodeAt(i++) 0xff];
} while(i len c2 == -1);
if(c2 == -1)
break;
out += String.fromCharCode((c1 2) | ((c2 0x30) 4));
/* c3 */
do {
c3 = str.charCodeAt(i++) 0xff;
if(c3 == 61)
return out;
c3 = base64DecodeChars[c3];
} while(i len c3 == -1);
if(c3 == -1)
break;
out += String.fromCharCode(((c2 0XF) 4) | ((c3 0x3C) 2));
/* c4 */
do {
c4 = str.charCodeAt(i++) 0xff;
if(c4 == 61)
return out;
c4 = base64DecodeChars[c4];
} while(i len c4 == -1);
if(c4 == -1)
break;
out += String.fromCharCode(((c3 0x03) 6) | c4);
}
return out;
}
//input base64 encode
function strdecode(str){
return utf8to16(base64decode(str));
}
document.write(strdecode('5L2g5aW9Iee+juWlsyE='));
/script
首先直接做成一页,中间步骤的数据处理用JS,然后就可以正常提交,交给原系统的注册处理页面
所有数据将以GET或POST方式存入$_GET或$_POST数组
看一下关于GET和POST的介绍你就明白了
action就是传递表单值到你指定的页面
提交过去之后你想怎么处理都可以啦