Jump to content

obsidian

Staff Alumni
  • Posts

    3,202
  • Joined

  • Last visited

Everything posted by obsidian

  1. Just some clarification... YYYY-MM-DD is the MySql date format. So, if you are using this (which is by far the best scenario for multiple reasons), be sure to declare your data type as DATE, too.
  2. That would be very nice. I would have to say, though, that the easiest solution would be for Microsoft to make IE standards compliant
  3. Use the MySql type DATE unless you also need the time, then use DATETIME. You can sort on the column, and you can use DATE_FORMAT() to retrieve the data in the format you desire, or it is extremely easy to parse with PHP as well.
  4. Nice. The Watcher carries an excellent persona for the monitoring you said this server will do. I'll have to keep that one in mind myself
  5. If you are determined to do it inline like that, at least clean it up a bit: function highlight(ele, action) { if (action == 'over') { ele.style.textDecoration = 'underline'; } else { ele.style.textDecoration = 'none'; } } <a href="#" onmouseover="highlight(this, 'over');" onmouseout="highlight(this, 'out');">Try me</a>
  6. Again, cron itself will not set the limits of an account, either. Cron simply executes a script in which you have the user's account limits reset. Now, if your site is fairly well trafficked, there may be a way to implicitly check for needed user updates from your visited pages, but your database load would go through the roof with the additional queries... One other thought would be to have each user's information checked when they log in. Have a column in the DB that stores the last time their limits were reset. Then, when they log in, if it has been >= 24 hours, reset their limits and update the timestamp. This would be fairly easy to implement, and it would simulate the resetting you are after.
  7. No. Remember that PHP is simply a preprocessor scripting language. It has nothing to do with execution or server activities. Your crontab is set up on apache (or scheduled tasks in Windows), and the server action executes the PHP script (or whatever language the script is written in).
  8. Good call, emehrkay. If you can indeed use the attachEvent for the handler, that would be great, since it will pile up all the handlers that you attach. So, whatever you run for your footer would need to be attached as well as the code that I sent you. If you have issues with attaching more than one action to the event, you can use my previous window.onload code, but you'll need to place everything that needs to happen at page load within that one function declaration.
  9. Hahaha! Awesome. I've always wanted a server named after me
  10. Some of the other lesser gods and goddesses of Greek and other mythologies are pretty fun, too, but I tend to like those of lesser renown personally
  11. Hmm... that's odd. My function doesn't do anything with layout at all... Do you have other JavaScript that needs to run on page load as well? My onload assignment may overwrite something you have in place...
  12. Actually, since it is within a string, the array syntax is fine
  13. At work, they always choose a theme for every new batch of servers, so if you're ever looking to pair another server (or more) with this one, it might be good to choose a theme or name bank from which you can pull additional ones in the future. We have database servers named after transformers (Megatron, etc) and our pubshare servers are characters from LoTR (Frodo, etc)... I've always been partial to the Norse gods myself, since they were actually mortal but retained a level of divinity. Something like Freyja or Heimdall (aka Rígr) would be cool. I really like the idea of Rígr, since he was the guardian of his realm, and that's sort of what your monitoring server is for... just some thoughts
  14. Exactly... Then, to retrieve the specific record you are after, use mysql_result. So, for instance, you want the 5th highest record: <?php $sql = mysql_query("SELECT id FROM table ORDER BY id DESC LIMIT 5"); $id = mysql_result($sql, 4, 'id'); ?> Remember that results are numbered as arrays, so your 1st record is actually row 0... Hope this helps. **EDIT** In fact, you could just do this with one query: 5th record: SELECT id FROM table ORDER BY id DESC LIMIT 4, 1; 10th record: SELECT id FROM table ORDER BY id DESC LIMIT 9, 1;
  15. Passing in the event and id are really not necessary for simply triggering a function like that. By the time you set your highlight function, your onmouseover has already been triggered. Try something like this: assign a recognizable class to all the anchor tags which you want this method applied. Then, when your page loads, dynamically apply the event handler to all the different pieces: Javascript: window.onload = function() { var eles = document.getElementsByTagName('a'); for (var i = 0; i < eles.length; i++) { if (eles[i].className == 'hover-me') { eles[i].onmouseover = function() { this.style.textDecoration = 'underline'; } eles[i].onmouseout = function() { this.style.textDecoration = 'none'; } } } } The above code will execute when the page loads to set all links with the class of "hover-me" to react in the way defined by the functions. So, all you have to do is set up your links: <a href="#" class="hover-me">I will change</a> <a href="#">I will not</a> Good luck!
  16. There is a function to help you with reading CSV files in PHP, so you don't have to do it all from scratch unless you really want to. Look into this as a possible alternative, too: <?php $id = array(); $tech = array(); $tech_area = array(); $handle = fopen("technologies.txt", "r"); while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { $id[] = $data[0]; $tech[] = $data[1]; $tech_area[] = $data[2]; } fclose($handle); ?>
  17. Typically speaking, you don't have to use conditional comments for styles. This is only necessary when you are doing some really off the wall layout with CSS. In 8 years of web work, I have only had two times where I had enough strictly IE code to merit using the conditionals and having an IE only style sheet. You really ought to check out the following website for the biggest IE hacks of which you need to be aware: http://www.positioniseverything.net
  18. He wrote it to return a value, so you need to echo the result.
  19. My first question is, why do you have separate pages for all this? You could just simply update a single CSS declaration at the top of your receiving page to output the color you have chosen. Try something like this for fun: <?php $avail_colors = array('red', 'green', 'blue'); $color = isset($_POST['color']) && in_array(strtolower($_POST['color']), $avail_colors) ? strtolower($_POST['color']) : 'black'; echo <<<STARTCSS <style type="text/css"> body { color: $color; } </style> ?> <!-- Data gets spit out here --> Keep in mind that CSS should always be printed out in the header of an HTML document, but for simplicity's sake I just put it straight out here.
  20. If you truly want to see if it starts with the img tag, use a regular expression: <?php if (preg_match('|^<img|i', $string)) { } ?> This is also case insensitive, in case the string comes back with <IMG for some reason.
  21. In your example, your first div has no width at all assigned to it. Unless it is picking up styles from somewhere else, it should stretch the entire width of the screen (this is DIV behavior by default). If having the "block" div is simply to assure that the LEFT, RIGHT and MIDDLE divs get dropped down beneath the first div, you may need to put a clear: both on it to be sure that it is clearing any previous styles. It would be much easier to help debug if you have a link or can post the generated markup (this also assures you are getting the expected result).
  22. OK, I was saying that if it was an array, you could check the number of records that way. After looking at your code, the variables you are checking are database resources, so you need to check the number of rows like this: <?php if (mysql_num_rows($result) > 0) { // records returned, so process } ?>
  23. [quote author=ProjectFear link=topic=106377.msg970676#msg970676 date=1219301553] I find it annoying when people say you're supposed to watch Star Wars in the order of I, II, III, IV, V, VI... Why the hell would he make the last three first if you were supposed to wait 25 years before seeing the first three. -_-" [/quote] I wouldn't say you're necessarily [i]supposed[/i] to watch them in the numerical order. That's the nice thing about prequels and well written stories that can each be completely self-contained. In an interview I read a long time ago, Lucas selected episodes IV, V and VI initially because he felt they were the ones most prone to holding up a solid story on the big screen (understandably so, given the time they were made). Interesting to think that now there are well over 50 [url=http://en.wikipedia.org/wiki/Category:Star_Wars_books]Star Wars books[/url] available to read. Thankfully, I don't think that Lucas will be trying to make them all into movies ;) [quote author=corbin link=topic=106377.msg971457#msg971457 date=1219362025] I must concur on LotR being better than Star Wars.  Then again, I prefer fantasy over sci-fi in general. [/quote] Definitely have to agree here. I had thankfully read all the LoTR books a second time shortly before [i]The Fellowship of the Ring[/i] came out, so I was once again reminded of the creative license that movie makers are (sadly) able to take in some cases. I mean, I've never really understood how a movie maker could completely change a character from a book or just decide to leave them out of the story completely (Tom Bombadil, for example). I still must say that, as a movie, the LoTR trilogy is one of my favorites. As for other fantasy writing in general, I've enjoyed reading Robert Jordan's [i]Wheel of Time[/i] series (although there are a couple duds in there) as well as reading Terry Goodkind's [i]Sword of Truth[/i] books. I would like to see someone get license to do a couple of the better stories in either of those series, too.
  24. Yes. this is one of the nice things about having a config file for large applications. Simply setting some variables and including a config file will let you take care of all the initial includes and instantiation of any classes and such needed on the page all from one file instead of having to duplicate code at the top of every page.
×
×
  • 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.