Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by Irate

  1. You can use a for-loop for this. Possibly also dynamically compute the amount of pages you want to load before you use a hard-coded constant.
  2. You can use regular expressions to filter user input. For example, you have the submit button for the textarea which has a name of, say, "newpost". You can just generally filter out HTML tags to only allow wysiwyg tags (BBCode, to be exact) with regular expressions. An example below. $post = isset($_POST["newpost"])&&!empty($_POST["newpost"])?$_POST["newpost"]:""; if($post) { $post = preg_replace("#<(.*?)>#gm",""); # modify the string further now }You can also a predefined editor for this, such as the SCEditor (being used by a free forum host which I frequently use) or others.
  3. What AbraCadaver posted is quite a good example. compact() is quite what you want. Check the official document of compact() and then think how to use the script again. AbraCadaver possibly covered it all, just pointing out what he did.
  4. Check the code, you are creating a variable named $arr1, and then you reset $arr1u, not $arr1. Edit: bolded the u
  5. It is frowned upon to steal from other sites... But, anyway, your best guess is PHP - $othersite = file_get_contents("http://someurl.com"); would copy the contents of the source code into the variable $othersite. If you cannot use PHP, use document.documentElement.innerHTML.toString() in JavaScript, that'd give you the entire head and body content of the site, though you'd might need to check for any attributes on the documentElement if they are relevant to the site flow (like, if its dir attribute it rtl and not ltr, or the lang is something other than en). Once again, stealing stuff from other sites is frowned upon. Don't do it. Examples above are just for documentation purpose, I do not condone any misconduct...
  6. Try using something like this... $.fn.req = $.fn.jquery.indexOf("1.3.") > -1 ? $.fn.click : ($fn.jquery.substr($.fn.jquery.indexOf("1.4."),$.fn.jquery.lastIndexOf(".")) >= "1.4" ? $.fn.dblclick : $.fn.click);If the jQuery version is 1.3 (or any version of 1.3), the $.fn.req property will be the normal click method of the jQuery object, otherwise, if the version is 1.4 or higher, it will be the dblclick function.So, to write code with the .req property, you'd do something like this. $(function(){ $('#clicked_element').req(function(e){ alert(e + " was fired."); }); });By the way, $.fn is the jQuery prototype object.
  7. I guess you are using XML for that, so why not use simplexml for PHP? It's quite a nice library with very handy methods and properties on your .xml file. If you want to call the string directly, why not use a <response attribute="your string" />? You can then call an eval($xmlfile->response{"attribute"}) (well, to be honest, I forgot the syntax for getting an attribute of an element... but look up the online documentation for simplexml) or whatever you need to do with the string.
  8. Gmail has some SMTP solutions, you could try there. That'd of course require an internet connection, but so do the Linux distributions... well, generally everything with emails.
  9. As someone with a high status here says in their signature... "Using global is a sign of doing it wrong." So, because this is necessary, where do you want to have $db defined? Everywhere in your class? Everywhere in PHP?
  10. Try this... preg_match('#"key":"(.*?)"#',$content,$match); echo $match[1];
  11. Irate

    localhost question

    Check your httpd.conf or your apache.conf file, find the line named "Listen" and change it to "Listen 1234", where you can change 1234 to whatever port you want. You must also then type in, if your line was 1234, "localhost:1234" or "" and then your file URL.
  12. 32603 profile views doesn't seem legit O_O

    1. Show previous comments  1 more
    2. Irate



      I really wonder who even searches for me.

    3. KubeR


      Or you're just so lovable...

    4. Irate


      I'd say so, too ;)

  13. Try using JavaScript for that jQuery (a JavaScript framework) has some excellent modal dialog box support.
  14. Try using JavaScript for that jQuery (a JavaScript framework) has some excellent modal dialog box support. Edit: to the moderators, I excuse for the double post :/ My mobile made itself self-concious and posted twice (no, I had to reset my connection and my mobile resent the data)
  15. To add something to what Psycho said... Web Design nowadays is a lot more than just setting a few fonts, some fancy colors here and some nice padding, right now, with CSS 3, transitions are coming to enable previously static sites to be animated without using any scripting language (Flash (as in, ActionScript, too), JavaScript, Java) and they require quite a lot of skills, and it is definitely nothing to be looked down upon. Web Design can, just like Web Development, get you a nice and quite well-paid job, and it is nowhere near being bored during the job. However, Web Design also involves generally graphical skills (Photoshop, etc.) and, most importantly, a good imagination of how your ideal website would look like (unlike the Web Developer who cares for the actual functionality of the site). I cannot really speak about qualifications or any experience in jobs right now, though, as I am right now only getting ready to start searching for jobs myself. As Web Developer, you will certainly have a more "challenging" job experience (if you're not currently using CMS's, that is) due to the complicated nature of all programming languages for the unskilled eye. If that's what you like to do (I do, certainly), then go get yourself a nice degree. I'll do just that, possibly a general degree for Computer Science or something more specific like a qualification for online programming languages, though I believe my nearest university does not offer such course. Oh well. Help my post helped you out deciding a bit
  16. Irate

    localhost question

    Your files should be located in the htdocs folder, otherwise localhost won't respond to them.
  17. @.josh: Hm, true that, but doesn't your code invoke preg_match at least twice, too? Anyway, yeah, point taken. I'm still learning the extensive parts of PHP, as in, query minimization, storage release and so on.
  18. It would have worked with the code I gave you at the start, too, it just depends on how you need to work with it. Glad you found a fitting solution.
  19. Try using background-image: url('/Living_Space_Construction_Logo.jpg'); - also, are you sure the image should be located in the root folder?
  20. Do you have Apache installed and can you access your .htaccess file? You can perform URL rewriting from there. Like this. RewriteEngine On RewriteRule ^/wp-content/uploads/(.*)$ /media/$1
  21. Did you modify anything on your server recently? If the access such site, well... Try this. <?php foreach($_GET as $g) { if(preg_match("~[\da-zA-Z]+~i",$g)) { echo "Invalid request."; } } ?>
  22. Are you sure you inserted it there? It seems a lot like some XSS attempt... you should immediately check your log for any suspicious activities...
  23. That's the one thing you cannot hide unless you'd create your own browser and distribute it to every single internet user. Sadly, you are not a multi-billion company like Google to afford that (I guess, I highly doubt it), so the answer to that is no. There is no way to prevent the user from getting the link from SOMEWHERE out of your code, be it now the href attribute or some JavaScript-implemented redirect, the user would be able to figure it out. You could, if you are very eager for the user not to know where to redirect, try JavaScript code obsfuscation, but that's a pretty shameful thing to do unless you are actually trying to hide crucial data (and even then, you'd be doing it wrong - storing data with JavaScript is generally a bad idea and easily discovered).
  24. preg functions accept a string as argument containing your regular expression, delimited by two of the same characters, like, as commonly used (since you need to escape the starting character if you want to match them directly in your regular expression) are "#", "~" or "/". What .josh's code did was to create an array with the search terms in it ("foo" and "bar" have a long tradition of being used as examples in the IT branch), then he loops through that same array, creates a regular expression out of them and matches them against the text to search through, and if those functions return false, the whole variable $allMatched becomes false and you know that the text did not include all the keywords the user searched for.
  • 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.