PHP - Putting Users In Queue
Hi all
I am having a nightmare coming up with something and I wonder if I could pick everyones brain. I am helping to setup a mini web system for a friends dads work, the server is held internally on a very old machine, the current system runs ok and I am just helping to add some new things in. One of the functions they have is a "job" tool, which allows people to submit a small form of data about the job they are currently doing, this is used by internal and external staff. There network is really old and slow as well as the server the scripts are on, and they have no money at the moment to upgrade it, one of the reasons for these enhancements is so they can free up some money, so i'm doing my best to help them. The problem I am having is that when more than 150 users are submitting the form at the same time, the PHP pages are just timing out and the user has to go back to stage 1, their peak has been 230 users, which caused everyone a problem. So I wonder, is there anyway to create a queue style system with a countdown timer? So for example, when the user logs in, if there are more than 60 active users currently submitting on that form, then it would place that user in a queue for X number of seconds\minutes, then when one of those 60 users finish with the form or their 10 minutes is up, the user logged in is then forwarded to the form allowing them to complete it. I was going to give each user a maximum of 10 mins to complete the form before they are chucked out the queue, if that's possible. I was thinking about maybe logging them into a new bigger server online, then when number of user sessions drops below 60 on the current internal server, then they are forward to it, which allows them to complete the form, so you only ever have 60 users on the internal server at once. But I have 0 clue where to start. Is this a totally custom hard job? Or is there something anyone can point me to? Thanks very much all Johnny boy Similar TutorialsHi, I have two html made text boxes one that is called "name" and another that is called "regnum". I also have a submit button. They are both used to add data to a database. The name text box should add a name to the database under the "name" heading and the regnum should add a number under the "regnum" heading Here is the code for them: HTML Code: <form action="" method="post"> <p> Name: <input type="text" name="name"/> </p> <p> Regnum: <input type="text" name="regnum"/> </p> <p> <input type="submit" value="Add To Database" name = "submit2" /> </p> </form> Here is the PHP code that i am using for adding the user to the database: PHP Code: $host="localhost"; $username="root"; $password=""; $database="lab2"; mysql_connect("$host", "$username", "$password") or die(mysql_error()); mysql_select_db("$database") or die(mysql_error()); $name = $_POST['name']; $regnum = $_POST['regnum']; if(!$_POST['submit2']){ echo "Enter A Vaue"; }else{ mysql_query("INSERT INTO lab2('name', 'regnum') VALUES(NULL, '$name', '$regnum')") or die(mysql_error()); echo "User Added To Database"; } The problem i get with this is "Undefined Index name and regnum". I watched a video on youtube and this is how the guy did it but it worked for him and for some reason it doesn't work for me. Can anyone help?? Thanks. Hi folks, I'm trying do a system like a queue, but doesn't work like i expected. OS: Windows (IIS) PHP: 5.2 So, let me tell you, what i'm doing. 1º Click in one button and insert the entry into database $stmt = odbc_prepare($conn, 'INSERT INTO queue (ask_date, run_date, executed, user_id) VALUES (GETDATE(), NULL, 0, ?)'); 2º After that i will run a script to check values executed = 0 $handle = new COM('WScript.Shell'); $handle->Run("php generate.php", 0, false); 3º Check values executed = 0 and update de column executed to 1 (generate.php) $sql = "SELECT * FROM queue WHERE executed=0;"; $rsQueue = odbc_exec($conn, $sql); while (odbc_fetch_row($rsQueue )) { //code here } My problem is, when i click in button it will open always new process (php.exe). (2 clicks - 2 processes; 3 clicks - 3 processes; etc..) My ideia is, first button click execute the script (2º) but the other times if script is running, only add the content to queue table to be executed in current process. Someone have any ideia? Thank you! Hey Guys, I have the following problem. I have a lot of users sending querys to my DB at the same time, and for example each time a user sends the query, a field with a number increases. Sometimes that number increases like this: 10.11, 10.12, 10.13, 10.15, 10.14 When it obviously should be: 10.11, 10.12, 10.13, 10.14, 10.15 Maybe (in this example) the query from 10.15 finished first (got inserted on DB) than the query from 10.14. My question is if there is some kind of function or line of code to have some kind of queue between the Querys...so if a query that is received first must finish and the the next can go ahead and query. Hope I am making myself clear, Looking forward any kind of help and/or suggestions. Thanks a lot in advance! Hi to all the members of this great community, This is my first post here and I am new in PHP and in general web programming, my background is in C and C++ programming languages that's why I want to make some comments with regards to PHP and getting your feedbacks. In C++ one exercise considered that someone knows the basics of the language is to implement a general dynamic queue that is the client programmer can put an arbitrary number of objects into a queue and using templates you can instantiate different queues holding different kind of objects. I have grasped the most important parts of the language and I am pondering if you can effectively implement something like the above using PHP. I have googled this, and I have seen so far just a very simple implementation in PHP. He has defined his queue using an array having a fixed size and he just moved an index up and down through the array while inserting and poping elements from the queue. if you want to implement a dynamic queue the only way it comes to my mind just off the top of my head is to use the the construct [] to add dynamically element at the end of the queue and when you want to pop up an element you just have to unset(your current queue which is an array) create another array (smaller by one element than the previous one) copy the elements at the appropriate positions I just wanted, people with a C++ programming experience to give me some feedback about this topic and to give me some basic idea how could we implement a general queue in PHP. For example could we implement a queue w/o using an array? I would appreciate any comment. Greetings from Greece Hello
I am trying to work out how many regular users I have to my site and how long those users tend to be users..
So, I have a table that logs every time a user visits my site and logs in, it stores the date / time as a unix timestamp and it logs their user id.
I started by getting the id's of any user who logs in more than 5 times in a specified period, but now I want to extend that...
SELECT userID as user, count(userID) as logins FROM login_history where timestamp > UNIX_TIMESTAMP('2014-06-01 00:00:00') and timestamp < UNIX_TIMESTAMP('2014-07-01 00:00:00') group by user having logins > 5; Hi. I am sending out email with a php script - about 5000 at a time by send 15 or so every 20 seconds which works fine. Sometimes I need to add an attachemnt. I then find that the script will keep stalling. Is there a way to test the server qmail/mail queue to see if it isready to send another message? - rather than send it and have the script stall? It may be enough to simply be able to check that the number of messages left to be sent in the queue? Have search a lot for help on this with no results. Any server/qmail experts out there? Thanks Paul I just discovered that I have a major security flaw with my website. Anyone who logs in to the website can easily access other users information as well as delete and edit other users information just by changing the ID variable in the address bar. I have user ID Session started on these pages but still people can do anything they like with other users information just by editing the address bar. For example if your logged in in the address bar of www.mywebsite.com/delete_mystuff.php?id=5 and change the "5" say to a "9" then you will have access to user#9 information. Every important page that I have has this code: Code: [Select] session_start(); if (!isset($_SESSION['user_id'])) { // Start defining the URL. $url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']); // Check for a trailing slash. if ((substr($url, -1) == '/') OR (substr($url, -1) == '\\') ) { $url = substr ($url, 0, -1); // Chop off the slash. } // Add the page. $url .= '/index.php'; ob_end_clean(); // Delete the buffer. header("Location: $url"); exit(); // Quit the script. } else { //Else If Logged In Run The Script if((isset($_GET['id'])) && (is_numeric($_GET['id']))) { $id = (int) $_GET['id']; } elseif ((isset($_POST['id'])) && (is_numeric($_POST['id']))) { $id = (int) $_POST['id']; } else { echo ' No valid ID found, passed in url or form element'; exit(); } What am I doing wrong? Please help if you know how to correct this. Many thanks in advance. Howdy All i currently have Code: [Select] <? echo $guild ['name'];?> and i want to put <> around what is shown from the $guild ['name'] , but where ever i try the <> it cancels out and just doesnt show the name any more - currently its making us do the following <-<? echo $guild ['name'];?>-> as even if we try an echo with jsut the < and > it cancels it out Any specific way in which i can do this thanks Ok so for some reasons on my register and edit profile page when i hit submit it says that i have not filled in all the info i need.. Even after i fill all of them in.. but heres the code for the register form.. Code: [Select] <?php require("top.php"); ?> <div id='homeright'> <?php echo "<font size='6'>Sign up</font>"; echo "<hr width='75%' align='left'/>"; $form = "<form action='index.php' method='post'> <table cellspacing='5px'> <tr> <td>First Name:</td> <td class='register'><input type='text' name='firstname' class='textbox' size='35'></td> </tr> <tr> <td>Last Name:</td> <td><input type='text' name='lastname' class='textbox' size='35'></td> </tr> <tr> <td>Username:</td> <td><input type='text' name='username' class='textbox' size='35'></td> </tr> <tr> <td>E-mail:</td> <td><input type='text' name='email' class='textbox' size='35'></td> </tr> <tr> <td>Password:</td> <td><input type='password' name='password' class='textbox' size='35'></td> </tr> <tr> <td>Confirm Password:</td> <td><input type='password' name='repassword' class='textbox' size='35'></td> </tr> <tr> <td></td> <td><input type='submit' name='submitbtn' value='Register' class='button'></td> </tr> </table> </form>"; if ($_POST['submitbtn']){ $firstname = fixtext($_POST['firstname']); $lastname = fixtext($_POST['lastname']); $username = fixtext($_POST['username']); $email = fixtext($_POST['email']); $password = fixtext($_POST['password']); $repassword = fixtext($_POST['repassword']); $website = fixtext($_POST['website']); $youtube = fixtext($_POST['youtube']); $bio = fixtext($_POST['bio']); $name = $_FILES['avatar'] ['name']; $type = $_FILES['avatar'] ['type']; $size = $_FILES['avatar'] ['size']; $tmpname = $_FILES['avatar']['tmpname']; $ext = substr($name, strrpos($name, '.')); if ($firstname && $lastname && $username && $email && $password && $repassword){ if ($password == $repassword){ if (strstr($email, "@") && strstr($email, ".") && strlen($email) >= 6){ require("scripts/connect.php"); /*$query = mysql_query("SELECT * FROM users WHERE username='$username' ");*/ $query=mysql_query("SELECT * FROM users WHERE username='$username' ") or die(mysql_error()); $numrows = mysql_num_rows($query); if ($numrows == 0){ /*$query=mysql_query("SELECT * FROM users WHERE email='$email' ");*/ $query=mysql_query("SELECT * FROM users WHERE email='$email' ") or die(mysql_error()); $numrows=mysql_num_rows($query); if ($numrows == 0){ $pass = md5(md5($password)); $date = date("F d, Y"); if($name){ move_uploaded_file($tmpname, "avatars/$username.$ext"); $avatar = "$username.$ext"; } else $avatar = "/avatars/default_avatar.png"; $code = substr (md5(rand(11111111111, 999999999999999)), 2, 25); mysql_query("INSERT INTO users (`first_name`,`last_name`,`username`,`email`,`password`,`avatar`,`bio`,`website`,`youtube`,`last_login`,`active`,`code`,`locked`,`date`) VALUES ( '$firstname', '$lastname', '$username', '$email', '$pass', '$avatar', '$bio', '$website', '$youtube', '', '0', '$code', '0', '$date')"); /*mysql_query("INSERT INTO users (Field, Type) VALUES ('', '$firstname', '$lastname', '$username', '$email', 'pass', '$avatar', '$bio', '$website', '$youtube', '', '0', '$code', '0', '$date')");*/ $webmaster = "Admin@trucksite.com"; $subject = "Activate Your Account!"; $headers = "From: Admin <$webmaster>"; $message = "Hello $firstname.\n\nWelcome to trucksite below is a link for you to activate your account!.\n http://tprofiletesting.net23.net/activate.php?code=$code"; mail($email, $subject, $message, $headers); echo "Your activation email has been sent to <b>$email</b>."; } else echo "That email is currently in use."; } else echo "That username is currently in use."; } else echo "You did not enter a vaild email."; } else echo "Your passwords did not match."; } else echo"You did not fill in all the required fields."; } echo "$form"; ?> </div> <div id='homeleft'> <center><font size='6'>Create! Showoff! Educate!</font></center> <hr /> </div> </body> </html> Guys/Gals; This below block outputs a very simple progress bar, i'm curious if anyone would see a solution to perform a task when this bar reaches the end as you can see it's set to countinue until width<400 when that 400 is true I and in essence the process is done (even though nothing in reality) i want to display countinue but only when it's done echo "<table width='100%' border='1' cellpadding='1' cellspacing='1' bgcolor='#666666'><tr><td width='506' height='52' valign='top'><script type='text/javascript'>function progress(){if(document.images['bar'].width<400){document.images['bar'].width+=5;document.images['bar'].height=5; }else{clearInterval(ID);}}var ID;window.onload=function(){ID=setInterval('progress();',$cpuspeed);}</script><img src='images/white.gif' name='bar'/><br /><font color='#ffffff'>Cracking....</font></td></tr></table>"; any dideas Hi guys, I've got quite a few fields in my tables that i've serialised to keep the number of fields down. For everything else that works perfect as it stores the data and when needed I can use the following as an example: $dateofbirth = unserialize($row['dateofbirth']); $dobday = $dateofbirth[0]; $dobmonth = $dateofbirth[1]; $dobyear = $dateofbirth[2]; Date of birth is stored as dd,mm,yyyy and for everything else I can call it fine. My issue is now that i'm trying to use fputcsv to create a csv file using the following: $result = mysqli_query($con, 'SELECT u.user_id, b.dateofbirth FROM Users u INNER JOIN Basic b USING (user_id) ORDER BY user_id DESC'); $fp = fopen('latest.csv', 'w'); fputcsv($fp, array('User ID', 'DOB' )); The CSV generates, but for the date of birth column in the csv it outputs as "a:3:{i:0;s:2:"03";i:1;s:2:"02";i:2;s:4:"1986";}" because it's obviously still serialised. What is my best and or easiest way of handling these fields? Many thanks in advance. Edited by Kristoff1875, 21 January 2015 - 05:24 AM. I have a dropdown menu <td width="148" height="35" valign="top"><b>Type: </b> </td> <td><select name ="tabledrop"> <option value="goggles">goggles</option> <option value="headbands">headbands</option> <input type='hidden' id='tabledrop' name='tabledrop' value = ''/> </select> </td> those 2 options are actually names of my tables. I tried this and got some syntax error. $type = $_POST['tabledrop']; $item = $_POST['goggles_name']; $price = $_POST['goggles_price']; $file = $_FILES['goggles_image']['name']; $query = "INSERT into $type SET [$type]_name = '$item' , [$type]_price = '$price' , [$type]_image = '$file'"; 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 Hello there, I've been searching for the answer to this for a while but haven't got anywhere. I'm fairly new at the whole PHP scripting so I maynot be phrasing it correctly Basically I just want a couple of things to happen: 1) A user registers and is shown a page confirming successful registration. This page confirms there details, tells them an email is on the way and they may now login. The problem lies here, I have made it so it inputs the username into the url. For example we end up with something like www.xxxxx.com/login.php?user=Jacketh. I would like it so that username value is input into the Username: input type on the login page. I'm guessing there must be some coding as that link doesn't actually put anything into it, the input does have id and name both as user. 2) Pretty much the same for the email confirmation, the link does the same and creates a query string that inputs the info into the specific fields. Is there a way to then click the submit button automatically or something? Hence if I input there username and password through the string and enforce automatic login? This would be nice if possible! Thanks, Jacketh hello. im having trouble putting an if statment in my loop this is my loop. Code: [Select] <div id="ddtabs3" class="solidblockmenu"> <ul> <?PHP foreach($topNav as $topNavs): ?> <li><a href="<?PHP echo $topNavs->title; ?>.php" id="<?PHP echo $topNavs->title; ?>"><?PHP echo $topNavs->title; ?></a></li> <?PHP endforeach; ?> </ul> </div><!-- #ddtabs3--> i what to add an if $pageName = '$topNavs->title'; then <li class = selected> any ideas thanks rick Thanks to the great help from some great people on this message board I'm right at the finish line on this page. I'm trying to mesh all the coding together at this point, and make it display the information. I keep getting 'mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource....etc..(filename/location) on line 51. Am I way off here??? Code: [Select] <?php $db_host = 'localhost'; $db_user = 'root'; $db_pass = ''; $db_in = new MySQLi ( $db_host, $db_user, $db_pass, 'sign_in' ); $db_out = new MySQLi( $db_host, $db_user, $db_pass, 'sign_out' ); if( $db_in->connect_error || $db_out->connect_error ) trigger_error( 'Unable to initiate database connections', E_USER_ERROR ); $q_in = 'SELECT * FROM `customer sign-in`'; $q_out = 'SELECT * FROM `customer sign-out`'; if( ($r_in = $db_in->query($q_in)) === FALSE || ($r_out = $db_out->query($q_out)) === FALSE ) trigger_error( 'Unable to grab ticket information from databases', E_USER_ERROR ); $data_in = array(); $data_out = array(); while( $row = $r_in->fetch_assoc() ) $data_in[ $row['Ticket #'] ] = $row; $r_in->free(); while( $row = $r_out->fetch_assoc() ) $data_out[ $row['Ticket #'] ] = $row; $r_out->free(); $result = array_diff_key( $data_in, $data_out ); echo "<table border='1'> <tr> <th>ID</th> <th>Sign In Date</th> <th>RANK/CIV</th> <th>First Name</th> <th>Last Name</th> <th>Unit</th> <th>DSN/Roshan</th> <th>Classifications</th> <th>Services Requested</th> <th>Service Tag/ Serial Number</th> <th>Ticket #</th> <th>Make/ Model</th> </tr>"; while($row = mysql_fetch_assoc($result)) { // Retrieve data until no more { echo "<tr>"; echo "<td>" . $row['ID'] . "</td>"; echo "<td>" . $row['Sign in Date'] . "</td>"; echo "<td>" . $row['Rank/CIV'] . "</td>"; echo "<td>" . $row['First Name'] . "</td>"; echo "<td>" . $row['Last Name'] . "</td>"; echo "<td>" . $row['Unit'] . "</td>"; echo "<td>" . $row['DSN/Roshan'] . "</td>"; echo "<td>" . $row['Classifications'] . "</td>"; echo "<td>" . $row['Services Requested'] . "</td>"; echo "<td>" . $row['Service Tag/ Serial Number'] . "</td>"; echo "<td>" . $row['Ticket #'] . "</td>"; echo "<td>" . $row['Make/ Model'] . "</td>"; echo "</tr>"; } } ?> Hello! I was working on a simple url generator, but than i though to myself, why not put everything in the root. I've heard thats not a good idea, but i'm ot sure why. I can immagine it gets really messy when you have a lot of files, but its also easy, if you ask me. I was just wondering what your view on this is. What are the pros and what are the cons? Thanks <?php $PostID = mysql_escape_string($_GET['postid']); ?> <?php If ($_GET['CODE'] == '0') { $GetPostData = "SELECT * FROM ".FORUM_POSTS." WHERE post_id='{$PostID}'"; $GetPostRes = mysql_query($GetPostData, $db); $PostText = mysql_result($GetPostRes, 0, 'post_text'); $AuthorID = mysql_result($GetPostRes, 0, 'user_id'); If ($memid == $AuthorID || $MemLevel >= 1000) { ?> <div class="maintitle" align="left"><img src="./images/nav_m.gif" width="8" height="8"> Editing Post</div> <form action="index.php?act=edit&postid=<?php echo $PostID; ?>&CODE=1" method="POST"> <table width="100%" cellspacing="1" cellpadding="4"> <tr> <td class="titlemedium" colspan="2">Make changes below.</td> </tr> <tr> <td class="row2" align="right" width="15%" valign="top">Post Text:</td> <td class="row2" align="left" width="85%"> <textarea cols="80" rows="20" name="posttext"><?php echo $PostText; ?></textarea> </td> </tr> <tr><td class="row2" colspan="2" align="center"><input type="submit" value="Post" /></td></tr> </table> </form> <?php } Else { ?> <div class="maintitle" align="left"><img src="./images/nav_m.gif" width="8" height="8"> Error</div> <table width="100%" cellspacing="1" cellpadding="4"> <tr><td class="row2">You do not have the permission to edit this post.<br>If you believe this is an error please contact an administrator.</td></tr> </table> <?php } } If ($_GET['CODE'] == '1') { //Gather Information $PostText = mysql_escape_string($_POST['posttext']); $PostText = htmlentities($PostText); $PostID = mysql_escape_string($_GET['postid']); //Update Database $EditQry = "UPDATE ".FORUM_POSTS." SET post_text='{$PostText}' WHERE post_id='{$PostID}'"; $EditRes = mysql_query($EditQry, $db); //Check Data went in If (!$EditRes) { ?> <div class="maintitle" align="left"><img src="./images/nav_m.gif" width="8" height="8"> Error</div> <table width="100%" cellspacing="1" cellpadding="4"> <tr><td class="row2">Could not modify database. Please contact administrator.</td></tr> </table> <?php } Else { ?> <div class="maintitle" align="left"><img src="./images/nav_m.gif" width="8" height="8"> Success</div> <table width="100%" cellspacing="1" cellpadding="4"> <tr><td class="row2">Post modified. Please go back to the thread to see it.</td></tr> </table> <?php } } ?> </div> This is my page for editing a post. However, whenever this form actually goes through, the query for some reason makes post_text in the database blank with no text in it whatsoever. I have tried echoing the query to see what it says and it has a perfectly fine query and I can copy/paste it manually to put it into the mysql but I don't get why this isn't adding it. Hi, I'm trying to create a simple BB code-type function, but I'm having trouble putting a function within preg_replace. Let me show you what I mean: Code: [Select] $bb_search = array ( '/\[b\]/', '/\[\/b\]/', '/\[img\=(.*?)\]/', ); $bb_replace = array ( '<b>', '</b>', check_image( '\\1' ), ); return preg_replace( $bb_search, $bb_replace, $text_string ); The first two (b and /b) work fine, even the function is recognised, but using \\1 doesn't put the bbcode value as the function value. I know that probably made no sense - I'm terrible at explaining these things, so sorry. If anyone can understand what I mean, even offer a solution, that would be great! Cheers! Hi Everyone, I'm trying to figure out a way to put my MySql data into a table. I'm close to getting this completed by I'm having some trouble. The data I'm inserting isn't being put into the correct tables. I'm not quite sure what I'm doing wrong. Any help? http://whatsmyowncarworth.com/practice/table.php Code: [Select] <?php include('init.php'); $result = mysql_query("SELECT * FROM info") or die(mysql_error()); echo "<table border='1'>"; echo "<tr> <th>Name</th> <th>Last Name</th> <th>Address</th> <th>City</th> </tr>"; // keeps getting the next row until there are no more to get while($row = mysql_fetch_array( $result )) { // Print out the contents of each row into a table echo "<tr><td>"; echo $row['first_name']; echo "</td><td>"; echo $row['last_name']; echo "</td></tr>"; echo "<tr><td>"; echo $row['address']; echo "</td><td>"; echo $row['city']; echo "</td></tr>"; } echo "</table>"; ?> |