Jump to content

bugcoder

Members
  • Posts

    74
  • Joined

  • Last visited

Everything posted by bugcoder

  1. your question is bit ambiguous. the above code is for page before showing thank you page? if it is so then you are also telling that you save random number in database, then why are you generating it again? how you are validating or want to validate random number?
  2. rewriting first function for you and look for what is difference between yours and mine function isLoggedIn() { if (isset($_SESSION['loginid'])){ echo $_SESSION['username']; return true; // the user is loged in } else { return false; // not logged in } return false; }
  3. Thanks for all replies. This is what I have got the solution with the help of my senior. php file code: $rbFile = "path/to/file.rb"; //ruby file full path $reply = system($cmd = "ruby $rbFile ". escapeshellarg(json_encode(array('options' => 1, 'abd'=>'def'))), $status); $ruby_response = json_decode($reply); print_r($ruby_response); //0 response is success if ($status === 0) { echo "yay!\n"; } else { echo "boo!\n"; } exit; Ruby File code: require 'json' #using php passed arguments in ruby file ARGV.each do |a| puts "Arguments: #{a}" end #replying to php file puts [result:'ok', rows:400, out_file:'/tmp/abc.txt'].to_json exit 0 # if success return 0 #exit 1 # if fail return 1
  4. hello all. In cakephp while a function saves a data in database, I want to grab unexpected errors and store in a variable and then show that errors to user, that while importing to database there were following errors. how can I do this grab errors in variable?
  5. ruby script can get that array in any variable and later that variable will be worked on for whatever purpose i would like to. ========= "You'd do it the same way you would with a regular command line." Any example of link will be very helpful for me
  6. Hello, I am calling a simple ruby file using following php system command and its working fine so far. Now I have an array that I want to pass to this ruby file. What is the best approach to do this? $rbFile = 'path/to/file.rb'; system($cmd = "ruby $rbFile", $status); echo "\$cmd is $cmd\n\n"; echo "\$status is {$status}\n\n";
  7. hi, i want the foreach loop to exit right away when i get warning message. How can I know that i have got warning while looping as foreach continues looping even if warning comes.
  8. Thanks Kicken I was using absolute path for ssconvert command but wasn't working but now its working for catdoc command.
  9. well it was not outputting anything and neigther it was converting to csv file now I am using catDoc following command but similar thing is happening. no output and no csv file. exec("xls2csv -x temp_name.xls -s cp1252 -d 8859-1 > output.csv"); whereas it works fine in terminal window.
  10. Hello experts, I am trying to run linux command for converting xls to csv file using php shell_exec but I am getting nothing in $output variable in following code. Paths etc are fine. $filePath = 'files/temp_file_location/temp_name.xls'; $csvOutput = 'files/temp_file_location/output.csv'; chdir('files/temp_file_location' ); $output = shell_exec("ssconvert --export-type=Gnumeric_stf:stf_csv $filePath $csvOutput"); echo $output; My above linux command is working perfectly fine in terminal window. Will be greatful for any kind of help.
  11. found solution echo ${"sumQuarter_{$quarterNumber}"};
  12. Hi, This might be basics of php but i haven't come across this situation before. $sumQuarter_1 = 121; $sumQuarter_2 = 223; ........so on later somewhere in code i have variable having just 1, 2 etc only e.g $quarterNumber = 2; now how can I get the value dynamically from $sumQuarter_2 as I can't use echo $sumQuarter_$quarterNumber; ------------- I hope my question is clear enough.
  13. well i was already searching in google however here is what i could finally get from my research <?php $watermark = imagecreatefrompng('transparent.png'); //image written "confidential" in it with grey color and white bg $watermark_width = imagesx($watermark); $watermark_height = imagesy($watermark); $image = imagecreatetruecolor($watermark_width, $watermark_height); $image = imagecreatefromjpeg("photo.jpg"); //photo on which watermark needs to be written $size = getimagesize("photo.jpg"); $dest_x = $size[0] - $watermark_width - 175; $dest_y = $size[1] - $watermark_height - 45; imagecopymerge($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, 50); imagejpeg($image,'new_image.jpg'); //uncomment the following two lines if you want to see result directly in browser or use the above line to get the file in directory. //header('content-type: image/jpeg'); //imagejpeg($image); imagedestroy($image); imagedestroy($watermark); ?>
  14. Hi, I am trying to add a transparent watermark on an image. I have a jpg image and I want to write transparent "confidential" on this image. Any kind of direction will be v helpful... Thank you.
  15. Thanks for the reply. it works like charm
  16. Hi developers, I have following country names in countries table with non-english chracters Cura?ao Saint Barth?lemy but when i try to show it on front end in dropdown it doesn't show up. How can i show it? thanks
  17. Thanks for the reply. I will now give full concentration for one month and will see how good i can get along with ror and then might be able to feel at more ease with ror.
  18. Hi all Php coders, I myself have been doing code in php/CakePhP since last 5 years. I have switched to freelancing a while ago and had plans to continue in php only. One of my recent client has asked me to shift to Ruby on Rails. I was quick in learning in other things so he suggested me and also helping me too in learning RoR. He have given various reasons that why RoR is better from php from future point of view. But my biggest concern is that if i will shift to RoR my php/CakePhp experience will lessen and after one or two years of RoR experience, i will still not be that expert. If i will keep coding in php after one or two years i will have 6 to 7 years of v good one solid experience. What you all php guros will suggest, that what step should i take? Should i learn ror or should i continue with php(by finding other clients) to increase my php experience further? Will be grateful to every suggestion Regards
  19. Thank you a lot for your great help indeed in both OOP and 5.3 version issue....................... yes it was not working also coz of 5.3 version now from php site i have found function that does same work as array_replace_recursive from this link and my code worked... link is http://php.net/manual/en/function.array-replace-recursive.php and its user contributed code by "Gregor at der-meyer dot de" Thanks again Adam!!!
  20. yes i did use the same code you said but i got the same error message again...
  21. but im getting error when iniating class like this $upload_handler = new UploadHandler( array("options" => array("upload_dir"=>ROOT.DS.'files'.DS.'newDire') )); the error is Fatal error: Call to undefined function array_replace_recursive() in D:\xampp\htdocs\...
  22. i have a class class UploadHandler { public $options; function __construct($options=null) { $this->options = array( 'upload_dir' => ROOT.DS.'files'.DS.'Jupload/', 'param_name' => 'files', 'max_file_size' => null, 'min_file_size' => 1 ); if ($options) { $this->options = array_replace_recursive($this->options, $options); } } .................other code } How can i change the options $this->options['upload_dir'] by calling this class in other class? Please help with example.
  23. Thats what i want to make sure that i should not bother about extra header...?
  24. I send a request to just one url using curl but its responding two headers. one with "HTTP/1.1 401 Unauthorized" and other "HTTP/1.1 200 OK" Why it is returning first one header? what im doing wrong in this case? Dont need this one:- requires only this one:-
×
×
  • 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.