Jump to content

shiftJIS

Members
  • Posts

    87
  • Joined

  • Last visited

Everything posted by shiftJIS

  1. Your spelling has improved.When I first saw the problem, I didn't notice that you were trying to style the hr line a different color. Yes, I can realize that that's a problem because, according to w3, "presentation attributes of the hr element were deprecated in HTML 4.01". Firefox still allows the setting of a color for the hr though, but it's through background-color.Try a css of: hr { width: 90%; color: #00ff00; background-color: #00ff00;}p { margin-left: 100px; color: red;} The thing is now, this will make the hr colored in IE and Firefox, but isn't fully supported with other browsers. From what I read online, there might be some browsers out there that don't behave the way you intend it to. Just google for "css hr color" and you can find lots of discussion and lots of methods of doing this.
  2. First of all, you have a <li> block as the first child of <body>. It can't go there. Browsers don't particularly care, but it'd be good to wrap it in a <ul></ul>About your nav situation, the problem is that none of the CSS declarations apply to the html that you have shown. There are classes "imsc", "imsubc" declared but the CSS doesn't even mention them.
  3. shiftJIS

    css paths

    I think the point is to be lazy and only have one CSS file and one folder of images. The only thing I can think to do is to have absolute paths.
  4. Change .menu and .image_content_block to "position:absolute;" instead of "position:relative;" and set "top:0px;" in .image_content_block.
  5. First, get Firefox 2. It has an inline spell checker.The CSS looks okay. I personally would put ending semi-colons on the second statements, but I don't think the browsers mind. It validates at least.Because the CSS is okay, I suspect the issue is with the HTML (or perhaps you have another stylesheet somewhere?) I'll need more info than what you have so far.
  6. To the best of my knowledge, the only variables that a <form></form> passes along are the inputs that are within the tags.In your example, the query is outside, thus its value does not get passed.I hate javascript with a passion, and I don't recommend it, but it is one way of getting around this. You can put a <input type="hidden" /> in each form and have javascript update their values whenever that "real" input is changed.Instead, what *I* would do is to have one form with one target, and two submit buttons: <form name="form" action="search_wrapper.php" method="TUBES"> <input type="text" name="query" value="" /> <input type="submit" name="monkey" value="METHOD1" /> <input type="submit" name="monkey" value="METHOD2" /></form> Then, in the wrapper file, you can check for the variable "monkey" and take action depending on whether it's "METHOD1" or "METHOD2".
  7. shiftJIS

    PHP/MYQL Help

    I can't just stand by while someone has the totally wrong idea. justsomeguy is right, you NEED to escape input. I'll try to clear things up.Let's say you want to query information out of a table for a specific name: SELECT * FROM table WHERE name='$name' Suppose this $name came from $name = $_GET["name"]; If the hacker types in somename'; DROP TABLE table; then your mysql query effectively becomes: SELECT * FROM table WHERE name='somename'; DROP TABLE table;' Now I forget if that last quote makes a difference, but the hacker could close it or include it in an if statement that always tests as TRUE. Still, what you end up with is two queries in one, the first doing a search and the second screwing up your life.However, if you escape the string: $name = mysql_real_escape_string($_GET["name"]); then the query becomes: SELECT * FROM table WHERE name='somename\'; DROP TABLE table;' This is only one query, the quote has been ESCAPED (hence the function name) and shows up as a literal quote. This query is harmless and won't even return any results.That is, unless there is someone in your database named: somename'; DROP TABLE table;
  8. shiftJIS

    PHP Text Input

    htmlspecialchars() translates &,<,> to their respective html entities. The example from the php docs: <?php $new = htmlspecialchars("<a href='test'>Test</a>", ENT_QUOTES); echo $new; // OUTPUTS : "<a href='test'>Test</a>"?> Read up (http://www.php.net/manual/en/function.htmlspecialchars.php) for more information regarding how to get the function to handle quotes the way you want them to.htmlentities() is another function that also does a similar job.That or you can go learn some regex.Oh yeah, about the limitation stuff. You can do it with Javascript (read up here: http://w3schools.com/js/js_form_validation.asp) or in code with PHP. A simple substr() can truncate your input to whatever length you want.Example from PHP docs: <?phpecho substr('abcdef', 1); // bcdefecho substr('abcdef', 1, 3); // bcdecho substr('abcdef', 0, 4); // abcdecho substr('abcdef', 0, 8); // abcdefecho substr('abcdef', -1, 1); // f// Accessing single characters in a string// can also be achived using "curly braces"$string = 'abcdef';echo $string{0}; // aecho $string{3}; // decho $string{strlen($string)-1}; // f?>
  9. shiftJIS

    pointers

    Suppose you want a function that does something to affect a variable. Say, you have some number 10 and your code calls for transforming it to something else. Without pointers, you'd have to do this: If you add a pointer to the function declaration - function foo (&$input), then it effectively points (via alias or whatever the heck) to the variable that was passed in. I use this a lot because I do a lot of pre-processing in my script. I have separate variables for sections of the page ($text_body, $text_menu, $text_debug) and instead of using echo to put out data, I created my own function f_echo. This was so that decisions would only need to be made once and to make it simpler to handle sessions (once you output text, you can't set cookies and stuff anymore):
  10. shiftJIS

    help!

    Say your column is called rtfm, "SELECT rtfm FROM table_name ORDER BY rtfm DESC LIMIT 1"
  11. How about this?http://en.wikipedia.org/wiki/PHP
  12. Not very helpful.Didn't work how? Which part? What happened? What's the browser output look like? I'm not psychic.
  13. Image recognition is an art in statistics. Meaning if you can understand this: http://en.wikipedia.org/wiki/Canonical_correlation, then you have a good chance of making it happen. The idea is to find patterns in the image data, and compare them statistically to patterns in other images.If you can do the math, then it wouldn't be all too expensive to implement. Although, I suppose the math degree did cost a lot of money to begin with.
  14. For one, I would ditch the PDF altogether and figure out another way to display the data. Otherwise, here are some of my thoughts:Please close the EMBED tag. I can't stand ill formed markup.I think the issue is probably on the client side, with whatever plugin adobe uses to display pages inline. This isn't as good, since there are people that either don't have the plugin, or block specific plugin/active-x use.You can consider putting in a frame, and having that frame just point to the pdf. I personally dislike frames myself, but it is something you can do.Otherwise, look into this: http://www.adobe.com/products/flashpaper/
  15. Yes Rejoice, very very helpful there </sarcasm>babinlal: It looks like the code is okay - except that you're blinding accepting info from $_REQUEST['folder']. Imagine if someone changes the POST or GET variable to "../../../", then a chmod will reveal make your filesystem open to all. Make sure you clean up that request before doing anything, and do your best to limit the access as much as possible. Does the public need write access AND exec access? 0777 is TOO open, consider 0775 or 0755. But to your problem, the origin is at line 6 with the first chmod. I suspect that your php might be running as a different user that does NOT have permissions to modify the filesystem. Are you using a host? Are you running this on your own server? Make sure whatever user php runs as has access, because that seems to be the issue here.
  16. How is it that a database is less secure? While I would say that if you took all the precautions, they can both be safe methods of accessing files, the database itself is in general "safer".For one, most of the access comes internally. The sql host and password are all handled server side and the client sees or hears nothing of that connection. Also, if the system DOES get compromised, a person with database access can only destroy your data. A person with file-system access can destroy data (they could very well look at your scripts for the db passwords) AND install malicious script, up to damaging the actual server.But I still think that if used correctly, both methods are safe. It just depends on what your needs are.
  17. Well, the standard way of programming is to make sure each part works. So change your code to .php extension and try this:Contents of 'custom.php' <?php$file = "template.png";$im = @imagecreatefrompng($file); if(!$im){ die("Image-file $file does not exist.");}$string = $_GET['text'];$orange = imagecolorallocate($im, 255, 180, 0);imagestring($im, 2, 5, 5, $string, $orange);header("Content-type: image/png");header("Content-Disposition: inline; filename=custom.png");imagepng($im);imagedestroy($im); ?> Make sure all that works. Then, if your server allows mod_rewrite, use this:add to .htaccess <IfModule mod_rewrite.c>RewriteEngine OnRewriteRule ^custom.png(/?)$ custom.php</IfModule> Then, in your html, you can use:
  18. I quote the w3 entry on CSS Background-attachment Property: Your problem is in using the "fixed" tag. Delete it, and the image will stick to the bottom of the DIV box.If this doesn't solve your problem, then it's probably because I imagined your problem to be different from what it is. In that case, if you can show me a live example of where the problem occurs, I can be more useful.
  19. The issue is with your css and the application of the two images.The actual header is an img: Your <body> has this applied to it: Somewhere in here is the problem. You've got padding on that header image and then you're trying to have that center (via auto margins) with the background image centered in css.I would suggest a change in template, putting the background runners on the container div:<div id="container" style="#running background, pad left and right inside, margin 0 auto#"> <div id="header">#put a header image here, minus those bars on the side#</div> <div id="main">#body</div></div> Notice I don't like to re-use "body" as an ID tag. I suppose it doesn't cause any problems but it's slightly confusing. Also, why do you have tables when you're using xhtml? Stop that!
  20. Um... The w3 validator source is free to download. http://validator.w3.org/source/ It's basically a perl script, and you can obviously run it locally.Also, there is a totally free plugin for Firefox at https://addons.mozilla.org/firefox/249/ that is based on the above mentioned code. Most validator plugins send it to the w3 over the tubes, but this does it all locally.
  21. Hi there, I admit XML is pretty neat. You need to check the PHP docs. They should be included with your web-server or you can find them online. PHP has had functions to parse XML since 3.0.6 (e.g. xml_parse() and others). You do still need to think a bit about how your info is stored though. I would follow some sort of template like this: <?xml version="1.0" encoding="UTF-8"?> <data> <heading>Page Heading</heading> <body> <![CDATA[ The body of the text.... Stuff stuff... ]]> </body> <info>Some other info</info> </data></xml> Notice the use of the <![CDATA[, this allows you to put html tags and such into the body tag. Without this, any images or links or general html tags you decide to use will be parsed as XML.The next step is to then pull this data out of the XML file and replace them into a template.
  22. shiftJIS

    Php email

    Messy messy. Use //some array$array = array("fish", "fish2");//the variable to write to$message = "";foreach ($array as $row){ $message.=$row;} This doesn't work (and neither does the previous solution) if your array contains other arrays and you want to parse those also. However, that is a different problem.
  23. shiftJIS

    Switch Question

    If you go the database route, make sure you escape your browser variables. $input = mysql_escape_string($_GET['img']); Actually, I don't know if a database is really the way to go. It involves adding entries when you upload new photos etc.If you properly escape and clean (again: BIG emphasis on ESCAPE and CLEAN) your input, I don't see what's wrong with passing filenames through the browser and fetching the image from a directory. As long as you restrict access to a specific folder (that holds only pictures) then you can live without a database backend. Just upload to that directory and it's all set I've made a gallery with this method that even allows browsing through subdirectories (and ONLY those within that first gallery). Various comments and stuff I put in the EXIF tag.
×
×
  • Create New...