Jump to content

akrytus

Members
  • Posts

    70
  • Joined

  • Last visited

    Never

Everything posted by akrytus

  1. I have a MYSQL dbase and I am currently getting duplicate entries. Can someone give me some example code to check the MYSQL dbase if that record exists before I write it a second or third time? I know how to querry the dbase, but what do I do with that information?
  2. I dont understand why, but everytime I do this querry with php it seems to find the record, although it doesnt exist. If I do this querry through mysql at the dbase the record does not exist. After I did the querry and it did not find the record, I had it produce the code and inserted it into my php and it doesnt looks as if it found it. What am I doing wrong? Perhaps my if($result) is incorrect? $sql='SELECT * FROM `Attendance` WHERE `Date` = \''.$HTTP_POST_VARS['Date'].'\' AND `First` LIKE CONVERT(_utf8 \''.$value[1].'\'USING latin1) COLLATE latin1_swedish_ci AND `Last` LIKE CONVERT(_utf8 \''.$value[2].'\' USING latin1) COLLATE latin1_swedish_ci'; $result = mysql_query($sql); if($result){echo "$fullname on day ".$HTTP_POST_VARS['Date']." was Found<br>";} if(!$result){echo "$fullname was Not Found<br>"; /*
  3. Thankyou for your reply. I want the full image up there for downloading by others, so resizing them ahead of time isnt much of a solution. Yes the files are big, yes it takes a while, and I have increased maximumexecution time to almost 30 min, even though it has never taken more then 5 to do it. Does it always stop on 25, no not on other directories, yes on that particular directory. Notice in my code I have it loop through the array until the all pictures files have been converted. What is happening is it exists out of the loop before it finishes. No errors, nothing breaks, everything worked just fine, it just didnt finish the loop. If I knew how to move the pointer to start at 25 instead of 1, then perhaps I could see if it finished the rest of the pics. In my other directories I have 31 pics and it works just fine and takes 3.5 minutes to do it. If I reduce the pics to 25 in that dir it works just fine. What would make it jump out of the loop. Ohh, and I have done a count() on the array to be sure how many pics there were to prove it jumped out early. Thankyou for you help. I just dont get this one!
  4. No one has an answer? Someone knows what the problem is. Help me please!
  5. Here is my code. Your point is well taken, I guess I have no idea why it will only do 25. Help me please! <?php // Generates thumbnails of given dir from previous form // Functions -----------------------------------------------------------------------------------> function ditchtn($arr,$thumbname){ // Filter out thumbnails foreach ($arr as $item) { if (!preg_match("/^".$thumbname."/",$item)){$tmparr[]=$item;}} return $tmparr; } /* variables: $name Original filename $filename Filename of the resized image $new_w width of resized image $new_h height of resized image */ function createthumb($name,$filename,$new_w,$new_h,$x) { $system=explode(".",$name); // Seperate each name and store into $system echo "<font color=\"#CCCCCC\" size=\"3\">$x. Name: $name</font><br><br>"; if(eregi("jpg",$name)){$src_img=imagecreatefromjpeg($name);} // If jpg create jpg image if(eregi("png",$name)){$src_img=imagecreatefrompng($name);} // If png create png image $old_x=imageSX($src_img); $old_y=imageSY($src_img); if ($old_x > $old_y) { $thumb_w=$new_w; $thumb_h=$old_y*($new_h/$old_x);} if ($old_x < $old_y) { $thumb_w=$old_x*($new_w/$old_y); $thumb_h=$new_h;} if ($old_x == $old_y) { $thumb_w=$new_w; $thumb_h=$new_h;} $dst_img=ImageCreateTrueColor($thumb_w,$thumb_h); imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y); if (preg_match("/png/",$system[1])) { imagepng($dst_img,$filename); } else{imagejpeg($dst_img,$filename); } imagedestroy($dst_img); imagedestroy($src_img); } /* Function directory($directory,$filters) reads the content of $directory, takes the files that apply to $filter and returns an array of the filenames. You can specify which files to read, for example $files = directory(".","jpg,gif"); gets all jpg and gif files in this directory. $files = directory(".","all"); gets all files. */ function directory($dir,$filters) { $handle=opendir($dir); $files=array(); if ($filters == "all"){while(($file = readdir($handle))!==false){$files[] = $file;}} if ($filters != "all"){ $filters=explode(",",$filters); while (($file = readdir($handle))!==false){ for ($f=0;$f<sizeof($filters);$f++): $system=explode(".",$file); if ($system[1] == $filters[$f]){$files[] = $file;} endfor; }} closedir($handle); return $files; } // Begin Page -----------------------------------------------------------------------------------> ?> <?php // Creating thumbnails and displaying status $picdir='Students/Pics/'.$HTTP_GET_VARS['event']."/"; $thumbdir=$picdir; $pics=directory($picdir,"jpg,JPG,JPEG,jpeg,png,PNG"); $pics=ditchtn($pics,"tn_"); $pics=ditchtn($pics,"rs_"); $x=0; if ($pics[0]!=""){ foreach ($pics as $p) { $x++; createthumb($picdir.$p,$thumbdir."tn_".$p,125,125,$x); createthumb($picdir.$p,$thumbdir."rs_".$p,800,800,$x);}} php?>
  6. I host a webpage that has a few pics from some events that we are a part of. I am lazy and dont want to write a new webpage for each event nor convert the files to view and create thumbnails for them all. So I upload a bunch of full sized pictures to the server, about 2816x2112 no more then 5MBs and no less then 1.5MBs in size. Then I have it read them all into an array and have it create 2 new files one 800x600 to view and another 125x125 for thumbnails. My script works super, however it wont do more then 25 pics at a time. If I want more then 25, I have to manually do it in the script myself by adding the name of the file instead of automating it. I believe this is a memory issue, but I could be wrong. I am not that familiar with php.ini, and would imagine that there is a variable I need to change to allow more pics to be stored in the array. Does anyone know what the variable name I need to change is and what value I should try?
  7. Not familiar with curl, is this going to be a big deal to figure out? 
  8. Why not after ending the session you just refresh the page to where you want them to go using a meta tag?
  9. I know this subject has been posted before, I searched for nearly an hour and couldnt find what I was looking for.  So please be patient if I am reposting. I am a dealler for several software companies and I have different usernames and password for them all.  Some are extremely hard to remember, especially since I dont use them everyday.  I have created a nice little website for my company and created a login for my partners.  Once logged in I would like to be able to click on a link to each of these sites and have it log in for me.  Then I have 1 username, password, and url to memorize.  Is this even possible?  I figure I probly have to know the name of the form variables to their websites to do it.  So I cant see it happening, but perhaps you experts could tell me otherwise! Currently I have a little question mark to click that reveals the username and password if I forget.  But that sucks if I am on site with a customer.  I cant have them seeing that.  Thanks for your help!
  10. Ok, all of you that helped me THANKS SO MUCH! Been working on this for over a week, getting a headache.  Almost Done. One more thing.  I can download any file but .txt files.  The .txt files contain the html code of that page instead of what it should have.  My guess is ascii over binary.  Should I do an if statement on the extension to see if it is .txt and then some how use ascii instead, other wise use binary?  How do you do that?
  11. OK, thanks wolf, let me check it out. Ohh you have to have session_start first, or I wont have my session variables that I need to even send the headers.
  12. Well that eliminated the errors, but nothing downloaded.  Do you know why?
  13. [quote]You need to put the HEADER information ebfore ANYTHING else, needs to be at the top of the file...That's the problem [/quote] Before session_start?  Becuase this is a secure page.  What about the filesize error?  How come lines 6,7,8 all went through ok?
  14. This page is loaded multiple times as user clicks links to navigate through folders.  When user clicks on a file, it is flagged.  Then the page is reloaded to send the new headers to force the download but I get these errors.  Can someone tell me why I am getting these errors? [quote]Warning: filesize() [function.filesize]: stat failed for /public_ftp/POS/Cash Registers/PCTOOL-VER-1_20.zip in /home/wtmalone/public_html/Dealer/dealer.php on line 9 Warning: Cannot modify header information - headers already sent by (output started at /home/wtmalone/public_html/Dealer/dealer.php:9) in /home/wtmalone/public_html/Dealer/dealer.php on line 9 Warning: Cannot modify header information - headers already sent by (output started at /home/wtmalone/public_html/Dealer/dealer.php:9) in /home/wtmalone/public_html/Dealer/dealer.php on line 10 Warning: Cannot modify header information - headers already sent by (output started at /home/wtmalone/public_html/Dealer/dealer.php:9) in /home/wtmalone/public_html/Dealer/dealer.php on line 11 Warning: Cannot modify header information - headers already sent by (output started at /home/wtmalone/public_html/Dealer/dealer.php:9) in /home/wtmalone/public_html/Dealer/dealer.php on line 12 [/quote] [color=red][font=Verdana]Here is the flag code:[/font][/color] [code] function Flag_Download ($file,$dir){   $remote_file=$dir."/".$file;   echo $remote_file;   $_SESSION['download']=$remote_file;   ?><meta http-equiv="Refresh" content="0; url=http://nocrs.net/Dealer/dealer.php"><? }[/code] [color=red][font=Verdana]Here is the forced download code:[/font][/color][code] 1  <? session_start(); 2 3  // Download File if flagged 4  if(isset($_SESSION['download'])){ 5  $remote_file=$_SESSION['download']; 6  header("Pragma: public"); 7  header("Expires: 0"); 8  header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); 9  header("Content-length: ".filesize($remote_file)); 10  header("Content-Type: application/force-download"); 11  header("Content-Disposition: attachment; filename=".basename($remote_file)); 12  header("Content-Description: File Transfer"); 13  @readfile($remote_file); 14  unset($_SESSION['download']); 15 } [/code]
  15. Thanks for the advice, I feel like I am much farther. However, after the file downloads, it is the correct file name, but the contents of the file is html.  Infact it is the html code of the current visited page.  Why?  Here is my code: [code] if(isset($_SESSION['download'])){   $remote_file=$_SESSION['download'];   header("Pragma: public");   header("Expires: 0");   header("Cache-Control: must-revalidate, post-check=0, pre-check=0");   header('Content-length: '.filesize($file));   header("Content-Type: application/force-download");   header( "Content-Disposition: attachment; filename=".basename($remote_file));   header( "Content-Description: File Transfer");   @readfile($remote_file);   unset($_SESSION['download']);} [/code]
  16. Ok, I have to read up on that, I am clueless, never used it.  However I still have a question.  I am assuming those command are good for files on the web server, if the files reside on a ftp server, same server just diferent directory outside of the public hmtl folder, can these still work?  Or do I need to eliminate the ftp server and move the files to a folder in the public html folder?
  17. Really that last post by craygo should work.  No problem. Ohh sorry about the error I posted originally. [quote]also this does not look right Code: $day=$RESULT['Lmo']."/".$RESULT['Lda']."/".$RESULT['Lda'];   $day_timestamp=strtotime($day); shouldn't it be Code:   $day=$RESULT['LYR']."/".$RESULT['Lmo']."/".$RESULT['Lda'];   $day_timestamp=strtotime($day);[/quote]
  18. Huh, learned something new today!  Well now I know. Also I had to login twice.  Does it do that for you?
  19. It shouldnt play it, that would be streaming audio or something.  Never messed with that before.  Should download.
  20. Are you aware that your username and password are being sent over the url.  Everyone can see them, and capture them. Try just making a link to the actual file that simple. <a href="..song.mp3">Song.mp3</a>
  21. What are your errors, what is the output?
  22. Can you believe I get the exact same result?  That didnt help, anything else?
  23. [quote]If I am understanding you correctly, you want to take a file that is currently on the web server and store it om the users' machine. If that is correct, you want to use ftp_put(). That is because your script is running on the Server. [/quote] I like your thinking, why didnt I look at it like that?  Out of curiosity, what if it is not on the webserver, could your write code to act on behalf of the client and have it sent to them?  I let you know what I find out about that put.  Thanks!
  24. Please dont give up on me!  I am so close to finishing this, this is all I have left.  I beg of you, FIND A WAY!
×
×
  • 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.