Jump to content

SharkBait

Members
  • Posts

    845
  • Joined

  • Last visited

    Never

Everything posted by SharkBait

  1. Ahh I see where I did that. I have a <p> </p> on either side of my nl2br() which pulled from the database which has the <p> already inserted in it. Thanks :) Now to add the alt tags to my images, and then do the things mentioned above.
  2. so if you have a url like: http://mything.com/script.php?industry=232  ?? Then you can use $_GET[] [code] <?php if(isset($_GET['industry'])) {   $industry_id = $_GET['industry']; } ?> [/code]
  3. I used [code=php:0]echo gettype($sn);[/code] and it returned as a boolean type (which is what php.net says about substr())) So in the above code, am I really compairing a boolean to a string? Or am I right to think that its compairing a boolean to the integer value of "tr-" ? Am I comparing strings in an incorrect way???
  4. This is the block of code that deals with a $_POST; [code] <?php foreach($_POST['sn'] as $sn) { $sn = mysql_real_escape_string(trim($sn)); $pre = substr(strtolower($sn),0,3); if ($pre != "tr-") { echo "{$pre} <br />"; $errMsg .= "<li>The Serial Number must follow the TR- scheme.</li>"; break; } else { echo "AGHHFDF"; } if ($sn <> "") { $strqry = "SELECT * FROM rebates WHERE sn = '{$sn}'"; $query = mysql_query($strqry) or die("MySQL Error: Aborting Query"); $found = mysql_num_rows($query); if($found > 0) { $FOUNDSN[$b] = $sn; $SNFAILED = true; } else { $FOUNDSN[$b] = ""; } $i++; } else { $FOUNDSN[$b] = ""; } $b++; } ?> [/code] Now it never echos the 'Pre is {$pre}' but it does assign [code=php:0] $errMsg .= "<li>The Serial.....</li>";[/code] It does echo the AGHHFDF so I am completely confused as to what is happening.  Does it have to do with the break; I have?  I want the foreach loop to stop on this if statement.
  5. I am looking to check the first 3 characters of a string a user inputs to see if they at least match. After the first 3 characters i dont care about
  6. I still haven't figured this out...
  7. They seem to be all the <p> tags I though it was just <p>Something here</p> between paragraphs, isnt this correct??
  8. I have the following: [code] <?php $string = "TI-493"; if(substr(strtolower($string), 0, 3) != "ti-") {   echo "Error Wrong"; } else {   echo "Woo Right"; } ?> [/code] Am I doing this wrong with substr() should I be using something else?
  9. Is it coming back to you with an error? Make sure your permissions on the directory you're moving the file too is correct as well as the file executing the move_uploaded_file().
  10. Web crawlers are pretty much like automated browsers. They see what we see.  Though they pick up on META tags and keywords etc within the content of the website. They cannot see the source code, they can't see PHP/ASP, just like a user cannot see your source code. There is talk about how the crawlers don't like to index pages with variables in the URL ie: http://blah.com/script.php?id=asd&view=thisplace but I've seen lots of pages that are indexed that way with google and yahoo, so they must do it, they might just perfer the http://blah.com/script.php/asd/thisplace better. Submit your site to the big search engines.  Make sure there is alot of content in the pages you provide. Also make sure things images etc have title/alt tags associated to them too. Also ensure the content on your pages actual makes sense to the rest of the site.  Google likes to stop indexing your site if you use words that are not relevent to the rest of the site. IE having and white background and below your footer adding white text with popular search tems like teen, sex, etc when your site is about flowers ;)
  11. Alright I figured it out....... dumb me [code=php:0] date("M-d-Y h:i:s", strtotime("-10 minutes"))[/code] I was using 'm' and not 'i' for minutes ;)
  12. I've tried: [code=php:0] date("M-d_Y h:m:s", strtotime("-1 hour"); [/code] Which worked, but when I tried: [code=php:0] date("M-d-Y h:m:s", strtotime("-10 minutes") [/code] it didnt work. Though [code=php:0] date("M-d-Y h:m:s", strtotime("-60 minutes")[/code] does work.... How do I check if 10 minutes has past?? I set a session varible strtotime("now") which gets the unix timestamp of that moment, then I want to check that to see if at least 10 mins has passed since.
  13. I can't seem to remember how to do it properly... How do I check the current time against 1 hour ago using mktime? mktime() <= mktime(-1,0,0,0) ??
  14. Thanks for the replies. For the page beinga bit long, I will be pagnating it, just have not gotten around to doing so. I definately think the title/header should be a bit more.. something, the text title is boring and blah.  It was just a filler I guess till I can think of something better. I'll look into adding an opaque image or something too. Indenting will be good too, I'll add that to the css for <p> tags. Thanks again :)
  15. Not sure about the others, but in Firefox it breaks pretty well.
  16. The usual: www.tingram.ca Looking to see what could be improved upon. I am really wanting to get into the design/layout/graphic side of web development and as you can see from the above its pretty simplistic. It's more of a test site than anything I suppose. I guess really all it is a blog now isnt it? The text/font doesn't really seem right, content wise I mean. (yea the header text is a bit.. boring too).  What are the better fonts to use? Colouring: Perhaps a slight shade difference between blog entries?  Perhaps spruce up the guestbook/comments etc?
  17. I've made a custom CMS for the company I work for. It's a work in progress as they keep wanting me to add things to it.  I started with the layout of the website, looked at how I wanted to display the content, then worked the backend into the way I wanted to display the content. Don't know if that makes any sense but it seems to work.
  18. If you want it to give the user the option to save the file or open the file then you need to use headers like this: [code] <?php if(file_exists($the_file)) { if(filesize($the_file) == $fs) { $dl++; $qry = "UPDATE support_files SET downloads = '{$dl}' WHERE file_id = '{$uid}'"; $query = mysql_query($qry) or die ("MySQL Error: <br />{$qry}<br />". mysql_error()); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Type: {$ft}"); header("Content-disposition: attachment; filename={$fn}"); header("Content-Length: {$fs}"); header("Content-Transfer-Encoding: binary"); readfile($the_file); exit(); } else { $message .= "<p>The file size is incorrect. Please notify the <a href=\"mailto:support@.com\">Support</a> team about this.</p>\n"; } } else { $message .= "<p>That file could not be located.  Please notify the <a href=\"mailto:support@.com\">Support</a> team about this.</p>"; } ?> [/code] Also note when using headers your file size has to be correct or it will corrupt the file.  If any text output is echo'd before the file is downloaded the echoing text will be added to the header of the file corrupting it too. This is what I have have found when people were complaining about corrupted downloads ;)
  19. I'll look into doing a function/class for this. Thanks obsidian
  20. HI, When using PHP with MySQL what are some good rules for processing $_GET variables? Should each $_GET[] had a mysql_real_escape_string() thrown around it to help with possible injections? What are your recommendations without using a 3rd party class?
  21. Well I turned on E_Notice in the php.ini and when I tried uploading the image, I must of spelt the varible name for the temp file... But why it was giving me a Permission Denied error, why not tell me if couldnt find the tmp file I specified without having to use file_exists(). But now since my little test server doesnt have GD2.0 on it, i gota figure out how to update PHP and the GD.
  22. Could it be because we don't have read/write access to the tmp file on our test machines?
  23. Ok this is driving me nuts. I have a small script that uses move_uploaded_file() but I keep getting the Permission Denied. The file that calls move_uploaded_file() I changed its permission to 777 as well as the folder its going to. The bit of code looks like: [code] <?php if(move_uploaded_file($file_tmp_name, "photos/{$filename}")) {   // Good } else {   // Not good } ?> [/code] [/code] The file is under 100kb in size. This is the error msg i am getting: [code] Warning: move_uploaded_file(photos/ChelseaCard.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in /home/tingram/public_html/tingram/imageUpload.php on line 36 Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpS5YP17' to 'photos/ChelseaCard.jpg' in /home/tingram/public_html/tingram/imageUpload.php on line 36 Error moving file [/code] Is there a setting in php.ini I need to look at?  I use this type of script on another server and it works fine... =-)
  24. Can use [code=php:0] mysql_escape_real_string() [/code] or for those running older than PHP  4.3.*?? [code=php:0]mysql_escape_string()[/code] I've been switching to that instead of using str_replace() so that I can catch other odd escape characters in mysql queries.
×
×
  • 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.