Jump to content

blackcell

Members
  • Posts

    439
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

blackcell's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. I need to send a cURL request containing a file to upload as well as a JSON string. I can get a properly formatted request when sending the JSON, but the file is throwing it off. $curl_file_object = '@'.$tmp_name $postData= array( 'JSON'=> json_encode($jsonParams), $reference => $curl_file_object, ); $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $target); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); // stop verifying certificate curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_HEADER, true); curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: multipart/form-data;")); curl_setopt($curl, CURLOPT_POST, true); // enable posting curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); // post data curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); // if any redirection after upload $response = curl_exec($curl); $info = curl_getinfo($curl); curl_close($curl); debug($info); Am I the first one needing to send file binary data along with a json string to a server at the same time?
  2. To answer your question without posting completely off the topic... The best source is the cookbook: https://www.google.com/webhp?sourceid=chrome-instant&rlz=1C1CHWA_enUS627US627&ion=1&espv=2&ie=UTF-8#safe=off&q=cakephp+cookbooks One of the first three links depending on version. Welcome — CakePHP Cookbook 3.x documentationWelcome — CakePHP Cookbook 2.x documentation
  3. Yep. That was it. Thanks max_gyver. I've been out of coding for about half a year now so things are a bit rusty.
  4. <?php ini_set("error_reporting","-1"); ini_set("display_errors","on"); $Pay_freq = $_REQUEST['Pay_freq']; $Start_value = $_REQUEST['Start_value']; $Start_date = $Start_date_ori = $_REQUEST['Start_date']; $Pay_earnings = $_REQUEST['Pay_earnings']; $Perc_contr = $_REQUEST['Perc_contr']/100; $Perc_emp_contr = $_REQUEST['Perc_emp_contr']/100; if($Perc_contr > .08){ $perc_non_matched = $Perc_contr - .08; $Perc_contr = .08; }else{ $non_matched_contri = 0; } $yourContrib = number_format(round( (($Pay_earnings*$Perc_contr)+($Pay_earnings*$perc_non_matched)), 2)); $empContrib = number_format(round(($Pay_earnings*$Perc_contr)*$Perc_emp_contr,2)); $totalContrib = number_format($yourContrib+$empContrib); $projection = " <br /> <table class='Standard' align='center' width='900' border='1'> <tr bgcolor='#CCCCCC'> <td colspan='3' align='center'><h1>Per Paycheck Contribution</h1></td> </tr> <tr> <td width='' align='center'><b><big>Your Contribution</big></b></td> <td width='' align='center'><b><big>Employer Matched Contribution</big></b></td> <td width='' align='center'><b><big>Total Contribution</big></b></td> </tr> <tr> <td width='' align='center'>$"."$yourContrib</td> <td width='' align='center'>$"."$empContrib</td> <td width='' align='center'>$"."$totalContrib</td> </tr> <tr bgcolor='#CCCCCC'> <td colspan='3' align='center'><h1>Projection Base(Without Investment Return)</h1></td> </tr> "; $totalValue = $Start_value; if($Pay_freq == "Bi-Weekly")$incPeriod = 1209600; if($Pay_freq == "Weekly")$incPeriod = 604800; $payPeriod = 0; $year_last = 1900; while($payPeriod <= 520){ $totalValue = $totalValue + $totalContrib; $year = date("Y",strtotime($Start_date)); if($year != $year_last){ $projection .= " <tr bgcolor='#6699FF'> <td colspan='3' align='left'><h2><b>$year</b></h2></td> </tr> "; $year_last = $year; } $projection .= " <tr class='Hover'> <td colspan='1' align='left'>$Start_date</td> <td colspan='2' align='left'>$".round($totalValue,2)."</td> </tr> "; $payPeriod++; $Start_date = date("Y-m-d",strtotime($Start_date)+$incPeriod); } $projection .= " </table> "; echo json_encode(array("projection"=>$projection,"date"=>$Start_date_ori)); ?>
  5. I figured the problem resided in the initial calculations since the shift from 39 to 40 causes an overall contribution issue before even entering the loop.
  6. Of course. Sorry I should have included this. Sorry have a ton going on the past week. $totalValue = $Start_value; if($Pay_freq == "Bi-Weekly")$incPeriod = 1209600; if($Pay_freq == "Weekly")$incPeriod = 604800; $payPeriod = 0; $year_last = 1900; while($payPeriod <= 520){ $totalValue = $totalValue + $totalContrib; $year = date("Y",strtotime($Start_date)); if($year != $year_last){ $projection .= " <tr bgcolor='#6699FF'> <td colspan='3' align='left'><h2><b>$year</b></h2></td> </tr> "; $year_last = $year; } $projection .= " <tr class='Hover'> <td colspan='1' align='left'>$Start_date</td> <td colspan='2' align='left'>$".round($totalValue,2)."</td> </tr> "; $payPeriod++; $Start_date = date("Y-m-d",strtotime($Start_date)+$incPeriod); }
  7. I tried error reporting and nothing. Attached is three SS. Anything <= 38 works like it should. 39 starts going crazy. Calculates the correct monthly contribution but not the correct monthly values. Anything >= 40 totally goes wrong. http://progtronics.com/files/38.PNG http://progtronics.com/files/39.PNG http://progtronics.com/files/40.PNG
  8. //I am calculating payroll contributions to 401k to give employees a baseline outlook for 20 years to check against their portfolio quarterly reports. It all works until numbers start getting larger. Nothing //ginormous...this is the reason I am at a loss. Is there a setting in php.ini that would be bombing? Sorry...the code formatting tool is acting dumb. $Pay_earnings = $_REQUEST['Pay_earnings']; $Perc_contr = $_REQUEST['Perc_contr']/100; $Perc_emp_contr = $_REQUEST['Perc_emp_contr']/100; if($Perc_contr > .08){ $perc_non_matched = $Perc_contr - .08; $Perc_contr = .08; }else{ $non_matched_contri = 0; } $yourContrib = number_format(round( (($Pay_earnings*$Perc_contr)+($Pay_earnings*$perc_non_matched)), 2)); $empContrib = number_format(round(($Pay_earnings*$Perc_contr)*$Perc_emp_contr,2)); $totalContrib = number_format($yourContrib+$empContrib); echo " <br /> <table class='Standard' align='center' width='900' border='1'> <tr bgcolor='#CCCCCC'> <td colspan='3' align='center'><h1>Per Paycheck Contribution</h1></td> </tr> <tr> <td width='' align='center'><b><big>Your Contribution</big></b></td> <td width='' align='center'><b><big>Employer Matched Contribution</big></b></td> <td width='' align='center'><b><big>Total Contribution</big></b></td> </tr> <tr> <td width='' align='center'>$"."$yourContrib</td> <td width='' align='center'>$"."$empContrib</td> <td width='' align='center'>$"."$totalContrib</td> </tr> <tr bgcolor='#CCCCCC'> <td colspan='3' align='center'><h1>Projection Base(Without Investment Return)</h1></td> </tr> This works find until my $Perc_contr rises above 40. Then my $totalContrib toward the bottom does not reflect my $yourContrib in the addition. But the actual TD holding the $yourContrib is fine. I am frikin dumbfounded....
  9. I've been looking at Drive Bender by the way. I'm not sure about reliability and support though. http://www.drivebender.com/index.php/features/105.html
  10. I have a bunch of old 7200 RPM drives at work. I am in need of space for user files that need redundancy. I link users' personal drive on logon and would like to remap these to a standalone system other than the company shared network drives on replicated servers at two locations. Would there be anyway software that would enable sata drives to be popped in to RAID to create a new aggregate and use as user storage? I know you can go buy Netapps for buckoo bucks but would rather have the ability to pop sata drives in on failure to a standalone system.
  11. Thanks a ton! This is an expression match on an exchange server. So the backslash wasn't accepted for some weird reason.
  12. Hello guys(and girls), I am finding more of a need to learn RegEx. I have a very basic knowledge of it(basically what it is used for and how to make literal text matches with no considerations. I have been trying to figure out how to go about writing a regex to block emails originating from anyone@domain.in but I don't want to block jim.inners@somewhere.com What do I use to restrict the match to must not have anything following it?
  13. blackcell

    Stack

    You can try to specify a width but I am not sure css divs are meant for that. That is more along the lines of tabular data and tables need to be used. I have run into this same issue. I div/span everything until I need data displayed in table form and then use tables.
  14. I have tried this: in the head and it doesn't seem to work. Is there a problem with subdomains or smf forum theme interfacing?
×
×
  • 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.