Jump to content

jarv

Members
  • Posts

    325
  • Joined

  • Last visited

Posts posted by jarv

  1. I'm still really stuck here:

     

    so far I have:

     

    page1

    $query1 = mysql_query("SELECT * FROM aarbookts_booking_bookings_slots WHERE booking_id = '$booking_id'");
    $row1 = mysql_fetch_array($query1);
    
    <input type="checkbox" name="cbox[]" value="07:00:00" <?php if($row1['start_time']=="07:00:00"){ echo 'checked';} ?>> 07:00 - 10:00<br />
    								<input type="checkbox" name="cbox[]" value="10:00:00" <?php if($row1['start_time']=="10:00:00"){ echo 'checked';} ?>> 10:00 - 13:00<br />
    								<input type="checkbox" name="cbox[]" value="13:00:00" <?php if($row1['start_time']=="13:00:00"){ echo 'checked';} ?>> 13:00 - 16:00<br />
    								<input type="checkbox" name="cbox[]" value="16:00:00" <?php if($row1['start_time']=="16:00:00"){ echo 'checked';} ?>> 16:00 - 19:00<br />
    
    

    This only shows one checkbox checked?!

     

    2nd page

    
    
    $booking_id = $_REQUEST['booking_id'];
    
    
    if(sizeof($_POST['cbox'])) {
    
    //means if at least one check box is selected
    
    foreach($_POST['cbox'] AS $id) {
    
    $sql "UPDATE aarbookts_booking_bookings_slots SET start_time='$start_time' WHERE booking_id=$booking_id");
    } //end foreach
    
    } //end IF
    
    
    echo $sql;
    

     

    this shows a blank page?!

  2. I don't get it, I have

     

    <input type="checkbox" name="cbox[]" value="07:00:00" <?php if($row1['start_time']=="07:00:00"){ echo 'checked';} ?>> 07:00 - 10:00<br />
    								<input type="checkbox" name="cbox[]" value="10:00:00" <?php if($row1['start_time']=="10:00:00"){ echo 'checked';} ?>> 10:00 - 13:00<br />
    								<input type="checkbox" name="cbox[]" value="13:00:00" <?php if($row1['start_time']=="13:00:00"){ echo 'checked';} ?>> 13:00 - 16:00<br />
    								<input type="checkbox" name="cbox[]" value="16:00:00" <?php if($row1['start_time']=="16:00:00"){ echo 'checked';} ?>> 16:00 - 19:00<br />
    
    

     

    but only the 1st one is checked, first 3 out of the 4 should be checked?!

  3. hi, in my database I have  booking_id = 22

    then I have 3 records for booking_id=22

     

    start_time = 07:00:00 - booking_id=22

    start_time = 10:00:00 - booking_id=22

    start_time = 13:00:00 - booking_id=22

     

    I would like to loop through these as checkboxes adding an additional one eg

     

    checkbox1 = start_time = 07:00:00 - checked

    checkbox2 = start_time = 10:00:00 - checked

    checkbox3 = start_time = 13:00:00 - checked

    checkbox4 = start_time = 16:00:00 - unchecked

     

    so far, I have:

     

    $query1 = mysql_query("SELECT * FROM aarbookts_booking_bookings_slots WHERE booking_id = '$booking_id'");
    $row1 = mysql_fetch_array($query1);
    
    
    <input type="checkbox" name="Times" value="07:00:00" <?php if($row1['$start_time']=="07:00:00"){ echo 'checked';} ?>> 07:00 - 10:00<br />
    								<input type="checkbox" name="Times" value="10:00:00" <?php if($row1['$start_time']=="10:00:00"){ echo 'checked';} ?>> 10:00 - 13:00<br />
    								<input type="checkbox" name="Times" value="13:00:00" <?php if($row1['$start_time']=="13:00:00"){ echo 'checked';} ?>> 13:00 - 16:00<br />
    								<input type="checkbox" name="Times" value="16:00:00" <?php if($row1['$start_time']=="16:00:00"){ echo 'checked';} ?>> 16:00 - 19:00<br />
    

     

    then I only want to either INSERT INTO or DELETE depending on which is checked

     

    Please help!

  4. in my code below $_SESSION['id'] = the last ID number in my recordset?!

     

    Please help, I think I need to put my <div id="myOnPageContent"> bit inside my loop?!

     

     

     

    <?php
    							$bookingstotal = 0; 
    							while($row1 = mysql_fetch_array($result))
    								{
    									$bookingstotal += intval($row1['booking_total']);
    									echo '<tr>';
    									echo '<td><a href="view-booking.php?id='.$row1['id'].'" title="View booking details">'.$row1['id'].'</a></td>'; 
    									echo '<td>'.$row1['customer_name'].'</td>'; 
    									echo '<td>'.$row1['customer_phone'].'</td>';
    									echo '<td>'.$row1['customer_notes'].'</td>';
    									if($row1['booking_status'] == 'pending'){
    									echo '<td><div class="backorange">'.$row1['booking_status'].'</div></td>';
    									} else if($row1['booking_status'] == 'confirmed'){
    									echo '<td><div class="backgreen">'.$row1['booking_status'].'</div></td>';
    									} else if($row1['booking_status'] == 'cancelled'){
    									echo '<td><div class="backgrey">'.$row1['booking_status'].'</div></td>';										
    									}
    									echo '<td><input alt="#TB_inline?height=300&width=400&inlineId=myOnPageContent&id='.$row1['id'].'" title="add a caption to title attribute / or leave blank" class="thickbox" type="button" value="Add Note" /></td>';
    									echo '<td>'.date('d F, Y ', strtotime($row1['booking_date'])).'</td>';
    									echo '<td>
    									<!-- Icons -->
    									 <a href="resources/pdf/'.$row1['customer_name'].$row1['id'].'.pdf" target="_blank" title="View Policy Document"><img src="resources/images/pdf_icon.jpg" alt="View Policy Document" /></a>';
    									echo '<a href="edit-booking.php?id='.$row1['id'].'" title="Edit"><img src="resources/images/icons/pencil.png" alt="Edit" /></a>
    									 <a href="javascript:confirmationbooking('.$row1['id'].')" title="Delete"><img src="resources/images/icons/cross.png" alt="Delete" /></a> 									
    									 </td>';
    									echo '</tr>';
    									$_SESSION['id'] = $row1['id'];
    								}
    							?>
    						</tbody>
    						<tr>
    							<td>Bookings: <strong><?php echo $total_pages;?></strong></td>
    							<td></td>
    							<td><strong>Totals:</strong></td>
    							<td colspan="2"> </td>
    							<td><strong>£<?php echo number_format($bookingstotal, 2, '.', ''); ?></strong></td>
    							<td colspan="2"></td>
    						</tr>
    
    					</table>
    					<div id="myOnPageContent">
    						<form action="#" method="post" name="add note">
    							<table>
    								<tr>
    									<td valign="top">Note:</td>
    									<td><textarea name="AdditionalNote" rows="15" cols="40"></textarea></td>
    								</tr>
    								<tr>
    									<td><input type="hidden" name="booking_id" value="<?php echo $_SESSION['id'];?>" /></td>
    									<td><input type="submit" value="Add Note" /></td>
    								</tr>
    							</table>
    						</form>
    					</div>

  5. hi,

     

    on my site: http://helix3d.previewsite.co.uk/marketing.html the images slide onto the next when the numbers are clicked, I would like to have this functionality on the actual image... need a bit of help here?!

     

    
    <!DOCTYPE html>
    <html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Helix</title>
        <link type="text/css" rel="stylesheet" href="css/reset.css">
        <link rel="stylesheet" type="text/css" href="css/style.css" title="default" /><!--[if lte IE 7]>
    <style type="text/css">
    html .jqueryslidemenu{height: 1%;} /*Holly Hack for IE7 and below*/
    </style>
    <![endif]-->
    <script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
    <script type="text/javascript" src="js/jquery.cycle.all.min.js"></script>
    <script type="text/javascript">
    $(function() {
            
        $('#slideshow1').after('<div id="nav1" class="nav">').cycle({
            fx:     'fade',
            speed:  'fast',
            timeout: 0,
            pager:  '#nav1',
            before: onBefore
        });
        $('#slideshow2').after('<div id="nav2" class="nav">').cycle({
            fx:     'fade',
            speed:  'fast',
            timeout: 0,
            pager:  '#nav2',
            before: onBefore
        });
        $('#slideshow3').after('<div id="nav3" class="nav">').cycle({
            fx:     'fade',
            speed:  'fast',
            timeout: 0,
            pager:  '#nav3',
            before: onBefore
        });
        $('#slideshow4').after('<div id="nav4" class="nav">').cycle({
            fx:     'fade',
            speed:  'fast',
            timeout: 0,
            pager:  '#nav4',
            before: onBefore
        });
        $('#slideshow5').after('<div id="nav5" class="nav">').cycle({
            fx:     'fade',
            speed:  'fast',
            timeout: 0,
            pager:  '#nav5',
            before: onBefore
        });
        
            function onBefore() {
            $('#title').html(this.alt);
        }
    });
    
    </script>
    </head>
    <body>
    <div id="top">
    <div id="topwrapper">
    <a href="index.html"><div id="logo">
    	 
    </div></a>
    <ul id="rightnav">
    	<li><a href="index.html" title="Home">Home</a></li>
    	<li><a href="news.html" title="News">News</a></li>
    	<li><a href="services.html" title="Services">Services</a></li>
    	<li><a href="archive.html" title="Archives">Archive</a></li>
    	<li><a href="finishes.html" title="Finishes">Finishes</a></li>
    	<li><a href="showreel.html" title="Showreel">Showreel</a></li>
    	<li><a href="contact.html" title="Contact">Contact</a></li>
    </ul>
    <nav>
    	<ul>
    		<li><a href="events.html" title="HELIX EVENTS">HELIX EVENTS</a></li>
    		<li><a href="marketing.html" title="HELIX EXPERIENTIAL MARKETING" class="menuselected">HELIX EXPERIENTIAL MARKETING</a></li>
    		<li><a href="film.html" title="HELIX FILM &AMP; TV SET CONSTRUCTION">HELIX FILM &AMP; TV SET CONSTRUCTION</a></li>
    		<li><a href="exhibitions.html" title="HELIX EXHIBITIONS">HELIX EXHIBITIONS</a></li>
    		<li><a href="interiors.html" title="HELIX COMMERCIAL INTERIORS">HELIX COMMERCIAL INTERIORS</a></li>
    	</ul>
    </nav>
    <div class="line"> </div>
    </div>
    </div>
    <div id="content">
    <section id="slider">
    	<div id="viewport">
    		<div id="container"> 
    			<div id="section-1" class="section">
    			   <img src="images/hero_experiential.jpg">
    			</div>
    		</div>
    	</div>
    </section>
    <div class="line"> </div>
    <div id="left">
    <h1>HELIX  MARKETING</h1>
      <p>We help brands and agencies create experiences that excite, surprise and delight. Our attention to detail and fast-paced production bring your experiential marketing to life and ensure memorable, positive brand connections.</p>
    </div>
    <div id="right">
    <img src="images/quote-marketing.gif" alt="Marketing quote" />
      <ul>
      <li class="youtube"><a href="#"><img src="images/yt.png" alt="youtube" /></a></li>
      <li class="twitter"><a href="#"><img src="images/twit.png" alt="Twitter" /></a></li>
      <li class="facebook"><a href="#"><img src="images/fb.png" alt="Facebook" /></a></li>
      </ul>
      </div>
      <div class="clear"> </div>
    <div class="dashedlinetop"> </div>
    	<div id="box1">
    		<h1>01</h1>
    		<h2>V Hand</h2>
    		<p>We were contracted by Speed Communications PR to turn ideas from the creative team at The Game Changer into reality. The concept was a giant hand over 30 ft tall making the V for Virgin sign, designed to look as if it had burst up through the ground.</p>
    		<ul>
          <li><strong>Key people:</strong></li>
    			<li>Client: Virgin Business Media.<br>
    			  Agency : Speed Communications.<br>
    			  Creative : The Game Changer<br>
    		    Location : Canary Wharf</li>
    		</ul>
    	  <div id="casestudy1"><a href="case-study-virgin.html">CASE STUDY</a></div>
            <div id="slideshow1" class="pics">
                <img src="images/marketing/virgin1.jpg" alt="1"/>
                <img src="images/marketing/virgin2.jpg" alt="2"/>
               	<img src="images/marketing/virgin3.jpg" alt="3"/>
                <img src="images/marketing/virgin4.jpg" alt="4"/>
                <img src="images/marketing/virgin5.jpg" alt="5"/>	        </div>
      </div>
    <div class="dashedlinebottom"> </div>
    <div class="dashedlinetop"> </div>
    	<div id="box2">
    		<h1>02</h1>
    		<h2>Cat Walk</h2>
    		<p>We were commissioned by Mischief PR to design, manufacture and project manage the installation of the world's first car mounted fashion catwalk. We scoured London for priceless shoot locations normally off limits and organised logistics to enable a super fast, film shoot set up.</p>
    		<ul>
          <li><strong>Key people:</strong></li>
    			<li>Client : Vauxhall.<br>
    			  Agency : Mischief PR.<br>
    			  Creative : Dan Glover.<br>
    		    Location : St Paul's Cathedral</li>
    		</ul>
    
    		<div id="slideshow2" class="pics">
                <img src="images/marketing/carwalk1.jpg" alt="1"/>
                <img src="images/marketing/carwalk2.jpg" alt="2"/>
               	<img src="images/marketing/carwalk3.jpg" alt="3"/>
                <img src="images/marketing/carwalk4.jpg" alt="4"/>
                <img src="images/marketing/carwalk5.jpg" alt="5"/>	        </div>
      </div>
    <div class="dashedlinebottom"> </div>
    <div class="dashedlinetop"> </div>
    	<div id="box3">
    		<h1>03</h1>
    		<h2>Tower of Terror</h2>
    		<p>As the centre piece of the European launch of the Disney's new Tower Of Terror ride in Paris, Cow PR commissioned us to design and build a full seized replica model of a lift car from the ride. The twist was that the lift had to look as if it had crash landed!</p>
    		<ul>
          <li><strong>Key people:</strong></li>
    			<li>Client : Disney<br>
    			  Agency : Cow PR<br>
    			  Creative : Claire Myddleton<br>
    		    Location : Leicester Square</li>
    		</ul>
    
    		<div id="slideshow3" class="pics">
                <img src="images/marketing/tot1.jpg" alt="1"/>
                <img src="images/marketing/tot2.jpg" alt="2"/>
               	<img src="images/marketing/tot3.jpg" alt="3"/>
                <img src="images/marketing/tot4.jpg" alt="4"/>
                <img src="images/marketing/tot5.jpg" alt="5"/>	        </div>
      </div>
    <div class="dashedlinebottom"> </div>
    <div class="dashedlinetop"> </div>
    	<div id="box4">
    		<h1>04</h1>
    		<h2>Ice Age 3</h2>
    		<p>The set for this experiential brief; for 20th Century Century Fox's Ice 3 movie launch, was designed in house by Brian Dowling. The experience included an chilled Ice Cave and a jungle equipped with rock faces, real plants, a bridge, a lake and heated humidified air. </p>
    		<ul>
          <li><strong>Key people:</strong></li>
    			<li>Client.: 20th Century Fox.<br>
    			  Agency : Designwerk<br>
    			  Creative : Scott and Ed<br>
    		    Location : CWOA</li>
    
    		</ul>
    
    		<div id="slideshow4" class="pics">
                <img src="images/marketing/ice1.jpg" alt="1"/>
                <img src="images/marketing/ice2.jpg" alt="2"/>
               	<img src="images/marketing/ice3.jpg" alt="3"/>
                <img src="images/marketing/ice4.jpg" alt="4"/>
                <img src="images/marketing/ice5.jpg" alt="5"/>	        </div>
      </div>
    <div class="dashedlinebottom"> </div>
    <div class="dashedlinetop"> </div>
    	<div id="box5">
    		<h1>05</h1>
    		<h2>Hanging gardens of paddington</h2>
    		<p>When Mischief PR wanted to create "The Hanging Gardens of Paddington" for the launch of boutique Hotel Indigo there was only one company on the call sheet. We devised a plan to cantilever the giant basket 40ft above the street, the story went global, the launch was a huge success.</p>
    		<ul>
          <li><strong>Key people:</strong></li>
    			<li>Client : International Hotel Group<br>
    			  Agency : Mischief PR<br>
    			  Creative : Dan Glover<br>
    		    Location : Paddington</li>
    
    		</ul>
    
    		<div id="slideshow5" class="pics">
                <img src="images/marketing/basket1.jpg" alt="1"/>
                <img src="images/marketing/basket2.jpg" alt="2"/>
               	<img src="images/marketing/basket3.jpg" alt="3"/>
                <img src="images/marketing/basket4.jpg" alt="4"/>
                <img src="images/marketing/basket5.jpg" alt="5"/>	        </div>
      </div>
    <div class="dashedlinebottom"> </div>
    <footer>
    <ul>
    	<li><a href="index.html" title="Home">Home</a></li>
    	<li><a href="events.html" title="Events Design">Events Design</a></li>
    	<li><a href="marketing.html" title="Marketing Design">Marketing Design</a></li>
    	<li><a href="film.html" title="Film & Set Design">Film & Set Design</a></li>
    	<li><a href="exhibitions.html" title="Exhibition Design">Exhibition Design</a></li>
    	<li><a href="interiors.html" title="Commercial Interior Design">Commercial Interior Design</a></li>
    	<li><a href="#" title="Sitemap">Sitemap</a></li>
    	<li><a href="contact.html" title="Contact Helix Ltd">Contact Helix Ltd</a></li>
    	<li><a href="news.html" title="Latest Helix News">Latest Helix News</a></li>
    	<li><a href="careers.html" title="Careers">Careers</a></li>
    </ul>
    <!--<div class="copyright">©2011 Helix </div> -->
    </footer>
    </div> <!-- end content -->
    </body>
    </html>

  6. Hi,

     

    at the moment, I am pulling events from my Google Calendar and showing them by calling the outputCalendarByDateRange() function below. Now would like to be able to update/Delete them

     

    <html>
    <head>
    <title>Gdata</title>
    </head>
    <body>
    <?php
    //session_start();
    //ini_set('display_errors',1);
    //ini_set('display_startup_errors',1);
    //error_reporting (E_ALL);
    //DATES
    if(!isset($_REQUEST['from'])){
    $newdateTimeStart = "01/01/2009";
    } else {
    $newdateTimeStart = $_REQUEST['from'];
    }
    if(!isset($_REQUEST['to'])){
    $newdateTimeEnd = "11/05/2011";
    } else {
    $newdateTimeEnd = $_REQUEST['to'];
    }
    $startyear = substr($newdateTimeStart, 6, 4);
    $startmonth = substr($newdateTimeStart, 3, 2);
    $startday = substr($newdateTimeStart, 0, 2);
    $newdateTimeStart = $startyear.'-'.$startmonth.'-'.$startday;
    
    $endyear = substr($newdateTimeEnd, 6, 4);
    $endmonth = substr($newdateTimeEnd, 3, 2);
    $endday = substr($newdateTimeEnd, 0, 2);
    $newdateTimeEnd = $endyear.'-'.$endmonth.'-'.$endday;
    
    $dateStart = $newdateTimeStart;
    $dateEnd = $newdateTimeEnd;
    
    
    //between dates
    function outputCalendarByDateRange($client, $startDate='2007-05-01', 
                                       $endDate='2007-08-01') 
    {
      $gdataCal = new Zend_Gdata_Calendar($client);
      $query = $gdataCal->newEventQuery();
      $query->setUser('default');
      $query->setVisibility('private');
      $query->setProjection('full');
      $query->setOrderby('starttime');
      $query->setStartMin($startDate);
      $query->setStartMax($endDate);
      $eventFeed = $gdataCal->getCalendarEventFeed($query);
      echo "<ul>\n";
      foreach ($eventFeed as $event) {
        echo "\t<li>" . $event->title->text .  " (" . $event->id->text . ")\n";
        echo "\t\t<ul>\n";
        foreach ($event->when as $when) {
          echo "\t\t\t<li>Starts: " . $when->startTime . "</li>\n";
        }
        echo "\t\t</ul>\n";
        echo "\t</li>\n";
      }
      echo "</ul>\n";
    }
    
    //Connect to google calendar
        //If you do not have access to the PHP.INI file on the remote server, you should use the following statement to set the path information for Zend framework
        $clientLibraryPath = 'libraries';
        $oldPath = set_include_path(get_include_path() . PATH_SEPARATOR . $clientLibraryPath);
        // load ZEND classes
        require_once 'Zend/Loader.php';
        Zend_Loader::loadClass('Zend_Gdata');
        Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
        Zend_Loader::loadClass('Zend_Gdata_Calendar');
        Zend_Loader::loadClass('Zend_Http_Client');
        // connect to calendar service
        $gcal = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
        $user = "***"gmail.com"; //Insert your google username
        $pass = "***"; //Insert your Google password
        //$user = stripslashes($_POST['user']); //Insert your google username
        //$pass = stripslashes($_POST['pass']); //Insert your Google password
        $_SESSION['user'] = $user;
        $_SESSION['pass'] = $pass; 
        $client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $gcal);
        $gcal = new Zend_Gdata_Calendar($client);
    
    
    
    function createEvent ($client, Zend_GData_Calendar $gcal, $title = 'testing google calendar',
        $desc='this is great', $where = 'at work',
        $startDate = '2011-04-20', $startTime = '10:00',
        $endDate = '2011-04-20', $endTime = '11:00', $tzOffset = '+01')  
        {
          $newEvent = $gcal->newEventEntry();
          
          $newEvent->title = $gcal->newTitle($title);
          $newEvent->where = array($gcal->newWhere($where));
          $newEvent->content = $gcal->newContent("$desc");
          
          $when = $gcal->newWhen();
          $when->startTime = "{$startDate}T{$startTime}:00.000{$tzOffset}:00";
          $when->endTime = "{$endDate}T{$endTime}:00.000{$tzOffset}:00";
          $newEvent->when = array($when);
        
          // Upload the event to the calendar server
          // A copy of the event as it is recorded on the server is returned
          $createdEvent = $gcal->insertEvent($newEvent);
          return $createdEvent->id->text;
        }
    
    echo outputCalendarByDateRange($client, "$dateStart", "$dateEnd");
    
    ?>
    </body>
    </html>
    

  7. hi,

     

    I have set my include_path in my php.ini and it shows that the path is added in my php info page.... I test if Zend is installed and I get the following error:

     

    Exception thrown trying to access Zend/Loader.php using 'use_include_path' = true. Make sure you include Zend Framework in your include_path which currently contains: .:/Applications/MAMP/bin/php5.3/lib/php:/Applications/MAMP/htdocs/gcal/library/zend

     

     

    Please help! I have been on this for the last 6 hours?!

  8. here is what I have so far and it still doesn't work:

     

    <?
    $surgeryinvoicescount=0;
    
    
    $qry="SELECT month_end_date,xls_name,surgery_or_branch,surgery_or_branch_id,Doctor FROM invoices_to_surgerys_files WHERE month_end_date BETWEEN '$from' AND '$to' ORDER BY Doctor ASC";
    $cur=mysql_query($qry);
    while($i=mysql_fetch_row($cur))
    {
    $month_end_date[$surgeryinvoicescount]=$i[0];
    $month_end_date[$surgeryinvoicescount] = date('d/m/Y',strtotime($month_end_date[$surgeryinvoicescount]." 00:00:00"));
    $xls_name[$surgeryinvoicescount]=$i[1];
    $surgery_or_branch[$surgeryinvoicescount]=$i[2];
    $surgery_or_branch_id[$surgeryinvoicescount]=$i[3];
    $Doctor[$surgeryinvoicescount]=$i[4];
    $surgeryinvoicescount++;
    }
    ?>

  9. At the moment I have:

    $month_end_date[$surgeryinvoicescount]=$i[0]; = 2011-04-13

     

    I would like

     

    $month_end_date[$surgeryinvoicescount]=$i[0]; = 13/04/2011

    :shrug:

     

    I have tried the following but didn't work?!:

     

    $month_end_date = date('d/m/Y',strtotime($month_end_date));
    $month_end_date[$surgeryinvoicescount]=$i[0];

  10. hi,

     

    I would like to add a leading 0 to my FOR loop

     

    for ($i=0; $i<23; $i++)
    if($i<10){
    $i = 0$i;
    }
      {
      echo "<option value=".$i.">" . $i . "</option>";
      }
    

    this gives and error: unexpected T_VARIABLE

     

    at the moment I have:

     

    0

    1

    2

    3

    4

    5

    6

    7

    8

    9

     

    I would like:

     

    00

    01

    02

    03

    04

    05

    06

    07

    08

    09

  11. Hi,

     

    I am doing an EDIT user page and would like to check records with a dropdown and then set as selected, please help!

     

    <select name="BrokerID" class="small-input">
    								<option value="Please select an option">Please select a Broker</option> 
    							<?php 
    								while($row2 = mysql_fetch_array($broker))
    									{
    										echo '<option name="BrokerID" value="'.$row2['BrokerID'].'">'.$row2['BrokerName'].'</option>';	
    									}
    							?>
    							</select>
    

     

     

  12. there are a couple of exit; in my incdex.php

     

    <?php
    session_start();
    include_once("config.php");
    checkLoggedIn("no");
    if(isset($_POST["submit"])) {
    field_validator("rsUser", $_POST["rsUser"], "alphanumeric", 3, 15);
    // password must be between 4 and 15 chars - any characters can be used:
    field_validator("rsPass", $_POST["rsPass"], "string", 3, 15);
    
    if($messages){
    	doIndex();
    	exit;
    }
    if( !($row = checkPass($_POST["rsUser"], $_POST["rsPass"])) ) {
            $messages[]="Incorrect login/password, try again";
        }
    
    if($messages){
    	doIndex();
    	exit;
    }
    
    cleanMemberSession($row["rsUser"], $row["rsPass"], $row["UserID"]);
    
    if ($user = checkPass($_REQUEST['rsUser'], $_REQUEST['rsPass'])) {
      cleanMemberSession($user['rsUser'], $user['rsPass'], $user['UserID']);
    } else {
      echo('Login failed');
    }  
    header("Location: main.php");
    } else {
    doIndex();
    }
    function doIndex() {
    global $messages;
    global $title;
    }
    ?>

  13. function field_validator($field_descr, $field_data,
      $field_type, $min_length="", $max_length="",
      $field_required=1) {
    /*
    Field validator:
    This is a handy function for validating the data passed to
    us from a user's <form> fields.
    
    Using this function we can check a certain type of data was
    passed to us (email, digit, number, etc) and that the data
    was of a certain length.
    */
    
    # array for storing error messages
    global $messages;
    
    # first, if no data and field is not required, just return now:
    if(!$field_data && !$field_required){ return; }
    
    # initialize a flag variable - used to flag whether data is valid or not
    $field_ok=false;
    
    # this is the regexp for email validation:
    $email_regexp="^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|";
    $email_regexp.="(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$";
    
    # a hash array of "types of data" pointing to "regexps" used to validate the data:
    $data_types=array(
    	"email"=>$email_regexp,
    	"digit"=>"^[0-9]$",
    	"number"=>"^[0-9]+$",
    	"alpha"=>"^[a-zA-Z]+$",
    	"alpha_space"=>"^[a-zA-Z ]+$",
    	"alphanumeric"=>"^[a-zA-Z0-9]+$",
    	"alphanumeric_space"=>"^[a-zA-Z0-9 ]+$",
    	"string"=>""
    );
    
    # check for required fields
    if ($field_required && empty($field_data)) {
    	$messages[] = "$field_descr is a required field.";
    	return;
    }
    
    # if field type is a string, no need to check regexp:
    if ($field_type == "string") {
    	$field_ok = true;
    } else {
    	# Check the field data against the regexp pattern:
    	$field_ok = ereg($data_types[$field_type], $field_data);
    }
    
    # if field data is bad, add message:
    if (!$field_ok) {
    	$messages[] = "Please enter a valid $field_descr.";
    	return;
    }
    
    # field data min length checking:
    if ($field_ok && ($min_length > 0)) {
    	if (strlen($field_data) < $min_length) {
    		$messages[] = "$field_descr is invalid, it should be at least $min_length character(s).";
    		return;
    	}
    }
    
    # field data max length checking:
    if ($field_ok && ($max_length > 0)) {
    	if (strlen($field_data) > $max_length) {
    		$messages[] = "$field_descr is invalid, it should be less than $max_length characters.";
    		return;
    	}
    }
    }
    function cleanMemberSession($login, $password, $id) {
    /*
    Member session initialization function:
    This function initializes 3 session variables:
      $login, $password and $loggedIn.
    
    $login and $password are used on member pages (where you
    could allow the user to change their password for example).
    
    $loggedIn is a simple boolean variable which indicates
    whether or not the user is currently logged in.
    */
    $_SESSION["USERID"]=$id;
    $_SESSION["RSUSER"]=$login;
    $_SESSION["RSPASS"]=$password;
    $_SESSION["loggedIn"]=true;
    }
    function checkPass($login, $password) {
    /*
    Password checking function:
    This is a simple function that takes the $login name and
    $password that a user submits in a form and checks that a
    row exists in the database where:
    
    the value of the 'login' column is the same as the value in $login
    and
    the value of the 'password' column is the same as the value in $password
    
    If exactly one row is returned, then that row of data is returned.
    If no row is found, the function returns 'false'.
    */
    global $link;
    
    $query="SELECT * FROM Users WHERE RSUSER='$login' and RSPASS='$password'";
    $result=mysql_query($query, $link)
    	or die("checkPass fatal error: ".mysql_error());
    
    // Check exactly one row is found:
    if(mysql_num_rows($result)==1) {
    	$row=mysql_fetch_array($result);
    	return $row;
    }
    //Bad Login:
    return false;
    }
    
    

  14. Hi my code below checks for Username and password from a form and if they match those in database, it redirects to main.php However, I would like some help setting up error page?!

    at the moment if the username or password are incorrect and teh form is submitted, the pages just goes white and blank?!

     

    <?php
    session_start();
    include_once("config.php");
    checkLoggedIn("no");
    if(isset($_POST["submit"])) {
    field_validator("rsUser", $_POST["rsUser"], "alphanumeric", 3, 15);
    // password must be between 4 and 15 chars - any characters can be used:
    field_validator("rsPass", $_POST["rsPass"], "string", 3, 15);
    
    if($messages){
    	doIndex();
    	exit;
    }
    if( !($row = checkPass($_POST["rsUser"], $_POST["rsPass"])) ) {
            $messages[]="Incorrect login/password, try again";
        }
    
    if($messages){
    	doIndex();
    	exit;
    }
    
    cleanMemberSession($row["rsUser"], $row["rsPass"], $row["UserID"]);
    
    if ($user = checkPass($_REQUEST['rsUser'], $_REQUEST['rsPass'])) {
      cleanMemberSession($user['rsUser'], $user['rsPass'], $user['UserID']);
    } else {
      echo('Login failed');
    }  
    header("Location: main.php");
    } else {
    doIndex();
    }
    function doIndex() {
    global $messages;
    global $title;
    }
    ?>
    

     

    Login failed does not get shown if a username is entered wrong?!

  15. Hi,

     

    I currently have a google map which shows a marker where the postcode is for a certain pub (converts postcodes to coords lat/long)

    I would like to loop through all my pubs in my database as place a marker for each on one map, I am uncertain of how to loop through and show each marker for each postcode either PHP or JavaScript.

     

    here is my code for a single pub / postcode:

     

    <!doctype html>
    <?php 
    include "../config.php";
    $loggedIn = (isset($_COOKIE['loggedin']) && $_COOKIE['loggedin'] == 'true')?true:false;
    
    $PUBID = intval($_REQUEST['PUBID']);
    $PUB = mysql_query("SELECT * FROM pubs WHERE PUBID = '".$PUBID."'");
    $pubdetails = mysql_fetch_array($PUB);
    ?>
    <html>
        <head>
            <meta charset="UTF-8" />
            <title><?php echo $pubdetails['rsPubName']; ?>, <?php echo $pubdetails['rsTown']; ?>, <?php echo $pubdetails['rsCounty']; ?></title>
            <style type="text/css" media="screen">@import "jqtouch/jqtouch.min.css";</style>
            <style type="text/css" media="screen">@import "themes/jqt/theme.min.css";</style>
            <script src="jqtouch/jquery.1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
            <script src="jqtouch/jqtouch.min.js" type="application/x-javascript" charset="utf-8"></script>
            <script src="http://maps.google.com/maps?file=api&v=2&sensor=true&key=ABQIAAAAM17e4xGXwO4sBd_QYtRiSRQXB4T7UHWaz4zUQgLx9muJZW0c3hS8jRMJg733CHqOihn7BVfhZTkLiA" type="text/javascript"></script>
    		<script type="text/javascript">
    
        function initialize() {
        var latlng = new google.maps.LatLng(-34.397, 150.644);
        var myOptions = {
          zoom: 8,
          center: latlng,
          mapTypeId: google.maps.MapTypeId.G_NORMAL_MAP 
        };
        var map = new google.maps.Map(document.getElementById("map_canvas"),
            myOptions);
      }
    
    
        </script>
    
            <script type="text/javascript" charset="utf-8">
                var jQT = new $.jQTouch({
                    icon: 'jqtouch.png',
                    addGlossToIcon: false,
                    startupScreen: 'jqt_startup.png',
                    statusBar: 'black',
                    preloadImages: [
                        'themes/jqt/img/back_button.png',
                        'themes/jqt/img/back_button_clicked.png',
                        'themes/jqt/img/button_clicked.png',
                        'themes/jqt/img/grayButton.png',
                        'themes/jqt/img/whiteButton.png',
                        'themes/jqt/img/loading.gif'
                        ]
                });
            </script>
        </head>
        <body onLoad="ukPostcodeTest(); return false">
     	<!-- TOWNS -->
    	<div id="pub" class="current">
                <div class="toolbar">
                    <h1>View Pub</h1>
                    <a class="back" href="index.php" rel="external">Home</a>
                </div>
    			<h2><?php echo $pubdetails['rsPubName']; ?></h2>
                	<?php echo $pubdetails['rsAddress']; ?><br /> 
    				<?php echo $pubdetails['rsTown']; ?><br />
    				<?php echo $pubdetails['rsCounty']; ?><br />
    				<?php echo $pubdetails['rsPostCode']; ?><br />
    				<?php echo $pubdetails['Region']; ?><br />
    				<?php echo $pubdetails['rsTel']; ?><br />
    				<?php echo '<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.mypubspace.com/pub_info.php?PUBID='.$pubdetails['PUBID'].'&layout=box_count&show_faces=true&width=450&action=like&colorscheme=light&height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:60px; height:65px; float:right;" allowTransparency="true"></iframe>';?>
    
    
        <div id="map" style="width: 250px; height: 250px"></div>
      
        <form name="mapform" onsubmit="ukPostcodeTest(); return false" action="#">
    	<input id="search" type="hidden" value="<?php echo $pubdetails["rsPostCode"]; ?>" />
        </form>
        
        <div id="message"></div>
    
        <noscript><b>JavaScript must be enabled in order for you to use Google Maps.</b> 
          However, it seems JavaScript is either disabled or not supported by your browser. 
          To view Google Maps, enable JavaScript by changing your browser options, and then 
          try again.
        </noscript>
    
        <script type="text/javascript">
        //<![CDATA[
        
        if (GBrowserIsCompatible()) { 
    
          var map = new GMap(document.getElementById("map"));
          
    	map.addControl(new GLargeMapControl());
          map.addControl(new GMapTypeControl());
          map.setCenter(new GLatLng(51.520593197675446,-0.19775390625),16);
          
          // ====== Is the search string a UK Postcode ======
          function ukPostcodeTest() {
            var search = document.getElementById("search").value;
            // take a copy and convert to upper case
            var s = search.toUpperCase();
            // Replace punctuation and whitepsace by a single space
            s = s.replace(/\W+/g, " ");
            // Remove and trailing leading spaces
            s = s.replace(/^ /, "");
            s = s.replace(/ $/, "");
            // Perform the check
            var match = s.match(/^[A-Z]{1,2}[0-9R][0-9A-Z]? [0-9][ABD-HJLNP-UW-Z]{2}$/);
            if (!match) {
              // Its not a UK Postcode, so perform a standard GClientGeocoder call on the original search string
              showAddress(search);
            } else {
              // It is a UK Postcode, so call GDirections on the reformatted search string 
              showPostcode(s);
            }
          }
    
    
          
          
          // ====== Code for handling search strings that are not UK Postcodes =======
          // ====== Use the GClientGeocoder in the normal way ======
          
          // ====== Create a Client Geocoder ======
          var geo = new GClientGeocoder(); 
    
          // ====== Array for decoding the failure codes ======
          var reasons=[];
          reasons[G_GEO_SUCCESS]            = "Success";
          reasons[G_GEO_MISSING_ADDRESS]    = "Missing Address: The address was either missing or had no value.";
          reasons[G_GEO_UNKNOWN_ADDRESS]    = "Unknown Address:  No corresponding geographic location could be found for the specified address.";
          reasons[G_GEO_UNAVAILABLE_ADDRESS]= "Unavailable Address:  The geocode for the given address cannot be returned due to legal or contractual reasons.";
          reasons[G_GEO_BAD_KEY]            = "Bad Key: The API key is either invalid or does not match the domain for which it was given";
          reasons[G_GEO_TOO_MANY_QUERIES]   = "Too Many Queries: The daily geocoding quota for this site has been exceeded.";
          reasons[G_GEO_SERVER_ERROR]       = "Server error: The geocoding request could not be successfully processed.";
          
          // ====== Geocoding ======
          function showAddress(search) {
            // ====== Perform the Geocoding ======        
            geo.getLocations(search, function (result)
              { 
                // If that was successful
                if (result.Status.code == G_GEO_SUCCESS) {
                  // How many resuts were found
                  document.getElementById("message").innerHTML = "Found " +result.Placemark.length +" results";
                  // Loop through the results, placing markers
                  for (var i=0; i<result.Placemark.length; i++) {
                    var p = result.Placemark[i].Point.coordinates;
                    var marker = new GMarker(new GLatLng(p[1],p[0]));
                    document.getElementById("message").innerHTML += "<br>"+(i+1)+": "+ result.Placemark[i].address + marker.getPoint();
                    map.addOverlay(marker);
                  }
                  // centre the map on the first result
                  var p = result.Placemark[0].Point.coordinates;
                  map.setCenter(new GLatLng(p[1],p[0]),14);
                }
                // ====== Decode the error status ======
                else {
                  var reason="Code "+result.Status.code;
                  if (reasons[result.Status.code]) {
                    reason = reasons[result.Status.code]
                  } 
                  alert('Could not find "'+search+ '" ' + reason);
                }
              }
            );
          }
    
    
    
    
          // ====== Create a Client Geocoder ======
          var gdir = new GDirections(null); 
          
          // ====== Using GDirections to process a UK postcode ======
          function showPostcode(search) {
            // Call GDirections
            gdir.loadFromWaypoints([search,search],{getPolyline:true});
            // Wait for the reply to come back
            GEvent.addListener(gdir,"load", function() {
              var poly = gdir.getPolyline();
              var point = poly.getVertex(0);
              //document.getElementById("message").innerHTML = "Found a UK Postcode";
              // Process the result
              var marker = new GMarker(point);
              //document.getElementById("message").innerHTML += "<br>" + search + " = " + point.toUrlValue(5);
              map.addOverlay(marker);          
              // centre the map on the result
              map.setCenter(point,16);
            });
          }
        }
    
    
        
        // display a warning if the browser was not compatible
        else {
          alert("Sorry, the Google Maps API is not compatible with this browser");
        }
    
        // This Javascript is based on code provided by the
        // Community Church Javascript Team
        // http://www.bisphamchurch.org.uk/   
        // http://econym.org.uk/gmap/
    
        //]]>
        </script>
    
    
            </div>
        </body>
    </html>
    

×
×
  • 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.