Jump to content

bugcoder

Members
  • Posts

    74
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

bugcoder's Achievements

Member

Member (2/5)

0

Reputation

  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
×
×
  • 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.