Jump to content

stublackett

Members
  • Posts

    331
  • Joined

  • Last visited

About stublackett

  • Birthday 10/01/1985

Contact Methods

  • MSN
    stuartb15@hotmail.com
  • Website URL
    http://www.stuartblackett.com/
  • ICQ
    131386371

Profile Information

  • Gender
    Male
  • Location
    Hartlepool, UK

stublackett's Achievements

Advanced Member

Advanced Member (4/5)

0

Reputation

  1. Hi Barand, Really appreciate your help on this one. Now I have the array in some form I need, I just need to split down based on market type to then do an sort on it. This has left me with something to go off. Many Thanks!
  2. Hi, appreciate the answer! Looks like its going to send me in the right direction. Just wondering what I set "$_xml_string" as?
  3. Hi Barand, Totally agree with your comment there and apologies! If I could have edited my original post I would have added a couple of things, Such as my actual PHP code. An example of the XML feed is here My current PHP code looks like : foreach($array->Outcome as $outcome) { $outcometypes = $outcome->attributes(); $outcomename = $outcometypes['name']; foreach($outcome->Bookmaker as $bookmaker) { $bookmakers = $bookmaker->attributes(); $bookmaker_name = $bookmaker['name']; // Replace Spaces, William Hill Now = WilliamHill $bookmaker_name = str_replace( ' ', '', $bookmaker_name); foreach($bookmaker->Odds as $odds) { $odds_types = $odds->attributes(); $currentprice = $odds_types['currentPrice']; $decimalprice = $this->convert_decimal($currentprice); $odds_types->addAttribute('decimal', $decimalprice); foreach($odds_types['bet'] as $bet) { } } } } Thank You!
  4. Hi, I am working on a betting API, The data comes from an XML Feed. I am using a PHPPhar file to iterate the XML data, Seems to work really well. What I need to do now is iterate each "outcome" type and order it by the highest decimal to lowest decimal value (Best odds) My current array of data from the XML looks like this (See pastebin for full version) : SimpleXMLElement Object ( [Outcome] => Array ( [0] => SimpleXMLElement Object ( [@attributes] => Array ( [id] => 1 [name] => 1X2 ) [Bookmaker] => Array ( [0] => SimpleXMLElement Object ( [@attributes] => Array ( [id] => 8 [name] => Bet365 [isLive] => false [lastUpdate] => 2015-01-15T04:17:03 [bookieEventID] => [bookieLeagueID] => [BookieOfferTypeID] => 40 ) [Odds] => Array ( [0] => SimpleXMLElement Object ( [@attributes] => Array ( [id] => 10026743121640944 [bet] => 1 [startPrice] => 9/2 [currentPrice] => 5/1 [line] => [LastUpdate] => 2015-01-15T04:17:03 [bookieOutcomeID] => [Status] => Open ) ) [1] => SimpleXMLElement Object ( [@attributes] => Array ( [id] => 10026743131640944 [bet] => 2 [startPrice] => 31/50 [currentPrice] => 57/100 [line] => [LastUpdate] => 2015-01-15T04:17:03 [bookieOutcomeID] => [Status] => Open ) ) [2] => SimpleXMLElement Object ( [@attributes] => Array ( [id] => 10026743511640944 [bet] => X [startPrice] => 11/4 [currentPrice] => 3/1 [line] => [LastUpdate] => 2015-01-14T17:55:48 [bookieOutcomeID] => [Status] => Open ) ) ) )[1] => SimpleXMLElement Object ( [@attributes] => Array ( [id] => 2 [name] => Under/Over ) [Bookmaker] => Array ( [0] => SimpleXMLElement Object ( [@attributes] => Array ( [id] => 8 [name] => Bet365 [isLive] => false [lastUpdate] => 2015-01-15T15:25:31 [bookieEventID] => [bookieLeagueID] => [BookieOfferTypeID] => 981 ) [Odds] => Array ( [0] => SimpleXMLElement Object ( [@attributes] => Array ( [id] => 14185280871640944 [bet] => Over [startPrice] => 1/20 [currentPrice] => 3/50 [line] => 0.5 [LastUpdate] => 2015-01-15T15:15:14 [bookieOutcomeID] => [Status] => Open ) ) [1] => SimpleXMLElement Object ( [@attributes] => Array ( [id] => 8219239561640944 [bet] => Over [startPrice] => 9/50 [currentPrice] => 1/5 [line] => 1.25 [LastUpdate] => 2015-01-15T08:30:43 [bookieOutcomeID] => [Status] => Open ) ) [2] => SimpleXMLElement Object ( [@attributes] => Array ( [id] => 13305582441640944 [bet] => Over [startPrice] => 29/100 [currentPrice] => 8/25 [line] => 1.5 [LastUpdate] => 2015-01-15T15:25:31 [bookieOutcomeID] => [Status] => Open ) ) [3] => SimpleXMLElement Object ( [@attributes] => Array ( [id] => 15814388431640944 [bet] => Over [startPrice] => 7/20 [currentPrice] => 2/5 [line] => 1.75 [LastUpdate] => 2015-01-15T08:30:43 [bookieOutcomeID] => [Status] => Open ) ) [4] => SimpleXMLElement Object ( [@attributes] => Array ( [id] => 9542253841640944 [bet] => Over [startPrice] => 9/20 [currentPrice] => 13/25 [line] => 2.0 [LastUpdate] => 2015-01-15T08:53:07 [bookieOutcomeID] => [Status] => Open ) ) [5] => SimpleXMLElement Object ( [@attributes] => Array ( [id] => 18435608691640944 [bet] => Over [startPrice] => 17/25 [currentPrice] => 77/100 [line] => 2.25 [LastUpdate] => 2015-01-15T08:53:07 [bookieOutcomeID] => [Status] => Open ) )[2] => SimpleXMLElement Object ( [@attributes] => Array ( [id] => 17 [name] => Both Teams To Score ) [Bookmaker] => Array ( [0] => SimpleXMLElement Object ( [@attributes] => Array ( [id] => 8 [name] => Bet365 [isLive] => false [lastUpdate] => 2015-01-14T17:55:48 [bookieEventID] => [bookieLeagueID] => [BookieOfferTypeID] => 10150 ) [Odds] => Array ( [0] => SimpleXMLElement Object ( [@attributes] => Array ( [id] => 14294083431640944 [bet] => No [startPrice] => 83/100 [currentPrice] => 73/100 [line] => [LastUpdate] => 2015-01-14T17:55:48 [bookieOutcomeID] => [Status] => Open ) ) [1] => SimpleXMLElement Object ( [@attributes] => Array ( [id] => 18070790851640944 [bet] => Yes [startPrice] => 83/100 [currentPrice] => 1/1 [line] => [LastUpdate] => 2015-01-14T17:55:48 [bookieOutcomeID] => [Status] => Open ) ) ) ) [1] => SimpleXMLElement Object ( [@attributes] => Array ( [id] => 31 [name] => William Hill [isLive] => false [lastUpdate] => 2015-01-15T15:58:30 [bookieEventID] => [bookieLeagueID] => [BookieOfferTypeID] => 226344747 ) [Odds] => Array ( [0] => SimpleXMLElement Object ( [@attributes] => Array ( [id] => 11341591031640944 [bet] => No [startPrice] => 73/100 [currentPrice] => 67/100 [line] => [LastUpdate] => 2015-01-15T15:58:30 [bookieOutcomeID] => [Status] => Open ) ) [1] => SimpleXMLElement Object ( [@attributes] => Array ( [id] => 10996680931640944 [bet] => Yes [startPrice] => 1/1 [currentPrice] => 11/10 [line] => [LastUpdate] => 2015-01-15T15:58:30 [bookieOutcomeID] => [Status] => Open ) ) ) ) Is it possible build an array of outcomes, Then sort by the best decimal price. (I have a function built that can convert the "currentPrice" to decimal. Thnak You!
  5. I'm having on and off problems with a PaReq code that I receieve from PayPoint. This is part of a 3D Secure transaction. What happens is, I post to PayPoint the card information, They send me back a URL, MD Code and a PaReq code, The MD and URL are fine. BUT the PaReq is hit and miss. After consulting the tech support at PayPoint they are saying that occassionally the PaReq string is missing the "==" from the end of it. How can this be, If all I am doing is replicating what they send to me? My code is as follows... The Array I receieve from PayPoint : array 'valid' => string 'true' (length=4) 'test_status' => string 'true' (length=4) 'trans_id' => string 'TRAN004' (length=7) 'mpi_status_code' => string '200' (length=3) 'mpi_message' => string 'Payer Verification Required' (length=27) 'acs_url' => string 'https%3A%2F%2Fwww.secpay.com%2Fjava-bin%2FACSSimulator%3Fpartner%3Dsecpay%26VAA%3DB' (length=83) 'MD' => string '1510881303' (length=10) 'PaReq' => string 'eJxVUlFvgjAQft+vIP4AWhANmqPGqcl8YHEb2zspF2SDggUG/vtdFdQ1aXLf3X29u+8Kq77IrV/UdVaqYOLYfLISTxAdNeL2A2WrUUCIdR2naGUJZcwc7vvOlE8nAg7rdzwJGOiC2LYLbITE0/IYq0ZALE/P+1fhuQvuesAGCAXq/VbM+HzqufTu9QC7ukHFBYpcYqly7gC7QJBlqxp9Fr47BzYCaHUujk1TLRnrus6+kjKFtizt9geYiQO793NojVXTe32WiDD67MNt6oVR2IXndbrf3G4AzGRAEjcoXO7Q4b7FF8uZt+Q0ycUPcWEaERSj7gcAlamxfow8eoCk1ajkOMmIAPuqVEgZpOTNhgRrKTZUTGcqtXanNqsKClADJgDsPtDmxcgtG1Lw63vnhtGuD9+CwIh+cZoCGWlGK3QuFQwAZmhs2CcbFk7Wv4/wB5zPtsU' (length=455) The HTML Form I send : <form name='mainform' action='$threedurl' method='POST'> <center> <h1>Processing your 3D Secure Transaction</h1> <h3>Please click Submit to continue the processing of your 3D Secure transaction.</h3> <input type='submit' value='Submit'> </center> <input type='hidden' name='PaReq' value='$paymentauth'> <input type='hidden' name='TermUrl' value='http://localhost/Test Stuff/Payments/pares.php'> <input type='hidden' name='MD' value='$mdcode'> </form> <SCRIPT LANGUAGE='Javascript' > <!-- function OnLoadEvent() { document.mainform.submit(); } //--> PHP Code to load the array is : <?php if(isset($_POST['submit'])) { extract ($_POST); $soapClient = new SoapClient("https://www.secpay.com/java-bin/services/SECCardService?wsdl"); $params = array( 'mid' => '', 'vpn_pswd' => '', 'trans_id' => 'TRAN000102', 'ip' => '127.0.0.1', 'name' => $card_name, 'card_number' => $card_number, 'amount' => $amount, 'expiry_date' => $card_expire_Month.$card_expire_Year, 'issue_number' => '', 'start_date' => '', 'order' => '', 'shipping' => '', 'billing' => '', 'options' => 'test_status=true, test_mpi_status=true', 'device_category' => '', 'accept_headers' => '', 'user_agent' => '', 'mpi_merchant_name' => '', 'mpi_merchant_url' => '', 'mpi_description' => '', 'purchaseRecurringFrequency' => '', 'purchaseRecurringExpiry' => '', 'purchaseInstallments' => '' ); $error = 0; try { // Call The Soap Client threeDSecureEnrolmentRequest - As Per Paypoint Docs... $result = $soapClient->__call("threeDSecureEnrolmentRequest", $params); } catch(SoapFault $fault) { $error = 1; if($fault->faultstring != 'Could not connect to host') { throw $fault; } } if ($error == 0) { $args = split("&", substr($result,1)); foreach ( $args as $arg) { list($key, $value) = explode("=", $arg); $result_arr[$key] = $value; } var_dump($result_arr); var_dump($params); print_r($_POST); $mpistatus = $result_arr['mpi_status_code']; if ($mpistatus == '200') { $threedurl = urldecode($result_arr['acs_url']); $paymentauth = $result_arr['PaReq']; $mdcode = $result_arr['MD']; echo "<form name='mainform' action='$threedurl' method='POST'> <center> <h1>Processing your 3D Secure Transaction</h1> <h3>Please click Submit to continue the processing of your 3D Secure transaction.</h3> <input type='submit' value='Submit'> </center> <input type='hidden' name='PaReq' value='$paymentauth'> <input type='hidden' name='TermUrl' value='http://localhost/Test Stuff/Payments/pares.php'> <input type='hidden' name='MD' value='$mdcode'> </form> <SCRIPT LANGUAGE='Javascript' > <!-- function OnLoadEvent() { document.mainform.submit(); } //--> </SCRIPT> "; } else { echo "Fine"; } } } ?> Any hints, tips or answers on this are much appreciated, As this is an ongoing issue that I'd love to solve. It appears the tech support I've receieved has been pretty poor.
  6. I've got a design, where I need to include a graphic underneath the class "current_page_item" currently when I do this, I am getting the graphic dropping underneath bar I have setup. My code is http://jsfiddle.net/MveHs/ :: Screen shot is here: http://imageshack.us/photo/my-images/534/navt.jpg/ Any help appreciated on this one..
  7. I'm working on an "In My Basket" Feature on a shopping site (X-Cart Version 4.0.0) I'm pairing it on productid. I've done a tamper data on the post when you add to basket. The variable that is getting posted is productid. I've been using This as a guide to output the productid variable. But I'm just not getting a response from the page at all. The code I am using is {$smarty.request.productid} The TPL file I am using is http://dev.lceonline.co.uk/test/products_list.tpl I am working on <div class="inbasket"> which is line 69. It seems to output with the SERVER_NAME example. But I need that equivalent PHP $_POST VAR. Does anyone have any idea on what I need to do to pull through the productid and show it on screen, Then I can do an IF statement based on that. Hoping someone can help me out with this. It appears that smarty is just not showing the session variables at all... :?
  8. Hi, I'm asking this on behalf of a colleague who has hit a bit of a programming brick wall His Flex Service Call is returning Null can anybody tell me where he may be going wrong? Database: PHP Service Method: <?php public function getAllUserByStatus($arrStatus) { $rows = array(); foreach ($arrStatus as $item) { $stmt = mysqli_prepare($this->connection, "SELECT * FROM $this->tablename WHERE status=?"); $this->throwExceptionOnError(); mysqli_stmt_bind_param($stmt, 's', $item); $this->throwExceptionOnError(); mysqli_stmt_execute($stmt); $this->throwExceptionOnError(); mysqli_stmt_bind_result($stmt, $row->user_id, $row->user_name, $row->user_password, $row->status); while (mysqli_stmt_fetch($stmt)) { $rows[] = $row; $row = new stdClass(); mysqli_stmt_bind_result($stmt, $row->user_id, $row->user_name, $row->user_password, $row->status); } mysqli_stmt_free_result($stmt); } mysqli_close($this->connection); return $rows; } ?> PHP Test Query: <?php include('UserService.php'); $o = new UserService(); ?> <pre> <?php var_dump($o->getAllUserByStatus(array('Active','Passive'))); ?> </pre> PHP Test Result: Flex Application (Returns Null, Why): Any help on this much appreciated, As he's getting a little hacked off with it right now
  9. stublackett

    Custom Font

    Or keep the font face and convert it to Cufon. http://cufon.shoqolate.com/generate/ As another option, Works a treat for me
  10. Hi Guys, I've hit a bit of a brick wall in converting an SQL Query into a suitable ORM Query The query is pretty complex even in SQL Terms, But I am looking at ways of collating this into an ORM Query, as I'm converting a lot of functions I've produced in Flex into Zend Framework Models for future proofing and API Purposes. The current flat SQL is as follows : SELECT subcategory_id, SUM(total) / (1+(YEAR(2011)*12+MONTH(1))-(YEAR(2011)*12+MONTH(12))) AS monthly_average FROM aggr_subcategory WHERE user_id=1 AND month BETWEEN 01 AND 05 GROUP BY user_id, subcategory_id The main issues I am having are the SUM, I can manage the GROUP and WHERE clauses in ORM, but cannot get the sum in the DB Table Abstract. Any help or points in the right direction much appreciated.
  11. Thats perfect, Thanks! I've been looking at an array for this. I've managed to piece it together for each table. The SHOW TABLE syntax may come in handy at a later date, as I may need to export the relationships etc. Cheers
  12. 0 down vote favorite I'm looking to export 11 Database tables' data as XML. I've easily managed to export one table, without issue. But I am looking to export more than one really. I'm sure theres a way and obviously output the data as seperate table entitys. Any help is much appreciated on this one, As I'm finding it a little tricky. My code is as follows <?php error_reporting(E_ALL); $host = "localhost"; $user = "root"; $pass = ""; $database = "db_etch"; $table = "keywords"; $SQL_query = "SELECT * FROM $table"; $DB_link = mysql_connect($host, $user, $pass) or die("Could not connect to host."); mysql_select_db($database, $DB_link) or die ("Could not find or access the database."); $result = mysql_query ($SQL_query, $DB_link) or die ("Data not found. Your SQL query didn't work... "); // produce XML header("Content-type: text/xml"); $XML = "<?xml version=\"1.0\"?>\n"; // root node $XML .= "<result>\n"; // rows while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $XML .= "\t<$table>\n"; $i = 0; // cells foreach ($row as $cell) { $cell = str_replace("&", "&", $cell); $cell = str_replace("<", "<", $cell); $cell = str_replace(">", ">", $cell); $cell = str_replace("\"", """, $cell); $col_name = mysql_field_name($result,$i); $XML .= "\t\t<" . $col_name . ">" . $cell . "</" . $col_name . ">\n"; $i++; } $XML .= "\t</$table>\n"; } $XML .= "</result>\n"; // output the whole XML string echo $XML; // Write $sql to file $File = "keywords.xml"; $fh = fopen($File, 'w') or die("can't open file"); $stringData = $XML; fwrite($fh, $stringData); fclose($fh); ?>
  13. Hi, I've got a FORM Setup. The form has a current image and an option to add a new image (In place of that image) The form fields in question are : <input type="hidden" name="image_url" value="<?php echo $row_select_propertyimages['image_url']; ?>" /> <input type="file" name="new_image_url" class="inputfile" /> I've setup an IF Statement, to check that if new_image_url ISNT set, then to keep the current image. Otherwise, overwrite it with new_image_url. When I dont choose to upload a new file, The code works correctly. The code is as follows. if(empty($_POST['new_image_url'])) { $image_url = $row_select_propertyimages['image_url']; } else { $image_url = $_FILES['new_image_url']; } The data then gets input to a Database. But at the moment, It is not overwriting what is currently there. Can anyone help me on this? My full code is : <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $colname_select_propertyimages = "-1"; if (isset($_GET['image_id'])) { $colname_select_propertyimages = $_GET['image_id']; } mysql_select_db($database_db_connect, $db_connect); $query_select_propertyimages = sprintf("SELECT * FROM image WHERE image_id = %s", GetSQLValueString($colname_select_propertyimages, "int")); $select_propertyimages = mysql_query($query_select_propertyimages, $db_connect) or die(mysql_error()); $row_select_propertyimages = mysql_fetch_assoc($select_propertyimages); $totalRows_select_propertyimages = mysql_num_rows($select_propertyimages); mysql_select_db($database_db_connect, $db_connect); $query_select_property = "SELECT property.property_id, property.property_name FROM property "; $select_property = mysql_query($query_select_property, $db_connect) or die(mysql_error()); $row_select_property = mysql_fetch_assoc($select_property); $totalRows_select_property = mysql_num_rows($select_property); $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "addproperty")) { if(empty($_POST['new_image_url'])) { $image_url = $row_select_propertyimages['image_url']; } else { $image_url = $_FILES['new_image_url']; } echo $image_url; $updateSQL = sprintf("UPDATE image SET image_url=%s, image_desc=%s, image_disphome=%s, image_property_id=%s WHERE image_id=%s", GetSQLValueString($image_url, "text"), GetSQLValueString($_POST['image_desc'], "text"), GetSQLValueString(isset($_POST['image_disphome']) ? "true" : "", "defined","'Y'","'N'"), GetSQLValueString($_POST['image_property_id'], "int"), GetSQLValueString($_POST['image_id'], "int")); mysql_select_db($database_db_connect, $db_connect); $Result1 = mysql_query($updateSQL, $db_connect) or die(mysql_error()); // $updateGoTo = "success_editproperty.php"; // if (isset($_SERVER['QUERY_STRING'])) { // $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?"; // $updateGoTo .= $_SERVER['QUERY_STRING']; // } // header(sprintf("Location: %s", $updateGoTo)); } ?> Many Thanks in advance.
  14. Tried that Cheers Paul, Wasnt correct but put me on the right root. I needed... $image = $_GET['image']; Solved, Thanks
×
×
  • 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.