Jump to content

dubc07

Members
  • Posts

    79
  • Joined

  • Last visited

    Never

Everything posted by dubc07

  1. <?php $timeanddate = date('m/d/y g:i a', strtotime('-1 hours'));/////current date and time set -1 as needed.// $to = " stmartin@scientist.com "; $name = $_POST ['name']; $from = $_POST ['fromMail']; $message= $_POST ['message']; mail ( $to, $name, $from, $message ); header("Location: ./thanks.html"); ?>
  2. i received a bit of code here yesterday that will not allow booking between start and end time. This thing works great. However if i go to book before start time and into the reservation it allows booking. here's the code <?php $start='630'; $end='900'; $plane = 0; $q = "SELECT COUNT(*) AS count FROM rentme WHERE plane = $plane AND (starttime BETWEEN '$start' AND '$end' OR endtime BETWEEN '$start' AND '$end' OR '$start' BETWEEN starttime AND endtime OR '$end' BETWEEN starttime AND endtime)"; $sql = mysql_query($q); $count = mysql_result($sql, 0, 'count'); if ($count > 0) { echo $count; die('you may not book here'); } echo ' you made it '; ?> what is listed on the database is a booking in plane 0 from starttime 700 to endtime 1100 The example would be someone trying to book from 600 to 1200 would be able to book because the code is not designed to look for outside times or overlapping. However inside those start and end times as listed above the script works great. i need both functions. Any help would be great, I'm still new to php.
  3. GoDaddy may not have the mail function turned on which allows you to submit mail through there system using php or asp But this is rare. Contact them and tell them what your trying to do. and they should help. Also if your using an FTP manager make sure your chmod is set to 666 or 777 on the contact.php file also for the actionscript use this instead getURL("contact.php","_blank", "POST"); leave out the }
  4. anyone else have any idea's ?
  5. Forget the asp and stick with the php Replace code inside flash with the following.... on (rollOver) { this.gotoAndPlay("s1"); } on (releaseOutside, rollOut) { this.gotoAndPlay("s2"); } on (release) { for (i=1; i<_parent.fields_descriptions.length; i++) { if (_parent[_parent.fields_descriptions[i][1]]!=undefined) { this[_parent.fields_descriptions[i][1]]=_parent[_parent.fields_descriptions[i][1]]+"&777&"+_parent.fields_descriptions[i][2]; } } this.recipient=_parent.rec; i=undefined; getURL("contact.php" "_blank", "POST"); } Now than here's the php. copy and paste this in place of the code inside contact php. <?php Error_Reporting(E_ALL & ~E_NOTICE); while ($request = current($_REQUEST)) { if (key($_REQUEST)!='recipient') { $pre_array=split ("&777&", $request); $post_vars[key($_REQUEST)][0]=$pre_array[0]; $post_vars[key($_REQUEST)][1]=$pre_array[1]; } next($_REQUEST); } reset($post_vars); $subject="From ".$post_vars['your_name'][0] ; $headers= "From: ".$post_vars['your_email'][0] ."\n"; $headers.='Content-type: text/html; charset=iso-8859-1'; $message=''; while ($mess = current($post_vars)) { if ((key($post_vars)!="i") && (key($post_vars)!="your_email") && (key($post_vars)!="your_name")) { $message.="<strong>".$mess[1]."</strong> ".$mess[0]."<br>"; } next($post_vars); } $recipient='youremail@yourdomain.com';////put your email address you would like the message to goto here mail($_REQUEST["$recipient"], $subject, " <html> <head> <title>Contact letter</title> </head> <body> <br> ".$message." </body> </html>" , $headers); echo ("Your message was successfully sent!"); ?> <script> resizeTo(300, 300); </script> Hope this helps.
  6. The codes that you have provided are solid However my scripts work off of military time and i can't seem to do a conversion. i was just going to see if theres some math that can be done in order to verify. Thanks.
  7. Try this $i = 1; while (!empty($_FILES['pic'.$i.'File']['name'])) { $imageSource = $_FILES['pic'.$i.'File']['tmp_name']; $imageType = $_FILES['pic'.$i.'File']['type']; $imageName = $_FILES['pic'.$i.'File']['name']; $imageDescription = $_POST['pic'.$i.'Description']; $imageAlbum = $_POST['pic'.$i.'Album']; $imageWeight = $_POST['pic'.$i.'Weight']; $uniqueQuery = "SELECT name FROM images WHERE name = '$imageName' AND album = '$imageAlbum'"; $uniqueResult = mysql_query($uniqueQuery) or die("Error in query: $uniqueQuery. ".mysql_error()."."); if (mysql_num_rows($uniqueResult) != 0) { echo "<p class=\"error\">Cannot create ".stripslashes($imageName)." - image already exists!</p>"; } else { $imagePic = addslashes(file_get_contents($imageSource)); $imageCopy = imagecreatefromjpeg($imageSource); $imageWidth = imagesx($imageCopy); $imageHeight = imagesy($imageCopy); $thumbSource = 'tmp/'.substr($imageName, 0, -4).'Thumb.tmp'; $thumbWidth = 100; $thumbHeight = 100; $imageThumb = imagecreatetruecolor($thumbWidth, $thumbHeight); imagecopyresampled($imageThumb, $imageCopy, 0, 0, 0, 0, $thumbWidth, $thumbHeight, $imageWidth, $imageHeight); imagejpeg($imageThumb, $thumbSource, 100); $imageThumb = addslashes(file_get_contents($thumbSource)); unlink($thumbSource); $insertQuery = "INSERT INTO images VALUES ('', 'image', '$imageName', '$imageAuthor', '$imageDatetime', '$imagePic', '$imageThumb', '$imageDescription', '$imageAlbum', '$imageWeight')"; mysql_query($insertQuery) or die("Error in query: $insertQuery. ".mysql_error()."."); echo "<p>Successfully uploaded ".stripslashes($imageName).".</p>"; } } $i++;
  8. Sometimes just depending on your hosting, The php.ini changes will not be immediate. or the Hosting company has a set of ini rules that doesn't allow memory expansion. Call you hosting provider. to see if they allow ini changes.
  9. I'm trying to put together a code that will allow users to book slots in airplanes. I have everything figured out except for the over booking features. This is how i want to start on the verifications $month = 'September'; $day = '10'; //display all the news $result = mysql_query('SELECT * FROM `rentme` WHERE `month`="'.$month.'" AND `day`="'.$day.'"'); //run the while loop that grabs all the news scripts while($r=mysql_fetch_array($result)) { //grab the title and the ID of the news $time=$r["time"];//starttime $plane=$r["plane"]; $intrv=$r["intrv"]; $endtime=$r["endtime"];///endtime echo "$plane $time $intrv $endtime<br>"; } /////this will output below/// 2 800 120 1000 /// 2 is airplane 800 is start time in military 120 is the interval and 1000 is end time. Is there a way to have php check the start time and end time and not allow post between those times. The example would be there is a plane booked at 8am till 10am and some other person try's and books the airplane for 830am till 930am but php would check database and send error back? Any help is greatly appreciated.
  10. That will do it. BIG UP's To Jonny Thunder. Thanks Man
  11. I'm wanting to learn how to calculate time between a start time and an end time in 30 minute increments . $starttime = 600; /////which is militairy time for 6am /////////////// Wanting to caculate the time between the start and the end $endtime = 1400; ///////which is militairy time for 2pm so the total time from start to end would be 8 hours but i would like the output in minutes, which would be 480. Is there any way of doing this and HOW. Thanks.
  12. I'm trying to call from the database where month = july & day = 29 $result = mysql_query('SELECT * FROM `rentem` WHERE month="'.$month.'" day="'.$day.'"' ); ////does not work/// error message = Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource Just trying to see if it is possible to get data like this. By the way I'm pretty new to php stuff so give me a break.
  13. How can i make this work. <?php $month ="july"; $day ="29"; //display all the news $result = mysql_query('SELECT * FROM `rentem` WHERE month="'.$month.'" day="'.$day.'"' ); ?>
  14. That's it for now THANKS A Bunch
  15. What I'm needing is to put it into a variable so that classes_arr can read the whole content of the array. <?php 1 => array( // Adds a class at 12pm (1200 hours) 1200 => array( "html" => "<b>Hello</b><br>Solo", // Display 'Phsychology: Room 404' "style" => "background-color: #FFCC00", // use style property to change the background color "interval" => 0 // set the interval for 2hrs ), INTO <?php $echovalue = 1 => array( // Adds a class at 12pm (1200 hours) 1200 => array( "html" => "<b>Hello</b><br>Solo", // Display 'Phsychology: Room 404' "style" => "background-color: #FFCC00", // use style property to change the background color "interval" => 0 // set the interval for 2hrs ),?> with the => intact. Because i can get the $echovale to put the content's into an array but when i run the script i get a unexpected T_DOUBLE_ARROW. Here is the link to what I'm Trying to do but im wanting to pull from a mysql data base to add more users the the schedule http://x.crabtreeaircraft.com/nutts.php
  16. Is there anyway of putting the following into a variable? <?php 1 => array( 1200 => array( "html" => "<b>Hello</b><br>Solo", // Display 'Phsychology: Room 404' "style" => "background-color: #FFCC00", // use style property to change the background color "interval" => 0 // set the interval for 2hrs ),?> I have to keep the Arrow => intact so that it can me recognized by classes_arr. <?php $classes_arr = array( 1 => array( // Adds a class at 12pm (1200 hours) 1200 => array( "html" => "<b>Hello</b><br>Solo", // Display 'Phsychology: Room 404' "style" => "background-color: #FFCC00", // use style property to change the background color "interval" => 0 // set the interval for 2hrs ), ) );?> This is what i would like it to look like. <?php $echovalue = 1 => array( // Adds a class at 12pm (1200 hours) 1200 => array( "html" => "<b>Hello</b><br>Solo", // Display 'Phsychology: Room 404' "style" => "background-color: #FFCC00", // use style property to change the background color "interval" => 0 // set the interval for 2hrs ), $classes_arr = array( $echovalue ) );?>
  17. In this program I'm trying to pull user's info that has been submited to mysql to apply it to this script. However i cannot figure out how to apply multiple user's info from mysql to array into the schedule. it will only pull one user from the database and that's all. I believe it has something to do with the array's closing ). below is the link and what it looks like with just one user pulled from database. http://x.crabtreeaircraft.com/nutts.php Here is the code <?php require_once('require_once.php'); mysql_select_db("databads"); //display all the news $result = mysql_query("select * from rentme order by plane"); //run the while loop that grabs all the news scripts while($r=mysql_fetch_array($result)) { //grab the title and the ID of the news $name=$r["name"];//take out the title $time=$r["time"];//take out the id $plane=$r["plane"]; $intrv=$r["intrv"]; $color=$r["color"]; $type=$r["$type"]; $tilt = array( // Adds a class at 12pm (1200 hours) $time =>array( "html" => "<b>$name</b><br>$type", // Display 'Phsychology: Room 404' "style" => "background-color: $color", // use style property to change the background color "interval" => $intrv // set the interval for 2hrs ),); $first = array($plane =>$tilt); $planes = $first; echo $planes; } $classes_arr = $planes; $options = array( "row_interval" => 30, // set the schedule to display a row for every /2hr "start_time" => 700, // schedule start time (10am) "end_time" => 2200, // schedule end time (10pm) "title_style" => "font-family: verdana; font-size: 14pt;", // css style for schedule title "time_style" => "font-family: verdana; font-size: 8pt;", // css style for the time cells "dayheader_style" => "font-family: verdana; font-size: 10pt;", // css style for the day header cells // default css style for the class cells. Eachs tyle can be overridden using the "style" property of each class // see schedule.inc.php for details. "class_globalstyle" => "background-color: #EBEBEB; font-family: verdana; font-size: 8pt; text-align: center;", ); // if no row interval set or is zero, use 30mins if ( intval($options["row_interval"]) == 0 ) $options["row_interval"] = 30; // define start time as 8am if not set if ( ! isset($options["start_time"]) ) { $options["start_time"] = 700; } else { // change to the nearest row interval hour down. $time_hour = ($options["start_time"] - $options["start_time"] % 100) / 100; $time_min = $options["start_time"] % 100; $time_totalmins = $time_hour * 60 + $time_min; if ( $time_totalmins % $options["row_interval"] > 0) $time_totalmins = $time_totalmins - $time_totalmins % $options["row_interval"]; $options["start_time"] = ($time_totalmins - $time_totalmins % 60) / 60 * 100 + $time_totalmins % 60; } // define end time as 10pm if not set if ( ! isset($options["end_time"]) ) { $options["end_time"] = 2200; } else { // change to the nearest row interval hour down. $time_hour = ($options["end_time"] - $options["end_time"] % 100) / 100; $time_min = $options["end_time"] % 100; $time_totalmins = $time_hour * 60 + $time_min; if ( $time_totalmins % $options["row_interval"] > 0) $time_totalmins = $time_totalmins - $time_totalmins % $options["row_interval"]; $options["end_time"] = ($time_totalmins - $time_totalmins % 60) / 60 * 100 + $time_totalmins % 60; } $days_arr = array( "plane1", "plane2", "plane3", "instructor", "instructor", "instructor"); $days_norow = array(0, 0, 0, 0, 0, 0, 0 ); $html = "<table width=\"100%\" bgcolor=\"#FFFFFF\" cellspacing=\"2\" cellpadding=\"0\">\n"; // output title if set in $options. if ( isset($options["title"]) ) { $cell_style = "background-color: #FFCC00; color: #0099CC;"; // default title style $cell_style .= $options["title_style"]; $html .= " <tr>\n <th colspan=\"8\" style=\"$cell_style\">".$options["title"]."</th>\n </tr>\n"; } $cell_style = "background-color: #0099CC; color: #FFFFFF;"; // default day header style $cell_style .= $options["dayheader_style"]; $html .= " <tr style=\"$cell_style\">\n <th> </th>\n"; foreach ($days_arr as $day){ $html .= " <th>$day</th>\n"; } $html .= " </tr>\n"; $cur_time = $options["start_time"]; while ($cur_time < $options["end_time"]) { $format_time = date("g:ia", strtotime(substr($cur_time, 0, strlen($cur_time) - 2).":".substr($cur_time, -2, 2))); $cell_style = "background-color: #FF9900; color: #FFFFFF;"; // default time cell style $cell_style .= $options["time_style"]; $html .= " <tr bgcolor=\"#ffffff\">\n <td align=\"right\" width=\"2%\" style=\"$cell_style\"><b>$format_time</b></td>\n"; for ($cur_day = 0; $cur_day < 6; $cur_day++) { // if flag is set not to print any row for the next // row (since a class spans more than one row), then // continue. if ($days_norow[$cur_day] > 0) { $days_norow[$cur_day]--; continue; } $cell_style2 = "bgcolor=\"#EBEBEB"; // default time cell style //select which database you want to edit // check if there is a class during this day/time if ( isset($classes_arr[$cur_day][$cur_time]) ) { $class_interval = intval($classes_arr[$cur_day][$cur_time]["interval"]); if ( $class_interval == 0 ) $class_interval = 60; // default interval is 60mins // round to nearest interval $class_span = intval($class_interval / $options["row_interval"]); // flag that for the next $class_span rows, we should not print a cell $days_norow[$cur_day] += $class_span - 1; if ( isset($classes_arr[$cur_day][$cur_time]["style"]) ) $cell_style = $options["class_globalstyle"]."; ".$classes_arr[$cur_day][$cur_time]["style"]; else $cell_style = $options["class_globalstyle"]; $html .= " <td width=\"14%\" rowspan=\"$class_span\" style=\"$cell_style\">".$classes_arr[$cur_day][$cur_time]["html"]."</td>\n"; } else { $html .= " <td width=\"14%\ style=\"$cell_style2\"> </td>\n"; } } $html .= " </tr>\n"; $cur_time += $options["row_interval"]; // increment to next row interval if ($cur_time % 100 >= 60) $cur_time = $cur_time - $cur_time % 100 + 100; }; $html .= "</table>\n"; echo $html; ?>
  18. I have been having nothing but trouble with this script. Arrays are very touchy.
  19. I'm trying to make the output of the array look like this. inside of $classes_arr $planes => array( // Adds a class at 12pm (1200 hours) $times => array( "html" => "<b></b><br>Solo", // Display 'Phsychology: Room 404' "style" => "background-color: #FFCC00", // use style property to change the background color "interval" => 0 // set the interval for 2hrs ), Here is the whole code <?php $plane ='1'; $times ='1200'; $timeout ='120'; $name = 'Name Lastname'; $classes_arr = array( // Classes for monday (day 1) $plane => array( // Adds a class at 12pm (1200 hours) $times => array( "html" => "<b>$name</b><br>Solo", // Display 'Phsychology: Room 404' "style" => "background-color: #FFCC00", // use style property to change the background color "interval" => $timeout // set the interval for 2hrs ) ), ); $options = array( "row_interval" => 30, // set the schedule to display a row for every /2hr "start_time" => 700, // schedule start time (10am) "end_time" => 2200, // schedule end time (10pm) "title_style" => "font-family: verdana; font-size: 14pt;", // css style for schedule title "time_style" => "font-family: verdana; font-size: 8pt;", // css style for the time cells "dayheader_style" => "font-family: verdana; font-size: 10pt;", // css style for the day header cells // default css style for the class cells. Eachs tyle can be overridden using the "style" property of each class // see schedule.inc.php for details. "class_globalstyle" => "background-color: #EBEBEB; font-family: verdana; font-size: 8pt; text-align: center;", ); // if no row interval set or is zero, use 30mins if ( intval($options["row_interval"]) == 0 ) $options["row_interval"] = 30; // define start time as 8am if not set if ( ! isset($options["start_time"]) ) { $options["start_time"] = 700; } else { // change to the nearest row interval hour down. $time_hour = ($options["start_time"] - $options["start_time"] % 100) / 100; $time_min = $options["start_time"] % 100; $time_totalmins = $time_hour * 60 + $time_min; if ( $time_totalmins % $options["row_interval"] > 0) $time_totalmins = $time_totalmins - $time_totalmins % $options["row_interval"]; $options["start_time"] = ($time_totalmins - $time_totalmins % 60) / 60 * 100 + $time_totalmins % 60; } // define end time as 10pm if not set if ( ! isset($options["end_time"]) ) { $options["end_time"] = 2200; } else { // change to the nearest row interval hour down. $time_hour = ($options["end_time"] - $options["end_time"] % 100) / 100; $time_min = $options["end_time"] % 100; $time_totalmins = $time_hour * 60 + $time_min; if ( $time_totalmins % $options["row_interval"] > 0) $time_totalmins = $time_totalmins - $time_totalmins % $options["row_interval"]; $options["end_time"] = ($time_totalmins - $time_totalmins % 60) / 60 * 100 + $time_totalmins % 60; } $days_arr = array( "airplane1", "airplane2", "airplane3", "Instructor1", "Instructor2", "Instructor3"); $days_norow = array(0, 0, 0, 0, 0, 0, 0 ); $html = "<table width=\"100%\" bgcolor=\"#FFFFFF\" cellspacing=\"2\" cellpadding=\"0\">\n"; // output title if set in $options. if ( isset($options["title"]) ) { $cell_style = "background-color: #FFCC00; color: #0099CC;"; // default title style $cell_style .= $options["title_style"]; $html .= " <tr>\n <th colspan=\"8\" style=\"$cell_style\">".$options["title"]."</th>\n </tr>\n"; } $cell_style = "background-color: #0099CC; color: #FFFFFF;"; // default day header style $cell_style .= $options["dayheader_style"]; $html .= " <tr style=\"$cell_style\">\n <th> </th>\n"; foreach ($days_arr as $day){ $html .= " <th>$day</th>\n"; } $html .= " </tr>\n"; $cur_time = $options["start_time"]; while ($cur_time < $options["end_time"]) { $format_time = date("g:ia", strtotime(substr($cur_time, 0, strlen($cur_time) - 2).":".substr($cur_time, -2, 2))); $cell_style = "background-color: #FF9900; color: #FFFFFF;"; // default time cell style $cell_style .= $options["time_style"]; $html .= " <tr bgcolor=\"#ffffff\">\n <td align=\"right\" width=\"2%\" style=\"$cell_style\"><b>$format_time</b></td>\n"; for ($cur_day = 0; $cur_day < 6; $cur_day++) { // if flag is set not to print any row for the next // row (since a class spans more than one row), then // continue. if ($days_norow[$cur_day] > 0) { $days_norow[$cur_day]--; continue; } $cell_style2 = "bgcolor=\"#EBEBEB"; // default time cell style // check if there is a class during this day/time if ( isset($classes_arr[$cur_day][$cur_time]) ) { $class_interval = intval($classes_arr[$cur_day][$cur_time]["interval"]); if ( $class_interval == 0 ) $class_interval = 60; // default interval is 60mins // round to nearest interval $class_span = intval($class_interval / $options["row_interval"]); // flag that for the next $class_span rows, we should not print a cell $days_norow[$cur_day] += $class_span - 1; if ( isset($classes_arr[$cur_day][$cur_time]["style"]) ) $cell_style = $options["class_globalstyle"]."; ".$classes_arr[$cur_day][$cur_time]["style"]; else $cell_style = $options["class_globalstyle"]; $html .= " <td width=\"14%\" rowspan=\"$class_span\" style=\"$cell_style\">".$classes_arr[$cur_day][$cur_time]["html"]."</td>\n"; } else { $html .= " <td width=\"14%\ style=\"$cell_style2\"> </td>\n"; } } $html .= " </tr>\n"; $cur_time += $options["row_interval"]; // increment to next row interval if ($cur_time % 100 >= 60) $cur_time = $cur_time - $cur_time % 100 + 100; }; $html .= "</table>\n"; echo $html; ?>
  20. make sure you have mysql setup .
  21. still no function here is the whole code <?php $content = array( "html" => "<b>$name</b><br>Solo", // Display 'Phsychology: Room 404' "style" => "background-color: $color", // use style property to change the background color "interval" => $intrv // set the interval for 2hrs ); $tilt = array($time =>$content); $edz = $plane ->$tilt; } $classes_arr = array($edz); ?>
  22. Try to uninstall and reinstall the aplication. make sure proper file are set to chmod 777 or 666.
  23. Are you trying to spider the database or a web page for key words ?
  24. How can i put this into a functional variable with out getting a unexpected T_DOUBLE_ARROW it cannot contain the array( part because I'm putting it into another variable. <?php $plane = '3'; $edz =$plane =>$tilt); ?>
×
×
  • 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.