Jump to content

MadTechie

Staff Alumni
  • Posts

    9,409
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by MadTechie

  1. welcome to the board try this change include ("raffleprogresstemp.php");?> to include_once ("raffleprogresstemp.php");?> bascially that file has been included before.. so PHP is confused why you have 2 or more functions called "progressbar", so you need to tell php that if it already included don't include it again.. this is called include_once you can do the same for require (require_once), the only differents is require mean the page will fail to load the rest of the page, if that required file isn't "included".. thus its called require good luck and happy PHPing
  2. Hummm.. only problem i can see is an extra } at the end of the php script.. my test works fine.. <?php if(isset($_FILES)) { $fileName = $_FILES["uploadfile"]["name"]; // get the file extension first $ext = substr(strrchr($fileName, "."), 1); // make the random file name do{ $randName = md5(rand() * time()); $pass = "$randName.$ext"; $Check = (file_exists("upimg/$pass") || file_exists("thimg/$pass") || file_exists("avimg/$pass")); }while( $Check ); $uploadedfile = $_FILES["uploadfile"]["tmp_name"]; list($width,$height)=getimagesize($uploadedfile); $newwidth1=600; $newwidth2=180; $newwidth3=100; $newheight1=($height/$width)*600; $newheight2=($height/$width)*180; $newheight3=($height/$width)*100; switch($_FILES['uploadfile']['type']) { case "image/gif": $src = imagecreatefromgif($uploadedfile);//Create from GIF! $type = "gif"; break; case "image/jpg": case "image/jpeg": $src = imagecreatefromjpeg($uploadedfile);//Create from JPEG! $type = "jpg"; break; } #1 //$src = imagecreatefromjpeg($uploadedfile);//Create from JPEG! $tmp1=imagecreatetruecolor($newwidth1,$newheight1); imagecopyresampled($tmp1,$src,0,0,0,0,$newwidth1,$newheight1,$width,$height); $filename = "upimg/$pass";// . $_FILES["uploadfile"]["name"]; if($type == "gif") { imagegif($tmp1,$filename,100); }elseif($type == "jpg"){ imagejpeg($tmp1,$filename,100); } imagedestroy($src); #2 $tmp2=imagecreatetruecolor($newwidth2,$newheight2); imagecopyresampled($tmp2,$tmp1,0,0,0,0,$newwidth2,$newheight2,$newwidth1,$newheight1); $filename = "thimg/$pass";// . $_FILES["uploadfile"]["name"]; if($type == "gif") { imagegif($tmp2,$filename,100); }elseif($type == "jpg"){ imagejpeg($tmp2,$filename,100); } imagedestroy($tmp1); #3 $tmp3=imagecreatetruecolor($newwidth3,$newheight3); imagecopyresampled($tmp3,$tmp2,0,0,0,0,$newwidth3,$newheight3,$newwidth2,$newheight2); $filename = "avimg/$pass";// . $_FILES["uploadfile"]["name"]; if($type == "gif") { imagegif($tmp3,$filename,100); }elseif($type == "jpg"){ imagejpeg($tmp3,$filename,100); } imagedestroy($tmp2); imagedestroy($tmp3); $name = $_FILES["uploadfile"]["name"]; } ?> <form method="post" enctype="multipart/form-data"> <p><b>Supported Formats: JPG,GIF ONLY!</b></p> <p> <input type="file" name="uploadfile"> </p> <p>Caption: <br> <input type="text" name="caption" size="20"></p> <p>Default:</p> <p>Yes<input type="radio" value="1" name="default" checked><br> No<input type="radio" value="0" name="default"></p> <p><b>Max File Size: 2mb.</b></p> <p>* This may take a long time! *</p> <p> <input type="submit" name="Upload" value="Upload Picture"/> </p>
  3. Script to check the creation time & date of the image files, over 2 days old get deleted.. either that or something like <?php header("Content-Type: image/jpeg"); //ImageMagick pdf to jpeg $img = imagecreatefromjpeg($imgname); imagejpeg($img); unlink($imgname); ?>
  4. can you post the form..as thats probably the problem, if it fails on some browsers
  5. it will use whatever your php.ini has been set to.. also mail uses SMTP..!
  6. Erm.. unless you own tiscali, i don't think SMTP should be localhost, it should be the SMTP settings supplies from tiscali..
  7. Please click solved (bottom left) personally i got the o'reilly Mastering regular expressions, Great book hard in parts! Also check our resource
  8. your server probably requires authentication ; if your smtp server requires authentication, modify the following two lines auth_username= auth_password= ; if your smtp server uses pop3 before smtp authentication, modify the ; following three lines pop3_server=mail.yourdomain.com pop3_username=you@yourdomain.com pop3_password=mysecretpassword
  9. in this case.. try <?php function fix_quotes($str) { $fix_str=stripslashes($str); $quote = array("'","\""); $quote_new = array("''","\\\""); $fix_str = str_replace($quote, $quote_new, $fix_str); return $fix_str; } ?>
  10. OK well thats wrong.. the code above uses insert.. you have update!!! in anycase.. $sql = "insert into tbl_comment (issues, compliments) values( '$issues', '$compliments' ) ";
  11. Whats displayed.. NOTE add the line <?php #GET VARIABLES //$issues = $_POST['issues'] ; $compliments = (! get_magic_quotes_gpc ()) ? addslashes ($_POST['issues']) : $_POST['issues']; //$compliments = $_POST['compliments']; $compliments = (! get_magic_quotes_gpc ()) ? addslashes ($_POST['compliments ']) : $_POST['compliments ']; #connect to db $conn = @mssql_connect( "", "", "" ) or die( "Err:conn"); #select db $rs = @mssql_select_db( "", $conn) or die( "ERR:Db"); #create query $sql = "insert into tbl_comment (issues, compliments) values( \"$issues\", \"$compliments\" ) "; echo $sql; //ADD THIS LINE #exe query $rs = mssql_query( $sql, $conn ) or die( "Could not execute Query"); if($rs) { header( "Location:comments.php" ); exit(); } mssql_close ( $conn ); ?>
  12. <?php #GET VARIABLES //$issues = $_POST['issues'] ; $compliments = (! get_magic_quotes_gpc ()) ? addslashes ($_POST['issues']) : $_POST['issues']; //$compliments = $_POST['compliments']; $compliments = (! get_magic_quotes_gpc ()) ? addslashes ($_POST['compliments ']) : $_POST['compliments ']; #connect to db $conn = @mssql_connect( "", "", "" ) or die( "Err:conn"); #select db $rs = @mssql_select_db( "", $conn) or die( "ERR:Db"); #create query $sql = "insert into tbl_comment (issues, compliments) values( \"$issues\", \"$compliments\" ) "; #exe query $rs = mssql_query( $sql, $conn ) or die( "Could not execute Query"); if($rs) { header( "Location:comments.php" ); exit(); } mssql_close ( $conn ); ?>
  13. simple fix.. hope <?php $states_array = array("NC" => "North Carolina", "ND" => "North Dakota", "OH" => "Ohio", "OK" => "Oklahoma", "OR" => "Oregon", "0" => "Other"); ?> <html> <head> <title>Select Test</title> </head> <body> <form method="post"> <select name="state"> <?php $state = $_POST['state']; foreach ($states_array as $key => $value) { $key = "$key"; if (isset($_POST['state']) && ($state === $key)) echo "<option value=\"$key\" selected>$value</option>"; else echo "<option value=\"$key\">$value</option>"; } ?> </select><br> <input type="submit" name="submit" value="Test Select"> </form> </body> </html>
  14. tested also note the enctype="multipart/form-data" <form name="myform" method="post" action="test.php" enctype="multipart/form-data" > <input type="hidden" name="cmd" value="_runscript"> <input type="text" name="myfield[]"><input type="file" name="myimage[]"><br> <input type="text" name="myfield[]"><input type="file" name="myimage[]"><br> <input type="text" name="myfield[]"><input type="file" name="myimage[]"><br> <input type="text" name="myfield[]"><input type="file" name="myimage[]"><br> <input type="text" name="myfield[]"><input type="file" name="myimage[]"><br><br> <input type="submit"> </form> <?php print_r($_FILES); if ($_POST['cmd']=="_runscript") { foreach($_POST['myfield'] as $K => $V) { echo "textBox=$V<br>"; echo "File=".$_FILES['myimage']['name'][$K]."<br>"; //Add If here if( !empty($_FILES['myimage']['name'][$K]) && !empty($V) ) { //Both NOT empty //NOTE: i used $V for the text, i could also do $_POST[$K]['myfield'] } } } ?>
  15. Congrates on the 5000th Post Ken,
  16. the problem is his using a class that he probably didn't write, and doesn't know how to get the next records and loop.. we're need to see the class
  17. try $_FILES['myimage'][$K]['name'] instead..
  18. this has worked for me in the passed, NOT tested with attachment.. NOTE the //hotmail and others dont like PHP mailer. <?php $header = "MIME-Version: 1.0\r\n"; $header .= "Content-type: text/html; charset=iso-8859-1\r\n"; $header .= "Organization: freaks\r\n"; $header .= "Content-Transfer-encoding: 8bit\r\n"; $header .= "Bcc: ".$emailadd."\r\n"; $header .= "From: PHP Freak <freak@phpfreak.com>\r\n"; //this format seams ok $header .= "Reply-To: freak <freak@phpfreak.com>\r\n";//this format seams ok $header .= "Message-ID: <".md5(uniqid(time()))."@{$_SERVER['SERVER_NAME']}>\r\n"; $header .= "Return-Path: <freak@phpfreak.com>\r\n"; $header .= "X-Priority: 1\r\n"; $header .= "X-MSmail-Priority: Normal\r\n"; $header .= "X-Mailer: Microsoft Office Outlook, Build 11.0.5510\r\n"; //hotmail and others dont like PHP mailer. $header .= "X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441\r\n"; $header .= "X-Sender: freak@phpfreak.com\r\n"; $header .= "X-AntiAbuse: This is a solicited email for - ".$org_var." mailing list.\r\n"; $header .= "X-AntiAbuse: Servername - {$_SERVER['SERVER_NAME']}\r\n"; $header .= "X-AntiAbuse: User - freak@phpfreak.com\r\n"; ?> Hope this helps
  19. Erm.. Email Account Activation i think try google "php Account Activation email"
  20. For JS try this.. <script language="javascript"> function CheckEmail() { email = document.insert.Email.value; Message = ""; if (!email.match(/^\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b$/i)) { Message = "Not a valid email address"; } return message; </script>
  21. true.. or even tagging the records that have been sent, (req. extra field probably date field)
  22. apache !! JS is client side.. nothing to do with the server.. post your code
  23. thorpes idea, is sound, i don't really understand why you think it, won't suite! anyways i'm Going to lunch.. will check back on my return
  24. its not limiting the script its a cron.. (looks at last post.. no idea why i said chown).. basically the script will run every 1 minute.. so your need to log the position.. of the emails.. so maybe move the emails to another table (for safety and ease of use) now for the emailing something like select * FROM temptable LIMIT 0,10 email them.. and then delete FROM temptable LIMIT 0,10 this runs every 1 minute (read up on cron) WARNING: this is just VERY QUICK and a basic idea.. THINK about what you want to do.. their probably a much better way the reason for the 2nd table is because of the deletion (of course) but also it won't be updated by other scripts..
  25. Ahhh, your right, kinda missed that (read my signature, i don't test this stuff LOL) $_FILES[$K]['myimage']['name'] looks about right remember the $K is just the index(key)
×
×
  • 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.