① php和資料庫做日歷 高手給點幫助唄 簡單點就行 求代碼
<?php
if(isset($_GET['add_flag']) ){
require_once './Setting.php';
try {
$dbm = new DBManager($dsn, $user, $passwd);
$db = $dbm->getDB();
$stt = $db->prepare('INSERT INTO diary(date1,title,content,weather,feeling) VALUES(:date1,:title,:content,:weather,:feeling)');
$stt->bindValue(':date1', $_GET['date1']);
$stt->bindValue(':title', $_GET['title']);
$stt->bindValue(':content', $_GET['content']);
$stt->bindValue(':weather', $_GET['weather']);
$stt->bindValue(':mood', $_GET['mood']);
$stt->execute();
} catch(PDOException $e){
die("エラー: {$e}");
}
$db = null;
$dbm = null;
header('Location: ./main.php');
}
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html> <head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>ユーザ管理システム - ユーザの追加</title>
<script src="./sd.js" type="text/javascript"></script>
</head> <body>
<div id="header">
<h1>ユーザ管理システム</h1>
<h2>ユーザの追加</h2>
<?php
?>
</div>
<form action="./add_user.php" method="get">
<input type="hidden" size="5" name="id"><br>
<table>
<tr>
<td>date:</td>
<td><input type="TextBox" size="20" name="date1" ID="TextBox1" onfocus="calendar()" runat="server"></td>
</tr>
<tr>
<td>title:</td>
<td><input type="text" size="20" name="title"></td>
</tr>
<tr>
<td>content:</td>
<td><textarea name="content" cols = "45" rows = "5"></textarea></td>
</tr>
<tr>
<td>weather:</td>
<td><input type="radio" name="weather" value="陰" id="weather1" checked>
<label for="weather1" style="background-image: rainy.jpg)">rainy</label>
<input type="radio" name="weather" value="晴" id="weather2">
<label for="weather2" style="background-image: sunny.jpg)">sunny</label></td>
</tr>
<tr>
<td>mood:</td>
<td><input type="radio" name="feeling" value="happy" id="mood1" checked style="background-image: happy.jpg)">
<label for="mood1">happy</label>
<input type="radio" name="feeling" value="傷心" id="mood2" style="background-image: sad.jpg)" >
<label for="mood2">sad</label></td>
</tr>
<br>
</table>
<input type="hidden" name="add_flag" value="true">
<input type="submit" value="Add">
</form>
<p><a href="./main.php">トップ畫面へ戻る</a></p>
</body>
</html>
② 請大家看看我的php網路萬年歷的程序代碼 怎麼運行錯誤啊
echo"指叢配<option selected value=$month>$selected\n"
未鄭渣尾少一個分唯指號
③ php萬年歷程序代碼
PHP代碼:
--------------------------------------------------------------------------------
<style>
.calendar
{
background-color: #FFFFFF;
border: 1px solid #003366;
}
.calendar .title
{
background-image: url("/theme/monthbg.gif");
line-height: 17pt;
background-color: #D8E2EC;
text-align: center;
vertical-align: middle;
font-family: Geneva, Verdana, Arial, sans-serif;
font-size: 13px;
font-weight: Bold;
color: #252216;
}
.calendar .head
{
background-image: url("dayBg.gif");
font-family: Geneva, Verdana, Arial, sans-serif;
font-size: 10px;
font-weight: Bold;
color: #433D27;
}
.calendar tbody
{
line-height: 11pt;
background-color: #F5F4D3;
text-align: center;
vertical-align: middle;
}
.calendar td
{
font-family: Geneva, Verdana, Arial, sans-serif;
font-size: 10px;
line-height: 15pt;
text-align: center;
vertical-align: middle;
width: 25px;
}
.calendar .weekday
{
background-color: #e0e0e0;
}
.calendar .weekend
{
background-color: #d0d0d0;
}
.calendar .today
{
background-color: #f7bebd;
}
.calendar .exmonth
{
background-color: #eeeeee;
}
.calendar a
{
text-decoration: none;
cursor: hand;
}
</style>
<?php
// 顯示某天所在月份的日歷
function calendar($time)
{
$start=mktime(0, 0, 0, date('m', $time), 1, date('Y', $time));
$start=$start-date('w', $start)*86400; // extent to start of week
$end=mktime(0, 0, 0, date('m', $time)+1, 1, date('Y', $time));
$end=$end+(7-date('w', $end))*86400; // extent to end of week
//$sWeekday=array('日','一','二好櫻','三','四','五','六');
$sWeekday=array('S','M','T','友彎叢W','T','F'鬧伍,'S');
$title=date('M Y', $time);
$prev=mktime(0, 0, 0, date('m', $time)-1, 1, date('Y', $time));
$next=mktime(0, 0, 0, date('m', $time)+1, 1, date('Y', $time));
$url=$_SERVER['PHP_SELF'].'?time=';
$str = '';
$str .= <<<END
<table class="calendar" cellspacing="1">
<tr class="title">
<th colspan="2"><a href="{$url}{$prev}"><<</a></th>
<th colspan="3">{$title}</td>
<th colspan="2"><a href="{$url}{$next}">>></a></th>
</tr>
<tr class="head">
<th>{$sWeekday[0]}</td>
<th>{$sWeekday[1]}</td>
<th>{$sWeekday[2]}</td>
<th>{$sWeekday[3]}</td>
<th>{$sWeekday[4]}</td>
<th>{$sWeekday[5]}</td>
<th>{$sWeekday[6]}</td>
</tr>
<tr>
END;
for($stamp=$start;$stamp<$end;$stamp+=86400) // loop through each day, which is 86400 seconds
{
$weekday=date('w', $stamp);
if(date('m', $stamp)!=date('m', $time)) $style='exmonth';
else if(date('Y-m-d', $stamp)==date('Y-m-d')) $style='today';
else if(date('w', $stamp)==0 || date('w', $stamp)==6) $style='weekend';
else $style='weekday';
$str.= "\t\t".'<td class="'.$style.'"><a href="'.$url.$stamp.'">'.sprintf('%d',date('d', $stamp)).'</a></td>'."\n";
if(date('w', $stamp)==6) $str.="\t".'</tr>'."\n";
}
$str .= '</table>';
return $str;
}
?>
④ 萬年歷 源碼編輯,修改
1.
var adds
if (perscal[2]>7)
adds = 1230
else
adds = 1130
var timeData = {
"China 中國": {
"BeiJing 北京":["+"+adds,"","北京、重慶、烏魯木齊"],//伊朗春節過後修改為+1130,6個月後修改為+1230
"Iran 伊朗":["+0800","","德黑蘭"]
}
};
2.在HTML裡面加一個div,名字隨便了 跟著陰歷的一起跑,id=隨便取一個名字
然後用document.getElementById("id名").innerHTML="內容" 控制
⑤ 如何用php做日歷
具體代碼裂和如下:
<?php
$ch = curl_init();
$timeout = 5;
curl_setopt ($ch, CURLOPT_URL, '');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$file_contents = curl_exec($ch);
curl_close($ch);
echo $file_contents;
?>
PHP 獨特的語法混合了C、Java、Perl以及PHP自創的語法。
它可以比CGI或者Perl更快速地執弊嫌行動態網頁。用PHP做出的動態頁面與其他的編程語言相比,PHP是將程序嵌入到HTML(標准通用標記語言下的一個應用)租源手文檔中去執行,
執行效率比完全生成HTML標記的CGI要高許多;
PHP還可以執行編譯後代碼,編譯可以達到加密和優化代碼運行,使代碼運行更快。
⑥ 用php編程按月顯示的日歷
我把我寫的分享給你吧
/**
*顯示日歷
*@paramint$time時間戳
*/
privatefunction__calendarPanel($time=null){
$time||$time=time();
$dateinfo=getdate($time);
$calendar=array(
'year'=>$dateinfo['year'],
'month'=>$dateinfo['mon'],
'day'=>$dateinfo['mday'],
);
$m_start=strtotime(date('Y-m-01',$time));//本月第一天
$m_start_w=get_week($m_start,true);//本月第一天星期索引,0表示星期日
$m_end=strtotime('+1month',$m_start)-86400;//本月最後一天
$m_end_w=get_week($m_end,true);//本月最後一天星期索引,0表示星期日
//補齊上月日期
for($i=0;$i<$m_start_w;$i++){
$calendar['days'][]=array(
'style'=>'bef_month',
'day'=>abs(date('d',$m_start-($m_start_w-$i)*86400)),
);
}
//本月日期
for($i=$m_start;$i<=$m_end;$i+=86400){
$calendar['days'][]=array(
'style'=>'the_month'.(date('d',$i)==$calendar['day']?"bold":""),
'day'=>abs(date('d',$i)),
);
}
//補齊下月日期
for($i=$m_end_w+1;$i<=6;$i++){
$calendar['days'][]=array(
'style'=>'aft_month',
'day'=>abs(date('d',$m_end+($i-$m_end_w)*86400)),
);
}
return$calendar;
}
日歷都存到返回的一個數組里了,你列印的時候,一行放7列,第一列星期日
⑦ 如何用php 實現日歷三個月輸出
sybase_connect連喊段遲上資料庫。
語法: int sybase_connect(string [servername], string [username], string [password]);
返回值: 整數函數種類: 資料庫功能 本函數用來打開與 Sybase 資料庫的連接。
參數 servername 為欲連上的資料庫伺服器名稱。
參數 username 及 password 可省略,分別為連接使用的帳號及密碼。
使用本函數需注意早燃閉點關閉資料庫,以減少系統的負擔。
連接成功則返回資料庫的連接代號,鄭李失敗返回 false 值。
⑧ 如何用PHP製作日歷
calendar.class.php
代碼如下:
<?php
classCalendar{
private$year;//當前的年
private$month;//當前的月
private$start_weekday;//當月的第一天對應的是周幾
private$days;//當前月一共多少天
function__construct(){
$this->year=isset($_GET["year"])?$_GET["year"]:date("Y");
$this->month=isset($_GET["month"])?$_GET["month"]:date("m");
$this->start_weekday=date("w",mktime(0,0,0,$this->month,1,$this->year));
$this->days=date("t",mktime(0,0,0,$this->month,1,$this->year));
}
functionout(){
echo'<tablealign="center">';
$this->chageDate("test.php");
$this->weeksList();
$this->daysList();
echo'</table>';
}
privatefunctionweeksList(){
$week=array('日','一','二','三','四','五','六');
echo'<tr>';
for($i=0;$i<count($week);$i++)
echo'<thclass="fontb">'.$week[$i].'</th>';
echo'</tr>';
}
privatefunctiondaysList(){
echo'<tr>';
//輸出空格(當前一月第一天前面要空出來)
for($j=0;$j<$this->start_weekday;$j++)
echo'<td></td>';
for($k=1;$k<=$this->days;$k++){
$j++;
if($k==date('d'))
echo'<tdclass="fontb">'.$k.'</td>';
else
echo'<td>'.$k.'</td>';
if($j%7==0)
echo'</tr><tr>';
}
//後面幾個空格
while($j%7!==0){
echo'<td></td>';
$j++;
}
echo'</tr>';
}
privatefunctionprevYear($year,$month){
$year=$year-1;
if($year<1970)
$year=1970;
return"year={$year}&month={$month}";
}
privatefunctionprevMonth($year,$month){
if($month==1){
$year=$year-1;
if($year<1970)
$year=1970;
$month=12;
}else{
$month--;
}
return"year={$year}&month={$month}";
}
privatefunctionnextYear($year,$month){
$year=$year+1;
if($year>2038)
$year=2038;
return"year={$year}&month={$month}";
}
privatefunctionnextMonth($year,$month){
if($month==12){
$year++;
if($year>2100)
$year=2100;
$month=1;
}else{
$month++;
}
return"year={$year}&month={$month}";
}
privatefunctionchageDate($url=""){
echo'<tr>';
echo'<td><ahref="?'.$this->prevYear($this->year,$this->month).'">'.'<<'.'</a></td>';
echo'<td><ahref="?'.$this->prevMonth($this->year,$this->month).'">'.'<'.'</a></td>';
echo'<tdcolspan="3">';
echo'<form>';
echo'<selectname="year"onchange="window.location=''.$url.'?year='+this.options[selectedIndex].value+'&month='.$this->month.''">';
for($sy=1970;$sy<=2100;$sy++){
$selected=($sy==$this->year)?"selected":"";
echo'<option'.$selected.'value="'.$sy.'">'.$sy.'</option>';
}
echo'</select>';
echo'<selectname="month"onchange="window.location=''.$url.'?year='.$this->year.'&month='+this.options[selectedIndex].value">';
for($sm=1;$sm<=12;$sm++){
$selected1=($sm==$this->month)?"selected":"";
echo'<option'.$selected1.'value="'.$sm.'">'.$sm.'</option>';
}
echo'</select>';
echo'</form>';
echo'</td>';
echo'<td><ahref="?'.$this->nextYear($this->year,$this->month).'">'.'>>'.'</a></td>';
echo'<td><ahref="?'.$this->nextMonth($this->year,$this->month).'">'.'>'.'</a></td>';
echo'</tr>';
}
}
?>test.php
代碼如下:
<style>
table{
border:1pxsolid#050;
}
.fontb{
color:white;
background:blue;
}
th{
width:30px;
}
td,th{
height:30px;
text-align:center;
}
form{
margin:0px;
padding:0px;
}
</style>
<?php
include"calendar.class.php";
$calendar=newCalendar;
$calendar->out();
?>
⑨ 年 月 日 星期 時間 農歷 源代碼
37021偷來的.下面是一個fun.js文件里的一殲激部分
function show_rili() {
document.write('<a href="/mwxq/index-wnl.htm" target="_blank" class=TD1 title="萬年歷查詢"><font color="#999999"><div class=TD1 id="date"></div></font><font class=TD1 color="#DF0A10">星期<span class=TD1 id="wk"></span></font><font color="#999999"><span class=TD1 id="clk"></span><br /><font class=TD1>農歷</font><span class=TD1 id="nongli"></span></font></a>')
cal_u()
cal_s()
setInterval("cal_s()",999)
}
-------------------------------------------------------
下氏仔襪面這段放在主頁里調用.別忘了在主頁把上面那個文件包含進去
<戚數script language=JavaScript>show_rili()</script>
--------------------------------------------------------
包含代碼:
<SCRIPT language=JavaScript src="/css/fun.js"
type=text/javascript></SCRIPT>