Jump to content

mandred

Members
  • Posts

    46
  • Joined

  • Last visited

    Never

Everything posted by mandred

  1. <?php function http_content_type($url = '', $default_mime = 'application/octet-stream') { if ($headers = @array_change_key_case(get_headers($url, true)) AND isset($headers['content-type'])) { $headers['content-type'] = strtolower(is_array($headers['content-type']) ? end($headers['content-type']) : $headers['content-type']); $headers['content-type'] = explode(';', $headers['content-type']); return trim($headers['content-type'][0]); } return $default_mime; } if (http_content_type($epvideo) == 'video/x-flv') { // do stuff } ?> And figure out which content types you want, list them, then use this function to validate them.
  2. Sometimes I listen to music, when I am not writing a rediculous OOP function that requires every ounce of my attention.
  3. I'm talking about full scripts I've written that I am charging money for.
  4. Trying to replace all instances of url( with url(../ IF http does not come directly after it. My regex: <?php $style = preg_replace('/url\([^http]/i', 'url(../', $style); echo $style; ?> Seems to work, except for the fact that url(images/logo.gif) becomes url(../mages/logo.gif). The I in IMAGES is gone.
  5. I am looking for more, free places to advertise my scripts. I know about hot scripts and the resource index, are there any other quality sites like these 2 that I can post my scripts on?
  6. Getting the following warning: Warning: ftp_put() [function.ftp-put]: 0.239 seconds (measured here), 25.61 Kbytes per second in C:\htdocs\script\functions.php on line 150 What is this in regards to? None of my code is producing any errors whatsoever, yet this pops up sometimes...is it some kind of timeout error?
  7. You don't have to specify the path or the domain name. Also, time()+3500 is only about 1 hour. The cookie will not work once that hour comes, so make it a year if you're shooting for a 'forever' type cookie.
  8. mysql_query("SELECT * FROM data WHERE field='$lname'");
  9. <?php if (isset($_POST['submitbutton'])) { $value1 = mysql_real_escape_string($_POST['value1']); $value2 = mysql_real_escape_string($_POST['value2']); mysql_query("INSERT INTO table (value1, value2) VALUES ('$value1', '$value2')"); } ?> <html> <head> <title>My Form</title> </head> <body> <form method="post"> <input name="value1" type="text"> <input name="value2" type="text"> <input name="submitbutton" type="submit" value="Submit Form"> </form> </body> </html>
  10. Escape every single variable then.
  11. Compare the x and y of the user to the ball's coordinates and whoever has the smallest distance can be considered closest.
  12. Use the imagedestroy() function. edit - PF beat me to it.
  13. Sorry, this is making little sense to me. I don't see the point in doing this. Anywho, why are you using DELETE if you want to empty the table? Use TRUNCATE instead. That will make things much faster.
  14. You could use the substr function and do it by character count too. <?php // $the_article is the writing you want cutoff with a 'Read More' link at the end $cutoff = 300; // characters to show before [read more] link $message = substr($the_article, 0, $cutoff); echo "$message...<a href=\"http://www.url.com\">Read More</a>"; ?>
  15. You're selecting 60,000 rows all at once? Are you outputting the results all on 1 page? Can you give us more details on the application of this? Why do you need to select 60,000 rows, and why does it have to take less than 3 seconds?
  16. Then you haven't optimized your tables properly. Show me the table structure, and an example of a row that is inserted.
  17. foreach ($output as $newrow) mysql_query("INSERT INTO table (field) VALUES ('$newrow')");
  18. So what is the issue? Just use 4 queries if you have to. CREATE, INSERT, DELETE, then SELECT.
  19. Beat me to it! Son of suckerfish uses the CSS and JavaScript required for these dropdowns (they need to use JS for xbrowser integration) http://htmldog.com/articles/suckerfish/dropdowns/
  20. Where are all those variables you're inserting coming from? The explode function is exploding the contents of each line of the text file into an array. Do you want to insert each line into its own row in the database? Or does each line contain a uniform formatting that you can use a regular expression on in order to grab each variable from each line? You should really read up on some of these functions at php.net to better understand them, otherwise you're pissing in the wind. edit - I just saw the text file. You can easily use a regular expression to extract the information you want into their own variables.
×
×
  • 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.