Jump to content

Xster

Members
  • Posts

    23
  • Joined

  • Last visited

    Never

Everything posted by Xster

  1. I used dreamweaver as a tools for php coding..and Im using php version 4.3.3, Apache 2.0.47(win32) and MySQL as database. I found a problem with php mail() and the error says like this ;- Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set(). How i gonna to settle this bug..? TQ in advance!
  2. em,if you dont mind..pls show me how to do it fenway. TQ~ Xster cheers!
  3. I do some modified and Its runs well. but I need another validations that only accept user to fill in the input box like if the day (Monday to Friday) the actual operating hours is 10:00 to 22:00 and (Saturday and Sunday) is 09:00 to 23:00..give me some idea how to figure this pls..TQ~ This is JavaScript Function function formvalidations(){ var FHour = document.getElementById("timeFrom"); var FMin = document.getElementById("timeFrom1"); var THour = document.getElementById("timeTo"); var TMin = document.getElementById("timeTo1"); if(checkHour(FHour, "Invalid Data Entry in the From Hour selection")){ if(checkMin(FMin, "Invalid Data Entry in the From Minute selection")){ if(checkHour(THour, "Invalid Data Entry in the To Hour selection")){ if(checkMin(TMin, "Invalid Data Entry in the To Minute selection")){ return true; } } } } return false; } function checkHour(elem, helperMsg){ var numericExpression = /^[0-9]+$/; if(elem.value.match(numericExpression)){ if(elem.value >= 08 && elem.value <= 22){ return true; }else{ alert(helperMsg); elem.focus(); return false; } }else{ alert(helperMsg); elem.focus(); return false; } } function checkMin(elem, helperMsg){ var numericExpression = /^[0-9]+$/; if(elem.value.match(numericExpression)){ if(elem.value >= 0 && elem.value <= 59){ return true; }else{ alert(helperMsg); elem.focus(); return false; } }else{ alert(helperMsg); elem.focus(); return false; } } This is html form <form onSubmit="return formvalidations()" method="post"> input type="text" name="timeFrom" size="1" id="timeFrom" maxlength="2"> <input type="text" name="timeFrom1" size="1" id="timeFrom1" maxlength="2"> <input type="text" name="timeTo" size="1" id="timeTo" maxlength="2"> <input type="text" name="timeTo1" size="1" id="timeTo1" maxlength="2"> p/s: Thx for ur attention fenway!
  4. Can someone pls tell me how to fix this codes somekind like if user didnt insert anything to the text box, it pop-ups an prompt error like "Pls insert bla bla bla" and how to create time format validation in JavaScript? any answers would help.. TQ in advance! <html> <head> <title><?php echo $row_rs1['title']; ?></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="../pnec.css" rel="stylesheet" type="text/css"> <script type="text/javascript"> // this section im very confuse function checkForm() { var timeFrom, timeFrom1, timeTo, timeTo1; with(window.document.msgform) { ctime1 = timeFrom; ctime2 = timeFrom1; ctime3 = timeTo; ctime4 = timeTo1; } if(trim(ctime1.value) == '') { alert('Please enter your time from'); ctime1.focus(); return false; } else if(trim(ctime2.value) == '') { alert('Please enter your time from'); ctime2.focus(); return false; } else if(trim(ctime3.value) == '') { alert('Please enter your time to'); ctime3.focus(); return false; } else if(trim(ctime4.value) == '') { alert('Please enter your time to'); ctime4.focus(); return false; } else { ctime1.value = trim(ctime1.value); ctime2.value = trim(ctime2.value); ctime3.value = trim(ctime3.value); ctime4.value = trim(ctime4.value); return true; } } </script> </head> Welcome, <?php echo "".$_SESSION['username'];?>!</td> <?php if(!isset($_POST['submit'])) { ?> <form action="" method="post" onSubmit="return (checkForm();"> <table width="98%" height="301" border="0" cellpadding="10" cellspacing="0" bordercolor="#FFFFFF"> <!--Step 3 : Select Time--> <tr> <td style="border-width:1px; border-color:#A8B2C6; border-style:solid;" class="body" colspan="2"> <tr> <td width="15%" class="body-facilities">From:</td> <td class="body-facilities"> <input type="text" name="timeFrom" size="1" maxlength="2"> : <input type="text" name="timeFrom1" size="1" maxlength="2"> <sup style="color:#FF0000">eg: 08:00</sup> </td> </tr> <tr> <td class="body-facilities">To:</td> <td class="body-facilities"> <input type="text" name="timeTo" size="1" maxlength="2"> : <input type="text" name="timeTo1" size="1" maxlength="2"> <sup style="color:#FF0000">eg: 23:00</sup></td> </tr> <tr> <td colspan="2" align="right"><input type="submit" name="submit" value="Next" onClick="checkForm();"> <input type="reset" name="reset" value="Reset"> <input type="hidden" name="fac_id" value="<?php echo $fac_id;?>"> </td> </tr> </table> </form> <?php } ?> </td> </tr> </table>
  5. Xster

    Matching times

    No. How to setup? I want the PHP to check for the errors (eg : no input or wrong time format) and put them all in an array, if there are some errors it should redirect back to the previous form (written in html and php) and display the errors, if there are no errors it should link to the confirmation page before the data save into database. Is there any way to do that effigy? I already sent my php code before..hope you can show me how to setup..
  6. Xster

    Matching times

    [code]<form action="" method="post">[/code] why effigy?
  7. Xster

    Matching times

    effigy, Im not quiet sure..but still I need your attention.. what Im looking is,when I click button 'next' then its shows prompt msg something like "Invalid Entry" (if user didnt insert numbers into the box) pls forgive me if Im ask for stupid questions because Im freaking new bout this PHP.
  8. Xster

    Matching times

    effiegy... do u know which line should I put your code according to my php code? mine does not work and still got same problem...
  9. Xster

    Matching times

    Btw, this link... [url=http://www.badongo.com/pic/433848]http://www.badongo.com/pic/433848[/url] suppose to show you the image of my php.. hope this will help... p/s: effigy: i want my form accepting only [b]numbers[/b]...if you see mine still accepting any data entry such as letter,symbol or none (means nothing to put inside the box) please put the line if you got any ideas..thk u
  10. My time form suppose to accept the [b]numbers[/b] written as (eg: 01 for hours and 02 for minutes) i've tried this regex code on my php code... [b]$legit = ereg("^[0-9]{2,2}$", $time);[/b] and here's my php code... [code]<?php if(!isset($_POST['submit'])) { ?> <form action="" method="post"> <table width="100%" cellpadding="10" cellspacing="0" border="0"> <!--Step 3 : Select Time--> <tr> <td style="border-width:1px; border-color:#A8B2C6; border-style:solid;" class="body" colspan="2"> <div style="font-size:18px; color:#007E8C; font-weight:bold;"> <font color="#cccccc">3. </font>Select Time</div><br> </td> </tr> <tr> <td width="15%" class="body-facilities">From:</td> <td class="body-facilities">&nbsp;<input type="text" name="timeFrom" size="1" maxlength="2">&nbsp;:&nbsp;<input type="text" name="timeFrom1" size="1" maxlength="2">&nbsp; <sup style="color:#FF0000">eg: 08:00</sup> </td> </tr> <tr> <td class="body-facilities">To:</td> <td class="body-facilities">&nbsp;<input type="text" name="timeTo" size="1" maxlength="2">&nbsp;:&nbsp;<input type="text" name="timeTo1" size="1" maxlength="2">&nbsp; <sup style="color:#FF0000">eg: 23:00</sup></td> </tr> <tr> <td class="body-facilities"><sub>Operating Hour:</sub></td> <td class="body-facilities"><sub><?php echo $row_rs['fac_wkdayS'];?>&nbsp;to&nbsp;<?php echo $row_rs['fac_wkdayE'];?>&nbsp;(Monday to Friday)</sub><br> <sub><?php echo $row_rs['fac_wkendS'];?>&nbsp;to&nbsp;<?php echo $row_rs['fac_wkendE'];?>&nbsp;(Saturday &amp; Sunday)</sub></td> </tr> <tr> <td colspan="2" align="right"><input type="submit" name="submit" value="Next">   &nbsp;&nbsp; <input type="hidden" name="fac_id" value="<?php echo $fac_id;?>"></td></tr> </table> </form> <?php } ?> </td> </tr> </table> </td>[/code] mine does not work... anybody got ideas for more tests I can run to pin down this problem..? u guys rock...!
  11. anyway thx anatak.. i do understand the code that you've given.. but which line should i put the code inside my php code? i put a long with php tags and nothing happened.. and it still run'd like usual.. sorry if i ask silly questions..rite now im trying and still got some error.
  12. Yes! i got it rite..and my server completely connected.. let me share how i recover this problem. if you install mysql under windows system, sometime it will suddenly unable to start the service, i face this issue quite a few times already, finally i found a solution for it, 1st step check the error, under your installation path for mysql, check the data/mysql.err, it the error showing you something like this .. 050213 20:43:37 InnoDB: Starting shutdown… 050213 20:43:40 InnoDB: Shutdown completed; log sequence number 0 1051715 050213 20:43:40 [Note] C:\Web\mysql\bin\mysqld-nt: Shutdown complete this should be the log file having problem! 2nd step remove the ib_logfile0 or ib_logfile1 in the same folder 3rd step restart the mysql … da da da… mysql service is running again thx to wildteen88,fenway and ah knight's blog...
  13. here's my code [code]<?php if(!isset($_POST['submit'])) { ?> <form action="" method="post"> <table width="100%" cellpadding="10" cellspacing="0" border="0"> <!--Step 3 : Select Time--> <tr> <td style="border-width:1px; border-color:#A8B2C6; border-style:solid;" class="body" colspan="2"> <div style="font-size:18px; color:#007E8C; font-weight:bold;"> <font color="#cccccc">3. </font>Select Time</div><br> </td> </tr> <tr> <td width="15%" class="body-facilities">From:</td> <td class="body-facilities">&nbsp;<input type="text" name="timeFrom" size="1" maxlength="2">&nbsp;:&nbsp;<input type="text" name="timeFrom1" size="1" maxlength="2">&nbsp; <sup style="color:#FF0000">eg: 08:00</sup> </td> </tr> <tr> <td class="body-facilities">To:</td> <td class="body-facilities">&nbsp;<input type="text" name="timeTo" size="1" maxlength="2">&nbsp;:&nbsp;<input type="text" name="timeTo1" size="1" maxlength="2">&nbsp; <sup style="color:#FF0000">eg: 23:00</sup></td> </tr> <tr> <td class="body-facilities"><sub>Operating Hour:</sub></td> <td class="body-facilities"><sub><?php echo $row_rs['fac_wkdayS'];?>&nbsp;to&nbsp;<?php echo $row_rs['fac_wkdayE'];?>&nbsp;(Monday to Friday)</sub><br> <sub><?php echo $row_rs['fac_wkendS'];?>&nbsp;to&nbsp;<?php echo $row_rs['fac_wkendE'];?>&nbsp;(Saturday &amp; Sunday)</sub></td> </tr> <tr> <td colspan="2" align="right"><input type="submit" name="submit" value="Next">   &nbsp;&nbsp; <input type="hidden" name="fac_id" value="<?php echo $fac_id;?>">   </td></tr> </table> </form> <?php } ?> </td> </tr> </table> </td> [/code] again how to build and put the regex into this code and which line it was? i appreciate any help...
  14. aha,anatak thx 4 the msg.. the hours is suppose written as 01 using format 24 hours not am/pm... am i clear o not? there's a button called 'NEXT' below the picture that i just mention before.. btw anatak,how to build the regex?
  15. Btw, this link... [url=http://www.badongo.com/pic/433848]http://www.badongo.com/pic/433848[/url] suppose to show you the image of my php.. hope this will help...
  16. hello guys, how to create a good validation.. because mine is not so good..its still accepting any data entry (letter,symbol or number) but suppose to be [b]number[/b] or none... here's i'd post the image of my form..hope the image will help. p/s: im very new in php..so,i really need some guidence...
  17. What do you mean error log says? I've got error in computer management says in 'Event Properties' "The MySql service terminated unexpectedly. It has done this 6 time(s). For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp." i've also go to folder MySQL>bin>winmysqladmin.exe and still can't start the service... what should i do...? ???
  18. hello, Im getting this problem when i try to start mysql server... when i try to right click and select 'start the service'...the lights still red ...i try go to MyComputer>Manage>Services and Applications>Services i try to start mysql on properties...prompt error came out and says "Could not start MySQL service on local computer. Error 1067: The process terminated unexpectedly" any answers would help..TQ guys!
  19. Sir... the code that I posted is for 'select date' form. ok...
  20. [quote author=linuxdream link=topic=123436.msg510280#msg510280 date=1169439308] What code do you have so far? Would be helpful to post. [/quote] Post? Ok sir... $d = getdate(time()); $month = $_GET['month']; $year = $_GET['year']; if ($month == "") { $month = $d["mon"]; } if ($year == "") { $year = $d["year"]; } $cal = new MyCalendar; echo $cal->getMonthView($month, $year, $fac_id, $fac_name); class Calendar { function Calendar() { } function getDayNames() { return $this->dayNames; } function setDayNames($names) { $this->dayNames = $names; } function getMonthNames() { return $this->monthNames; } function setMonthNames($names) { $this->monthNames = $names; }   function getStartDay() { return $this->startDay; } function setStartDay($day) { $this->startDay = $day; } function getStartMonth() { return $this->startMonth; } function setStartMonth($month) { $this->startMonth = $month; } function getCalendarLink($month, $year, $fac_id, $fac_name) { return "month=$month&year=$year&fac_id=$fac_id&fac_name=$fac_name"; } function getDateLink($day, $month, $year, $fac_id, $fac_name) { $facBooked_date=""; $link = "user_facilitiesTime.php?fac_id=$fac_id&fac_name=$fac_name&facBooked_date=$year-$month-$day"; return $link; } function getCurrentMonthView($fac_id, $fac_name) { $d = getdate(time()); return $this->getMonthView($d["mon"], $d["year"], $fac_id, $fac_name); } function getCurrentYearView() { $d = getdate(time()); return $this->getYearView($d["year"]); } function getMonthView($month, $year, $fac_id, $fac_name) { return $this->getMonthHTML($month, $year,1, $fac_id, $fac_name); } function getYearView($year) { return $this->getYearHTML($year); } function getDaysInMonth($month, $year) { if ($month < 1 || $month > 12) { return 0; }   $d = $this->daysInMonth[$month - 1];   if ($month == 2) { if ($year%4 == 0) { if ($year%100 == 0) { if ($year%400 == 0) { $d = 29; } } else { $d = 29; } } } return $d; } function getMonthHTML($m, $y, $showYear = 1, $fac_id, $fac_name) { $s = ""; $a = $this->adjustDate($m, $y); $month = $a[0]; $year = $a[1];        $daysInMonth = $this->getDaysInMonth($month, $year); $date = getdate(mktime(12, 0, 0, $month, 1, $year)); $first = $date["wday"]; $monthName = $this->monthNames[$month - 1]; $prev = $this->adjustDate($month - 1, $year); $next = $this->adjustDate($month + 1, $year); if ($showYear == 1) { $prevMonth = $this->getCalendarLink($prev[0], $prev[1], $fac_id, $fac_name); $nextMonth = $this->getCalendarLink($next[0], $next[1], $fac_id, $fac_name); } else { $prevMonth = ""; $nextMonth = ""; } $header = $monthName . (($showYear > 0) ? " " . $year : ""); //display month and year (<< month >>) $s .= "<table bgcolor=\"#ffffff\" height=\"120px\" width=\"450px\" border=\"1\" bordercolor=\"#FFFFCC\" cellspacing=\"0\" cellpadding=\"5\" align=\"center\" class=\"calendar\">\n"; $s .= "<tr>\n"; $s .= "<td align=\"center\" valign=\"top\" class=\"calendarHeader\">" . (($prevMonth == "") ? "&nbsp;" : "<a href=\"$prevMonth\" class=\"month\">&lt;&lt;</a>")  . "</td>\n"; $s .= "<td align=\"center\" valign=\"top\" class=\"calendarMonth\" colspan=\"5\">$header</td>\n"; $s .= "<td align=\"center\" valign=\"top\" class=\"calendarHeader\">" . (($nextMonth == "") ? "&nbsp;" : "<a href=\"$nextMonth\" class=\"month\">&gt;&gt;</a>")  . "</td>\n"; $s .= "</tr>\n"; //display days(mon, tue,...) $s .= "<tr>\n"; $s .= "<td align=\"center\" valign=\"top\" class=\"calendarHeader\">" . $this->dayNames[($this->startDay)%7] . "</td>\n"; $s .= "<td align=\"center\" valign=\"top\" class=\"calendarHeader\">" . $this->dayNames[($this->startDay+1)%7] . "</td>\n"; $s .= "<td align=\"center\" valign=\"top\" class=\"calendarHeader\">" . $this->dayNames[($this->startDay+2)%7] . "</td>\n"; $s .= "<td align=\"center\" valign=\"top\" class=\"calendarHeader\">" . $this->dayNames[($this->startDay+3)%7] . "</td>\n"; $s .= "<td align=\"center\" valign=\"top\" class=\"calendarHeader\">" . $this->dayNames[($this->startDay+4)%7] . "</td>\n"; $s .= "<td align=\"center\" valign=\"top\" class=\"calendarHeader\">" . $this->dayNames[($this->startDay+5)%7] . "</td>\n"; $s .= "<td align=\"center\" valign=\"top\" class=\"calendarHeader\">" . $this->dayNames[($this->startDay+6)%7] . "</td>\n"; $s .= "</tr>\n"; $d = $this->startDay + 1 - $first; while ($d > 1) { $d -= 7; } $today = getdate(time()); include('../Connections/mConn2.php'); //display day of the month in table while ($d <= $daysInMonth) { $s .= "<tr>\n";      for ($i = 0; $i < 7; $i++) { $class = ($year == $today["year"] && $month == $today["mon"] && $d == $today["mday"]) ? "calendarToday" : "calendar"; $s .= "<td class=\"$class\" align=\"center\" valign=\"middle\" bgcolor=\"#ffffff\">";      if ($d > 0 && $d <= $daysInMonth) { $link = $this->getDateLink($d, $month, $year, $fac_id, $fac_name, $i); $ymd = "$year-$month-$d"; mysql_select_db($database_mConn, $mConn); $query_rsq = "SELECT offDay,reason FROM offday WHERE fac_id='$fac_id' AND offDay='$ymd'"; $rsq = mysql_query($query_rsq, $mConn) or die(mysql_error()); $row_rsq = mysql_fetch_assoc($rsq); $totalRows_rsq = mysql_num_rows($rsq); $reason= $row_rsq['reason']; if ($totalRows_rsq=="0") { //normal work day $s .= (($link == "") ? $d : "<a href=\"$link\" style=\"cursor:hand; text-decoration:none;\" class=\"calendar\">$d</a>"); }else{ //selected off day $s .= (($link == "") ? $d : "<div class=\"offday\" ONMOUSEOVER=\"popup('OFF Day reason due to:  ".$reason."','lightblue')\"; ONMOUSEOUT=\"kill()\">$d</div>"); } //mysql_free_result($rsq); } else { $s .= "&nbsp;"; } $s .= "</td>\n";      $d++; } $s .= "</tr>\n";    } $s .= "</table>\n"; return $s;  } function getYearHTML($year) { $s = ""; $prev = $this->getCalendarLink(0, $year - 1, $fac_id, $fac_name); $next = $this->getCalendarLink(0, $year + 1, $fac_id, $fac_name); $s .= "<table class=\"calendar\" border=\"0\">\n"; $s .= "<tr>"; $s .= "<td align=\"center\" valign=\"top\" align=\"left\">" . (($prev == "") ? "&nbsp;" : "<a href=\"$prev\">&lt;&lt;</a>")  . "</td>\n"; $s .= "<td class=\"calendarHeader\" valign=\"top\" align=\"center\">" . (($this->startMonth > 1) ? $year . " - " . ($year + 1) : $year) ."</td>\n"; $s .= "<td align=\"center\" valign=\"top\" align=\"right\">" . (($next == "") ? "&nbsp;" : "<a href=\"$next\">&gt;&gt;</a>")  . "</td>\n"; $s .= "</tr>\n"; $s .= "<tr>"; $s .= "<td class=\"calendar\" valign=\"top\">" . $this->getMonthHTML(0 + $this->startMonth, $year, 0, $fac_id, $fac_name) ."</td>\n"; $s .= "<td class=\"calendar\" valign=\"top\">" . $this->getMonthHTML(1 + $this->startMonth, $year, 0, $fac_id, $fc_name) ."</td>\n"; $s .= "<td class=\"calendar\" valign=\"top\">" . $this->getMonthHTML(2 + $this->startMonth, $year, 0, $fac_id, $fac_name) ."</td>\n"; $s .= "</tr>\n"; $s .= "<tr>\n"; $s .= "<td class=\"calendar\" valign=\"top\">" . $this->getMonthHTML(3 + $this->startMonth, $year, 0, $fac_id, $fac_name) ."</td>\n"; $s .= "<td class=\"calendar\" valign=\"top\">" . $this->getMonthHTML(4 + $this->startMonth, $year, 0, $fac_id, $fac_name) ."</td>\n"; $s .= "<td class=\"calendar\" valign=\"top\">" . $this->getMonthHTML(5 + $this->startMonth, $year, 0, $fac_id, $fac_name) ."</td>\n"; $s .= "</tr>\n"; $s .= "<tr>\n"; $s .= "<td class=\"calendar\" valign=\"top\">" . $this->getMonthHTML(6 + $this->startMonth, $year, 0, $fac_id, $fac_name) ."</td>\n"; $s .= "<td class=\"calendar\" valign=\"top\">" . $this->getMonthHTML(7 + $this->startMonth, $year, 0, $fac_id, $fac_name) ."</td>\n"; $s .= "<td class=\"calendar\" valign=\"top\">" . $this->getMonthHTML(8 + $this->startMonth, $year, 0, $fac_id, $fac_name) ."</td>\n"; $s .= "</tr>\n"; $s .= "<tr>\n"; $s .= "<td class=\"calendar\" valign=\"top\">" . $this->getMonthHTML(9 + $this->startMonth, $year, 0, $fac_id, $fac_name) ."</td>\n"; $s .= "<td class=\"calendar\" valign=\"top\">" . $this->getMonthHTML(10 + $this->startMonth, $year, 0, $fac_id, $fac_name) ."</td>\n"; $s .= "<td class=\"calendar\" valign=\"top\">" . $this->getMonthHTML(11 + $this->startMonth, $year, 0, $fac_id, $fac_name) ."</td>\n"; $s .= "</tr>\n"; $s .= "</table>\n"; return $s; } function adjustDate($month, $year) { $a = array();  $a[0] = $month; $a[1] = $year; while ($a[0] > 12) { $a[0] -= 12; $a[1]++; } while ($a[0] <= 0) { $a[0] += 12; $a[1]--; } return $a; } var $startDay = 0; var $startMonth = 1; var $dayNames = array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"); var $monthNames = array("JANUARY", "FEBRUARY", "MARCH", "APRIL", "MAY", "JUNE", "JULY", "AUGUST", "SEPTEMBER", "OCTOBER", "NOVEMBER", "DECEMBER"); var $daysInMonth = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); } class MyCalendar extends Calendar { function getCalendarLink($month, $year, $fac_id, $fac_name) { $s = getenv('SCRIPT_NAME'); return "$s?month=$month&year=$year&fac_id=$fac_id&fac_name=$fac_name"; } } /*$d = getdate(time()); if ($month == "") { $month = $d["mon"]; } if ($year == "") { $year = $d["year"]; } $cal = new MyCalendar; echo $cal->getMonthView($month, $year,$fac_id, $fac_name);*/?>
  21. Hi, Im a newbies in this forum..so,pls teach me as good as u can... Em, lets get in started... 1. how to block the calender after the current day...i mean after this day (eg 1,2,3 Jan...and so on) 2. how to create a good validation,because the script is always accept even if user didn't insert any number inside the box (eg Time From : - (none) and Time To : - (none) 2. how can i add more features for admin to block the calender to user information before they book the dates with a proper reason (eg : for maintenance, lights broken and so on..) btw, the script is all about facilities..means that user can choose any day to select facility such as tennis court, basketball court etc... p/s: thk u!
×
×
  • 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.