Jump to content

aarontbarksdale

Members
  • Content Count

    75
  • Joined

  • Last visited

Community Reputation

0 Neutral

About aarontbarksdale

  • Rank
    Newbie
  • Birthday 01/01/1980

Previous Fields

  • Languages
    HTML, PHP & SQL (n00b Level 20), English...and Pig Latin.

Profile Information

  • Location
    Ocean Springs, MS
  • Interests
    God, Family, Movies, Video Games...geeky stuff!

Contact Methods

  • Yahoo
    fmulder1013
  1. Don, Thanks, tried that...didn't work. I changed the code to read $update = mysql_query('UPDATE mcn_users SET first_name = "$first_name", last_name = "$last_name", bill_address = "$address", city = "$city", state = "$state", zip = "$zip", phone = "$phone", email = "$user_email", user_pass = "$password" WHERE user_id = "$userid"'); And removed the @mysql_query($update); line...still doesn't work.
  2. Hey Guys, So, I know this information is all over the 'net...and I've scoured dozens of similar problems, however, none of the suggested fixes have helped for my code. So, I've turned back here... <? session_start(); ?><?php$email = $_SESSION['email'];$userid = $_SESSION['user_id'];include ('connect.php');$result = mysql_query("SELECT * FROM shadbarktest.mcn_users WHERE email = '$email'"); $row = mysql_fetch_array($result);// data sent from form $first_name = $_POST['first_name'];$last_name = $_POST['last_name'];$user_email = $_POST['email'];$address = $_POST['address'];$city = $_POST['city'];$state = $_POST['state'];$zip = $_POST['zip'];$phone = $_POST['phone'];$password = $_POST['password'];// To protect MySQL injection (more detail about MySQL injection)$first_name = stripslashes($first_name);$last_name = stripslashes($last_name);$user_email = stripslashes($user_email);$address = stripslashes($address);$city = stripslashes($city);$state = stripslashes($state);$zip = stripslashes($zip);$phone = stripslashes($phone);$password = stripslashes($password);$first_name = mysql_real_escape_string($first_name);$last_name = mysql_real_escape_string($last_name);$user_email = mysql_real_escape_string($user_email);$address = mysql_real_escape_string($address);$city = mysql_real_escape_string($city);$state = mysql_real_escape_string($state);$zip = mysql_real_escape_string($zip);$phone = mysql_real_escape_string($phone);$password = mysql_real_escape_string($password);// Adding information to Database$update = 'UPDATE mcn_users SET first_name = "$first_name", last_name = "$last_name", bill_address = "$address", city = "$city", state = "$state", zip = "$zip", phone = "$phone", email = "$user_email", user_pass = "$password" WHERE user_id = "$userid"';@mysql_query($update);$_SESSION['email'] = $user_email;echo $userid ."<br/>";echo $first_name ."<br/>";echo $last_name ."<br/>";echo "<a href="user_mainpage.php">Return</a>";?> It simply is not adding the updated information that it receives from the Edit User page to the database. Please point out to me where I've gone wrong:I have tried... NOTHING HAS WORKED...which leads me to question if I even have the syntax correct.
  3. Nothing. The code starts the date at 12/31/1969. No information from the customer's page gets carried over to the report. No payments or anything.
  4. session_start(); is at the top of every page, first line of code. I'll try removing the ` ` around clients in the table lines to see if that works.
  5. Okay, so, it was working...now it doesn't. PLEASE HELP! NEED IT WORKING TODAY!!! require ('connect.php');$myusername = $_SESSION['myusername'];//Data from Clients table and variables associate$client_table = mysql_query("SELECT * FROM `clients` WHERE client_id = ". $_SESSION['clientid'] ." ") or die(mysql_error());$row = mysql_fetch_assoc($client_table);//Data from Payments table and variables associated$pmt_table = mysql_query("SELECT * FROM `payments` WHERE client_id = ". $_SESSION['clientid'] ." ORDER BY YEAR(pmt_date) ASC") or die(mysql_error());$row2 = mysql_fetch_assoc($pmt_table);$userstate = $row2['userstate']; The ENTIRE report.php file is dependent upon information from the database that carried over via Session from the client's information page with a unique ID number that corresponds to the client_id in the database. I can access all the information in the client info.php, but it's like it doesn't carry over. Please help ASAP!
  6. Okay, I think I've resolved my issue. Since I could not get everything to generate like I needed it to, I simply added a line in the Javascript that will redirect the page upon success to the CONFIRMED page that will include the php script for adding information to the database.
  7. Okay, so I found this tutorial, http://net.tutsplus.com/tutorials/tools-and-tips/so-you-want-to-accept-credit-cards-online/ and I got it to work...the ONLY thing that I have done to change the code is my Secret/Publish Live and Test keys...and the price...all code is the same. I've tried to redirect a successful payment to another page, and an unsuccessful payment to reload. But it throws an error reading pay.php file. So, I remove the code and viola! it works again. I tried to add a CreateCustomer script (per the Stripe.com docs) and it threw the an error saying the credit card is invalid. I need it to do like it's supposed to...collect and store the information, charge the card, redirect to a page where they can continue logging in and using the system. Any suggestions...
  8. Okay...so after playing around with the damn thing and making it NOT have the above error, it runs ONCE and gives me the error. Here's the code snippets that the signup.php file for processing: <head> <script type="text/javascript" src="https://js.stripe.com/v1/"></script> <!-- jQuery is used only for this example; it isn't required to use Stripe --> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script type="text/javascript"> // This identifies your website in the createToken call below Stripe.setPublishableKey('pk_test_jsKjsHzkOpK2PG7ZMLQ9XYj8'); var stripeResponseHandler = function(status, response) { var $form = $('#payment-form'); if (response.error) { // Show the errors on the form $form.find('.payment-errors').text(response.error.message); $form.find('button').prop('disabled', false); } else { // token contains id, last4, and card type var token = response.id; // Insert the token into the form so it gets submitted to the server $form.append($('<input type="hidden" name="stripeToken" />').val(token)); // and re-submit $form.get(0).submit(); } }; jQuery(function($) { $('#payment-form').submit(function(e) { var $form = $(this); // Disable the submit button to prevent repeated clicks $form.find('button').prop('disabled', true); Stripe.createToken($form, stripeResponseHandler); // Prevent the form from submitting with the default action return false; }); }); </script></head>....//utilizes the Checkout script<?php require_once('login/stripe/config.php'); ?><form method="post" action="charge.php"><script src="https://checkout.stripe.com/v2/checkout.js" class="stripe-button" data-key="<?php echo $stripe['publishable_key']; ?>" data-amount="2499" data-description="Monthly Subscription" data-name="Child Support Arrearage Calculator" data-panel-label="Subscribe" data-address="Customer's Address"></script></form> The charge.php script is: <?php require_once(dirname(__FILE__) . '/login/stripe/config.php'); $token = $_POST['stripeToken']; $customer = Stripe_Customer::create(array( "email" => $_POST['email'], "card" => $token,)); $charge = Stripe_Charge::create(array( 'customer' => $customer->id, 'amount' => 2499, 'currency' => 'usd')); echo '<h1>Successfully charged $24.99!</h1><br/>'; $_SESSION['stripeToken'] = $token;?>
  9. JSG: Here's the code for the APIRequestor.php <?php class Stripe_ApiRequestor{ public $apiKey; public function __construct($apiKey=null) { $this->_apiKey = $apiKey; } public static function apiUrl($url='') { $apiBase = Stripe::$apiBase; return "$apiBase$url"; } public static function utf8($value) { if (is_string($value) && mb_detect_encoding($value, "UTF-8", TRUE) != "UTF-8") return utf8_encode($value); else return $value; } private static function _encodeObjects($d) { if ($d instanceof Stripe_ApiResource) { return self::utf8($d->id); } else if ($d === true) { return 'true'; } else if ($d === false) { return 'false'; } else if (is_array($d)) { $res = array(); foreach ($d as $k => $v) $res[$k] = self::_encodeObjects($v); return $res; } else { return self::utf8($d); } } public static function encode($arr, $prefix=null) { if (!is_array($arr)) return $arr; $r = array(); foreach ($arr as $k => $v) { if (is_null($v)) continue; if ($prefix && $k && !is_int($k)) $k = $prefix."[".$k."]"; else if ($prefix) $k = $prefix."[]"; if (is_array($v)) { $r[] = self::encode($v, $k, true); } else { $r[] = urlencode($k)."=".urlencode($v); } } return implode("&", $r); } public function request($meth, $url, $params=null) { if (!$params) $params = array(); list($rbody, $rcode, $myApiKey) = $this->_requestRaw($meth, $url, $params); $resp = $this->_interpretResponse($rbody, $rcode); return array($resp, $myApiKey); } public function handleApiError($rbody, $rcode, $resp) { if (!is_array($resp) || !isset($resp['error'])) throw new Stripe_ApiError("Invalid response object from API: $rbody (HTTP response code was $rcode)", $rcode, $rbody, $resp); $error = $resp['error']; switch ($rcode) { case 400: case 404://LINE 86 throw new Stripe_InvalidRequestError(isset($error['message']) ? $error['message'] : null, isset($error['param']) ? $error['param'] : null, $rcode, $rbody, $resp); case 401: throw new Stripe_AuthenticationError(isset($error['message']) ? $error['message'] : null, $rcode, $rbody, $resp); case 402: throw new Stripe_CardError(isset($error['message']) ? $error['message'] : null, isset($error['param']) ? $error['param'] : null, isset($error['code']) ? $error['code'] : null, $rcode, $rbody, $resp); default: throw new Stripe_ApiError(isset($error['message']) ? $error['message'] : null, $rcode, $rbody, $resp); } } private function _requestRaw($meth, $url, $params) { $myApiKey = $this->_apiKey; if (!$myApiKey) $myApiKey = Stripe::$apiKey; if (!$myApiKey) throw new Stripe_AuthenticationError('No API key provided. (HINT: set your API key using "Stripe::setApiKey(<API-KEY>)". You can generate API keys from the Stripe web interface. See [url="https://stripe.com/api"]https://stripe.com/api[/url] for details, or email support@stripe.com if you have any questions.'); $absUrl = $this->apiUrl($url); $params = self::_encodeObjects($params); $langVersion = phpversion(); $uname = php_uname(); $ua = array('bindings_version' => Stripe::VERSION,'lang' => 'php','lang_version' => $langVersion,'publisher' => 'stripe','uname' => $uname); $headers = array('X-Stripe-Client-User-Agent: ' . json_encode($ua), 'User-Agent: Stripe/v1 PhpBindings/' . Stripe::VERSION, 'Authorization: Bearer ' . $myApiKey); if (Stripe::$apiVersion) $headers[] = 'Stripe-Version: ' . Stripe::$apiVersion; list($rbody, $rcode) = $this->_curlRequest($meth, $absUrl, $headers, $params); return array($rbody, $rcode, $myApiKey); } private function _interpretResponse($rbody, $rcode) { try { $resp = json_decode($rbody, true); } catch (Exception $e) { throw new Stripe_ApiError("Invalid response body from API: $rbody (HTTP response code was $rcode)", $rcode, $rbody); } if ($rcode < 200 || $rcode >= 300) { $this->handleApiError($rbody, $rcode, $resp); } return $resp; } private function _curlRequest($meth, $absUrl, $headers, $params) { $curl = curl_init(); $meth = strtolower($meth); $opts = array(); if ($meth == 'get') { $opts[CURLOPT_HTTPGET] = 1; if (count($params) > 0) {$encoded = self::encode($params);$absUrl = "$absUrl?$encoded"; } } else if ($meth == 'post') { $opts[CURLOPT_POST] = 1; $opts[CURLOPT_POSTFIELDS] = self::encode($params); } else if ($meth == 'delete') { $opts[CURLOPT_CUSTOMREQUEST] = 'DELETE'; if (count($params) > 0) {$encoded = self::encode($params);$absUrl = "$absUrl?$encoded"; } } else { throw new Stripe_ApiError("Unrecognized method $meth"); } $absUrl = self::utf8($absUrl); $opts[CURLOPT_URL] = $absUrl; $opts[CURLOPT_RETURNTRANSFER] = true; $opts[CURLOPT_CONNECTTIMEOUT] = 30; $opts[CURLOPT_TIMEOUT] = 80; $opts[CURLOPT_RETURNTRANSFER] = true; $opts[CURLOPT_HTTPHEADER] = $headers; if (!Stripe::$verifySslCerts) $opts[CURLOPT_SSL_VERIFYPEER] = false; curl_setopt_array($curl, $opts); $rbody = curl_exec($curl); $errno = curl_errno($curl); if ($errno == CURLE_SSL_CACERT ||$errno == CURLE_SSL_PEER_CERTIFICATE ||$errno == 77 // CURLE_SSL_CACERT_BADFILE (constant not defined in PHP though)) { array_push($headers, 'X-Stripe-Client-Info: {"ca":"using Stripe-supplied CA bundle"}'); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); curl_setopt($curl, CURLOPT_CAINFO, dirname(__FILE__) . '/../data/ca-certificates.crt'); $rbody = curl_exec($curl); } if ($rbody === false) { $errno = curl_errno($curl); $message = curl_error($curl); curl_close($curl); $this->handleCurlError($errno, $message); } $rcode = curl_getinfo($curl, CURLINFO_HTTP_CODE); curl_close($curl); return array($rbody, $rcode); } public function handleCurlError($errno, $message) { $apiBase = Stripe::$apiBase; switch ($errno) { case CURLE_COULDNT_CONNECT: case CURLE_COULDNT_RESOLVE_HOST: case CURLE_OPERATION_TIMEOUTED: $msg = "Could not connect to Stripe ($apiBase). Please check your internet connection and try again. If this problem persists, you should check Stripe's service status at [url="https://twitter.com/stripestatus"]https://twitter.com/stripestatus[/url], or let us know at support@stripe.com."; break; case CURLE_SSL_CACERT: case CURLE_SSL_PEER_CERTIFICATE: $msg = "Could not verify Stripe's SSL certificate. Please make sure that your network is not intercepting certificates. (Try going to $apiBase in your browser.) If this problem persists, let us know at support@stripe.com."; break; default: $msg = "Unexpected error communicating with Stripe. If this problem persists, let us know at support@stripe.com."; } $msg .= "\n\n(Network error [errno $errno]: $message)"; throw new Stripe_ApiConnectionError($msg); }}
  10. I have created a form, I have no issues with the FORM or entering that information into the database. I have also been able to successfully get the payment process to work. However, the problem I'm having is getting the form to pass through the payment so that (A) the same information that I store in my db can be in the stripe customer information and (B.) it continues to throw an error with regards to the subscription API. I have the subscription setup, I do NOT have a script that creates a new subscription in the API.
  11. Yes. I downloaded all of the libraries and can get it setup. I have a form but what I don't have is the understanding on how to take that information insert it into MY database. That's what I can't understand how to adjust that.
  12. Is there anyone who might be able to assist me in creating a form that will collect all the necessary information that I require for my user set-up then input that information into my database. For more info: https://stripe.com/
  13. Holy shnikees! That's the dang problem...Thanks again justsomeguy...
  14. Nothing...I tried it with ` back quotes ` and without any quotes. the error looks like it starts right at the SET portion. Var_dump returns correct information with regards to the first field name.....so, I have NO idea!
×
×
  • Create New...