Jump to content

Adam

Moderators
  • Posts

    5,717
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Adam

  1. Adam

    Grab url

    Ahh. It's the hash in the 'href' causing the error. For example, go to: http://www.pat-burt.com/csspopup.html#test Clear the address bar and enter: javascript:alert(location.hash); Alerts '#test'. Click to open the popup then re-enter the javascript command into the address bar, nothing is returned. You need to re-think the way you're calling the pop up. I suggest: <a href="javascript:void(0);" onclick="popup('popUpDiv')">popup</a> Although I would recommend looking into replacing that with a JS-disabled friendly alternative.
  2. Kinda reminds me of the orange website actually, as ILMV said though not very 'gamerish'. The center thumbnails let it down the most at the moment I think, badly stretched and pixelated. The text headers look a little lost too. Code-wise it's table based, which, is never going to go down well here. It's also dragging down your content to mark-up ratio. There's no use of text tags at all. It doesn't validate as XHTML. In short it's not optimized for search engines. It's not a bad effort at all, just I think rather than focusing on the design aspects you should be thinking more about the mark-up & technical side of things.
  3. Yeah I agree with mvpetrovich, then you can just change your form to: <SELECT NAME="CourseName"> <OPTION VALUE="101">MATHS</OPTION> <OPTION VALUE="102">BIOLOGY</OPTION> <OPTION VALUE="103">CHEMISTRY</OPTION> </SELECT> By 'html if statement' did you mean JavaScript to update the next select list based upon the first selection?
  4. Heh, got that backwards my friend. JavaScript is insecure. Never trust JS. It can be disabled & manipulated by any user. Any form of validation or security, must be performed by a server-side technology/programming language, like PHP. I think what he's talking about with 'hiding links' is cross-site scripting (or XSS). I recommend reading the following tutorial for a good insight into security... http://www.phpfreaks.com/tutorial/php-security
  5. Adam

    Grab url

    That's no pop up *window* script, it's a JS page-based pop up - never really know what to call them. That shouldn't alter the URL at all, unless, how are you calling this pop up? I reckon they may be using the <a href="#"... trick which is removing the hash. This would be much easier if there was a live version to take a look at?
  6. Jeez. This is the best I could come up with I'm affraid: if (preg_match_all('/<other_tag(.*?)\/>/', $xml, $tag_matches)) { if (preg_match_all('/([^=]+)=(\'|")([^\'"]*)(\'|")/', $tag_matches[1][0], $param_matches)) { $nex_xml = '<other_tag>'; foreach ($param_matches[1] as $key => $param) { $new_xml .= '<' . trim($param_matches[1][$key]) . '>' . $param_matches[3][$key] . '</' . trim($param_matches[1][$key]) . '>'; } $nex_xml .= '</other_tag>'; } $xml = str_replace($tag_matches[0][0], $new_xml, $xml); } I dare say someone will come along with a tidier / different version.
  7. Is the syntax *always*: a='...' b='...' c='...' ?
  8. It's essentially just another SEO trick, their nickname if you like are 'search engine friendly URLs'. Consider the following two, stands to reason that the second URL would gain a higher rank in the search engines: blog.php?cat=12&subcat=2&blog_id=63 and /blog/technology/computers/title_of_blog_here
  9. Heh out shone me as ever!
  10. Well it needs to be run from a web server that has PHP installed, yeah... And no, you need a server-side programming language capable of file operations. You could install PHP and a web server on your computer quite easily though with some of the packages out there.. LAMP, XAMPP, etc.
  11. Try adding the following to the top of the PHP script: error_reporting(E_ALL); ini_set('display_errors', '1');
  12. 'validateEmail()' isn't actually a built-in PHP function, just with the many, many ways of validating email available out there on the net, I didn't want to complicate the code.. which I guess I actually did. I'm assuming that $handle = fopen($filename, 'a') returned false, or that $_POST['email'] wasn't set - but that's less likely looking at the form HTML. Check the write permissions on the file & directory where your text file is, and add an 'else' clause to see if there's an error returned whilst trying to open the file: // attempt to open the file if ($handle = fopen($filename, 'a')) { // attempt to write to the file if (!fwrite($handle, $email)) { echo 'Cannot write to file'; } else { echo 'Written to file'; } } else { echo 'Unable to open file'; } Should point out what's going wrong.
  13. Well just a quick example similar to in the manual: if (isset($_POST['email'])) { // some form of email validation $email = validateEmail($_POST['email']); // write-to file $filename = 'path/to/emails.txt'; // attempt to open the file if ($handle = fopen($filename, 'a')) { // attempt to write to the file if (!fwrite($handle, $email)) { echo 'Cannot write to file'; } else { echo 'Written to file'; } } fclose($handle); }
  14. Aah, as kickstart just pointed out your perhaps best re-writing the code so you don't need several loops within a loop. I can't really test this so I'm not sure if it'll work with your table structure but, take a look at what data is returned from this: SELECT mss.regionID, mss.constellationID, mss.solarSystemName, mss.security, mc.constellationName, mr.regionName FROM mapSolarSystems mss, mapConstellations mc, mapRegions mr WHERE solarSystemName = '$system' AND mc.constellationID = mss.constellationID AND mr.regionID = mss.regionID ORDER BY solarSystemName;
  15. Firstly, don't *rely* on JavaScript for your validation. JS can be disabled and manipulated by the user, which makes it completely insecure. Always validate with PHP (although feel free to validate with JS as well). Read up on how to use the fwrite function to write the data to a text file. There's good explanation and examples on the PHP manual (see the link).
  16. To be honest I think some may disagree with that statement based on what you're asking. It's mod_rewrite.
  17. Ha, are you aware there's 2 wheres in there? You could also use: SELECT * FROM table WHERE time >= DATE_SUB(CURDATE(), INTERVAL 1 DAY)
  18. What data type is "time"?
  19. Heh no problem. I actually changed it from the \w character class after I realized that would match underscores as well (remembering that you'd said alphanumerical). To build on yours you could quite easily turn that into one single replace: $xml = preg_replace('/<(\/)?([a-z0-9]+)[a-z0-9]+)/i', '<$1$2_$3', $xml);
  20. Adam

    Grab url

    Yeah but it's not a static string, it's the URL of the current page. "location.hash" exists really for this type of use. Odd. I can't see why it wouldn't work, unless the location.hash property isn't updated as it's changed (which I can't really see being the case). Perhaps have a search around for known 'location.hash bugs', or perhaps someone here as some experience.
  21. Using what you have, just add the underscore into the replacement param: $namespaceFree = preg_replace('/([<<\/])([a-z0-9]+):/i','$1_$2',$xml); Edit: No my mistake, didn't think about what the regexp was doing. 2 minutes! Edit 2: This should do the trick: $namespaceFree = preg_replace('/<([a-z0-9]+)[a-z0-9]+)/i', '<$1_$2', $xml);
  22. With JavaScript you could just hide the table at the page 'onload' event. To do that you just simply switch the CSS display property to 'none' which would effectively hide the content from the user. Note not straight from within the CSS though as this would render the content useless for those with JS disabled. Then to make the content viewable again, just create a custom JS function that would switch the CSS display property back to block, table, or whatever.. as you click a button / link. Take a look at 'definition and usage' section of this page for a quick example on how to modify the CSS display property with JS. Does that help? Just read it back to myself but not sure if I was quite clear enough.
  23. Adam

    Grab url

    Err, so the pop up.. pops up, and you want to get the URL of that, or the parent window? And from within which window?
  24. Adam

    Grab url

    Sorry, I actually missed the line where you mentioned location.hash before. This is odd. What browser are you using? Works fine for me in every browser I have (Firefox, Chrome, Safari, IE (even 6)).
  25. Yeah it's possible. I'd just use the match() method though instead. Consider the following... var matches = str.match(/your regex/); If you add the 'g' modifier it will match more than once.
×
×
  • 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.