$dbh = new PDO($db, $user, $pass); } catch (PDOException $e) { print "Error!: " . $e->getMessage() . "<br/>"; die; } header('Content-Type: text/event-stream'); header('Cache-Control: no-cache'); //to prevent caching of event data $uid = $_REQUEST["uid"]; setlocale(LC_ALL, 'en_GB'); date_default_timezone_set('Europe/London'); $lastUpdate = time(); $startedAt = time(); //Note: IRL, should lock this down by IP address too session_write_close(); while (is_logged_on($dbh, $uid)) { //IRL you'd use the same functions as being used to build the initial page here $getChat = $dbh->prepare('SELECT `timestamp`,`handle`, `message` FROM `log` WHERE `timestamp` >= :lastupdate ORDER BY `timestamp`'); $getChat->execute(array(':lastupdate' => strftime("%Y-%m-%d %H:%M:%S", $lastUpdate))); $rows = $getChat->fetchAll(); foreach ($rows as $row) { echo "event: message\n"; echo "data: <time datetime=\"" . $row['timestamp'] . "\">" . strftime("%H:%M", strtotime($row['timestamp'])) . "</time> <b>" . $row['handle'] . "</b> <span>" . $row['message'] . "</span>\n\n"; ob_flush(); flush(); } //The client should reconnect when terminated, most servers are configured to limit script execution time to between 30-90 seconds if (time() - $startedAt > 60) { session_start(); die; }
<?php } } else { echo '<p>' . lang('no_review') . '</p>'; } ?> <hr class="divider" /> <h3><?php echo lang('heading_write_review'); ?> </h3> <?php if (is_logged_on() === FALSE) { ?> <p><?php echo sprintf(lang('login_to_write_review'), site_url('account/login')); ?> </p> <?php } else { ?> <p><?php echo lang('introduction_rating'); ?> </p> <form method="post" action="<?php
<li><a href="<?php echo base_url('wishlist'); ?> "><?php echo lang('my_wishlist'); ?> </a></li> <li><a href="<?php echo site_url('account'); ?> "><?php echo lang('my_account'); ?> </a></li> <?php if (is_logged_on()) { ?> <li><a href="<?php echo site_url('account/logoff'); ?> "><?php echo lang('logoff'); ?> </a></li> <?php } else { ?> <li><a href="<?php echo site_url('account/login'); ?> "><?php
</div> <div class="accordion-group" id="orderConfirmationForm"> <div class="accordion-heading"> <a class="accordion-toggle" href="#orderConfirmationFormBody"> <?php echo $step++ . '. ' . lang('checkout_order_review'); ?> </a> <a class="modify" href="javascript:void(0);">Modify</a> </div> <div id="orderConfirmationFormBody" class="accordion-body collapse"> <div class="accordion-inner"></div> </div> </div> </div> <script type="text/javascript" src="<?php echo base_url(); ?> templates/base/web/javascript/checkout.js"></script> <script> <!-- var checkout = new jQuery.Toc.Checkout({ logged_on: <?php echo is_logged_on() ? 'true' : 'false'; ?> }); //--> </script>