Jessica
Staff Alumni-
Posts
8,968 -
Joined
-
Last visited
-
Days Won
41
Everything posted by Jessica
-
[code]<div id="clock"> <script language="javascript"> // Get the server time and GMT offset var server_offset = <? print(date('Z')); ?>; var server_time = <? print(time()); ?>; // The clock DIV var clock = document.getElementById("clock"); // Get the client GMT offset var client_offset = new Date(); client_offset = client_offset.getTimezoneOffset() / 60; // Get the appropriately mapped time var client_time = server_time; var clock = document.getElementById("clock"); var client_time = server_time; function js_clock() { var date_time = new Date((client_time * 1000)); var date = date_time.getDate(); var month = date_time.getMonth() + 1; var year = date_time.getFullYear(); var hours = date_time.getHours()+(client_offset-5); var minutes = date_time.getMinutes(); var seconds = date_time.getSeconds(); var suffix = "AM"; if(hours > 11){ suffix = "PM"; hours = hours - 12; } if(hours == 0){ hours = 12; } if(hours < 10){ hours = "0" + hours; } if(minutes < 10){ minutes = "0" + minutes; } if(seconds < 10){ seconds = "0" + seconds; } if(month < 10){ month = "0" + month; } clock.innerHTML = hours + ":" + minutes + ":" + seconds + " " + suffix; client_time++; setTimeout("js_clock()", 1000); } js_clock(); </script> </div>[/code] This is what I got, I checked it by setting my computer timezone differently and it works.
-
[!--quoteo(post=373554:date=May 13 2006, 01:21 PM:name=eXtaZa)--][div class=\'quotetop\']QUOTE(eXtaZa @ May 13 2006, 01:21 PM) [snapback]373554[/snapback][/div][div class=\'quotemain\'][!--quotec--] You can use the date funtion in php, its by the server time and its much more simple... [/quote] but then the clock isn't dynamic.
-
[!--quoteo(post=373545:date=May 13 2006, 12:32 PM:name=eXtaZa)--][div class=\'quotetop\']QUOTE(eXtaZa @ May 13 2006, 12:32 PM) [snapback]373545[/snapback][/div][div class=\'quotemain\'][!--quotec--] I think that by the user's computer time... [img src=\"style_emoticons/[#EMO_DIR#]/unsure.gif\" style=\"vertical-align:middle\" emoid=\":unsure:\" border=\"0\" alt=\"unsure.gif\" /] But I don't know exacly... [/quote] yeah..it is the user's. My fiance is trying to help me get it to display server time, or at least just the same time for everyone, we want it in CST. :(
-
That'll do the trick! Is it going off my server time or the user's computer's time?
-
I've been trying to find a javascript clock, and all the ones I find by googling are in forms in the input field type. Does anyone know how I would do this without putting it in a form? Thanks
-
[b]EDIT: [/b]Uhm, I have no idea what happened. It wasn't working for hours last night. I looked again just now and it works. So...if anyone wants to take a gander, feel free, but it's working now so I'm good. Sorry! I have [a href=\"http://doublooncove.net/stalls.txt\" target=\"_blank\"]this php code[/a] saved as stalls.php. I need to display it on several different pages, so I am including it in them. Here is one page it is included in: [code]session_start(); include_once('../functions.php'); validate_user(); include_once('../loc_names.php'); $location = $session_loc_id; if($location != 1){ header('Location: http://www.doublooncove.net/explore'); die(); } include_once('../header.php'); ?> <h1>Top of the Third Pier</h1> <p> The infamous third pier of the port of the emerald coast lives up to its reputation. A few gangs of burly sailors shift cargo up the pier while a shifty-eyed man whispers quietly with their stern captain. A weasely merchant tries to sell you a parrot that appears to actually be dead, and you feel a hand tug at your pockets as an old beggar jostles into you. What a great place to do business!</p> <? include_once('../stalls.php'); include_once('../footer.php');[/code] The problem is when I view just stalls.php it prints the variables title, till, etc. When I view it in this page, it prints everything but the variables. What is wrong?
-
[!--quoteo(post=366104:date=Apr 18 2006, 01:10 PM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ Apr 18 2006, 01:10 PM) [snapback]366104[/snapback][/div][div class=\'quotemain\'][!--quotec--] It works fine for me. Whats the problem? If I selected 2 from the menu na orange square appears in the brown box and if I select 1 a red box apears in the brown box. [/quote] Someone else already helped me on another forum, was just about to come delete this ;)
-
SOLVED!! [a href=\"http://doublooncove.net/test.txt\" target=\"_blank\"]Here is the code[/a] [a href=\"http://doublooncove.net/test.php\" target=\"_blank\"]Here is the test page[/a] The image should change to 1 or 2 when you click on 1 or 2 in the drop down. I have tried onBlur, onClick, onChange and onFocus. What should I do?
-
Sorry, maybe I didn't ask clearly enough. I know there are advantages to using OOP, but I don't understand what it is. It's classes & functions, having objects...but I don't know how you would write PHP without those things.
-
I'm having trouble understanding the concept of OOP and non-OOP programming. I was taught that PHP is an OOP language, yet someone is telling me they can code PHP without it being OOP. Can someone please explain OOP in an easy to understand way, and if PHP can be non OOP, an example?
-
[!--quoteo(post=361729:date=Apr 4 2006, 04:03 PM:name=redbullmarky)--][div class=\'quotetop\']QUOTE(redbullmarky @ Apr 4 2006, 04:03 PM) [snapback]361729[/snapback][/div][div class=\'quotemain\'][!--quotec--] hey, if someone wants a percentage to start at 15 and end at 35, who am i to argue? [/quote] I do have a reason ;) I promise, I'm not totally insane.
-
[!--quoteo(post=361708:date=Apr 4 2006, 03:17 PM:name=Dan R.)--][div class=\'quotetop\']QUOTE(Dan R. @ Apr 4 2006, 03:17 PM) [snapback]361708[/snapback][/div][div class=\'quotemain\'][!--quotec--] But it would not work if you wanted 1/10 to be 15%, it would have made 1/10 equal to 17% (15 + (1/10 *20)) But I see now that you wanted 0 to be 15% - did you edit that or was it just Mark who started all this 1/10 = 15% nonsense ;) [/quote] That was my fault, I fixed it to reflect it. I've got it working perfectly now. I meant when A=0, not a=1 :) Sorry!
-
Actually the way redbullmarky posted worked perfectly. Here's what I get now when B = 7 0/7: 15 1/7: 17 2/7: 20 3/7: 23 4/7: 26 5/7: 29 6/7: 32 7/7: 35
-
[!--quoteo(post=361633:date=Apr 4 2006, 01:01 PM:name=redbullmarky)--][div class=\'quotetop\']QUOTE(redbullmarky @ Apr 4 2006, 01:01 PM) [snapback]361633[/snapback][/div][div class=\'quotemain\'][!--quotec--] yes. [/quote] Thaaank you :)
-
[!--quoteo(post=361630:date=Apr 4 2006, 12:57 PM:name=redbullmarky)--][div class=\'quotetop\']QUOTE(redbullmarky @ Apr 4 2006, 12:57 PM) [snapback]361630[/snapback][/div][div class=\'quotemain\'][!--quotec--] assuming that your examples are not shown with the results you expect, then: [code] $percent = ($a/$b)*35; [/code] would give you a "percentage" with 35 as the top value, as the normal way to work out percent is: [code] $percent = ($pizza_slice_size/$pizza_full_size)*100; [/code] [/quote] So if I want only between 15-35, I could do: $percent = ($a/$b)*20; and add 15% right?
-
[!--quoteo(post=361626:date=Apr 4 2006, 12:48 PM:name=redbullmarky)--][div class=\'quotetop\']QUOTE(redbullmarky @ Apr 4 2006, 12:48 PM) [snapback]361626[/snapback][/div][div class=\'quotemain\'][!--quotec--] Hi i'd hazard a guess that this is purely a math question rather than php at all, but i can't see any way that $a=1 and $b=10 could ever create 15%, even by using 35 instead of 100 to work out the percentage?... maybe you could elaborate a bit more? Cheers Mark [/quote] I know, but I couldn't find anywhere else to ask, and I am trying to do it in PHP ;) Let me try to explain better. Depending on how close A is to B, I want to pick a number between 15-35. We could make it just 0-20 and add on 15 later. So if B is 20, it's easy: A=1, number = 0, so +15 = 15% when A = 10, number = 10, 25%. When A is 20, number=20 +15 = 35% Make sense? It's easy when B is 20, but if B is 7 and A is 4... How do I find the number on the scale? A..............B 0..............20
-
Use cookies AND sessions to ensure the best security. You have cookie_username cookie_userid cookie_login (username+md5(pw)) session_login session_username session_userid Cookies can be edited, so you always want to make your code refer to the SESSION variables, NOT the cookies. You want to check on each page that the cookie login and username MATCH the session login and username. If the session doesn't exist, you get the info from the database using the cookie info and set the session. Otherwise, someone can change their cookie to whatever they want and if you don't verify it against the session, they'll get in.
-
**SOLVED** Sorry if this isn't appropriate for here, but I can't figure out how to do this. I have two variables, a&b. I want to establish a percentage between 15-35 based on a&b. So if: $a = 0; $b = 10; $percent = 15% $a = 5; $b = 10; $percent = 25% $a = 10; $b = 10; $percent = 35% To summarize: the closer A gets to B, the higher the percentage is. So stuck on how to do this? Any help would be GREATLY appreciated, thank you SO much!
-
Thank you. So it's because of the unique_id being in there too?
-
Could someone help me fix this: [code]$get_items = "SELECT count(*) AS wood_count, unique_id FROM items WHERE owner = '$cookie_userid' AND location = 'inventory' AND item_id = 22"; if ($db_result = $db_conn->Execute($get_items)) { if ($db_result->RecordCount()) { while (!$db_result->EOF) { $wood_ids[] = $db_result->fields['unique_id']; } $wood_count = $db_result->fields['wood_count']; } $db_result->Close(); } else die('SQL Error #'.$db_conn->ErrorNo().': '.$db_conn->ErrorMsg()); [/code] It gives the error SQL Error #1140: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause Thanks.
-
[!--quoteo(post=353022:date=Mar 8 2006, 03:44 PM:name=lessthanthree)--][div class=\'quotetop\']QUOTE(lessthanthree @ Mar 8 2006, 03:44 PM) [snapback]353022[/snapback][/div][div class=\'quotemain\'][!--quotec--] The only real advantage it has over intval is that if you are definitely expecting a number you can use something like if(!is_numeric($_GET["id"]) //print some kind of error. Which can quite often be useful. [/quote] Okay great, thanks :) I will remember that one.
-
[!--quoteo(post=353011:date=Mar 8 2006, 03:36 PM:name=lessthanthree)--][div class=\'quotetop\']QUOTE(lessthanthree @ Mar 8 2006, 03:36 PM) [snapback]353011[/snapback][/div][div class=\'quotemain\'][!--quotec--] just to add. If you're expecting numbers as well as using intval you could use is_numeric() [/quote] Why would I do that? Doesn't that just find out if it is a number, wheras intval returns the numeric value? Can you explain the value of checking if it's a number? Thanks :)
-
Hi :) Right now I have a few functions I am using for when a user submits info, which strip out anything that could be dangerous. Is there anything else I need to add, or do they look okay as is? Here are two of them: [code]function safe_POST($item){ $item = mysql_real_escape_string(strip_tags($_POST[$item])); return $item; } function safe_int_GET($item){ $item = intval($_GET[$item]); return $item; }[/code]
-
[!--quoteo(post=346584:date=Feb 16 2006, 05:37 PM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ Feb 16 2006, 05:37 PM) [snapback]346584[/snapback][/div][div class=\'quotemain\'][!--quotec--] That's exactly what an index is for -- and yes, generally speaking, most (if not all) tables have a UID field that is indexed as the PRIMARY key. So if you ask for UID=5324521, the DB doesn't have to read through the entire table just to find it, since the index "knows" where the record is located within the table file itself. If this were not the case -- e.g. if you searched for first_name = 'joe' -- and there was no index on first_name, the DB would have no choice but to search the entire table for instances of 'joe', which is several orders of magnitude slower. Make sense? [/quote] Perfectly :) Thanks for all your help!
-
[!--quoteo(post=346554:date=Feb 16 2006, 04:07 PM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ Feb 16 2006, 04:07 PM) [snapback]346554[/snapback][/div][div class=\'quotemain\'][!--quotec--] wickining1 is simply referring to have correct indexes set up for your DB tables, so that the server never has to resort to actually seeking through the actual table data to find the records you request. This sounds easier than it actually is, but for the most part, common sense will prevent 90% of "typical" queries from causing a "table scan". [/quote] Okay. I've read a lot of articles and even a few books on game design and database design, so I think I have a fair idea of the concept, it's just a few of the technical hang ups that get me. I'd just never heard of a table scan. My tables all have IDs, so when I need an entry I get the entry at ID x, that's what you mean right?