Jump to content

Clarkey_Boy

Members
  • Posts

    25
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Clarkey_Boy's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Try the following: [code] function randomquote() {     $quote_array = array(1 => "Quote 1", "Quote 2", "Quote 3", "Quote 4");     // OR:     $quote_array = array(1 => "Quote 1", 2 => "Quote 2", 3 => "Quote 3", 4 => "Quote 4");     // (Both of the above result in the same thing, just one is less code, the other is easier to understand to those that have not written the code. Remember to repeat the array up to number 31 (so carry on from 5 up to 31)).     $quote_number = date("d");     echo $quote_array[$quote_number]; } // Now call the function wherever you want the quote to be placed, as follows: randomquote(); [/code]
  2. Is this not classed as scripting, which is not allowed on most sites (particularly online games)? Or are you talking about logging in to a site which you own? RC
  3. So put them in a database with a day of the month next to them (as in 1st, 2nd, 3rd etc, not Monday, Tuesday, Wednesday). Then select the quote with the day column the same as the current day. RC
  4. nah... not sure whether I believe that theory - its possible but I cant prove it wrong (noone can prove it wrong as you can not prove a negative!). I just made the point about it not loading as it could have been to do with incorrect cookies or temp files or something like that (I dont know anything about that sort of thing). RC
  5. I have only read the first 5 or so posts so forgive me if this has already been mentioned. I would personally use a database to store the quotes, then have a random variable. I would check that the count in the quotes table where id = the random variable = 1. If the count is 0, I would "remake" the random number and do the same again and again until I got a number where count = 1. I would then draw the quote out of the table where id = random number and display that quote. RC
  6. So what you are saying is that lots of people have been having the same problem at the same times as I have? RC
  7. Hi, Today I have been using opera to access this site. However, a couple of times I have noticed that the page just does not want to load for a long period of time. The first time it recovered... but the second, well, it has not been working for several hours now and it still is not working. Any help would be appreciated. Thanks, RC
  8. Are you sure it should be $sstep, rather than $step? RC
  9. Yes, the <br> means line break - the next calculation would appear on the next line. RC
  10. ok... weird... I checked it again, and could not find any gibberish in any of the instruction cells. I then typed in the cells and reuploaded the database and it all seems to work fine now. I then went back to the old database and found that, still, I could not find ANY gibberish what-so-ever. Thanks for the help, RC
  11. Sorry for the double post but... Just looked through the gibberish and noticed it says "manifests" quite a lot, and gives a mention to the exact location of the view recipe page on the server, and the location "C:/Windows/Win32/rtcres.dll". I know there is a directory, in "C:/ Windows/WinSxS", called "manifests" but have no idea what any of it means. It seems to be pointing at quite a few of the files I have in my windows folder, and 1 from the folder on the server. RC
  12. Now take another look at it, using Opera browser. Look at the source code. It may not show any serverside code but you can still see that it is one big form. I seriously dont think it is possible to take data from another form on submit. RC
  13. You should be able to do this using just one form, and one submit button... thats how I would do it. RC
  14. I checked the record. I noticed that, like with the other record, there are amounts and measurements listed which should appear before the sub heading "instructions". For some reason, these details are missed out for id 1 but are there for id 2. Then, it skips on to writing "instructions". If there was an error, "instructions" would not appear, would it? All that gibberish is not ANYWHERE to be seen in the table. RC Edit: Thats another good point... how could the gibberish be in the table when it changes on every refresh? Ps I have added another recipe (just put random letters in for all the field) and that seems to work fine - just id 1 that seems to be gibberish. I could just delete it but I really wanna find out where it comes from so that I can try to prevent it happening again in the future.
  15. The code is as follows: The view recipe function: [code] <?php function viewrecipe($id, $status) { include "variables.php"; for($recipe = $conn->Execute("SELECT * FROM recipes WHERE ID = $id"); !$recipe->EOF; $recipe->MoveNext()) { $title = $recipe->Fields("title"); if($status == 1) { title($title); subtitle("Ingredients"); echo "<table width=100%>"; for($counter = 1; $counter <= 10; $counter++) { $ingredient = $recipe->Fields("ingredient".$counter); $amount = $recipe->Fields("amount".$counter); $measurement = $recipe->Fields("measure".$counter); if($ingredient <> "" && $amount <> "" && $measurement <> "") { $ingredient = strtoupper(substr($ingredient, 0, 1)).substr($ingredient, 1, 100); for($counter2 = 0; $counter2 < strlen($ingredient); $counter2++) { if(substr($ingredient, $counter2, 1) == " ") { $ingredient = substr($ingredient, 0, $counter2 + 1).strtoupper(substr($ingredient, $counter2 + 1, 1)).strtolower(substr($ingredient, $counter2 + 2, 255)); } } echo " <tr><td width=5%></td><td width=45%><font style='color:#ffffff'>".$ingredient."</font></td><td width=45%><font style='color:#ffffff'>".$amount.$measurement."</font></td><td width=5%></td></tr>"; } } echo "</table>"; subtitle("Instructions"); echo "<table width=100%><tr><td width=100%>"; for($counter = 1; $counter <= 10; $counter++) { $instruction = $recipe->Fields("instruction".$counter); echo $instruction; } echo "</table>"; subtitle("Comments"); for($selectcomments = $conn->Execute("SELECT * FROM comments WHERE recipeid = $id"); !$selectcomments->EOF; $selectcomments->MoveNext()) { echo "<table width=100%>"; $submitter = $selectcomments->Fields("userid"); $recipecomment = $selectcomments->Fields("recipeid"); $comment = ""; for($counter = 1; $counter <= 10; $counter++) { $comment .= $selectcomments->Fields("comment".$counter)->Value; } for($selectcurrentuser = $conn->Execute("SELECT * FROM users WHERE username = '$username' AND password = '$password'"); !$selectcurrentuser->EOF; $selectcurrentuser->MoveNext()) { $currentid = $selectcurrentuser->Fields("ID"); } if($submitter == $currentid) { $comment .= "[Edit]"; } echo "<tr><td width=100%><font style='color:#ffffff'>".$comment."</font></td></tr>"; echo "</table>"; } } elseif($status == 0) { subtitle("<font style='font-size:25px; color:white'>Recipes</font>"); $subtitle = "<a href=viewrecipe.php?rid=".$id.">".$title."</a>"; subtitle($subtitle); } } } ?> [/code] (There is nothing wrong with any functions used inside this function, such as bodytext() and subtitle().) The view recipe page (this is different to the function - the functions page is included in this page then the function drawn out of it): [code] <?php session_start(); include "variables.php"; include "functions.php"; ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title><?php echo $gamename." - Homepage"; ?></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor=<?php echo $bgcolor; ?>> <?php if(isset($_SESSION["username"]) && isset($_SESSION["password"])) { identifyUser(); } $page = 5; $pospage = 5; $userGroup = $_SESSION["usergroup"]; $loggedIn = $_SESSION["loggedin"]; $colour = "darkblue"; siteheader("Welcome to ".$sitename, $headercolour); echo "<table width=100%><tr><td width=25%>"; contents($page, $userGroup, $headercolour); echo "</td><td width=50%>"; if($loggedIn == 1) { $title = "View Recipe"; title($title); $rid = $_GET["rid"]; viewrecipe($rid, 1); } echo "</td><td width=25%>"; if($loggedIn == 0) { login(); register(); } echo "</td></tr></table>"; ?> </body> </html> [/code]
×
×
  • 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.