PHP - Moved: Just A Little Php Help Required. Php Album
This topic has been moved to Third Party PHP Scripts.
http://www.phpfreaks.com/forums/index.php?topic=326412.0 Similar Tutorialsi do think is a small mistake i making can u please have a look if u can ok here's the problem i am trying to delete an album within the album should also delete the photos related to that album this what i tried gives this error Delete image failed. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3 my tables are table albums fields album_id, album_name, album_owner, sub_album table photos fields, photo_id, photo_name, photo_extension, photo_proper photo_owner, photo_date, photo_comments, photo_size, album_id photo_proper is the name image stored in folder <?php define('ROOT_DIR', './'); define('PROPER', TRUE); /** * include common files */ include_once(ROOT_DIR. 'includes/common.inc.php'); // No album id has been selected if (isset($_GET['albums'])) // get the album name since we need to display // a message that album 'foo' is deleted $result = mysql_query("SELECT album_id, album_name, album_owner, sub_album FROM albums WHERE album_id = $album_id") or die('Delete image failed. ' . mysql_error()); if (mysql_num_rows($result) == 1) { $row = mysql_fetch_assoc($result); $album_id = $row['album_id']; $album_name = $row['album_name']; // get the image filenames first so we can delete them // from the server $result = mysql_query("SELECT photo_id, photo_id FROM photos WHERE album_id = $album_id") or die(mysql_error()); while ($row = mysql_fetch_assoc($result)) { define("GALLERY_IMG_DIR", "./photos/"); unlink(GALLERY_IMG_DIR . $row['photo_proper']); unlink(GALLERY_IMG_DIR . 'thumbs/' . $row['photo_proper']); } $result = mysql_query("DELETE FROM photos WHERE album_id = $album_id") or die('Delete image failed. ' . mysql_error()); $result = mysql_query("DELETE FROM album WHERE album_id = $album_id") or die('Delete album failed. ' . mysql_error()); // album deleted successfully, let the user know about it echo "<p align=center>Album '$album_name' deleted.</p>"; } else { echo "<p align=center>Cannot delete a non-existent album.</p>"; } ?> try 2 error line 5 <?php define('ROOT_DIR', './'); define('PROPER', TRUE); /** * include common files */ include_once(ROOT_DIR. 'includes/common.inc.php'); // No album id has been selected if (isset($_GET['albums'])) { // get the image file name so we // can delete it from the server $sql = "SELECT album_id, album_name, album_owner, sub_album FROM albums WHERE album_id = {$_GET['albums']}"; $result = mysql_query($sql) or die('Delete photo failed. ' . mysql_error()); if (mysql_num_rows($result) == 1) { $row = mysql_fetch_assoc($result); // get the image filenames first so we can delete them // from the server $sql = "SELECT photo_id, photo_proper FROM photos WHERE photo_id = {$_GET['photos']}"; $result = mysql_query($sql) or die('Delete photo failed. ' . mysql_error()); if (mysql_num_rows($result) == 1) { $row = mysql_fetch_assoc($result); define("GALLERY_IMG_DIR", "./photos/"); // remove the image and the thumbnail from the server unlink(GALLERY_IMG_DIR . $row['photo_proper']); unlink(GALLERY_IMG_DIR . 'thumbs/' . $row['photo_proper']); // and then remove the database entry $sql = "DELETE FROM photos WHERE photo_id = {$_GET['photos']}"; $result = mysql_query("DELETE FROM album WHERE album_id = $album_id") or die('Delete album failed. ' . mysql_error()); // album deleted successfully, let the user know about it echo "<p align=center>Album '$album_name' deleted.</p>"; } else { echo "<p align=center>Cannot delete a non-existent album.</p>"; } } } ?> This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=313541.0 Hello, I was not sure on which board to put this thread, so please move it if there is a more appropriate board. I am wanting to create a website that displays images which I have put into a database. I would like the number of images on one page not to exceed 10, for example, and when the number of images in the database exceeds this number, a new page will be created. I would like it to function similar to Google Images where the number of pages is dictated by the number of images in the database. I cant figure out how to achieve this, so any pointers or thoughts would be great Thanks, Matlab There is something wrong with my statement it is not returning sql queries results based on matching the url based based userid to match with the table user_id and get the Ablum id and Album name: Please hlep: Code: [Select] if(isset($_GET['userid'])) { $db =& JFactory::getDBO(); $user =& JFactory::getUser(); $id = $user->id; $album_id = $_GET['userid']; $query = 'SELECT user_id, id, format_id, year, name FROM #__muscol_albums WHERE user_id = ' . $album_id; //$query = 'SELECT user_id FROM #__muscol_albums WHERE id = ' . $album_id ; $result = mysql_query($query) or die('Error, No Album Search failed'); list($name, $user_id, $id, $year) = mysql_fetch_array($result); echo $id; //exit; } Hi Friends, I am trying to do an API with oracle database. The JSON request from 3rd party will look like below. { "contact_id": "1", "serial_no": "100", "name": "baby", "inv_date": "2018-06-27", "due_date": "2018-06-27", "currency": "KD", "subtotal": "143", "tax_total": "13", "shipment_data": [ { "serial_no": "33", "master_no": "55", "house_no": "77", "cost_revenue_items": [ { "charge_ref": "rr", "currency": "INR", "quantity": "2", "selling_rate": "45", "exchange_rate": "7", "taxes": [ { "serial_no": "1", "ref": "INR", "voiding_remarks": "oo" },{ "serial_no": "2", "ref": "KWD", "voiding_remarks": "asd" } ] } ] } ] }
how to handle request for JSON in which master is updated (PUT) and child record is (Either INSERTED, UPDATED or DELETED) ? I have a html/php i am creating but getting the following error:
[10-May-2019 09:42:13 UTC] PHP Fatal error: Uncaught Error: Call to a member function prepare() on null in C:\inetpub\wwwroot\SupportDesk\php\Add_New_Engineer.php:88
<?php $server = htmlentities($_SERVER['PHP_SELF']); if (isset($_POST['submit'])) { $result = create_eng(); } ?> <!DOCTYPE html> <html lang="en"> <head> <title>Add A New Engineer | DDS Dashboard</title> <meta charset="utf-8" /> <link rel="icon" type="image/png" href="../images/favicon-16x16.png"/> </head> <body> <?php include('nav.php'); include('ConnectionDB.php'); ?> <div class="jumbotron"> <div class="container"> <h1><br><img src="../images/clipboard-customer.png"/> Add New Engineer:</br></h1> </div> </div> <form class="form-horizontal" role="form" id="add_eng" action="<?php $server ?>" method = "post"> <div class="form-group"> <!--<?php //display_msg($msg);?>--> <label for="EngineerName" class="col-sm-2 control-label">Engineer Name:</label> <div class="col-sm-6"> <input type="text" class="form-control" id="EngName" name="EngineersName" placeholder="Enter Engineer's Name"></input> <small class="form-text text-muted"> Enter the new engineer's name above to enter them into the database. </small> </div> <input name="submit" type="submit" value="Create Engineer" class="btn btn-primary default"></input> <input name="reset" type="Reset" value="Reset Form" class="btn btn-primary default"></input> </div> </form> <br><br> </body> </html> <?php $sql = "Select * from [Engineers] where [Engineer] not like '%\_%' Escape '\' order by [Engineer] asc"; $stmt = $conn->prepare($sql); $stmt->execute(); $results=$stmt->fetchAll(PDO::FETCH_ASSOC); ?> <div class="containerenglist"> <div class="col-sm-5"> <table id="alleng" class="table table-bordered"> <tr> <th>Active Engineer's Names:</th> </tr> <?php foreach ($results as $row) { echo "<tr><td>"; echo $row['Engineer']; echo "</td>"; echo "</tr>"; } ?> </table> </div> </div> </body> </html> <?php Function create_eng(){ global $msgID; global $msg, $conn; include('ConnectionDB.php'); $conn = null; $msgID = 0; //Get POST from submit $eng_name = $_POST['EngineersName']; //SQL Query $sql_count = "select count(*) as num from [Engineers] where [Engineer] = :eng_name"; //Query SQL Statement //echo $eng_name; $stmt = $conn->prepare($sql_count); $stmt->bindValue(':eng_name', $eng_name); //Execute SQL Statement $stmt->execute(); $results=$stmt->fetchAll(PDO::FETCH_ASSOC); If($results['num'] > 0){ echo $msg = "Engineer $eng_name exist's in the database"; $msgID = 1; }else{ $sql_insert = "insert into [Engineers](Engineer) values '$eng_name'"; //Prepare SQL Statement $stmt = $conn->Prepare($sql_insert); //Execute SQL Statement $stmt->execute(); $results=$stmt->fetchAll(PDO::FETCH_ASSOC); echo $msg = "Engineer $eng_name added to the database"; $msgID = 2; } } ?> Everything works correctly until i try submitting a name to the DB the line that is being pulled is $stmt = $conn->prepare($sql_count);
Hi Buddy I'm new to Php and downloaded shopping cart for www.phpwebcommerce.com/download/plaincart.zip With this code, i'm unable to update the shopping cart. On clicking the update button, it goes to previous page. But in demo version the update is working properly. Kindly help. Thanks Sakhsen How can I make it so that if file_get_contents cannot find the file else <?php $file = file_get_contents("http://www.example.com/lol.txt"); if ( $file == true ) { } else { } I have a login page that after logging in it sets a session Code: [Select] $_SESSION['user_info'] = $_POST['username']; and takes me to a start page (and checks for the session) which all works wonderfully. The problem is that no matter what link is clicked on that page it takes me to the login page again after checking to see if that same session is set Code: [Select] session_start(); if(!isset($_SESSION['user_info'])){ header("Location: http://website.com/folder/log_in.php"); } After logging in a second time every link on that same start page works wonderfully. If it works the second time why not the first? Hi All, I am new to PHP and HTML and I am trying to write an interface to MySQL 5.1 data base on Ubuntu 10.04LTS using PHP. My database has following tables 1) parts---> Part_no, Part_name--->PK is Part_no 2) operation---> Part_no,op_id--->PK is op_id, FK is Part_no 3)tool_list---->tl_id,op_id, tool---->PK is tl_id, FK is op_id 4)tool---->tool_part_no, tool_desc---->PK is tool_part_no I have many rows of data in 'tool' table. I want to referance/add these tools in to 'tool_list' table. these 'tool_list's are specific to a operatiom which once again is specific to a part. So Part_no--->op_id--->tool_list---->tool I have created 'one.php' which will aske the user for part no. This is a list which is populated from database. once the user selects the part_no and submits. it loads 'two.php' and lists operations specific to that part_no. Here once operation is selected and submited it calls 'three.php'. Here I need to add tools on to this selected operation. There can be as many as 20 different tool that can be added in to an operation. What i am looking to do is to list all tool in the 'tool' table as a list and add each tool in to the 'tool_list' table. once all tools are added press another button caled Exit which will take the user to Home page. The question is how do i accomplish this. 1) once a tool is selected it has to be added as a new row in to tool_list and the page need to be reloaded but has to remember the part_no, op_id for subsequent additions. 2) once all tools are added and exit is pressed it needs to goto home page. How do i accomplish these. Can a HTML page have two forms in it like on inside the other?. Or can this be accomplished with PHP only?. Thanks SKN Trying to make the email field in my form mandatory. Im new to php, more used to javascript but from everything i have read php is more universal. Here is my code, any help would be great. Code: [Select] <?php $emailsubject = 'Golf Registration'; $webMaster = 'dustin@duncantek.com'; $namea = $_POST['namea']; $nameb = $_POST['nameb']; $namec = $_POST['namec']; $named = $_POST['named']; $total = $_POST['total']; $sponsor = $_POST['sponsor']; $email = $_POST['email']; $comments = $_POST['comments']; $body = <<<EOD <br><hr><br> Golfer1: = $namea <br> Golfer2: = $nameb <br> Golfer3: = $namec <br> Golfer4: = $named <br> Total Owed: = $total <br> Sponsorship Name: = $sponsor <br> Comments: = $comments<br> EOD; $headers = "From: $email\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail($webMaster, $emailsubject, $body, $headers); $theResults = <<<EOD <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Thanks For Registering</title> <link href="golf-website.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="border"> <div class="name">Thanks For Registering!</div> <div id="links_bg"> <div class="toplinks"><a href="default.html">Homepage</a></div> <div class="toplinks"><a href="file:///C|/Users/Dustin/Desktop/Templates/Golf-Website/index.html">About Us</a></div> <div class="toplinks"><a href="file:///C|/Users/Dustin/Desktop/Templates/Golf-Website/index.html">Donations</a></div> <div class="toplinks"><a href="tourneyinfo.html">Events</a></div> <div class="toplinks"><a href="file:///C|/Users/Dustin/Desktop/Templates/Golf-Website/index.html">Contact us</a></div> </div> <div class="gap"></div> </div> </div> <div id="heading-bg"> <div align="left">Registration Complete</div> </div> <div id="main"> <p>Thank you for taking the time to register, we will email you back shortly to confirm registration along with an invoice via paypal. This is strictly for your convenience, we will also accept payment at the course on the day of the tournament. Thanks Again!</p> </div> <div id="bottom"> <div class="bottomlink"><a href="default.html">Home</a></div> <div class="sap">|</div> <div class="bottomlink"><a href="aboutus.html">About Us</a></div> <div class="sap">|</div> <div class="bottomlink"><a href="file:///C|/Users/Dustin/Desktop/Templates/Golf-Website/index.html">Donations</a></div> <div class="sap">|</div> <div class="bottomlink"><a href="tourneyinfo.html">Events</a></div> <div class="sap">|</div> <div class="bottomlink"><a href="file:///C|/Users/Dustin/Desktop/Templates/Golf-Website/index.html">Contact Us</a></div> </div> <center><div class="quicklinks"></div> </div> </body> </html> EOD; echo "$theResults"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Tournament Info</title> <link href="golf-website.css" rel="stylesheet" type="text/css" /> </head> <body> <td width="104"><label for="namea"> <div align="right">Golfer #1:</div> </label> </td> <td width="387"><div align="left"> <input name="namea" type="text" id="namea" size="35" maxlength="80" /> </div></td> </tr> <tr> <td><label for="name2"> <div align="right">Golfer #2:</div> </label> </td> <td><div align="left"> <input name="nameb" type="text" id="nameb" size="35" maxlength="80" /> </div></td> </tr> <tr> <td><label for="namec"> <div align="right">Golfer #3:</div> </label> </td> <td><div align="left"> <input name="namec" type="text" id="namec" size="35" maxlength="80" /> </div></td> </tr> <tr> <td><label for="named"> <div align="right">Golfer #4:</div> </label> </td> <td><div align="left"> <input name="named" type="text" id="named" size="35" maxlength="80" /> </div></td> </tr> <tr> <td><div align="right"></div></td> <td><div align="left">The option to sponsor a hole is also available, the price per hole is $200.00, please enter in the box below what you would like the sponsorship to be if any.</div></td> </tr> <tr> <td><div align="right"> <label for="total">Total:</label> </div></td> <td><div align="left"> <input name="total" type="text" id="total" size="35" maxlength="80" /> </div></td> </tr> <tr> <td><div align="right"> <label for="sponsor">Sponsorship:</label> </div></td> <td><div align="left"> <input name="sponsor" type="text" id="sponsor" size="35" maxlength="80" /> </div></td> </tr> <tr> <td><div align="right"> <label for="email">Email: </label> </div></td> <td><div align="left"> <input name="email" type="text" id="email" size="35" maxlength="80" /> </div></td> </tr> <tr> <td><label for="comments">Additional Comments:</label></td> <td><textarea name="comments" cols="35" rows="6" id="comments"></textarea></td> </tr> </table> <p> </p> <blockquote> <blockquote> <blockquote> <blockquote> <blockquote> <p> <input type="submit" name="send" id="send" value="Submit" /> <input type="reset" name="reset" id="reset" value="Reset" /> </p> </blockquote> < </body> </html> MOD EDIT: code tags added. One of my virtual hosts contained php_value upload_max_filesize 8M which resulted in error when running as php-fpm. Also, looks like .htaccess files are no longer used. Any other gotcha's??? Reading up on it, looks like I want to move all .htaccess instructions to a https://www.php.net/manual/en/configuration.file.per-user.php file. Should be straight forward enough. Looking at https://www.php.net/manual/en/configuration.changes.php, looks like I should scan /etc/httpd/* as well as any virtual sites defined elsewhere for "php_" and move these requirements elsewhere. Will this also have to be a per directory .user.ini file? Reason I ask is I always thought it was better performance to when possible use apache's conf file than a .htaccess file. Hi,
I am fairly new to PHP, I am tryin to put a code together that would see my incoming CLI as 44 and remove the 44 from it and add a 0 to it. I have managed to do this so far, now I am stuck, as any number thats not matching the length (10 digits ) or is not starting with 44 is also not forwarded to my database for query.
$input = ($cid); if(preg_match('/^(44|0)(\d{10})$/',$input,$matches)){ $phone = '0'.$matches[2]; }else die("Invalid Phone Number") ; What I would like is that any number starting with 441234567890 to become 01234567890, but should not involve 10 digits criteria. Any help would be appreciated. Okay, so below I have posted my code, the problem I am having is not knowing how PDO works that well. So what I have attempted to do here is use SQL to check if the user and password are correct, but I'm not sure how to carry on. I realize I have to determine if the database found the matching password and/or username but I have no idea how, any help will be much appreciated. <html> <head> <title>Database login</title> <?php if (isset($_POST['submit'])) { print_r($_POST); $password = md5($_POST['password']); echo'<p>'.$password.'</p>'; $username = ($_POST['username']); echo'<p>'.$username.'</p>'; } ?> </head> <body> <?php $db = new PDO('sqlite:login.sqlite'); $login = 'SELECT * FROM login WHERE userid="'.$username.'" AND password="'.$password.'";'; echo'<p>'.$login.'</p>'; $attempt = $db->query($login); ?> <form method="post" action="Db_login.php"> <p>Username:<br /><input type="text" name="username" /> </p> <p>Password:<br /><input type="password" name="password" /></p> <p><input type="submit" name="submit" value="Log In!" /></p> </body> </html> I am trying to update task based progress updates. I've got a very simple database that needs to be updated with:
Database name: progress
1. ID (auto increment)
2. admin (name of the project manager)
3. adminid (ID of the project manager in the project manager db)
4. member (name of the member of the project in the members db)
4. project (particular project being updated)
5. status (progress of the project as a number between 10 and 90)
6. timestamp
I have the following php script update insert a new line into my progress table:
if (!empty($_POST['progress'])) { if(Input::exists()) { if(Token::check(Input::get('token'))) { $adminprogress = Input::get('admin'); $adminidprogress = Input::get('adminid'); $memberprogress = Input::get('member'); $projectprogress = Input::get('project'); $statusprogress = Input::get('status'); $timestamp = date('Y-m-d H:i:s'); $progressupdate = DB::getInstance()->insert(progress, array( 'admin' => $adminprogress, 'adminid' => $adminidprogress, 'member' => $memberprogress, 'project' => $projectprogress, 'status' => $statusprogress, 'timestamp' => $timestamp )); Redirect::to('memberattire1.php'); } } }And I have the following code in the body of my page: <form method="post" action=""> <label> <select name="status"> <option value=choose>---Please Select---</option> <option value = "0">(10%) Bunker Registered</option> <option value = "10">(20%) First discussions held</option> <option value = "20">(30%) Initial research undertaken</option> <option value = "30">(40%) Ideas shared</option> <option value = "40">(50%) Enquiries made</option> <option value = "50">(60%) Results of enquiries shared</option> <option value = "60">(70%) Preferences shared</option> <option value = "70">(80%) Decisions made</option> <option value = "80">(90%) Decisions being executed</option> <option value = "90">(100%) Project Completed</option> </select> </label> <br><br> <input type="hidden" name="member" value="<?php echo $membername; ?>"> <input type="hidden" name="admin" value="<?php echo $admin; ?>"> <input type="hidden" name="adminid" value="<?php echo $adminid; ?>"> <input type="hidden" name="project" value="attire1"> <input type="hidden" name="token" value="<?php if(isset($token)) { echo $token; } else { echo $token = Token::generate(); } ?>" > <input type="submit" value="Submit Update" name="progress"> </form>I know my $membername, $admin and $adminid are ok because I can simply echo them out to confirm them, so there is something silly in my coding that I've overlooked. Can someone with a fresh pair of eyes see a typo or missed semi-colon or whatnot? Many thanks for any help. Hi, I need a preg_match for the following criteria: - no leading or trailing white space allowed - only alphanumeric characters and spaces are allowed (no full stops, commas apostrophe's, explanation marks, quotes, etc) - only one space allowed between each word (if there is more than one word) Thanks. Hi! Im in need of some help. I had a form built for me and im attempting to make it so some details are required eg name, cc number etc. But i cannot figure out how to do it. I only have dreamweaver cs4 and i attempted to do it through that but when i uploaded the form it didnt work. The form is located he https://eatatmenzies.com.au/catering_menu.php and my code it as follows [[code]<?php $teaandcoffee=$_POST['teaandcoffee']; $teaandcoffeeallday=$_POST['teaandcoffeeallday']; $orangejuice=$_POST['orangejuice']; $mineralwater=$_POST['mineralwater']; $cookies=$_POST['cookies']; $slices=$_POST['slices']; $minimuffins=$_POST['minimuffins']; $texanmuffins=$_POST['texanmuffins']; $bananaorcarrotcake=$_POST['bananaorcarrotcake']; $minidanishes=$_POST['minidanishes']; $assprtedsandwhiches4points=$_POST['assprtedsandwhiches4points']; $assortedsandwhiches6points=$_POST['assortedsandwhiches6points']; $c1=$_POST['c1']; $c2=$_POST['c2']; $c3=$_POST['c3']; $c4=$_POST['c4']; $c5=$_POST['c5']; $Tandoorichickenskewers=$_POST['Tandoorichickenskewers']; $Californiasushirolls=$_POST['Californiasushirolls']; $Thaiprawnskewers=$_POST['Thaiprawnskewers']; $Roastedvegetablefrittata=$_POST['Roastedvegetablefrittata']; $Vegetablesamosas=$_POST['Vegetablesamosas']; $Smokedsalmontarts=$_POST['Smokedsalmontarts']; $Cocktailspringrolls=$_POST['Cocktailspringrolls']; $DimSims=$_POST['DimSims']; $c6=$_POST['c6']; $Beefsatay=$_POST['Beefsatay']; $Orangeandhoneydrumsticks=$_POST['Orangeandhoneydrumsticks']; $Antipastoplatter=$_POST['Antipastoplatter']; $Roastedvegandcumincouscous=$_POST['Roastedvegandcumincouscous']; $Coleslaw=$_POST['Coleslaw']; $Potatoandeggsaladwithchives=$_POST['Potatoandeggsaladwithchives']; $Basilandcherrytomatofusilli=$_POST['Basilandcherrytomatofusilli']; $greensalad=$_POST['greensalad']; $ceasarsalad=$_POST['ceasarsalad']; $freshfruitsaad=$_POST['freshfruitsaad']; $breadrollsandbutter=$_POST['breadrollsandbutter']; $freshseasonalfruitplatter=$_POST['freshseasonalfruitplatter']; $cheeseplatter=$_POST['cheeseplatter']; $Name=$_POST['Name']; $deliveryaddress=nl2br($_POST['deliveryaddress']); $DeliveryDate=$_POST['DeliveryDate']; $DeliveryTime=$_POST['DeliveryTime']; $ContactForm=$_POST['ContactForm']; $comments=nl2br($_POST['comments']); $totalamount=$_POST['totalamount']; $gtotalamount=$_POST['gtotalamount']; $gst=$_POST['gst']; $discount=$_POST['discount']; $ccno=$_POST['ccno1'].$_POST['ccno2'].$_POST['ccno3'].$_POST['ccno4']; $CardExpiry=$_POST['CardExpiry']; $ccv=$_POST['ccv']; if($_POST['submit_2']==1) { $ipadd=$_SERVER['REMOTE_ADDR']; $to = 'derek@eatatmenzies.com.au'; $subject = 'New Catering Order'; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: mail@EatAtMenzies.com.au' . "\r\n" . 'Reply-To: mail@EatAtMenzies.com.au' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); $mailbody=<<<EWURPO <table width="575" border="0" align="center" cellpadding="0" cellspacing="2"> <tbody> <tr> <td colspan="3"><h2> <hr color="#333333" noshade="noshade" size="1" /> </h2></td> </tr> <tr> <td width="284"><h1>Refreshments</h1></td> <td width="122"><p>per person<br /> </p></td> <td width="161"><p>QTY</p></td> </tr> <tr> <td><p>Tea & Coffee</p></td> <td><p>$2.50 </p></td> <td>$teaandcoffee </td> </tr> <tr> <td><p>Tea & Coffee (all day)</p></td> <td><p>$8.50</p></td> <td>$teaandcoffeeallday</td> </tr> <tr> <td><p>Orange Juice</p></td> <td><p>$2.50</p></td> <td>$orangejuice</td> </tr> <tr> <td><p>Mineral Water</p></td> <td><p>$2.00</p></td> <td>$mineralwater</td> </tr> <tr> <td height="50"><br /></td> <td colspan="2"><br /></td> </tr> <tr> <td><h1>Morning & Afternoon Tea</h1></td> <td><p>per person<br /> </p></td> <td><p>QTY</p></td> </tr> <tr> <td><p>Cookies</p></td> <td><p>$2.50 </p></td> <td><p> $cookies </p></td> </tr> <tr> <td><p>Slices</p></td> <td><p>$3.00</p></td> <td>$slices</td> </tr> <tr> <td><p>Muffins (mini)</p></td> <td><p>$1.50</p></td> <td>$minimuffins</td> </tr> <tr> <td><p>Muffins (Texan)</p></td> <td><p>$3.00</p></td> <td>$texanmuffins</td> </tr> <tr> <td valign="top"><p>Banana or Carrot cake</p></td> <td valign="top"><p>$2.50</p></td> <td valign="top">$bananaorcarrotcake</td> </tr> <tr> <td><p>Mini Danishes</p></td> <td><p>$1.50</p></td> <td>$minidanishes</td> </tr> <tr> <td height="50"><br /></td> <td colspan="2"><br /></td> </tr> <tr> <td><h1>Sandwich Platters</h1></td> <td><p>per person<br /> </p></td> <td><p>QTY</p></td> </tr> <tr> <td><p>Assorted sandwiches (4 points)</p></td> <td><p>$5.00 </p></td> <td> $assprtedsandwhiches4points</td> </tr> <tr> <td><p>Assorted sandwiches (6 points)</p></td> <td><p>$6.80 per person</p></td> <td> $assortedsandwhiches6points</td> </tr> <tr> <td height="50"><br /></td> <td colspan="2"><br /></td> </tr> <tr> <td><h1>Finger Food Platters</h1></td> <td colspan="2">� <p>per person<br /> </p></td> </tr> <tr> <td colspan="3"><p>Items listed below are based on 2 pieces per serve (minimum 8 people)</p></td> </tr> <tr> <td> </td> <td> </td> <td><p>QTY</p></td> </tr> <tr> <td><p>Caramalised onion & goats cheese tarts (V)</p></td> <td><p>$1.50 </p></td> <td>$c1</td> </tr> <tr> <td><p>Mini cottage pies</p></td> <td><p>$2.00</p></td> <td>$c2</td> </tr> <tr> <td><p>Canap�s with tomato & basil salsa (V)</p></td> <td><p>$1.20</p></td> <td>$c3</td> </tr> <tr> <td><p>Canap�s with smoked salmon and cream cheese</p></td> <td><p>$1.80</p></td> <td>$c4</td> </tr> <tr> <td><p>Home made sausage rolls</p></td> <td><p>$1.60</p></td> <td>$c5</td> </tr> <tr> <td><p>Tandoori chicken skewers</p></td> <td><p>$2.00</p></td> <td> $Tandoorichickenskewers </td> </tr> <tr> <td><p>California sushi rolls</p></td> <td><p>$1.80</p></td> <td>$Californiasushirolls</td> </tr> <tr> <td><p>Thai prawn skewers</p></td> <td><p>$2.60</p></td> <td>$Thaiprawnskewers</td> </tr> <tr> <td><p>Roasted vegetable frittata</p></td> <td><p>$1.80</p></td> <td>$Roastedvegetablefrittata</td> </tr> <tr> <td><p>Vegetable samosas</p></td> <td><p>$1.50</p></td> <td>$Vegetablesamosas</td> </tr> <tr> <td><p>Smoked salmon tarts</p></td> <td><p>$1.80</p></td> <td>$Smokedsalmontarts</td> </tr> <tr> <td><p>Cocktail spring rolls</p></td> <td><p>$1.50</p></td> <td>$Cocktailspringrolls</td> </tr> <tr> <td><p>Dim Sims<br /> </p></td> <td><p>$1.50</p></td> <td>$DimSims</td> </tr> <tr> <td><p>Cheese & sun dried tomato puffs (V)</p></td> <td><p>$1.30</p></td> <td>$c6</td> </tr> <tr> <td><p>Beef satay</p></td> <td><p>$2.00</p></td> <td>$Beefsatay</td> </tr> <tr> <td><p>Orange and honey drumsticks</p></td> <td><p>$2.50</p></td> <td>$Orangeandhoneydrumsticks</td> </tr> <tr> <td height="50"><br /></td> <td colspan="2"><br /></td> </tr> <tr> <td><h1>Antipasto Platter</h1></td> <td valign="top"><p>$8.00 per person</p></td> <td valign="top"><p>QTY</p></td> </tr> <tr> <td><p>(minimum 4 people)</p></td> <td><p><br /> </p></td> <td>$Antipastoplatter</td> </tr> <tr> <td colspan="3"><p>Including: Olives, prosciutto, salami, pesto salad with bocconcini and tomato & roasted red capsicum</p></td> </tr> <tr> <td height="50"><br /></td> <td colspan="2"><br /></td> </tr> <tr> <td><h1>Salads</h1></td> <td colspan="2"><br /></td> </tr> <tr> <td><p>(minimum 4 people)</p></td> <td><p>per person<br /> </p></td> <td><p>QTY</p></td> </tr> <tr> <td><p>Roasted veg and cumin cous cous</p></td> <td><p>$2.50 </p></td> <td> $Roastedvegandcumincouscous</td> </tr> <tr> <td><p>Coleslaw</p></td> <td><p>$2.50</p></td> <td>$Coleslaw</td> </tr> <tr> <td><p>Potato and egg salad with chives</p></td> <td><p>$2.50</p></td> <td> $Potatoandeggsaladwithchives </td> </tr> <tr> <td><p>Basil and cherry tomato fusilli</p></td> <td><p>$2.50</p></td> <td>$Basilandcherrytomatofusilli</td> </tr> <tr> <td><p>Green salad</p></td> <td><p>$2.50</p></td> <td>$greensalad</td> </tr> <tr> <td><p>Caesar Salad</p></td> <td><p>$3.00</p></td> <td>$ceasarsalad</td> </tr> <tr> <td><p>Fresh fruit salad</p></td> <td><p>$3.80</p></td> <td>$freshfruitsaad</td> </tr> <tr> <td><p>Bread rolls and butter</p></td> <td><p>$1.00</p></td> <td>$breadrollsandbutter</td> </tr> <tr> <td height="50"><br /></td> <td colspan="2"><br /></td> </tr> <tr> <td><h1>Fresh Seasonal Fruit Platter</h1></td> <td valign="top"><p>$5.00 per person</p></td> <td valign="top"><p>QTY</p></td> </tr> <tr> <td><p>(minimum 4 people)</p></td> <td><p><br /> </p></td> <td>$freshseasonalfruitplatter</td> </tr> <tr> <td height="25"><p><br /> </p></td> <td colspan="2"><p><br /> </p></td> </tr> <tr> <td><h1>Cheese Platter</h1></td> <td valign="top"><p>$5.00 per person</p></td> <td valign="top"><p>QTY</p></td> </tr> <tr> <td><p>(minimum 4 people)</p></td> <td><p><br /> </p></td> <td>$cheeseplatter</td> </tr> <tr> <td colspan="3"><p>A soft, a cheddar and a blue, served with fresh grapes & biscuits</p></td> </tr> <tr> <td colspan="3"><br /></td> </tr> </tbody> </table> <table width="575" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="156"><p>Name:</p></td> <td width="419"><p> $Name </p></td> </tr> <tr> <td width="156"><p>Credit Card Number:</p></td> <td width="419"><p> $ccno </p></td> </tr> <tr> <td width="156"><p>Card Expiry:</p></td> <td width="419"><p> $CardExpiry </p></td> </tr> <tr> <td width="156"><p>Card Expiry:</p></td> <td width="419"><p> $ccv </p></td> </tr> <tr> <td><p>Delivery Address:</p></td> <td><p> $deliveryaddress </p></td> </tr> <tr> <td><p>Delivery Date:</p></td> <td><p> $DeliveryDate </p></td> </tr> <tr> <td><p>Aprrox Delivery Time:</p></td> <td><p> $DeliveryTime </p></td> </tr> <tr> <td><p>Contact Number:</p></td> <td><p> $ContactForm </p></td> </tr> <tr> <td><p>Comments:</p></td> <td>$comments</td> </tr> <tr> <td> </td> <td><h1>Sub Total: $totalamount</h1></td> </tr> <tr> <td> </td> <td><h1>Discounts: $discount</h1></td> </tr> <tr> <td> </td> <td><h1>GST: $gst</h1></td> </tr> <tr> <td> </td> <td><h1>Grand Total: $gtotalamount</h1></td> </tr> </table> <br /><br /> This form was submitted by this IP ($ipadd) EWURPO; mail($to, $subject, $mailbody, $headers); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Eat @ Menzies - Catering menu - Order Online</title> <link href="style.css" rel="stylesheet" type="text/css" /> <script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script> <link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" /> <style type="text/css"> <!-- body { background-color: #CCC; } #wrapper #container #content #menu table tr td #MenuBar2 li a{ color: #000; } #wrapper #container #content #menu table tr td #MenuBar2 li a:hover{ color: #FFF; } --> </style></head> <body> <div id="wrapper"> <div id="container"> <div id="logo"><a href="index.html"><img src="images/logo.jpg" alt="eat at menzies" width="360" height="139" border="0" longdesc="http://www.eatatmenzies.com.au" /></a></div> <div id="content"> <div id="menu"> <table width="573" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="6" height="67" align="center"> </td> <td width="59" align="center"><a href="index.html">Home</a></td> <td width="57" align="center"><a href="menu.html">Menu</a></td> <td width="69" align="center"><a href="the_toad.html">The Toad</a></td> <td width="156" align="center">Catering & Functions</td> <td width="158" align="center"><a href="meal_plans.html">Resident Meal Plans</a></td> <td width="54" align="center"><a href="contact.html">Contact</a></td> <td width="14" align="center"> </td> </tr> </table> </div> <div id="left_content"> <p>Menzies College<br /> La Trobe University<br /> Bundoora, 3086</p> <p>Tel: 03 9479 3289<br /> Email: mail@EatAtMenzies.com.au</p> </div> <div id="right_content"><form method="post" action="catering_menu.php"> <table width="696" border="0" cellspacing="0" cellpadding="0"> <tr> <td><img src="images/right_top.jpg" width="696" height="51" /></td> </tr> <tr> <td bgcolor="#FFFFFF"><table width="690" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="28"> </td> <td width="644"><h1>Catering Menu & Order Form</h1> <p> </p> <p><strong>Your catering order was submitted successfully. <br /> To contact us, please email</strong> <a href="mailto:mail@EatAtMenzies.com.au">mail@EatAtMenzies.com.au</a> <strong>or call 9479 3289.</strong></p> <p><strong>Free delivery within campus for orders over $50.00. <br /> Prices are subject to change without further notice.</strong></p> <p><strong><br /> </strong></p> <p> </p></td> <td width="18"> </td> </tr> </table></td> </tr> <tr> <td><img src="images/right_bottom.jpg" width="696" height="68" /></td> </tr> </table> </form> </div> <div id="footer"><a href="http://www.tizzbizzdesign.com.au">Wesbite By Tizz Bizz Design</a></div> </div> </div> </div> </body> </html> <?} else {?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script type="text/javascript" src="js/prototype.js"></script> <script type="text/javascript" src="js/scriptaculous.js?load=effects,builder"></script> <script type="text/javascript" src="js/lightbox.js"></script> <link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Eat @ Menzies - Catering menu - Order Online</title> <link href="style.css" rel="stylesheet" type="text/css" /> <script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script> <script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script> <link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" /> <style type="text/css"> <!-- body { background-color: #CCC; } #wrapper #container #content #menu table tr td #MenuBar2 li a{ color: #000; } #wrapper #container #content #menu table tr td #MenuBar2 li a:hover{ color: #FFF; } --> </style> <link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="wrapper"> <div id="container"> <div id="logo"><a href="index.html"><img src="images/logo.jpg" alt="eat at menzies" width="360" height="139" border="0" longdesc="http://www.eatatmenzies.com.au" /></a></div> <div id="content"> <div id="menu"> <table width="573" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="7" height="67" align="center"> </td> <td align="center"><table border="0" cellspacing="0" cellpadding="12"> <tr> <td><a href="index.html">Home</a></td> <td><a href="menu.html">Menu</a></td> <td><a href="the_toad.html">The Toad</a></td> <td>Catering & Functions</td> <td><a href="meal_plans.html">Resdient Meal Plans</a></td> <td><a href="contact.html">Contact</a></td> </tr> </table></td> <td width="12" align="center"> </td> </tr> </table> </div> <div id="left_content"> <p>Menzies College<br /> La Trobe University<br /> Bundoora, 3086</p> <p>Tel: 03 9479 3289<br /> Email: mail@EatAtMenzies.com.au</p> </div> <div id="right_content"> <form name="cform" method="post" action="catering_menu.php"> <input type="hidden" name="teaandcoffee" value="<?=$teaandcoffee?>" /> <input type="hidden" name="teaandcoffeeallday" value="<?=$teaandcoffeeallday?>" /> <input type="hidden" name="orangejuice" value="<?=$orangejuice?>" /> <input type="hidden" name="mineralwater" value="<?=$mineralwater?>" /> <input type="hidden" name="cookies" value="<?=$cookies?>" /> <input type="hidden" name="slices" value="<?=$slices?>" /> <input type="hidden" name="minimuffins" value="<?=$minimuffins?>" /> <input type="hidden" name="texanmuffins" value="<?=$texanmuffins?>" /> <input type="hidden" name="bananaorcarrotcake" value="<?=$bananaorcarrotcake?>" /> <input type="hidden" name="minidanishes" value="<?=$minidanishes?>" /> <input type="hidden" name="assprtedsandwhiches4points" value="<?=$assprtedsandwhiches4points?>" /> <input type="hidden" name="assortedsandwhiches6points" value="<?=$assortedsandwhiches6points?>" /> <input type="hidden" name="c1" value="<?=$c1?>" /> <input type="hidden" name="c2" value="<?=$c2?>" /> <input type="hidden" name="c3" value="<?=$c3?>" /> <input type="hidden" name="c4" value="<?=$c4?>" /> <input type="hidden" name="c5" value="<?=$c5?>" /> <input type="hidden" name="c6" value="<?=$c6?>" /> <input type="hidden" name="Tandoorichickenskewers" value="<?=$Tandoorichickenskewers?>" /> <input type="hidden" name="Californiasushirolls" value="<?=$Californiasushirolls?>" /> <input type="hidden" name="Thaiprawnskewers" value="<?=$Thaiprawnskewers?>" /> <input type="hidden" name="Roastedvegetablefrittata" value="<?=$Roastedvegetablefrittata?>" /> <input type="hidden" name="Vegetablesamosas" value="<?=$Vegetablesamosas?>" /> <input type="hidden" name="Smokedsalmontarts" value="<?=$Smokedsalmontarts?>" /> <input type="hidden" name="Cocktailspringrolls" value="<?=$Cocktailspringrolls?>" /> <input type="hidden" name="DimSims" value="<?=$DimSims?>" /> <input type="hidden" name="Beefsatay" value="<?=$Beefsatay?>" /> <input type="hidden" name="Orangeandhoneydrumsticks" value="<?=$Orangeandhoneydrumsticks?>" /> <input type="hidden" name="Antipastoplatter" value="<?=$Antipastoplatter?>" /> <input type="hidden" name="Roastedvegandcumincouscous" value="<?=$Roastedvegandcumincouscous?>" /> <input type="hidden" name="Coleslaw" value="<?=$Coleslaw?>" /> <input type="hidden" name="Potatoandeggsaladwithchives" value="<?=$Potatoandeggsaladwithchives?>" /> <input type="hidden" name="Basilandcherrytomatofusilli" value="<?=$Basilandcherrytomatofusilli?>" /> <input type="hidden" name="greensalad" value="<?=$greensalad?>" /> <input type="hidden" name="ceasarsalad" value="<?=$ceasarsalad?>" /> <input type="hidden" name="freshfruitsaad" value="<?=$freshfruitsaad?>" /> <input type="hidden" name="breadrollsandbutter" value="<?=$breadrollsandbutter?>" /> <input type="hidden" name="freshseasonalfruitplatter" value="<?=$freshseasonalfruitplatter?>" /> <input type="hidden" name="cheeseplatter" value="<?=$cheeseplatter?>" /> <input type="hidden" name="gtotalamount" value="<?=$gtotalamount?>" /> <input type="hidden" name="totalamount" value="<?=$totalamount?>" /> <input type="hidden" name="discount Ok well i've been trying to figure this out for a while now and really havent been able to find out how to implement this, I currently have it so that my email form requires you enter your name and email but you don't have to enter your phone number, I need to change it soo that it requires you enter a valid phone number aswell. Heres my code below, my boss is really getting on my case over this and I'm not a .php developered so any help would be really appretiated. The codes below I also attached it in a file for those who want it. Code: [Select] <?php $my_email = "email@emailhere.co.uk"; $continue = "/"; $errors = array(); if(count($_COOKIE)){foreach(array_keys($_COOKIE) as $value){unset($_REQUEST[$value]);}} function recursive_array_check_header($element_value) { global $set; if(!is_array($element_value)){if(preg_match("/(%0A|%0D|\n+|\r+)(content-type:|to:|cc:|bcc:)/i",$element_value)){$set = 1;}} else { foreach($element_value as $value){if($set){break;} recursive_array_check_header($value);} } } recursive_array_check_header($_REQUEST); if($set){$errors[] = "You cannot send an email header";} unset($set); if(isset($_REQUEST['email']) && !empty($_REQUEST['email'])) { if(preg_match("/(%0A|%0D|\n+|\r+|:)/i",$_REQUEST['email'])){$errors[] = "Email address may not contain a new line or a colon";} $_REQUEST['email'] = trim($_REQUEST['email']); if(substr_count($_REQUEST['email'],"@") != 1 || stristr($_REQUEST['email']," ")){$errors[] = "Email address is invalid";}else{$exploded_email = explode("@",$_REQUEST['email']);if(empty($exploded_email[0]) || strlen($exploded_email[0]) > 64 || empty($exploded_email[1])){$errors[] = "Email address is invalid";}else{if(substr_count($exploded_email[1],".") == 0){$errors[] = "Email address is invalid";}else{$exploded_domain = explode(".",$exploded_email[1]);if(in_array("",$exploded_domain)){$errors[] = "Email address is invalid";}else{foreach($exploded_domain as $value){if(strlen($value) > 63 || !preg_match('/^[a-z0-9-]+$/i',$value)){$errors[] = "Email address is invalid"; break;}}}}}} } if(!(isset($_SERVER['HTTP_REFERER']) && !empty($_SERVER['HTTP_REFERER']) && stristr($_SERVER['HTTP_REFERER'],$_SERVER['HTTP_HOST']))){$errors[] = "You must enable referrer logging to use the form";} function recursive_array_check_blank($element_value) { global $set; if(!is_array($element_value)){if(!empty($element_value)){$set = 1;}} else { foreach($element_value as $value){if($set){break;} recursive_array_check_blank($value);} } } recursive_array_check_blank($_REQUEST); if(!$set){$errors[] = "You cannot send a blank form";} unset($set); if(count($errors)){foreach($errors as $value){print "$value<br>";} exit;} if(!defined("PHP_EOL")){define("PHP_EOL", strtoupper(substr(PHP_OS,0,3) == "WIN") ? "\r\n" : "\n");} function build_message($request_input){if(!isset($message_output)){$message_output ="";}if(!is_array($request_input)){$message_output = $request_input;}else{foreach($request_input as $key => $value){if(!empty($value)){if(!is_numeric($key)){$message_output .= str_replace("_"," ",ucfirst($key)).": ".build_message($value).PHP_EOL.PHP_EOL;}else{$message_output .= build_message($value).", ";}}}}return rtrim($message_output,", ");} $message = build_message($_REQUEST); $message = $message . PHP_EOL.PHP_EOL."-- ".PHP_EOL.""; $message = stripslashes($message); $subject = "Website Query"; $headers = "From: " . $_REQUEST['email']; mail($my_email,$subject,$message,$headers); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Tracey Bell - Contact Form</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#ffffff" text="#000000"> <div> <center> <b>Thank you <?php print stripslashes($_REQUEST['name']); ?></b> <br>Your message has been sent <p><a href="<?php print $continue; ?>">Click here to continue</a></p> </center> </div> </body> </html> |