Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by Fmdpa

  1. <style type="text/css"><?php if ($page == 'home') { echo "body { background-color:#007FA6 }"; } else echo "body { background-color:inherit }";?></style> Just so you know, there is a vulnerability in your code. Because you are taking the $_GET values and including them if the file exists and the page is not home, a savvy user can include basically any .php file on your computer. PHP has access to files on the web server that web browser usually don't have access to. Because the user can only include .php files, your script is not as vulnerable as this would be: if(isset($_GET["page"]) && $_GET["page"] != "home"){ if(file_exists($_GET["page"])){ include($_GET["page"]); echo '<title>'.$title.'</title>'."\n"; echo '<meta name="description" content="'.$meta_description.'" />'."\n"; echo '<meta name="keywords" content="'.$meta_keywords.'" />'."\n"; } else{ include("PageNotFound.php"); } }else{ include("home.php"); }
  2. Fmdpa

    replacing linebreak

    I'm not sure why you'd need it all on one line, but you should be able to remove line breaks with this regular expression:JS regex: /(\r\n|\n|\r)/gmPHP regex: '/(\r\n|\n|\r)/s'Example usage: var text = "Multiline text !"text.replace(/(\r\n|\n|\r)/gm, ''); Or PHP: $text = "Multiline text !";$text = preg_replace('/(\r\n|\n|\r)/s', '');
  3. Congrats on the new site!You did a good job at integrating all the APIs and I'm sure you did a lot of backend work. However, I have a few suggestions as far as design goes.Homepage:I would add a padding or margin around "Facebook Profile" and "Friends". Possibly a bit around "Latest News", too. About:Same thing with "The Studio"Gallery:Same thing with the headings in the Etsy bar ("Etsy ListingsWhispy Fumed Wine Stopper") and the "Gallery" heading.Also, I the blue text color in the main content container doesn't work, IMO. You may have to do some experimentation to make the text color fit with the theme and not clash with the grey bg. Media: Padding for the headings on the youtube videos bar. Padding around the heading for the featured video.Contact: More padding around the cramped headings...Links: Padding around headings on the tweets bar (below "Latest Tweets").__________________I like how you designed each page with its own color theme, but lack of padding/margins around headings was what stood out to me most. One more very minor thing. I'd design the navbar slightly differently. You have to click on the text for the link to work. I find it slightly annoying that I can't click on the underline. Instead of making the underline a separate <span>, I'd do something like this: /* default styles for navbar links */#navbar li { padding:3px; padding-bottom:15px; border-bottom:2px solid #222; font-size:16px; color:#eee;}/* hover styles for list elements on the navbar */.brown:hover { color:brown; border-bottom-color:brown; }.purple:hover { color:purple; border-bottom-color:purple; }.blue:hover { color:blue; border-bottom-color:blue; }.green:hover { color:green; border-bottom-color:green; }.red:hover { color:red; border-bottom-color:red; }.orange:hover { color:orange; border-bottom-color:orange; }/* for active links... */li.brown_text { color:brown; border-bottom-color:brown; }li.purple_text { color:purple; border-bottom-color:purple; }li.blue_text { color:blue; border-bottom-color:blue; }li.green_text { color:green; border-bottom-color:green; }li.red_text { color:red; border-bottom-color:red; }li.orange_text { color:orange; border-bottom-color:orange; } HTH!
  4. Are you talking about using <meta> tags for SEO?
  5. To explain further...Here's a link to the extension. But it does not work on Twitter since navigation is asynchronous. I need a way of detecting AJAX requests so I can re-filter the page.
  6. Thanks for the overview! I was wondering about svn myself recently. It looks difficult to set up, but I imagine having the systematic workflow saves a lot of time.
  7. The server is what serves (gives) the HTML to the browser. Server-side languages like PHP and ASP can control what the HTML should look like when it is given to the browser.
  8. Sorry I didn't give the context. I'm building a web browser extension, so I need a way of dynamically intercepting all asynchronous updates to the page.
  9. I'm working on a project where I need to detect whenever the page is updated asynchronously. How could I do that?
  10. Fmdpa

    Practical JSON

    One more thing: is there a way I can "push" values into JSON, like array.push()?
  11. Fmdpa

    Practical JSON

    I think I'm ready for some meat! I've seen some useful little functions he's written (not to mention his large projects) and I'm very interested in the tricks he has up his sleeve.
  12. Fmdpa

    Practical JSON

    Thanks for the replies, guys! Thank you for the link to that book, thescientist. John Resig is a programming genius so that looks like a great book.
  13. Fmdpa

    Practical JSON

    Yeah, I do think they are sort of weird. Unlike the dozens of PHP functions available for PHP associative arrays, JSON seems like it has no connection with JS (other than it being "supported"). You can do lots of stuff with JSON (as illustrated profusely in jQuery), but it seems like native JS doesn't allow you to do much with them unless you create functions and loops, etc. Basically what I'm trying to say is that you have to create your own functions, which is unlike PHP's interaction with associative arrays (I actually sort of enjoy extending Javascript's functionality like that, though). Your for..in example was helpful, thescientist. I still don't see why this doesn't work: document.body.style = { color: 'green', background: 'blue', border: '1px solid yellow'} Since you are assigning this to "document.body.style", you'd access the color like this: "document.body.style.color". Since you are assigning the value of "green" to the color key, why isn't it the same as this: document.body.style.color = 'green'? Also, can I extend the JSON object?e.g. JSON.prototype.count = function() { return this.length}
  14. Fmdpa

    Practical JSON

    Is there a way to iterate through a JSON hash?
  15. There doesn't seem to be a whole lot of info on JSON on the web. I realize it can be used for things like APIs, but are there any native Javascript applications that use JSON? For example, could I do this: document.body.style = { color: 'green', background: 'blue', border: '1px solid yellow'} Also, are there any JS methods for handling JSON?
  16. Here's a good tutorial: http://net.tutsplus.com/tutorials/javascri...vanced-drawing/At its current state, it is not a replacement for Flash. However, I'm sure the introduction of more libraries will make this challenge more credible.
  17. Fmdpa

    Browser Discussion

    I've really been enjoying Opera Dragonfly. It is web-based, which has its advantages and disadvantages. The advantage is that it does affect the browser's speed until you load the console. I believe it is possible to download the Dragonfly script so it is running locally.
  18. Usually, you check if the data passes the validation, and if it does, then continue. if (data is valid) { //continue} else { echo 'errors';} If you need more specific errors than "something is wrong", you could check each field individually. $max_val = 500;$errors = '';if ( !filter_var($_POST['number'], FILTER_VALIDATE_INT) ) { $errors .= 'Please enter a valid number.';} if ( $_POST['number'] > $max_val ) { $errors .= 'Please enter a number that is no greater than ' . $max_val;}if ( !$errors ) { // continue}
  19. Fmdpa

    Browser Discussion

    Yeah...The only thing that I liked a lot in FF4 (over other browsers) was the addons browser.
  20. That looks similar to the jQuery source code... Now it is making sense! They most use a tool similar to this to compress the jquery.js file. I was thinking it would be impossible to develop jquery using such meaningless variables and function names. I have never looked at the development code, but I imagine it makes much more sense.
  21. Fmdpa

    Pageview Counter

    Either in a database or file (database would be easier). You can get the IP and the timestamp like this: $ip = $_SERVER['REMOTE_ADDR'];$timestamp = time(); So you want the hits to be tied to a specific page, including the GET variables?
  22. You are not making the forward-slashes optional. If you want to make variable2 optional, then you must also make the slash before variable two optional. I'd group the variables like this to make the second directory optional: RewriteRule ^directory/([a-zA-Z0-9-_;:=]*)(/([a-zA-Z0-9-_;:=]*))? testpage.php?variableone=$1&variabletwo=$3 [NC]
  23. Is it possible to nest CSS functions? Here's the code I have now, and the debugger is giving me a "function unknown" error. img:after { content:url(attr(src));}
  24. XML sitemaps help to tell the search engine bot when pages are updated so they can be reindexed. http://www.sitemaps.org/protocol.phphttp://en.wikipedia.org/wiki/Sitemaps
  25. Another + for Netbeans. Check out this thread for a much larger discussion on code editors: http://w3schools.invisionzone.com/index.php?showtopic=760
  • Create New...