Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by Irate

  1. Hint hint: You can test for $_GET['pageproducts'].
  2. Why not just use htmlspecialchars() or mysql(i)_real_escape_string()?
  3. Well, I've seen it and I must say that is indeed better than the older design (you know, new and such), but I do agree to trq.
  4. Irate

    css nesting

    I can very much understand people when they say that they want to use .sass because of variables... Continuously assigning margin: 0 auto; or whatever styles you might repeat over a few lines for multiple selectors can get tiresome!
  5. Which browser are you using? Usually, console is available by pressing Ctrl + Shift + I.
  6. Did you ever try to view the source code an image generates? Or, even, what the image consists of? You can get the contents of the file, yes. If you want only the image link, use some RegExp magic. <?php $fc = file_get_contents("http://vintage-british-diecasts.lefora.com/composition/attachment/6e0d8d1af650b33daea499e0757725d5/507827/P3270552.jpg"); $regex = "/<(?!http:\/\/vintage-british-diecasts.lefora.com\/composition/attachment/6e0d8d1af650b33daea499e0757725d5/507827/P3270552.jpg)(.*)?>/"; preg_replace($regex, "", $fc); ?> Edit: Yeah, the RegExp was written sloppily, but it serves the purpose.
  7. True and false boolean values are case-insensitive in PHP, for example. <?php $booltrue = TRUE; $boolfalse = FALSE; $citrue = true; $cifalse = false; $t = $booltrue === $citrue // $t now holds the value true $f = $boolfalse === $cifalse // $f is also true now ?>
  8. I don't like code completion either (unless it's in my console, there it's handy if you only need snippets to test one-liners), simple syntax highlighting is all a proper editor needs imo.
  9. No, it doesn't matter, but since this thread has been marked as solved, I though that I could throw in a joke. JS allows a function to define a global variable by omitting the var keyword, though, similar to PHP globals.
  10. JavaScript would like to differ ;P
  11. Besides, for calculators, if you don't want the page to reload at each submission of the form, why not use JavaScript? JavaScript is also an object-orientated programming language, so I believe it would very well fulfill your needs for this.
  12. Use the PCRE (preg_*) functions to do this? You can easily do this with something very simple as $regex = '/(hello|goodbye|morning|evening)(?:\|)/'; which matches either "hello", "goodbye", "morning" or "evening", followed by "|" (| is a control character in Regular Expressions so we have to escape it).
  13. You want to open a file and read its context, then explode on it? Easy. <?php function gc($file) { $stream = fopen($file,"r"); if(!feof($stream)) { $content = file_get_contents($file); $close = fclose($stream); return $content; } else { return false; } } $c = gc("test.txt"); if($c) { $arr = explode(",",$c,2); } print_r($arr); ?>That should work. Edit: And you can easily fetch the content from the array now. <?php $first = $array[0]; // "345" $second = $array[1]; // "567" $third = $array[2]; // "789" ?>
  14. You won't be able to do this without an SQL Database and with a proper index of all English words translated to your language, not mentioning commonly used phrases in English; so unless you are a major company or have very knowledgable native speakers and a lot of time, I wouldn't recommend doing this on your own.
  15. Cli as in Client, I guess. And I wouldn't have a do {} while(true) running all the time, initialize a variable that holds the value true and change it during function execution so that you have a way to fall out of the loop.
  16. Thing is, they're supposed to be dynamic and I want even illiterates to be able to use them without placing them inside divs or spans, so, for example... "This is Irate from {{homepage}} and recently, {{t12345,12345}} has caught my attention, so I want to thank {{u12345}} for creating this exceptional idea, which I have realized in {{h123}}." Am I being clear enough? :s
  17. Irate

    PHP Poll

    It is a very good practice to wrap all code in [ code ] [ /code ] tags (without the spaces so that it gets parsed correctly). Inline code which doesn't take up much space can be wrapped in [ ic ] [ /ic ] tags (again, without the spaces so that it gets parsed). Examples. // this is a demonstration of the code tag // it features a few comments to make its purpose clear $ic = 'this is some short inline code';
  18. So, I'm trying to implement a placeholder system on my forum, with a rather special syntax (I couldn't come up with something else, rather). Basically, they're supposed to look like this: {{t12345}} // link to an URL starting with t (for topics) {{t12345,12345}} // link to an URL starting with t but also include a fragment identifier for the exact post {{u12345}} // link to an URL starting with u (for users) {{homepage}} // any string of text can be inserted, I just want to interpret them differently, depending on the string {{h123}} // link to an URL starting with h (for html pages) So, I've written a Regex for this and want to replace it with according <a> tags... var regex = /\b(\{\{((t\d{1,5}|t\d{1,5}\,\d{1,6})|h\d{1,3}|DA|u\d{1,5}\}\}))/g; html = document.getElementsByTagName("body")[0].innerHTML; html.replace(regex, '<a href="$1">Generated link</a>'); That should do the basic user stuff, but for the homepage, HTML and topic URLs, I need an appending - to make the code work together with my forum's PHP pages. So, any ideas how I could change the URL according to the content on the $1 from the regex match? Thanks in advance...
  19. Start with a script that grabs all your recent articles via SQL.
  20. I'd like to point you to Google for this matter. Some information on Client-side XSS (also called non-persistent XSS): https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet (this explains how to perform XSS attacks so guard yourself against these) More Google results regarding this matter: http://www.veracode.com/security/xss As for SQL Injections, as kicken said, MySQLi's stmt method works just fine to prevent injections by default. Doesn't hurt to additionally escape data, though.
  21. $title = "Site Name"; echo "<title>$title</title>"; would be easiest, no need to use a function. If you want to fire a dynamic title change event, use JavaScript. This function, for example. function setTitle(title) { document.title = title; } And later on, you can register the function to various event handlers, for example, the .click() jQuery method. Example below. jQuery('#title_button').click(function(e){ e.preventDefault(); // prevent eventual predefined click events, if it is a link or so setTitle(jQuery(this).html()); // title now becomes the button's innerHTML, // but you can set it to any string value you want to, // and consider using the toString() methods });
  22. Remember, we're here on a site with over a million posts and over hundred thousand members (that are 5 zeros!), it is only natural that Google, Yahoo!, bing and facebook bots index this page.
  23. Why do you not want to use Flash again? Flash would be easiest to do as far as I know.
  24. Using OOP is a good start, and the jQuery framework for JavaScript provides the code to move an element with CSS. You can use the <canvas> tag to dynamically draw the animation into it with JavaScript.
  25. If Mozilla is giving out free copies of their browser's source code so that you can edit them, yes, you can edit it. Otherwise, no, and don't even attempt to do so. Edit: Made my post more clear to comprehend.
  • 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.