Jump to content

drumhrd

Members
  • Posts

    78
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

drumhrd's Achievements

Member

Member (2/5)

0

Reputation

  1. I just fixed the file generation script to strip encoding and special characters. seems to work.
  2. I am having difficulty getting this to work. I am reading in files and converting them to array. Some array values for some reason have unknown characters, or are blank. I am attempting to exclude these by simply matching values with "DEI". But this is not working. Array ( [0] => �� [1] => PoolSata TSFDEI RAID-6(6+2) 63121.7 42218.5 20903.1 33 0 [2] => IBMi_EFD TEFDEI 2-Way Mir 733.7 78.8 654.9 89 0 [3] => IBMi_FC TFFDEI 2-Way Mir 5269.1 438.9 4830.2 91 0 [4] => PoolFC_300 TFFDEI 2-Way Mir 13754.6 10160.8 3593.7 26 0 [5] => PoolEFD TEFDEI RAID-5(3+1) 4402.4 648.8 3753.6 85 0 [6] => IBMi_Clone TFFDEI 2-Way Mir 4294.3 343.0 3951.3 92 0 [7] => [8] => [9] => ) <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title></title> </head> <? $file665 = file("/vmax-status/665status.txt"); $file570 = file("/vmax-status/570status.txt"); ?> <pre> <?print_r($file665); #print_r($file570); ?> </pre> <? $search = "DEI"; foreach ($file665 as $line) { if( strpos($line, $search) !== false){ echo $line; } else{ echo "?"; } } ?> </html>
  3. :'( I am attempting to find the value of a variable in a created array. as you can see from the script below. I am identifying any "non system" users by looking at the passwd file and what I want to do is take the userID from passwd, compare it to my known list of system users. I do not want a print out of system users, I just want users that have been created after the fact. The problem is, the if statement is not working and I am getting a print out of all my users, including the ones I do not want to see awk 'BEGIN { FS=":"; a[1] = "adm"; a[2] = "apache"; a[3] = "bin"; a[4] = "daemon"; a[5] = "ftp"; a[6] = "games"; a[7] = "gopher"; a[8] = "halt"; a[9] = "lp"; a[10] = "mail"; a[11] = "mysql"; a[12] = "named"; a[13] = "news"; a[14] = "nobody"; a[15] = "ntp"; a[16] = "operator"; a[17] = "pcap"; a[18] = "postfix"; a[19] = "radvd"; a[20] = "root"; a[21] = "rpc"; a[22] = "rpm"; a[23] = "shutdown"; a[24] = "sshd"; a[25] = "sync"; a[26] = "syscheck"; a[27] = "testuser"; a[28] = "tomcat4"; a[29] = "uucp"; a[30] = "vcsa"; while ( getline < "/etc/passwd" ) { if ($1 in a){} else {print $1} } }'
  4. TCPDUMP confirmed paypal is taking 30+ seconds to fully respond I see alot of initial info being passed, then a 30+ second pause before I get a final PUSH/ACK from paypal, then the connection closes. I am using a some cURL functions to execute this..maybe I am doing something wrong? Maybe I am not closing the connection properly or something. unforturnately, the Paypal API is only available via SSL so I cannot cURL clear text so I can decode the packets with wireshark to see what's going on. DoDirectPayment API $environment = 'sandbox'; // or 'beta-sandbox' or 'live' // Set request-specific fields. $paymentType = urlencode('Sale'); $firstName = urlencode($cc_info['cc']['cc_first_name']); $lastName = urlencode($cc_info['cc']['cc_last_name']); $creditCardType = urlencode($cc_info['cc']['cc_type']); $creditCardNumber = urlencode($cc_info['cc']['cc_num']); $expDateMonth = $cc_info['cc']['cc_month']; // Month must be padded with leading zero $padDateMonth = urlencode(str_pad($expDateMonth, 2, '0', STR_PAD_LEFT)); $expDateYear = urlencode($cc_info['cc']['cc_year']); $cvv2Number = urlencode($cc_info['cc']['cc_security']); $address1 = urlencode($cc_info['billing']['address']); $address2 = urlencode($cc_info['billing']['address2']); $city = urlencode($cc_info['billing']['city']); $state = urlencode($cc_info['billing']['state']); $zip = urlencode($cc_info['billing']['zip']); $country = urlencode($cc_info['billing']['country']); // US or other valid country code $amount = urlencode($_SESSION['Payment_Amount']); $currencyID = urlencode('USD'); // or other currency ('GBP', 'EUR', 'JPY', 'CAD', 'AUD') // Add request-specific fields to the request string. $nvpStr = "&PAYMENTACTION=$paymentType&AMT=$amount&CREDITCARDTYPE=$creditCardType&ACCT=$creditCardNumber". "&EXPDATE=$padDateMonth$expDateYear&CVV2=$cvv2Number&FIRSTNAME=$firstName&LASTNAME=$lastName". "&STREET=$address1&CITY=$city&STATE=$state&ZIP=$zip&COUNTRYCODE=$country&CURRENCYCODE=$currencyID"; // Execute the API operation; see the PPHttpPost function above. $httpParsedResponseAr = PPHttpPost('DoDirectPayment', $nvpStr); if("SUCCESS" == strtoupper($httpParsedResponseAr["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($httpParsedResponseAr["ACK"])) { if($httpParsedResponseAr["CVV2MATCH"] == "M"){ } exit('Direct Payment Completed Successfully: '.print_r($httpParsedResponseAr, true)); } else { exit('DoDirectPayment failed: ' . print_r($httpParsedResponseAr, true)); } } PPHttpPost function using cURL function PPHttpPost($methodName_, $nvpStr_) { global $environment; // Set up your API credentials, PayPal end point, and API version. $API_UserName = urlencode('secret'); $API_Password = urlencode('secret'); $API_Signature = urlencode(secret); $API_Endpoint = "https://api-3t.paypal.com/nvp"; if("sandbox" === $environment || "beta-sandbox" === $environment) { $API_Endpoint = "https://api-3t.$environment.paypal.com/nvp"; } $version = urlencode('51.0'); // Set the curl parameters. $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $API_Endpoint); curl_setopt($ch, CURLOPT_VERBOSE, 1); // Turn off the server and peer verification (TrustManager Concept). curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); // Set the API operation, version, and API signature in the request. $nvpreq = "METHOD=$methodName_&VERSION=$version&PWD=$API_Password&USER=$API_UserName&SIGNATURE=$API_Signature$nvpStr_"; // Set the request as a POST FIELD for curl. curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq); // Get response from the server. $httpResponse = curl_exec($ch); if(!$httpResponse) { exit("$methodName_ failed: ".curl_error($ch).'('.curl_errno($ch).')'); } // Extract the response details. $httpResponseAr = explode("&", $httpResponse); $httpParsedResponseAr = array(); foreach ($httpResponseAr as $i => $value) { $tmpAr = explode("=", $value); if(sizeof($tmpAr) > 1) { $httpParsedResponseAr[$tmpAr[0]] = $tmpAr[1]; } } if((0 == sizeof($httpParsedResponseAr)) || !array_key_exists('ACK', $httpParsedResponseAr)) { exit("Invalid HTTP Response for POST request($nvpreq) to $API_Endpoint."); } return $httpParsedResponseAr; } 23:43:32.391814 IP myhost.com.46058 > 216.113.191.88.https: S 1477130283:1477130283(0) win 5840 <mss 1460,sackOK,timestamp 330132343 0,nop,wscale 6> 23:43:32.430418 IP 216.113.191.88.https > myhost.com.46058: S 2478546518:2478546518(0) ack 1477130284 win 5792 <mss 1460,sackOK,timestamp 1321850687 330132343> 23:43:32.430439 IP myhost.com.46058 > 216.113.191.88.https: . ack 1 win 5840 <nop,nop,timestamp 330132352 1321850687> 23:43:32.431642 IP myhost.com.46058 > 216.113.191.88.https: P 1:128(127) ack 1 win 5840 <nop,nop,timestamp 330132353 1321850687> 23:43:32.431818 IP 216.113.191.88.https > myhost.com.46058: . ack 128 win 5792 <nop,nop,timestamp 1321850688 330132353> 23:43:32.481927 IP 216.113.191.88.https > myhost.com.46058: P 1:1341(1340) ack 128 win 5792 <nop,nop,timestamp 1321850738 330132353> 23:43:32.481944 IP myhost.com.46058 > 216.113.191.88.https: . ack 1341 win 8040 <nop,nop,timestamp 330132365 1321850738> 23:43:32.486976 IP 216.113.191.88.https > myhost.com.46058: P 1341:2681(1340) ack 128 win 5792 <nop,nop,timestamp 1321850743 330132365> 23:43:32.486991 IP myhost.com.46058 > 216.113.191.88.https: . ack 2681 win 10720 <nop,nop,timestamp 330132366 1321850743> 23:43:32.519440 IP 216.113.191.88.https > myhost.com.46058: P 2681:3375(694) ack 128 win 5792 <nop,nop,timestamp 1321850776 330132366> 23:43:32.519453 IP myhost.com.46058 > 216.113.191.88.https: . ack 3375 win 13400 <nop,nop,timestamp 330132375 1321850776> 23:43:32.544778 IP myhost.com.46058 > 216.113.191.88.https: P 128:326(198) ack 3375 win 13400 <nop,nop,timestamp 330132381 1321850776> 23:43:32.544964 IP 216.113.191.88.https > myhost.com.46058: . ack 326 win 6432 <nop,nop,timestamp 1321850801 330132381> 23:43:32.587472 IP 216.113.191.88.https > myhost.com.46058: P 3375:3434(59) ack 326 win 6432 <nop,nop,timestamp 1321850844 330132381> 23:43:32.587927 IP myhost.com.46058 > 216.113.191.88.https: P 326:859(533) ack 3434 win 13400 <nop,nop,timestamp 330132392 1321850844> 23:43:32.589238 IP 216.113.191.88.https > myhost.com.46058: . ack 859 win 7504 <nop,nop,timestamp 1321850846 330132392> 23:44:07.363055 IP 216.113.191.88.https > myhost.com.46058: P 3434:3924(490) ack 859 win 7504 <nop,nop,timestamp 1321885621 330132392> 23:44:07.363138 IP 216.113.191.88.https > myhost.com.46058: F 3924:3924(0) ack 859 win 7504 <nop,nop,timestamp 1321885621 330132392> 23:44:07.363517 IP myhost.com.46058 > 216.113.191.88.https: P 859:896(37) ack 3925 win 16080 <nop,nop,timestamp 330141085 1321885621> 23:44:07.363702 IP 216.113.191.88.https > myhost.com.46058: . ack 896 win 7504 <nop,nop,timestamp 1321885622 330141085> 23:44:07.363923 IP myhost.com.46058 > 216.113.191.88.https: R 896:896(0) ack 3925 win 16080 <nop,nop,timestamp 330141085 1321885622>
  5. Right now I am not worried about IPN. I am using DoDirectPayment, which in my testing agaist the sandbox site, has taken up to 2 minutes for a response. In the meantime, the page just sits on the form page..once the reponse is recieved, the response page loads. I do not like that affect. I would like to show a Please wait message with an animated status GIF to show the user the page is actually doing something.
  6. Hello all, I am building my own shopping cart, attempting to use paypals DoDirectPayment which seems to work fine. What I need is a splash page or "please wait" status image. I have my payment form on page A and my processing page on page B. page B doesn't load until the response back from paypal is finished and the server sends the generated code. I would like to be able to display a "processing please wait" or something of the sort on my page B until I get the response back from paypal. I've tried sleep() funcitons or ob_start()...but couldn't get those to work so trashed the code.
  7. well..I did some googling. found my answer SELECT * FROM table WHERE datefield > DATE_ADD( CURDATE( ) , INTERVAL +2 DAY )
  8. I need a way query a DB and get results based on the DATE in the table. where the <current date> is greater than 2 DAYs away from the DATE in the table. so I have a table DATES -------- 2009-4-2 2009-4-3 2009-4-4 2009-4-5 2009-4-6 $current_date = 2009-4-2 SELECT * FROM <TABLE> WHERE DATE > 2 days from $current_date; I want to query the DB and should get 2009-4-4, 2009-4-5, and 2009-4-6
  9. Fixed..there was a timing issue. <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_blank"" onsubmit="setTimeout(newPage, 1000);">
  10. Ok I have tried and tried and cannot get this code to work in safari or google chrome. Basically I am working on a shopping cart. The user will click the paypal pay now button. The form is submitted to paypal via a new window target="_blank" I also need to refresh the current page. This will write shopping cart data to DB via php upon page refresh. Safari and google Chrome will open the paypal window, but seems to ignore the javascript to refresh the browser. FF and IE both work fine. <script LANGUAGE="JavaScript"> function newPage() { self.location.href=\'https://www.artists2you.com/s/orderconfirm.php?ordernumber='.$_SESSION['ordernumber'].'\'; } </script> <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_blank"" onSubmit=\'newPage()\'>
  11. thanks addslashes() did the trick...like I said..I am not thinking straight today..thanks again!!
  12. Ok..apparently I have no brain on today. Example code: $var = " INSERT INTO tour_dates(band_number,tddate1,tddate2,tddate3,tdvenue1,tdvenue2,tdvenue3, tdlocation1,tdlocation2,tdlocation3,tdtime1,tdtime2,tdtime3,tdcost1,tdcost2,tdcost3) VALUES('85','2010-07-17','2010-03-01','2010-07-12','Erin's bday','stepehn's bday','my Bday', 'some place cool','some place not so cool','a freaking sweet place to be','1:00 am','8:00 am', '4:00 am','02.00','01.00','05.00')"; I need to be able to comment out any single qoutes so I can make it work. I know there is a function somewhere..just got some serious brain block today..can't find the function I need. Thought maybe regex???? Dunno.. Basically 'Erin's bday','stepehn's bday', needs to look like 'Erin\'s bday','stepehn\'s bday',
  13. I attempted to change my code around..still no luck.. if ($_REQUEST['mc_gross'] == $total || $_REQUEST['mc_gross'] == $plusone || $_REQUEST['mc_gross'] == $minusone){ //processing code omitted. } else{ //assume fraud write to file //figure out the best way to log the data $compare = strcmp($_REQUEST[mc_gross],$total); $test = $test . " compare is " .$compare."\n"; $test = $test . " totals don't match\n"; $test = $test . " mc_gross was ".$_REQUEST['mc_gross'] ."\n"; $test = $test . " total was ".$total ."\n"; $test = $test . " plus one was ".$plusone ."\n"; $test = $test . " minus one was ".$minusone ."\n"; $myfile = '/var/www/test.log'; $fh = fopen($myfile, 'a') or die ("can't open file - " . $myfile); fwrite($fh, $test); fclose($fh); exit; } I don't know why they aren't matching //from log file emails match total is 19.99 compare is 0 totals don't match mc_gross was 19.99 total was 19.99 plus one was 20 minus one was 19.98
  14. Ok so not sure why this isn't working. if my $total,$plusone, or $minusone vars == to the $_REQUEST['mc_gross'] I want to do some processsing. However my code isn't working. Notice the file logging I am doing. Here is output from my log file emails match total is 10.98 compare is 0 totals don't match mc_gross was 10.98 total was 10.98 plus one was 10.99 minus one was 10.97 At first I didn't use strcmp but thought maybe somehow the strings weren't matching. notice strcmp returns a "0"..why is this code firing on my if and not skipping to my else??? //make sure the order totals match $test = $test . " emails match\n"; $total = $_REQUEST['mc_shipping'] + $txn_paid_total['order_total']; $test = $test . " total is ".$total . "\n"; //since the getsplitship function rounds to the nearest penny //set variables to check for +/- 1 penny $plusone = $total + .01; $minusone = $total - .01; if (strcmp($_REQUEST['mc_gross'],$total) != "0" || strcmp($_REQUEST['mc_gross'],$plusone) != "0" || strcmp($_REQUEST['mc_gross'],$minusone) != "0"){ //if ($_REQUEST['mc_gross'] != $total || $_REQUEST['mc_gross'] != $plusone || $_REQUEST['mc_gross'] != $minusone){ //assume fraud write to file //figure out the best way to log the data $compare = strcmp($_REQUEST['mc_gross'],$total); $test = $test . " compare is " .$compare."\n"; $test = $test . " totals don't match\n"; $test = $test . " mc_gross was ".$_REQUEST['mc_gross'] ."\n"; $test = $test . " total was ".$total ."\n"; $test = $test . " plus one was ".$plusone ."\n"; $test = $test . " minus one was ".$minusone ."\n"; $myfile = '/var/www/test.log'; $fh = fopen($myfile, 'a') or die ("can't open file - " . $myfile); fwrite($fh, $test); fclose($fh); exit; } else{ //processing code omitted }
  15. ok this seems to work..thanks for the help.
×
×
  • 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.