Jump to content

phast1

Members
  • Posts

    63
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://www.phastnet.com

Profile Information

  • Gender
    Not Telling

phast1's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. If you are not sure how to check the value of the radio buttons in the PHP code, it would be something like this: if ($_POST['radio_name'] == 'url') { // put code here to process a url submission } else { // put your original code here to process regular file submissions } Note that your form is also going to need a regular text input field for people to type in the URL.. Your example of imageshack.us has this extra field too, but they are using javascript to try and make it seem like only one field by hiding the file input box if you select 'URL' and vice-versa.. If you aren't sure what to do to process the url submission, then you should probably read up on fsockopen(), fread(), and fwrite(), since those are pretty much the only functions you need to use in order to accomplish this..
  2. I think the first step would be to determine the exact difference between an HTTP header response that works as expected and one that doesn't.. You could always add a line to your existing code to echo the raw header info that your script is seeing and then run some tests like that.. while(!feof($fp)) { $httpresult = fgets ($fp,1024); $httpheader = $httpheader.$httpresult; if (ereg("^\are\n",$httpresult)) break; } fclose ($fp); echo $httpheader; Once you know what the exact difference is, then you can start trying to figure out how to detect for this condition in your code.
  3. Excellent, glad to hear that its working But that's definitely strange how it would output two different things when the code is identical and uses the same value from the database.. It looks like the one with the % signs is URL encoded, so you could try this: <embed type="video/divx" src="<?php echo url_decode($result['path']); ?>" width="748" height="430" autoPlay="false" custommode="Stage6" previewImage="luffybox3.jpg" pluginspage="http://go.divx.com/plugin/download/"> If that doesn't work, then it might be encoded as HTML entities and you could try this: <embed type="video/divx" src="<?php echo html_entity_decode($result['path']); ?>" width="748" height="430" autoPlay="false" custommode="Stage6" previewImage="luffybox3.jpg" pluginspage="http://go.divx.com/plugin/download/">
  4. From a quick look at your code, it seems like it should work.. Is there an error being displayed when you try to run it??
  5. It looks like your film.php has no code for retrieving a record from the database based on the id that is being passed to it.. Doing something like this should work: <?php session_start(); // Alltid överst på sidan // Kolla om inloggad = sessionen satt if (!isset($_SESSION['sess_user'])){ header("Location: ../index.php"); exit; } //Inkludera filen som connectar till databasen include "conn.php"; $query = mysql_query("SELECT path FROM videos WHERE id='" . $_GET['id'] . "'"); if (mysql_num_rows($query) <= 0) { echo "Tomt"; } else { $result = mysql_fetch_assoc($query); } ?> <html> <head> <style type="text/css"> <!-- #Content { margin-left: 2px; margin-right: 40px; margin-bottom: 0px; margin-top: 40px; } --> </style></head> <div id="Content"> <object classid="clsid:67DABFBF-D0AB-41fa-9C46-CC0F21721616" width="748" height="430"> <param name="custommode" value="Stage6" /> <param name="previewImage" value="luffybox3.jpg" /> <param name="autoPlay" value="false" /> <param name="src" value="<?php echo $result['path']; ?>" /> <embed type="video/divx" src="<?php echo $result['path']; ?>" width="748" height="430" autoPlay="false" custommode="Stage6" previewImage="luffybox3.jpg" pluginspage="http://go.divx.com/plugin/download/"> </embed> </object> </div> </html>
  6. The 'filename' and 'modified' fields are optional, but they would typically be used to keep track of a filename to represent the image and the time that the image was last modified (this would be a TIMESTAMP field).. And yes, the 'data' field must be binary in order to store the image data.. I'm not sure why you would need to store the whole filepath, since the image will be in the database and there is no physical disk path for it.. As for height and width, you could store them to make it easier to generate afterwards instead of detecting the height and width each time, but if you are already resizing to a specific image size, then you probably already know the size and can just hard code it on the output part of the code..
  7. Can you be more specific about what the problem is? I know URLs that redirect are the problem, but what is happening when it comes across a redirect compared to what you want it to do? But, I'm sure that the fsockopen() function isn't going to automatically follow redirects, so you would probably need to view an http header that contains a redirect and see what the code needs to look for (sorry, I can't remember this at the moment), and then add some code that detects this using the strstr() function or similar and restarts the processing with the new URL..
  8. Ahh, those are 'radio' buttons, not radial First you need to add the radio buttons to your form and assign them a name, then you would need to modify the PHP file that the form submits to so that it checks for the value of the radio buttons and either runs your normal code (assuming it works) to process the uploaded file or runs new code to save a URL image instead of an uploaded one.. Saving the URL image can be done using fsockopen() and fread() functions to read in the image, and then use the fopen() and fwrite() functions to save the data to disk.. You could also save the image into a database instead of writing it to disk.. Does that help?
  9. I'm confused.. Can you explain what you mean by 'radial button' and 'upload via url'? Can you also give more detail about what is happening when you try to use your code? 'doesn't work' isn't much help
  10. Try it like this: $getimages = mysql_query("SELECT username, thumblocation FROM images ORDER BY timeposted ASC LIMIT 3"); while ($image=mysql_fetch_assoc($getimages)) { echo "<a href='/__site/$username'><img src=\"$image['thumblocation']\"></a>"; echo $spacer; }
  11. I'm not sure if it has anything to do with your current problem, but I do see that this line has an error: if (!$user_pass = md5($pass)) { it should be: if ($user_pass != md5($pass)) { Although, I see that $user_pass is also not being set properly.. You need to change this line: $user_pass = mysql_query($sql_pass_get); to something like this: $result = mysql_query($sql_pass_get); if (!$result) { die('Invalid query: ' . mysql_error()); } $row = mysql_fetch_assoc($result); $user_pass = $row['user_password'];
  12. Maybe try using fread() instead of fgets(), since fgets() only gets 1 line at a time while fread() gets the total number of bytes regardless of line breaks.. Might want to read more than 200 bytes also, such as fread($cwhois, 4096).. The only other thing I can think of is to try setting the socket timeout using stream_set_timeout($cwhois, 5) .. Your fsockopen() already specifies a 30 second timeout for connecting, but maybe the stream timeout would help too.. Good luck with it!
  13. You need to add code to the destination pages that will increment counters that are stored in the database.. So, if you have a menu.php that displays the menu and then separate pages that people are clicking to, such as page1.php, page2.php, etc, then you would need to modify the page*.php file and add code that does an update on an integer field in the database to increment by 1 each time that page is loaded.. You will basically end up with a mySQL table like this: id page1 page2 page3 etc and each of those fields will store an integer count for how many times that page has been accessed.. Once you have that accomplished, then you would need to modify your menu.php page to select the counter data from the database and use that instead of hard-coded numbers.. Such as: $result = mysql_query('SELECT * FROM counters'); if (!$result) { $message = 'Invalid query: ' . mysql_error() . "\n"; $message .= 'Whole query: ' . $query; die($message); } $row = mysql_fetch_assoc($result); $tags = array('weddings' => $row['page1'], 'birthdays' => $row['page2'], 'landscapes' => $row['page3'], 'ham' => $row['page4'], 'chicken' => $row['page5'], 'food' => $row['page6'], 'turkey' => $row['page7'], 'windows' => $row['page8'], 'apple' => $row['page9']); printTagCloud($tags);
  14. Deciding to store images in a database all depends on the situation.. If you do decide to, then yes, you should make an images table with fields such as id, filename, data, modified .. Make sure that the data field is binary.. As for getting the highest quality resize possible, please see my previous post that uses imagecopyresampled() instead of imagecopyresized()
  15. Here is the code that I normally use to resize an image with good quality, plus JPEG optimization: // create thumbnail image, resized and optimized $destimg=ImageCreateTrueColor(60,60) or die("Problem In Creating image"); $srcimg=ImageCreateFromJPEG($binFile) or die("Problem In opening Source Image"); ImageCopyResampled($destimg,$srcimg,0,0,0,0,60,60,ImageSX($srcimg),ImageSY($srcimg)) or die("Problem In resizing"); ob_start(); imagejpeg($destimg, '', 35); $thumb_data = addslashes(ob_get_contents()); ob_end_clean(); imagedestroy($destimg); imagedestroy($srcimg); After that, your $thumb_data var would have the binary data for the image and you can either save it into a database or write it to a file using fwrite().. The above code was intended to save into a database, so there might be an easier way to save directly to a file..
×
×
  • 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.