Jump to content

dantoni

Members
  • Posts

    6
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

dantoni's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi Scootash, I've tried a few ajax way, but it still didn't work. For the first time, it works but after we click previous / next button, it comeback must refresh manually again. Here's the code. <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $.ajaxSetup({ cache: false }); // This part addresses an IE bug. without it, IE will only load the first number and will never setInterval(function() { $('#result').load('3.php'); }, 1000); // the "3000" here refers to the time to refresh the div. it is in milliseconds. }); </script> <?php $monthNames = Array("January","February","March","April","May","June","July","August","September","October","November", "December"); if (!isset($_REQUEST["month"])) $_REQUEST["month"] = date("n"); if (!isset($_REQUEST["year"])) $_REQUEST["year"] = date("Y"); $cMonth = $_REQUEST["month"]; $cYear = $_REQUEST["year"]; $prev_year = $cYear; $next_year = $cYear; $prev_month = $cMonth-1; $next_month = $cMonth+1; if ($prev_month == 0 ) { $prev_month = 12; $prev_year = $cYear - 1; } if ($next_month == 13) { $next_month = 1; $next_year = $cYear + 1; } ?> <table width="200"> <tr align="center"> <td bgcolor="#999999" style="color:#FFFFFF"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="50%" align="left"><a href="<?php echo $_SERVER["PHP_SELF"] . "?month=". $prev_month . "&year=" . $prev_year; ?>" style="color:#FFFFFF">Previous</a></td> <td width="50%" align="right"><a href="<?php echo $_SERVER["PHP_SELF"] . "?month=". $next_month . "&year=" . $next_year; ?>" style="color:#FFFFFF">Next</a></td> </tr> </table> </td> </tr> </table> <table width="100%" border="1" cellpadding="2" cellspacing="2"> <tr align="center"> <td colspan="7" bgcolor="#999999" style="color:#FFFFFF"><strong><?php echo $monthNames[$cMonth-1].' '.$cYear; ?></strong></td> </tr> <tr> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>S</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>M</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>T</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>W</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>T</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>F</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>S</strong></td> </tr> </table> <div id="result"> <?php include "connection.php"; echo"<table width=100% border=1 cellpadding=2 cellspacing=2>"; echo " <tr> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> "; //echo "<tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td>"; $month=$_GET["month"]; $year=$_GET["year"]; $timestamp = mktime(0,0,0,$month,1,$year); $maxday = date("t",$timestamp); $thismonth = getdate ($timestamp); $startday = $thismonth['wday']; for ($i=0; $i<($maxday+$startday); $i++) { //echo "($maxday+$startday)"; //echo "<a href=2.php>".$i."</a><br>"; if(($i % 7) == 0 ) { echo ""; } if($i < $startday) { echo "<td></td>\n"; }else { $sql = "select * from agenda where date='".($i - $startday + 1).'-'.$cMonth.'-'.$cYear."'"; $hs = mysql_query($sql); $jmlAcara = mysql_num_rows($hs); echo "<td align='center' valign='middle' height='20px'".($jmlAcara > 0 ? " bgcolor='yellow'" : '').">"; echo "<a href=2.php?tgl=".urlencode($i - $startday + 1)."&month=".urlencode($monthNames[$cMonth-1])." onclick=\"window.open(this.href,'window','width=640,height=480,resizable,scrollbars,toolbar,menubar') ;return false;\">".($i - $startday + 1)."</a><br>"; echo "</td>"; //echo "$cMonth"; }if(($i % 7) == 6 ) { echo "</tr>"; } } ?> </table>
  2. Hi All, I've built agenda calendar. What I want to ask is when there are 2 different user (user A and B ) access the same month at same year, and after that one of the user (user A) input agenda, other user ( user B ) must manually refresh the calendar to be able to see the agenda that had been inserted. Is it possible to refresh automatically after the agenda inserted ? Here's the code <?php session_start(); include "con.php"; if (isset($_SESSION['user'])) { $sql=""; echo"<html>"; echo"<head>"; echo"<title>Agenda</title>"; echo"</head>"; echo"<body>"; $monthNames = Array("January","February","March","April","May","June","July","August","September","October","November", "December"); if (!isset($_REQUEST["month"])) $_REQUEST["month"] = date("n"); if (!isset($_REQUEST["year"])) $_REQUEST["year"] = date("Y"); $cMonth = $_REQUEST["month"]; $cYear = $_REQUEST["year"]; $prev_year = $cYear; $next_year = $cYear; $prev_month = $cMonth-1; $next_month = $cMonth+1; if ($prev_month == 0) { $prev_month = 12; $prev_year = $cYear - 1; } if ($next_month == 13) { $next_month = 1; $next_year = $cYear + 1; } echo"<table width=200>"; echo"<tr align=center>"; echo"<td bgcolor=#999999 style=color:#FFFFFF>"; echo"<table width=100% border=0 cellspacing=0 cellpadding=0>"; echo"<tr>"; echo"<td width=50% align=left><a href=$_SERVER[php_SELF]?month=". $prev_month . "&year=" . $prev_year." style=color:#FFFFFF>Previous</a></td>"; echo"<td width=50% align=right><a href=$_SERVER[php_SELF]?month=". $next_month . "&year=" . $next_year." style=color:#FFFFFF>Next</a></td>"; echo"</tr>"; echo"</table>"; echo"</td>"; echo"</tr>"; echo"</table>"; echo"<tr>"; echo"<td align=center>"; echo"<table width=100% border=1 cellpadding=2 cellspacing=2>"; echo"<tr align=center>"; echo"<td colspan=7 bgcolor=#999999 style=color:#FFFFFF><strong>".$monthNames[$cMonth-1]." ".$cYear."</strong></td>"; echo"</tr>"; echo"<tr>"; echo"<td align=center bgcolor=#999999 style=color:#FFFFFF><strong>Sun</strong></td>"; echo"<td align=center bgcolor=#999999 style=color:#FFFFFF><strong>Mon</strong></td>"; echo"<td align=center bgcolor=#999999 style=color:#FFFFFF><strong>Tue</strong></td>"; echo"<td align=center bgcolor=#999999 style=color:#FFFFFF><strong>Wed</strong></td>"; echo"<td align=center bgcolor=#999999 style=color:#FFFFFF><strong>Thu</strong></td>"; echo"<td align=center bgcolor=#999999 style=color:#FFFFFF><strong>Fri</strong></td>"; echo"<td align=center bgcolor=#999999 style=color:#FFFFFF><strong>Sat</strong></td>"; echo"</tr>"; $timestamp = mktime(0,0,0,$cMonth,1,$cYear); $maxday = date("t",$timestamp); $thismonth = getdate ($timestamp); $startday = $thismonth['wday']; for ($i=0; $i<($maxday+$startday); $i++) { //echo "<a href=2.php>".$i."</a><br>"; if(($i % 7) == 0 ) { echo ""; } if($i < $startday) { echo "<td></td>\n"; }else { $sql = "select * from agenda where date='".($i - $startday + 1).'-'.$cMonth.'-'.$cYear."'"; $hs = mysql_query($sql); $jmlAcara = mysql_num_rows($hs); echo "<td align='center' valign='middle' height='20px'".($jmlAcara > 0 ? " bgcolor='yellow'" : '').">"; echo "<a href=2.php?tgl=".urlencode($i - $startday + 1)."&month=".urlencode($monthNames[$cMonth-1])." onclick=\"window.open(this.href,'window','width=640,height=480,resizable,scrollbars,toolbar,menubar') ;return false;\">".($i - $startday + 1)."</a><br>"; echo "</td>\n"; } if(($i % 7) == 6 ) { echo "</tr>\n"; } } echo"</table>"; echo"<br><br><center><a href=logout.php>Logout</a>"; }else { echo "<script>alert('Please login first');javascript:window.location.href='index.php';</script>"; } ?> Thanks before,
  3. Hi All, I want to ask you about my calendar appointment. The problem in my calendar is when user A insert new agenda, user B must refresh it manually for can see the changes. I've used an auto div refresh which is refresh page automatically but it still didn't work. The problem is in my calendar have a nex and previous button to see the other months. When I'm access my calendar for first time, it works fine (user B don't need refresh it manually). But when I click the previous next button, user B must refresh it manually again. Can you show me where can I fix my code ? Here's the calendar file before spiltted into two parts. <?php include "connection.php"; ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Agenda</title> </head> <body> <?php $monthNames = Array("January","February","March","April","May","June","July","August","September","October","November", "December"); if (!isset($_REQUEST["month"])) $_REQUEST["month"] = date("n"); if (!isset($_REQUEST["year"])) $_REQUEST["year"] = date("Y"); $cMonth = $_REQUEST["month"]; $cYear = $_REQUEST["year"]; $prev_year = $cYear; $next_year = $cYear; $prev_month = $cMonth-1; $next_month = $cMonth+1; if ($prev_month == 0 ) { $prev_month = 12; $prev_year = $cYear - 1; } if ($next_month == 13 ) { $next_month = 1; $next_year = $cYear + 1; } ?> <table width="200"> <tr align="center"> <td bgcolor="#999999" style="color:#FFFFFF"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="50%" align="left"><a href="<?php echo $_SERVER["PHP_SELF"] . "?month=". $prev_month . "&year=" . $prev_year; ?>" style="color:#FFFFFF">Previous</a></td> <td width="50%" align="right"><a href="<?php echo $_SERVER["PHP_SELF"] . "?month=". $next_month . "&year=" . $next_year; ?>" style="color:#FFFFFF">Next</a></td> </tr> </table> </td> </tr> </table> <tr> <td align="center"> <table width="100%" border="1" cellpadding="2" cellspacing="2"> <tr align="center"> <td colspan="7" bgcolor="#999999" style="color:#FFFFFF"><strong><?php echo $monthNames[$cMonth-1].' '.$cYear; ?></strong></td> </tr> <tr> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>S</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>M</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>T</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>W</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>T</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>F</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>S</strong></td> </tr> <?php $timestamp = mktime(0,0,0,$cMonth,1,$cYear); $maxday = date("t",$timestamp); $thismonth = getdate ($timestamp); $startday = $thismonth['wday']; for ($i=0; $i<($maxday+$startday); $i++) { //echo "<a href=2.php>".$i."</a><br>"; if(($i % 7) == 0 ) { echo ""; } if($i < $startday) { echo "<td></td>\n"; }else { $sql = "select * from agenda where date='".($i - $startday + 1).'-'.$cMonth.'-'.$cYear."'"; $hs = mysql_query($sql); $jmlAcara = mysql_num_rows($hs); echo "<td align='center' valign='middle' height='20px'".($jmlAcara > 0 ? " bgcolor='yellow'" : '').">"; echo "<a href=2.php?tgl=".urlencode($i - $startday + 1)."&month=".urlencode($monthNames[$cMonth-1])." onclick=\"window.open(this.href,'window','width=640,height=480,resizable,scrollbars,toolbar,menubar') ;return false;\">".($i - $startday + 1)."</a><br>"; echo "</td>\n"; } if(($i % 7) == 6 ) { echo "</tr>\n"; } } ?> The I split up the file into two parts.The first is index.php who will refresh the user.php file every 1000ms. <?php include "connection.php"; ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Agenda</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $.ajaxSetup( { cache: false }); // This part addresses an IE bug. without it, IE will only load the first number and will never setInterval(function() { $('#result').load('user.php'); }, 1000); // the "3000" here refers to the time to refresh the div. it is in milliseconds. }); </script> </head> <body> <?php $monthNames = Array("January","February","March","April","May","June","July","August","September","October","November", "December"); if (!isset($_REQUEST["month"])) $_REQUEST["month"] = date("n"); if (!isset($_REQUEST["year"])) $_REQUEST["year"] = date("Y"); $cMonth = $_REQUEST["month"]; $cYear = $_REQUEST["year"]; $prev_year = $cYear; $next_year = $cYear; $prev_month = $cMonth-1; $next_month = $cMonth+1; if ($prev_month == 0) { $prev_month = 12; $prev_year = $cYear - 1; } if ($next_month == 13) { $next_month = 1; $next_year = $cYear + 1; } ?> <table width="200"> <tr align="center"> <td bgcolor="#999999" style="color:#FFFFFF"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="50%" align="left"><a href="<?php echo "cal.php?month=". $prev_month . "&year=" . $prev_year; ?>" style="color:#FFFFFF">Previous</a></td> <td width="50%" align="right"><a href="<?php echo "cal.php?month=". $next_month . "&year=" . $next_year; ?>" style="color:#FFFFFF">Next</a></td> </tr> </table> </td> </tr> </table> <tr> <div id="result"> The second file is user.php which contains the calendar. <?php include "connection.php"; $monthNames = Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); if (!isset($_REQUEST["month"])) $_REQUEST["month"] = date("n"); if (!isset($_REQUEST["year"])) $_REQUEST["year"] = date("Y"); $cMonth = $_REQUEST["month"]; $cYear = $_REQUEST["year"]; $month=$_GET["month"]; $year=$_GET["year"]; $prev_year = $cYear; $next_year = $cYear; $prev_month = $cMonth-1; $next_month = $cMonth+1; if ($prev_month == 0) { $prev_month = 12; $prev_year = $cYear - 1; } if ($next_month == 13) { $next_month = 1; $next_year = $cYear + 1; } //$m=$_GET["month"]; //$y=$_GET["year"]; ?> <table width="100%" border="1" cellpadding="2" cellspacing="2"> <tr align="center"> <td colspan="7" bgcolor="#999999" style="color:#FFFFFF"><strong><?php echo $monthNames[$cMonth-1].' '.$cYear; ?></strong></td> </tr> <tr> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>S</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>M</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>T</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>W</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>T</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>F</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>S</strong></td> </tr> <?php $timestamp = mktime(0,0,0,$cMonth,1,$cYear); $maxday = date("t",$timestamp); $thismonth = getdate ($timestamp); $startday = $thismonth['wday']; for ($i=0; $i<($maxday+$startday); $i++) { //echo "($maxday+$startday)"; //echo "<a href=2.php>".$i."</a><br>"; if(($i % 7) == 0 ) { echo ""; } if($i < $startday) { echo "<td></td>\n"; }else { $sql = "select * from agenda where date='".($i - $startday + 1).'-'.$cMonth.'-'.$cYear."'"; $hs = mysql_query($sql); $jmlAcara = mysql_num_rows($hs); echo "<td align='center' valign='middle' height='20px'".($jmlAcara > 0 ? " bgcolor='yellow'" : '').">"; echo "<a href=2.php?tgl=".urlencode($i - $startday + 1)."&month=".urlencode($monthNames[$cMonth-1])." onclick=\"window.open(this.href,'window','width=640,height=480,resizable,scrollbars,toolbar,menubar') ;return false;\">".($i - $startday + 1)."</a><br>"; echo "</td>\n"; //echo "$cMonth"; } if(($i % 7) == 6 ) { echo "</tr>\n"; } } ?> Thank you.. Regards, Ikram
  4. For example, today i want deliver the message to client A,B,C and D. Here the code... <?php $to = array('ikrom.shabri@yahoo.com','1.k.rom.pc@gmail.com'); foreach($to as $mail) { usleep(60000000); mail($mail,$subject,$email,$headers); } $to = array('me@gmail.com','you@hotmail.com'); foreach($to as $mail) { usleep(120000000); mail($mail,$subject,$email,$headers); } ?> and 1 week later, the destination automatically change to client E,F,G,H. What function should I use for this case ?
  5. Hello.. I've a problem about how to change our destination and the consecutively. As example, today the email will be sent to A,B,C and tomorrow the email will be sent to B,C,A until next week. Next week the email will be sent to D,E,F. Code for looping email.. <?php $to = array('ikrom.shabri@yahoo.com','1.k.rom.pc@gmail.com'); foreach($to as $mail) { usleep(60000000); mail($mail,$subject,$email,$headers); } ?> Thank you for your assistance..
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.