PHP - Moved: Js Checkbox Enable Disable Div Tag
This topic has been moved to JavaScript Help.
http://www.phpfreaks.com/forums/index.php?topic=327588.0 Similar TutorialsHi all, I wonder if anyone can give me some idea; I have a form with a drop down menu [BT,Virgin, None, Other] - When user select either [BT, Virgin,None] the textarea field will be disable. But when user select option [Other] the textarea will be available. How can I do this? .. .. <tr align="left" valign="top" <?php if ($_POST['action'] == "register") { if ($errornum[16] == "1") { echo 'class="error"'; } } ?>> <td>Who is your previous Internet Service Provider?</td> <td align="left"> <select name="oldprovider"> <option value="<?php echo $prev_supplier;?>" <?php if ($_POST['action'] == "register") { if ($_POST['oldprovider'] == "") { echo "selected"; } } ?>> Select Provider..... </option><?php $prev_supplier="BT";?> <option value="<?php echo $prev_supplier;?>" <?php if ($_POST['action'] == "register"){ if ($_POST['oldprovider'] == "$prev_supplier") { echo "selected"; } } ?>> <?php echo $prev_supplier;?> </option><?php $prev_supplier="Virgin";?> <option value="<?php echo $prev_supplier;?>" <?php if ($_POST['action'] == "register") { if ($_POST['oldprovider'] == "$prev_supplier") { echo "selected"; } } ?>><?php echo $prev_supplier;?> </option><?php $prev_supplier="None";?> <option value="<?php echo $prev_supplier;?>" <?php if ($_POST['action'] == "register") { if ($_POST['oldprovider'] == "$prev_supplier") { echo "selected"; } } ?>><?php echo $prev_supplier;?> </option><?php $prev_supplier="Other";?> <option value="<?php echo $prev_supplier;?>" <?php if ($_POST['action'] == "register") { if ($_POST['oldprovider'] == "$prev_supplier") { echo "selected"; } } ?>><?php echo $prev_supplier;?> </option> </select> <br /><br /> <textarea name="oldprovider_text" cols="30" rows="2"> <?php if ($_POST['action'] == "register") { echo $_POST['oldprovider_text']; } ?> </textarea></td> </tr> Thanks in advance. This topic has been moved to HTML Help. http://www.phpfreaks.com/forums/index.php?topic=315457.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=333807.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=349419.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=349419.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=352154.0 This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=325435.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=309239.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=326600.0 By default, PHP comes with some extensions disabled. Question 1: Is there a command (via command-line) to enable ALL extensions? Question 2: Are there any drawbacks to having all extensions enabled (e.g. slows it down, conflicts, etc.)? Thank you. I have a "system" setup for posting some feedback questions on an internal website. I have it setup to read a field "enabled" which has a 1 or 0. 0=disabled, 1=enabled The script works if I manually change that field, ie it reads the correct question. But need a way to have the questions listed then the one that needs to be shown on the site selected to be enabled on an admin page. Something like a list with checkboxes or radio buttons? How can I have one enabled and make sure the rest are not to prevent multiple questions being enabled? Hi, surely all of us have seen the auto-instant notifications in Facebook, or that comments appear automatically in a page while we are still on that page without page refresh. Can anybody give me an outline of how is it accomplished? If it were the other way around, like the user inputs something in the page, that data could be sent to the server through Ajax and a server side PHP script could update the database accordingly. But how can it be accomplished in the reverse manner also, that when some user does something in one page of a website, its notification is propagated to another page of the site open on some other computer instantly? I ve been having trouble processing form data to the same page as the do on facebook comments. Can php scripts do that. Help me guys!! I'm trying to utilize a PHP script to parse a large XML file (around 450 MB) to MYSQL database into certain structure and definitions of included XML elements. The problem is that the original script uses file_get_contents and SimpleXMLElement to get it done, but the corn job executed by the server halts due to the volume of the XML file. I'm no PHP expert, so I bought this XMLSplit software and divided the XML into 17 separated XML files each at size of 30 MB, parsed them one by one using the same script. However, the output database was missing a lot of input, and I have serious doubts whether this would be the same output of the original file if left not divided automatically and parsed one by one.
So, I've decided to use XMLReader with this exact PHP script to parse this big XML file, but so far I couldn't manage to simply replace the parsing code and keep other functionality intact.
I'm including the script below, I'd really appreciate if someone helps me to do so.
<?php set_time_limit(0); ini_set('memory_limit', '1024M'); include_once('../db.php'); include_once(DOC_ROOT.'/include/func.php'); mysql_query("TRUNCATE screenshots_list"); mysql_query("TRUNCATE pages"); mysql_query("TRUNCATE page_screenshots"); // This is the part I need help with to change into XMLReader instead of utilized function, to enable parsing of the large XML file correctly (while keeping rest of the script code as is if possible): $xmlstr = file_get_contents('t_info.xml'); $xml = new SimpleXMLElement($xmlstr); foreach ($xml->template as $item) { //print_r($item); $sql = sprintf("REPLACE INTO templates SET id = %d, state = %d, price = %d, exc_price = %d, inserted_date = '%s', update_date = '%s', downloads = %d, type_id = %d, type_name = '%s', is_flash = %d, is_adult = %d, width = '%s', author_id = %d, author_nick = '%s', package_id = %d, is_full_site = %d, is_real_size = %d, keywords = '%s', sources = '%s', description = '%s', software_required = '%s'", $item->id, $item->state, $item->price, $item->exc_price, $item->inserted_date, $item->update_date, $item->downloads, $item->template_type->type_id, $item->template_type->type_name, $item->is_flash, $item->is_adult, $item->width, $item->author->author_id, $item->author->author_nick, $item->package->package_id, $item->is_full_site, $item->is_real_size, $item->keywords, $item->sources, $item->description, $item->software_required); //echo '<br>'.$sql; mysql_query($sql); //print_r($item->screenshots_list->screenshot); foreach ($item->screenshots_list->screenshot as $scr) { $main = (!empty($scr->main_preview)) ? 1 : 0; $small = (!empty($scr->small_preview)) ? 1 : 0; insert_data($item->id, 'screenshots_list', 0, $scr->uri, $scr->filemtime, $main, $small); } foreach ($item->styles->style as $st) { insert_data($item->id, 'styles', $st->style_id, $st->style_name); } foreach ($item->categories->category as $cat) { insert_data($item->id, 'categories', $cat->category_id, $cat->category_name); } foreach ($item->sources_available_list->source as $so) { insert_data($item->id, 'sources_available_list', $so->source_id, ''); } foreach ($item->software_required_list->software as $soft) { insert_data($item->id, 'software_required_list', $soft->software_id, ''); } //print_r($item->pages->page); if (!empty($item->pages->page)) { foreach ($item->pages->page as $p) { mysql_query(sprintf("REPLACE INTO pages SET tpl_id = %d, name = '%s', id = NULL ", $item->id, $p->name)); $page_id = mysql_insert_id(); if (!empty($p->screenshots->scr)) { foreach ($p->screenshots->scr as $psc) { $href = (!empty($psc->href)) ? (string)$psc->href : ''; mysql_query(sprintf("REPLACE INTO page_screenshots SET page_id = %d, description = '%s', uri = '%s', scr_type_id = %d, width = %d, height = %d, href = '%s'", $page_id, $psc->description, $psc->uri, $psc->scr_type_id, $psc->width, $psc->height, $href)); } } } }}?>I'd appreciate your help with that... ok so I have this code. I need to know how to modify it so that if the user has already registered for the event, they cannot do so again.........how can I do this? does this make sense? members that have already registered are held in a table called events..........userid, eventid, name, subevent....... Code: [Select] <?php $sql = mysql_query("SELECT * FROM Registration WHERE eventid=".$_GET['eventid']." LIMIT 1"); while($row = mysql_fetch_array($sql)){ $eventid = $row["eventid"]; $event = $row["event"]; $startdate = $row["startdate"]; $enddate = $row["enddate"]; $description = $row["description"]; $location = $row["location"]; $title1 = $row['title1']; $title2 = $row['title2']; $title3 = $row['title3']; $title4 = $row['title4']; $title5 = $row['title5']; $title6 = $row['title6']; $title7 = $row['title7']; $title8 = $row['title8']; $price1 = $row['price1']; $price2 = $row['price2']; $price3 = $row['price3']; $price4 = $row['price4']; $price5 = $row['price5']; $price6 = $row['price6']; $price7 = $row['price7']; $price8 = $row['price8']; $date1 = $row['date1']; $date2 = $row['date2']; $date3 = $row['date3']; $date4 = $row['date4']; $date5 = $row['date5']; $date6 = $row['date6']; $date7 = $row['date7']; $date8 = $row['date8']; //this will echo the contents of each db row as they are iterated in the loop ############################# echo "<form action ='eventreg.php' method='post'>"; echo "<center><table border='1' width='600'>"; if (!empty($title1)) { echo "<tr><td width='100'> <input type='checkbox' name='subevent1' value='$title1'/></td><td width='500'><strong>$title1 </strong><br /> $date1 <br />$ $price1 </tr></td> "; } if (!empty($title2)) { echo "<br/><tr><td> <input type='checkbox' name='subevent2' value='$title2' /></td><td><strong>$title2 </strong><br /> $date2 <br />$ $price2 </tr></td>" ; } if (!empty($title3)) { echo "<br/><tr><td><input type='checkbox' name='subevent3' value='$title3' /></td><td><strong>$title3</strong> <br /> $date3 <br />$ $price3</tr></td>"; } if (!empty($title4)) { echo "<br/><tr><td><input type='checkbox' name='subevent4' value='$title4' /></td><td><strong>$title4</strong> <br /> $date4 <br />$ $price4</tr></td>"; } if (!empty($title5)) { echo "<br/><tr><td><input type='checkbox' name='subevent5' value='$title5' /></td><td><strong>$title5</strong> <br /> $date5 <br />$ $price5</tr>"; } if (!empty($title6)) { echo "<br/><tr><td> <input type='checkbox' name='subevent6' value='$title6' /></td><td><strong>$title6 </strong><br /> $date6 <br />$ $price6</tr></td>"; } if (!empty($title7)) { echo "<br/><tr><td> <input type='checkbox' name='subevent7' value='$title7' /></td><td><strong>$title7</strong> <br /> $date7 <br />$ $price7</tr></td>"; } if (!empty($title8)) { echo "<br/><tr><td> <input type='checkbox' name='subevent8' value='$title8' /></td><td><strong>$title8</strong> <br /> $date8 <br />$ $price8</tr></td>"; } echo "</table>"; echo "<input name='userid' type=\"hidden\" value=\"$userid\" />"; echo "<input name='eventid' type=\"hidden\" value=\"$eventid\" />"; echo "<input name='event' type=\"hidden\" value=\"$event\" />"; echo "<input name='name' type=\"hidden\" value=\"$name\" />"; echo "<input name=\"save\" type=\"submit\" value=\"Register Now!\" />"; echo "</center></form>"; } //etc etc ?> Ok, so I have a field in database called shutoff( a date when registrations will no longer be accepted for an event). How can I make it so that on the specified date, the register button will change to "no longer accepting Registrations". here is the form: Code: [Select] <?php // when displaying an article show a link // to see the article list if(isset($_GET['eventid'])) { ?> <div id="info " > <p>Date(s): <?php echo $startdate; ?><span class="klgjsa"> -</span> <?php echo $enddate; ?><br /> <span class="fgsdfg">Location:</span> <?php echo $location; ?><br /> <span class="adfasdf">Description</span><span class="adfdas">: </span><?php echo $description; ?> </p> <p> </p> <center> <table width="577" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="565" bgcolor="#C5C0B7" class="hjkh" scope="col"><?php echo $event; ?><font color='#C5C0B7'>...........................</font> <font size='-1'> <?php if ($accounttype =='Admin'){ echo "<a href='cofirmation.php'>Confirm Registrations </a><font color='#C5C0B7'>...</font><a href='quickregister.php?eventid=".$_GET['eventid']."'>Quick Registration</a><font color='#C5C0B7'>...</font><a href='viewregistered.php?eventid=".$_GET['eventid']."'>View Registrations</a>"; } ?></font></td> </tr> <tr> <td bgcolor="#999999" class="hjkh" scope="col"><table width="576" border="1" cellspacing="0" cellpadding="1"> <tr> <td width="91" bgcolor="#FFFFFF" scope="col"><?php $sql = mysql_query("SELECT * FROM Registration WHERE eventid=".$_GET['eventid']." LIMIT 1"); while($row = mysql_fetch_array($sql)){ $event= $row["event"]; $subevent1 = $row['subevent1']; $subevent2 = $row['subevent2']; $subevent3 = $row['subevent3']; $subevent4 = $row['subevent4']; $subevent5 = $row['subevent5']; $subevent6 = $row['subevent6']; $subevent7 = $row['subevent7']; $subevent8 = $row['subevent8']; $title1 = $row['title1']; $title2 = $row['title2']; $title3 = $row['title3']; $title4 = $row['title4']; $title5 = $row['title5']; $title6 = $row['title6']; $title7 = $row['title7']; $title8 = $row['title8']; $price1 = $row['price1']; $price2 = $row['price2']; $price3 = $row['price3']; $price4 = $row['price4']; $price5 = $row['price5']; $price6 = $row['price6']; $price7 = $row['price7']; $price8 = $row['price8']; $date1 = $row['date1']; $date2 = $row['date2']; $date3 = $row['date3']; $date4 = $row['date4']; $date5 = $row['date5']; $date6 = $row['date6']; $date7 = $row['date7']; $date8 = $row['date8']; //this will echo the contents of each db row as they are iterated in the loop ############################# if (!empty($title1)) { echo "<br/><strong>$title1</strong><br />$date1<br />$ $price1<br /><br />"; } if (!empty($title2)) { echo "<br/><strong>$title2</strong><br />$date2<br />$ $price2<br /><br />"; } if (!empty($title3)) { echo "<br/><strong>$title3</strong><br />$date3<br />$ $price3<br /><br />"; } if (!empty($title4)) { echo "<br/><strong>$title4</strong><br />$date4<br />$ $price4<br /><br />"; } if (!empty($title5)) { echo "<br/><strong>$title5</strong><br />$date5<br />$ $price5<br /><br />"; } if (!empty($title6)) { echo "<br/><strong>$title6</strong><br />$date6<br />$ $price6<br /><br />"; } if (!empty($title7)) { echo "<br/><strong>$title7</strong><br />$date7<br />$ $price7<br /><br />"; } if (!empty($title8)) { echo "<br/><strong>$title8</strong><br />$date8<br />$ $price8"; } } //etc etc ?></td> <td width="475" bgcolor="#FFFFFF" scope="col"><?php echo $description; ?></td> </tr> </table></td> </tr> </table> <table width="200" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="31" scope="col"><?php if (isset($_GET['eventid'])) { include('connect1.php'); $sql = "SELECT eventid FROM Registration WHERE eventid=".$_GET['eventid']." LIMIT 1"; $result = mysqli_query($dbcon, $sql) or die('error getting data'); echo "<table>"; $row = mysqli_fetch_array($result, MYSQLI_ASSOC); echo "<tr><td>"; echo "<form action='registration.php' method='get'><input type='hidden' name='eventid' value='{$row['eventid']}'><INPUT TYPE='submit' name='submit' VALUE='Register'></form>\n"; echo "</td></tr>"; echo "</table>"; } ?></td> </tr> </table></center> <p> </p> <table width="200" border="0" cellspacing="0" cellpadding="0"> <tr> <th scope="col"> </th> </tr> </table> <p><?php } ?> and here is where data is pulled: Code: [Select] $query = "SELECT event, description, startdate, enddate, location, subevent1, subevent2, subevent3, subevent4, subevent5, subevent6, subevent7, subevent8, price1, price2, price3, price4, price5, price6, price7, price8, shutoff FROM Registration WHERE eventid=".$_GET['eventid']; $result = mysql_query($query) or die('Error : ' . mysql_error()); $row = mysql_fetch_array($result, MYSQL_ASSOC); $startdate = $row['startdate']; $enddate = $row['enddate']; $location = $row['location']; $description = $row['description']; $event= $row["event"]; $subevent1 = $row['subevent1']; $subevent2 = $row['subevent2']; $subevent3 = $row['subevent3']; $subevent4 = $row['subevent4']; $subevent5 = $row['subevent5']; $subevent6 = $row['subevent6']; $subevent7 = $row['subevent7']; $subevent8 = $row['subevent8']; $title1 = $row['title1']; $title2 = $row['title2']; $title3 = $row['title3']; $title4 = $row['title4']; $title5 = $row['title5']; $title6 = $row['title6']; $title7 = $row['title7']; $title8 = $row['title8']; $price1 = $row['price1']; $price2 = $row['price2']; $price3 = $row['price3']; $price4 = $row['price4']; $price5 = $row['price5']; $price6 = $row['price6']; $price7 = $row['price7']; $price8 = $row['price8']; $date1 = $row['date1']; $date2 = $row['date2']; $date3 = $row['date3']; $date4 = $row['date4']; $date5 = $row['date5']; $date6 = $row['date6']; $date7 = $row['date7']; $date8 = $row['date8']; $shutoff = $row['shutoff']; does this make sense? it is in yyyy-mm-dd format(I believe that is correct...... ok, so I have this code for my event registration page......I need to make this event register button dissapear after the date has passed.......can I do this using dd/mm/yyyy or do i need yyyy-mm-dd? here is the codeif ($reg_end == date("F",strtotime("+1 month"))){ echo "<form action='registration.php' method='get'><input type='hidden' name='eventid' value='{$row['eventid']}'><INPUT TYPE='submit' name='submit' VALUE='Register'></form>\n";} else{echo "No longer accepting registrations";} also I need to know how to modify the red code to do this........thanks in advance.......btw I will have field call reg_end which is when the turn off date is....... <?php class booking_diary { // Mysqli connection function __construct($link) { $this->link = $link; } // Settings you can change: // Time Related Variables public $booking_start_time = "09:00"; // The time of the first slot in 24 hour H:M format public $booking_end_time = "13:00"; // The time of the last slot in 24 hour H:M format public $booking_frequency = 02; // The slot frequency per hour, expressed in minutes. //$date = new DateTime(); //$Pdate-> setDate(2020, 10, 29); // Day Related Variables public $day_format = 1; // Day format of the table header. Possible values (1, 2, 3) // 1 = Show First digit, eg: "M" // 2 = Show First 3 letters, eg: "Mon" // 3 = Full Day, eg: "Monday" public $day_closed = array("Saturday", "Sunday"); // If you don't want any 'closed' days, remove the day so it becomes: = array(); //public $Special_day = array() public $day_closed_text = "CLOSED"; // If you don't want any any 'closed' remove the text so it becomes: = ""; // Cost Related Variables public $cost_per_slot = 20.00; // The cost per slot public $cost_currency_tag = "£"; // The currency tag in HTML such as € £ ¥ // DO NOT EDIT BELOW THIS LINE public $day_order = array("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"); public $day, $month, $year, $selected_date, $back, $back_month, $back_year, $forward, $forward_month, $forward_year, $bookings, $count, $days, $is_slot_booked_today; /*========================================================================================================================================================*/ function make_calendar($selected_date, $back, $forward, $day, $month, $year) { // $day, $month and $year are the $_GET variables in the URL $this->day = $day; $this->month = $month; $this->year = $year; // $back and $forward are Unix Timestamps of the previous / next month, used to give the back arrow the correct month and year $this->selected_date = $selected_date; $this->back = $back; $this->back_month = date("m", $back); $this->back_year = date("Y", $back); // Minus one month back arrow $this->forward = $forward; $this->forward_month = date("m", $forward); $this->forward_year = date("Y", $forward); // Add one month forward arrow // Make the booking array $this->make_booking_array($year, $month); } function make_booking_array($year, $month, $j = 0) { $stmt = $this->link->prepare("SELECT name, date, start FROM bookings WHERE date LIKE CONCAT(?, '-', ?, '%')"); $this->is_slot_booked_today = 0; // Defaults to 0 $stmt->bind_param('ss', $year, $month); $stmt->bind_result($name, $date, $start); $stmt->execute(); $stmt->store_result(); while($stmt->fetch()) { $this->bookings_per_day[$date][] = $start; $this->bookings[] = array( "name" => $name, "date" => $date, "start" => $start ); // Used by the 'booking_form' function later to check whether there are any booked slots on the selected day if($date == $this->year . '-' . $this->month . '-' . $this->day) { $this->is_slot_booked_today = 1; } } // Calculate how many slots there are per day $this->slots_per_day = 0; for($i = strtotime($this->booking_start_time); $i<= strtotime($this->booking_end_time); $i = $i + $this->booking_frequency * 60) { $this->slots_per_day ++; } $stmt->close(); $this->make_days_array($year, $month); } // Close function function make_days_array($year, $month) { // Calculate the number of days in the selected month $num_days_month = cal_days_in_month(CAL_GREGORIAN, $month, $year); // Make $this->days array containing the Day Number and Day Number in the selected month for ($i = 1; $i <= $num_days_month; $i++) { // Work out the Day Name ( Monday, Tuesday... ) from the $month and $year variables $d = mktime(0, 0, 0, $month, $i, $year); // Create the array $this->days[] = array("daynumber" => $i, "dayname" => date("l", $d)); } /* Sample output of the $this->days array: [0] => Array ( [daynumber] => 1 [dayname] => Monday ) [1] => Array ( [daynumber] => 2 [dayname] => Tuesday ) */ $this->make_blank_start($year, $month); $this->make_blank_end($year, $month); } // Close function function make_blank_start($year, $month) { /* Calendar months start on different days Therefore there are often blank 'unavailable' days at the beginning of the month which are showed as a grey block The code below creates the blank days at the beginning of the month */ // Get first record of the days array which will be the First Day in the month ( eg Wednesday ) $first_day = $this->days[0]['dayname']; $s = 0; // Loop through $day_order array ( Monday, Tuesday ... ) foreach($this->day_order as $i => $r) { // Compare the $first_day to the Day Order if($first_day == $r && $s == 0) { $s = 1; // Set flag to 1 stop further processing } elseif($s == 0) { $blank = array( "daynumber" => 'blank', "dayname" => 'blank' ); // Prepend elements to the beginning of the $day array array_unshift($this->days, $blank); } } // Close foreach } // Close function function make_blank_end($year, $month) { /* Calendar months start on different days Therefore there are often blank 'unavailable' days at the end of the month which are showed as a grey block The code below creates the blank days at the end of the month */ // Add blank elements to end of array if required. $pad_end = 7 - (count($this->days) % 7); if ($pad_end < 7) { $blank = array( "daynumber" => 'blank', "dayname" => 'blank' ); for ($i = 1; $i <= $pad_end; $i++) { array_push($this->days, $blank); } } // Close if $this->calendar_top(); } // Close function function calendar_top() { // This function creates the top of the table containg the date and the forward and back arrows echo " <div id='lhs'><div id='outer_calendar'> <table border='0' cellpadding='0' cellspacing='0' id='calendar'> <tr id='week'> <td align='left'><a href='?month=" . date("m", $this->back) . "&year=" . date("Y", $this->back) . "'>«</a></td> <td colspan='5' id='center_date'>" . date("F, Y", $this->selected_date) . "</td> <td align='right'><a href='?month=" . date("m", $this->forward) . "&year=" . date("Y", $this->forward) . "'>»</a></td> </tr> <tr>"; /* Make the table header with the appropriate day of the week using the $day_format variable as user defined above Definition: 1: Show First digit, eg: "M" 2: Show First 3 letters, eg: "Mon" 3: Full Day, eg: "Monday" */ foreach($this->day_order as $r) { switch($this->day_format) { case(1): echo "<th>" . substr($r, 0, 1) . "</th>"; break; case(2): echo "<th>" . substr($r, 0, 3) . "</th>"; break; case(3): echo "<th>" . $r . "</th>"; break; } // Close switch } // Close foreach echo "</tr>"; $this->make_cells(); } // Close function function make_cells($table = '') { echo "<tr>"; foreach($this->days as $i => $r) { // Loop through the date array $j = $i + 1; $tag = 0; // If the the current day is found in the day_closed array, bookings are not allowed on this day if(in_array($r['dayname'], $this->day_closed)) { echo "\r\n<td width='21' valign='top' class='closed'>" . $this->day_closed_text . "</td>"; $tag = 1; } // Past days are greyed out if (mktime(0, 0, 0, $this->month, sprintf("%02s", $r['daynumber']) + 1, $this->year) < strtotime("now") && $tag != 1) { echo "\r\n<td width='21' valign='top' class='past'>"; // Output day number if($r['daynumber'] != 'blank') echo $r['daynumber']; echo "</td>"; $tag = 1; } // If the element is set as 'blank', insert blank day if($r['dayname'] == 'blank' && $tag != 1) { echo "\r\n<td width='21' valign='top' class='unavailable'></td>"; $tag = 1; } // Now check the booking array $this->booking to see whether we have a booking on this day $current_day = $this->year . '-' . $this->month . '-' . sprintf("%02s", $r['daynumber']); if(isset($this->bookings_per_day[$current_day]) && $tag == 0) { $current_day_slots_booked = count($this->bookings_per_day[$current_day]); if($current_day_slots_booked < $this->slots_per_day) { echo "\r\n<td width='21' valign='top'> <a href='calendar.php?month=" . $this->month . "&year=" . $this->year . "&day=" . sprintf("%02s", $r['daynumber']) . "' class='part_booked' title='This day is part booked'>" . $r['daynumber'] . "</a></td>"; $tag = 1; } else { echo "\r\n<td width='21' valign='top'> <a href='calendar.php?month=" . $this->month . "&year=" . $this->year . "&day=" . sprintf("%02s", $r['daynumber']) . "' class='fully_booked' title='This day is fully booked'>" . $r['daynumber'] . "</a></td>"; $tag = 1; } // Close else } // Close if if($tag == 0) { echo "\r\n<td width='21' valign='top'> <a href='calendar.php?month=" . $this->month . "&year=" . $this->year . "&day=" . sprintf("%02s", $r['daynumber']) . "' class='green' title='Please click to view bookings'>" . $r['daynumber'] . "</a></td>"; } // The modulus function below ($j % 7 == 0) adds a <tr> tag to every seventh cell + 1; if($j % 7 == 0 && $i >1) { echo "\r\n</tr>\r\n<tr>"; // Use modulus to give us a <tr> after every seven <td> cells } } echo "</tr></table></div><!-- Close outer_calendar DIV -->"; if(isset($_GET['year'])) $this->basket(); echo "</div><!-- Close LHS DIV -->"; // Check booked slots for selected date and only show the booking form if there are available slots $current_day = $this->year . '-' . $this->month . '-' . $this->day; $slots_selected_day = 0; if(isset($this->bookings_per_day[$current_day])) $slots_selected_day = count($this->bookings_per_day[$current_day]); if($this->day != 0 && $slots_selected_day < $this->slots_per_day) { $this->booking_form(); } } // Close function function booking_form() { echo " <div id='outer_booking'><h2>Available Slots</h2> <p> The following slots are available on <span> " . $this->day . "-" . $this->month . "-" . $this->year . "</span> </p> <table width='400' border='0' cellpadding='2' cellspacing='0' id='booking'> <tr> <th width='150' align='left'>Start</th> <th width='150' align='left'>End</th> <th width='150' align='left'>Price</th> <th width='20' align='left'>Book</th> </tr> <tr> <td> </td><td> </td><td> </td><td> </td> </tr>"; // Create $slots array of the booking times for($i = strtotime($this->booking_start_time); $i<= strtotime($this->booking_end_time); $i = $i + $this->booking_frequency * 60) { $slots[] = date("H:i:s", $i); } // Loop through $this->bookings array and remove any previously booked slots if($this->is_slot_booked_today == 1) { // $this->is_slot_booked_today created in function 'make_booking_array' foreach($this->bookings as $i => $b) { if($b['date'] == $this->year . '-' . $this->month . '-' . $this->day) { // Remove any booked slots from the $slots array $slots = array_diff($slots, array($b['start'])); } // Close if } // Close foreach } // Close if // Loop through the $slots array and create the booking table foreach($slots as $i => $start) { // Calculate finish time $finish_time = strtotime($start) + $this->booking_frequency * 60; echo " <tr>\r\n <td>" . $start . "</td>\r\n <td>" . date("H:i:s", $finish_time) . "</td>\r\n <td>" . $this->cost_currency_tag . number_format($this->cost_per_slot, 2) . "</td>\r\n <td width='110'><input data-val='" . $start . " - " . date("H:i:s", $finish_time) . "' class='fields' type='checkbox'></td> </tr>"; } // Close foreach echo "</table></div><!-- Close outer_booking DIV -->"; } // Close function function basket($selected_day = '') { if(!isset($_GET['day'])) $day = '01'; else $day = $_GET['day']; // Validate GET date values if(checkdate($_GET['month'], $day, $_GET['year']) !== false) { $selected_day = $_GET['year'] . '-' . $_GET['month'] . '-' . $day; } else { echo 'Invalid date!'; exit(); } echo "<div id='outer_basket'> <h2>Selected Slots</h2> <div id='selected_slots'></div> <div id='basket_details'> <form method='post' action='book_slots.php'> <label>Name</label> <input name='name' id='name' type='text' class='text_box'> <label>Email</label> <input name='email' id='email' type='text' class='text_box'> <label>Phone</label> <input name='phone' id='phone' type='text' class='text_box'> <div id='outer_price'> <div id='currency'>" . $this->cost_currency_tag . "</div> <div id='total'></div> </div> <input type='hidden' name='slots_booked' id='slots_booked'> <input type='hidden' name='cost_per_slot' id='cost_per_slot' value='" . $this->cost_per_slot . "'> <input type='hidden' name='booking_date' value='" . $_GET['year'] . '-' . $_GET['month'] . '-' . $day . "'> <input type='submit' class='classname' value='Make Booking'> </form> </div><!-- Close basket_details DIV --> </div><!-- Close outer_basket DIV -->"; } // Close function } // Close Class ?> Edited October 29, 2020 by requinix please use the Code <> button when posting code Hi Everyone,
I am really struggling with this.....Cannot find a solution anywhere.
I have a website with SSL installed.
I would like to force SSL on the whole website but not on 2 urls.
If my whole site is https://mysite.com
and the 2 urls to disable from the SSL a
http://mysite.com/hotels
http://mysite.com/weather
How can I do it via htaccess please?
Thank you so much,
Ben
|