Jump to content

willpower

Members
  • Posts

    296
  • Joined

  • Last visited

Everything posted by willpower

  1. Found this...which works... <?php function in_object($val, $obj){ if($val == ""){ trigger_error("in_object expects parameter 1 must not empty", E_USER_WARNING); return false; } if(!is_object($obj)){ $obj = (object)$obj; } foreach($obj as $key => $value){ if(!is_object($value) && !is_array($value)){ if($value == $val){ return true; } }else{ return in_object($val, $value); } } return false; } ?> Usage : <?php $array = array("a", "b", "c"=>array("x", "y"=>array("p", "q"=>"r"))); if(in_object("r", $arrX)){ echo "r is there "; }else{ echo "Its not there "; } ?>
  2. Hi and welcome. You havent had any responses as your question is a little vague. Perhaps if you explain what you have accomplished, what you have tried and what is failing...maybe by posting some of your code, any errors you get, etc you may get more help. Will
  3. Whats the most efficient way of searching within a multi dimensional array? My Array = Array ( [0] => Array ( [0] => Item 1 [title] => Item 1 [1] => 2012-03-21 [eventDate] => 2012-03-21 [2] => 21 [eventDay] => 21 ) [1] => Array ( [0] => Item 2 [title] => Item 2 [1] => 2012-03-21 [eventDate] => 2012-03-21 [2] => 21 [eventDay] => 21 ) ) String to find = '21' If (MY ARRAY contains STRING TO FIND) {} Clearly in this case there are several '21' (s) so if I only wanted to search the [eventDay] keys...would there be a fast effective and efficient manner? Thoughts and help gratefully received. Will
  4. Thanks so far... I need to write a php script to parse the file without ANY manual input. Ie this sheet will be ftp'd upstream and a cron job will then run the php script...so ALL csv or other processing will take place internally removing the ability to export each sheet separately...unless ofcourse we can establish how to do this in PHP alone.
  5. Has anyone any experience of parsing worksheet information into separate tables in a DB. to give an illustration. I have a single workbook, in which there is a worksheet containing data relevant to some staff members...so worksheet 1 - staff member 1 , worksheet 2 - staff member 2 etc. I need to separate this info into separate DB tables. Any advice gratefully received. Thanks Will
  6. yuck yuck yuck Im sure the service is great, but the website lacks any typography design. Would you be happy if a graphic designer handed you this after charging you mony and said...here is your latest ad campaign? The flow is ok but the typography needs sharpening up
  7. page loads arte slow...and i got bored as there was too much text. layout is good but i felt i was being told to read read read...instead of being aboe to identify key content from you. layout good , but i still dont know what the site is about as i kinda refused to read read read. Hope that helps Will
  8. im with the last comment....you cant say that you design great webiste and put that out there with confidence. Im not gonna hammer you , but it shows a lack of web understanding and as a result is more likey to deter business than promote it. Think about this...have you ever seen a print advert look like that...if not...why not? Will
  9. Yesssss.finallly somone has actually thought about their site before posting it...a nice clean and clear site. congrats. couple of points...text is a lil small. but i guess thats user pref site doesnt validate, but i think most of your issues come from the google map link (& not &) part from that ...good use of simple colour and layout...nice header n footer and normally im brutal! Will
  10. The 'garbage' contains the key!!!! Take time to look thru the garbage as in there there could well be the error message.
  11. id suggest posting more complete code so as we can gain a greater understandiong
  12. Yes it would. Youd need to understand the math behind the creation and look at GD's pixel mapping...ie imagesetpixel function. I dont know how to do it but it would mean getting the colour value of each pixel in the image and mathematically outputing it again in the desired shape.
  13. Firstly you while statement is not within your form therefore you value will neve be passed. Secondly you need to you a radioGroup. That way when you neame the group the value can be passed. Will
  14. That code i believe is proprietany to Dream weaver and its included within the <?php ?> tags. There is no way PHP can parse that. You need to close yopur tags before and reopen after that line
  15. you need to look at the round fucnction http://uk2.php.net/round
  16. Hi I have some code which opens a directory and reads the contents. In this case it performs some image manipulationof the jpgs it encounters. BUT The problem is that it does this based on the file structure which is by default, alphabetical . I need it to be numeric. ie DSC0001.jpg DSC0002.jpg etc currently i get DSC0001.jpg DSC0011.jpg DSC0002.jpg etc etc Any help?????? I am in a real pickle here.
  17. Sadly, im not sure that you can do this. What pdf lib are you using?
  18. persoanlly id separate your form fields into three...one for each and then provide drop down selection menus...that way you get exactly what you want with NO formatting errors
  19. surely there must be a way to open the file parse the contnets and say replace a tag with some other info from the DB???? Anyone? Will
  20. yeah i have tried googling...there seems to be a few possibilities. Has anyone done something similar? Will
  21. Hi I have a word.doc that I need to dynamically add headers and footers too...can anyone point me in the direction of a good tutorial etc? Thanks Will
  22. Seems to work on IE but not FF...is there an issue here?
  23. Here is another...both 'force the download'. I need a SAVE AS option....any ideas? <?php function output_file($file, $name, $mime_type='') { /* This function takes a path to a file to output ($file), the filename that the browser will see ($name) and the MIME type of the file ($mime_type, optional). If you want to do something on download abort/finish, register_shutdown_function('function_name'); */ if(!is_readable($file)) die('File not found or inaccessible!'); $size = filesize($file); $name = rawurldecode($name); /* Figure out the MIME type (if not specified) */ $known_mime_types=array( "pdf" => "application/pdf", "txt" => "text/plain", "html" => "text/html", "htm" => "text/html", "exe" => "application/octet-stream", "zip" => "application/zip", "doc" => "application/msword", "xls" => "application/vnd.ms-excel", "ppt" => "application/vnd.ms-powerpoint", "gif" => "image/gif", "png" => "image/png", "jpeg"=> "image/jpg", "jpg" => "image/jpg", "php" => "text/plain" ); if($mime_type==''){ $file_extension = strtolower(substr(strrchr($file,"."),1)); if(array_key_exists($file_extension, $known_mime_types)){ $mime_type=$known_mime_types[$file_extension]; } else { $mime_type="application/force-download"; }; }; @ob_end_clean(); //turn off output buffering to decrease cpu usage // required for IE, otherwise Content-Disposition may be ignored if(ini_get('zlib.output_compression')) ini_set('zlib.output_compression', 'Off'); header('Content-Type: ' . $mime_type); header('Content-Disposition: attachment; filename="'.$name.'"'); header("Content-Transfer-Encoding: binary"); header('Accept-Ranges: bytes'); /* The three lines below basically make the download non-cacheable */ header("Cache-control: private"); header('Pragma: private'); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // multipart-download and download resuming support if(isset($_SERVER['HTTP_RANGE'])) { list($a, $range) = explode("=",$_SERVER['HTTP_RANGE'],2); list($range) = explode(",",$range,2); list($range, $range_end) = explode("-", $range); $range=intval($range); if(!$range_end) { $range_end=$size-1; } else { $range_end=intval($range_end); } $new_length = $range_end-$range+1; header("HTTP/1.1 206 Partial Content"); header("Content-Length: $new_length"); header("Content-Range: bytes $range-$range_end/$size"); } else { $new_length=$size; header("Content-Length: ".$size); } /* output the file itself */ $chunksize = 1*(1024*1024); //you may want to change this $bytes_send = 0; if ($file = fopen($file, 'r')) { if(isset($_SERVER['HTTP_RANGE'])) fseek($file, $range); while(!feof($file) && (!connection_aborted()) && ($bytes_send<$new_length) ) { $buffer = fread($file, $chunksize); print($buffer); //echo($buffer); // is also possible flush(); $bytes_send += strlen($buffer); } fclose($file); } else die('Error - can not open file.'); die(); } $file='assets/docs/'.$_GET['f']; $name=$_GET['f']; output_file($file, $name, $mime_type='') ?>
×
×
  • 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.