Jump to content

nade93

Members
  • Posts

    113
  • Joined

  • Last visited

Everything posted by nade93

  1. $xml = simplexml_load_file('http://cachepricefeeds.williamhill.com/openbet_cdn?action=template&template=getHierarchyByMarketType&classId=1&marketSort=--&filterBIR=Y'); $x = $xml->response->williamhill->class->type; foreach ($x as $p=>$t): // get the type for drill down to market ?> <div id='feedhead'><? echo $t['name']; ?></div> <? foreach ($t as $m): // get the attributes for the market //-------- GET THE DATES IN ORDER $d = explode('-', $m['date']); $date = $d[2].'/'.$d[1].'/'.$d[0]; echo $m['url']; endforeach; endforeach;
  2. thanks for the replay however When I implement that no results (inluding the header) pull at all
  3. hi all I am trying to get one printed result from an attribute that is pulling from a nested array I am pulling a top layer for the header then placing the items under the header foreach ($x as $p=>$t): // get the type for drill down to market ?> <div id='feedhead'><? echo $t['name']; ?></div> <? foreach ($t as $m): so the $m['url'] is the thing i am wanting to group by as is it pulling things that are duplicating. so if did below for example echo $m['url'].'<br>'; would output as http://google.com http://google.com http://google.com http://google.com however would want just the single output from the loop http://google.com how do i go about this? thanks in advance
  4. Hi all I am hoping you can help. I am looking to pull the feed and parse the follow. I am wanting to get both the attributes and the cildren of the market branch of xml. Can someone help me out please? <oxip version="7.1" created="2014-03-21 19:19:20" lastMsgId="" requestTime="0.1686"> <response request="getHierarchyByMarketType" code="001" message="success" debug=""> <williamhill> <class id="436" name="Football - Virtual" maxRepDate="2014-03-21" maxRepTime="00:56:39"> <type id="8398" name="Victoria Stadium" url="http://sports.williamhill.com/bet/betting/t/8398" lastUpdateDate="2014-03-10" lastUpdateTime="23:31:52"> <market id="152656333" name=" Czech Republic v Poland - Match Betting" url="http://sports.williamhill.com/bet/en-gb/betting/e/5778703/%2dCzech%2dRepublic%2dv%2dPoland"date="2014-03-21" time="19:20:00" betTillDate="2014-03-21" betTillTime="19:20:00" lastUpdateDate="2014-03-21" lastUpdateTime="00:53:59"> <participant name="Poland" id="534674127" odds="2/1" oddsDecimal="3.00" lastUpdateDate="2014-03-21" lastUpdateTime="00:53:59" handicap=""/> <participant name="Draw" id="534674126" odds="12/5" oddsDecimal="3.40" lastUpdateDate="2014-03-21" lastUpdateTime="00:53:59" handicap=""/> <participant name="Czech Republic" id="534674125" odds="5/4" oddsDecimal="2.25" lastUpdateDate="2014-03-21" lastUpdateTime="00:53:59" handicap=""/> </market>
  5. hi ken its all in the text really basically there is a directory listing with 6 preferential listings running off a different script that are sorted into the members_categories_position table. However I do not want the listing to be duplicated, so need to check if the member user exists in the members_categories_position table, if it does it needs to exclude them from the listings
  6. hmm still struggling with this after three hours! where am i going wrong??? any help would be amazing please
  7. Hi All i hope someone can help about to scream! basically I am trying to do a few things with the statement below; First i want to check if the user id exists in member_categories_position. If it Does i want then to exclude all entries from the second statement where member_id equals all results from the first statement the third statement is the else statement that displays if the member_id is not present in the member_categories position. PROBLEM - the result from the first system loops fine, however when i try and insert into the second statement (!='$memid') is produces no results and has no effect. I think the problem is that $memid is a looped result. How do i get the second statement to say that any member_id that is in member_categories_position will not show in that statement? $sql2 = "SELECT * FROM member_categories_position a JOIN member_users b ON b.id = a.member_id"; $rs2 = mysql_query($sql2); while ($row = mysql_fetch_array($rs2)){ $memid = "".$row['member_id'].""; } if(mysql_num_rows($rs2) != 0){ $new= "SELECT * FROM member_categories JOIN member_users on member_categories.member_id=member_users.id JOIN member_config on member_categories.member_id=member_config.member_id WHERE member_categories.categories='$category' and member_categories.member_id !='$field' group by member_config.member_id order by RAND() limit 0,42"; $rs = mysql_query($new); while ($row = mysql_fetch_assoc($rs)) { echo "result excluding member ids from the first statement"; } echo "<div class=\"clear\"></div>"; } else{ $new= "SELECT * FROM member_categories JOIN member_users on member_categories.member_id=member_users.id JOIN member_config on member_categories.member_id=member_config.member_id WHERE member_categories.categories='$category' group by member_config.member_id order by RAND() limit 0,42"; $rs = mysql_query($new); while ($row = mysql_fetch_assoc($rs)) { echo "Result with all member ids"; } echo "<div class=\"clear\"></div>"; }}
  8. hi above is the latest code as reverted back when all others seems to break the login system totally i know its a session manipulation but apart from that i am stuck!
  9. oh dear been at this for few hours now and still no further, anyone who can help would be my hero
  10. Hi All I am using the following method to check if user is logged in to a member area. However, I ahve a password change section that then redirects back the the password change page within the logged in area. After password changes it automatically redirects back to the index page rather than password page and comes up with a redirect error (too many redirects) How can i change the code to match the new change in password. I think its a sessions problem but not great with sessions! if(isset($_COOKIE['ID_my_site'])) { $username = $_COOKIE['ID_my_site']; $pass = $_COOKIE['Key_my_site']; $check = mysql_query("SELECT * FROM member_users WHERE email = '$username'")or die(mysql_error()); while($info = mysql_fetch_array( $check )) { $usernameid=$info['username']; $userid = $info['id']; $firstname = $info['fname']; $lastname = $info['lname']; //if the cookie has the wrong password, they are taken to the login page if ($pass != $info['password']) { header("Location: index.php"); } //otherwise they are shown the admin area else { echo "<div class=\"memberloginactive\">Welcome $firstname | Your Profile | <a href=\"edit-profile.php?id=$userid\">Edit Profile</a> | <a href=\"logout.php\">Logout</a></div><div class=\"clear\"></div>"; } } } else {
  11. i had them saves in CYMK rather than RGB jpegs
  12. Hi All take a look at http://www.buypromo.co.uk/index.php in IE 7 or 8 the images at the bottom of the page are not showing up, whereas therest are find, any ideas? thanks
  13. that wouldnt put it in columns, nor would it group the content by the parent in order to split to columns thanks
  14. all from these previous listings from internet. the top one almost does what i need, however cannot get it to work http://stackoverflow.com/questions/3323626/help-on-displaying-data-in-colunm-php-mysql-modified-preorder-tree-trasversal http://www.codingforums.com/archive/index.php/t-165642.html
  15. Hi All i am wanting a column list like this http://extensions.joomla.org/extensions basically the database is set up as (id, category, parent) I want the parent to group the category section and list like the the joomla example in three columns search various threads throughout the internet but none seem to cover this entirely can any one please help?????
  16. Hi All I am trying to upload a csv file to a database using php html form however, the results shows none of the data passsing through to the database and it produces 1000's of empty fields here is the form form action="lib/import.php" method="post" enctype="multipart/form-data"> Type file name to import: <input type="file" name="filename" size="20"><br /> <input type="submit" name="submit" value="submit"></form> and here is the passing info $file = $_FILES['filename']; $sqlstatement="LOAD DATA INFILE '$file' into TABLE shop FIELDS TERMINATED BY ',' (id, merchant_name, product_name, description, category_name, Affiliate_deep_link, Affiliate_image_url, price)" ; mysql_query($sqlstatement); echo "it is done!"; can anyone help please?
  17. ah cool is that it? thought it may be something elaborate! ta very much!
  18. Hi All I am trying to set up a system that where a user sets up an account the system automatically sets up a new directory and inserts template files into it. I understand mkdir is something to do with it. Does anyone know how to go about this please? thanks
  19. Hi All I am trying to insert a feed on my site that automatically updates the football league etc like this one http://news.bbc.co.uk/sport1/hi/football/eng_div_1/table/default.stm is there a way to do this please? thanks
  20. hi i wrapped a function around coding function affiliateone(){ } and then in index.php linked using <? affiliateone(); ?> and worked a treat! (oh for others using this, you need to include the functions file with <? include('functions.php'); ?> at the beginning of your index file cheers!!!!
  21. Hi All I am wanting to start writing neater coding so am wanting to refer to coding in a functions file. So for example, If i was getting info from database using the following code $queryone = "SELECT * from affiliate where size='300x250' ORDER BY RAND() LIMIT 1"; $result = mysql_query($queryone); while ($row = mysql_fetch_assoc($result)) { echo "".$row['code'].""; } I would want this to go in a file called functions.php Then in my index.php(for example) I would want to link up to this code. Can anyone point me in the right direction please? Thanks!
  22. sorry do not mean to bump to annoy anyone, just am really stuck with this, any help would be great thanks!
  23. Hi All This is not really somthing the paypal developers answer as its general php so thought I would ask on here Basically, have 3 products with 3 item numbers (101,102,103) I have set up if, elseif statements to insert into database depending on the item number. This works fine. However i now want to integrate the quantity. As the purchase will set up a user, i want the inserts to be dependent on the quantity purchased, so if 3 courses are purcased under item number 101 then it sets up 3 user accounts (inserts in to users x3) with the username with an increment of for example test@test.com-1 Can someone pointe me in the correct direction please? Here is the script(including the mail script at bottom but ignore) $fecha = date("m")."/".date("d")."/".date("Y"); $fecha = date("Y").date("m").date("d"); //check if transaction ID has been processed before $checkquery = "select txnid from paypal_payment_info where txnid='".$txn_id."'"; $sihay = mysql_query($checkquery) or die("Duplicate txn id check query failed:<br>" . mysql_error() . "<br>" . mysql_errno()); $nm = mysql_num_rows($sihay); if ($nm == 0){ //execute query if ($itemno == "101"){ $strQuery = " INSERT INTO `users` ( `id` , `firstname` , `lastname` , `company` , `address1` , `address2` , `address3` , `postcode` , `email` , `username` , `password` , `wsiosh` , `msiosh` , `nebosh` , `telephone` ) VALUES ('' , '".$first_name."', '".$last_name."', '".$business."', '".$address_street."', '".$address_city."','', '".$address_zip."', '".$payer_email."', '".$payer_email."', '".$passwordnew."', 'yes', '', '', '' )"; $result = mysql_query($strQuery) or die("Cart - paypal_payment_info, Query failed:<br>" . mysql_error() . "<br>" . mysql_errno()); for ($i = 1; $i <= $num_cart_items; $i++) { $itemname = "item_name".$i; $itemnumber = "item_number".$i; $on0 = "option_name1_".$i; $os0 = "option_selection1_".$i; $on1 = "option_name2_".$i; $os1 = "option_selection2_".$i; $quantity = "quantity".$i; $struery = "insert into `paypal_payment_info`(paymentstatus,buyer_email,firstname,lastname,street,city,state,zipcode,country,mc_gross,mc_fee,itemnumber,itemname,os0,on0,os1,on1,quantity,memo,paymenttype,paymentdate,txnid,pendingreason,reasoncode,tax,datecreation) values ('".$payment_status."','".$payer_email."','".$first_name."','".$last_name."','".$address_street."','".$address_city."','".$address_state."','".$address_zip."','".$address_country."','".$mc_gross."','".$mc_fee."','".$item_number."','".$item_name."','".$option_name1."','".$option_selection1."','".$option_name2."','".$option_selection2."','".$quantity."','".$memo."','".$payment_type."','".$payment_date."','".$txn_id."','".$pending_reason."','".$reason_code."','".$tax."','".$fecha."')"; $result = mysql_query($struery) or die("Cart - paypal_cart_info, Query failed:<br>" . mysql_error() . "<br>" . mysql_errno()); } } else if ($itemno == "102"){ $strQuery = " INSERT INTO `users` ( `id` , `firstname` , `lastname` , `company` , `address1` , `address2` , `address3` , `postcode` , `email` , `username` , `password` , `wsiosh` , `msiosh` , `nebosh` , `telephone` ) VALUES ('' , '".$first_name."', '".$last_name."', '".$business."', '".$address_street."', '".$address_city."','', '".$address_zip."', '".$payer_email."', '".$payer_email."', '".$passwordnew."', '', 'yes', '', '' )"; $result = mysql_query($strQuery) or die("Cart - paypal_payment_info, Query failed:<br>" . mysql_error() . "<br>" . mysql_errno()); for ($i = 1; $i <= $num_cart_items; $i++) { $itemname = "item_name".$i; $itemnumber = "item_number".$i; $on0 = "option_name1_".$i; $os0 = "option_selection1_".$i; $on1 = "option_name2_".$i; $os1 = "option_selection2_".$i; $quantity = "quantity".$i; $struery = "insert into `paypal_payment_info`(paymentstatus,buyer_email,firstname,lastname,street,city,state,zipcode,country,mc_gross,mc_fee,itemnumber,itemname,os0,on0,os1,on1,quantity,memo,paymenttype,paymentdate,txnid,pendingreason,reasoncode,tax,datecreation) values ('".$payment_status."','".$payer_email."','".$first_name."','".$last_name."','".$address_street."','".$address_city."','".$address_state."','".$address_zip."','".$address_country."','".$mc_gross."','".$mc_fee."','".$item_number."','".$item_name."','".$option_name1."','".$option_selection1."','".$option_name2."','".$option_selection2."','".$quantity."','".$memo."','".$payment_type."','".$payment_date."','".$txn_id."','".$pending_reason."','".$reason_code."','".$tax."','".$fecha."')"; $result = mysql_query($struery) or die("Cart - paypal_cart_info, Query failed:<br>" . mysql_error() . "<br>" . mysql_errno()); } } else if ($itemno == "103"){ $strQuery = " INSERT INTO `users` ( `id` , `firstname` , `lastname` , `company` , `address1` , `address2` , `address3` , `postcode` , `email` , `username` , `password` , `wsiosh` , `msiosh` , `nebosh` , `telephone` ) VALUES ('' , '".$first_name."', '".$last_name."', '".$business."', '".$address_street."', '".$address_city."','', '".$address_zip."', '".$payer_email."', '".$payer_email."', '".$passwordnew."', '', '', 'yes', '' )"; $result = mysql_query($strQuery) or die("Cart - paypal_payment_info, Query failed:<br>" . mysql_error() . "<br>" . mysql_errno()); for ($i = 1; $i <= $num_cart_items; $i++) { $itemname = "item_name".$i; $itemnumber = "item_number".$i; $on0 = "option_name1_".$i; $os0 = "option_selection1_".$i; $on1 = "option_name2_".$i; $os1 = "option_selection2_".$i; $quantity = "quantity".$i; $struery = "insert into `paypal_payment_info`(paymentstatus,buyer_email,firstname,lastname,street,city,state,zipcode,country,mc_gross,mc_fee,itemnumber,itemname,os0,on0,os1,on1,quantity,memo,paymenttype,paymentdate,txnid,pendingreason,reasoncode,tax,datecreation) values ('".$payment_status."','".$payer_email."','".$first_name."','".$last_name."','".$address_street."','".$address_city."','".$address_state."','".$address_zip."','".$address_country."','".$mc_gross."','".$mc_fee."','".$item_number."','".$item_name."','".$option_name1."','".$option_selection1."','".$option_name2."','".$option_selection2."','".$quantity."','".$memo."','".$payment_type."','".$payment_date."','".$txn_id."','".$pending_reason."','".$reason_code."','".$tax."','".$fecha."')"; $result = mysql_query($struery) or die("Cart - paypal_cart_info, Query failed:<br>" . mysql_error() . "<br>" . mysql_errno()); } } // send an email in any case echo "Verified"; mail($notify_email, "VERIFIED IPN", "$res\n $req\n $strQuery\n $struery\n $strQuery_2"); } else { // send an email mail($notify_email, "VERIFIED DUPLICATED TRANSACTION", "$res\n $req \n $strQuery\n $struery\n $strQuery_2"); } //subscription handling branch if ( $txn_type == "subscr_signup" || $txn_type == "subscr_payment" ) { // insert subscriber payment info into paypal_payment_info table $strQuery = "insert into paypal_payment_info(paymentstatus,buyer_email,firstname,lastname,street,city,state,zipcode,country,mc_gross,mc_fee,memo,paymenttype,paymentdate,txnid,pendingreason,reasoncode,tax,datecreation) values ('".$payment_status."','".$payer_email."','".$first_name."','".$last_name."','".$address_street."','".$address_city."','".$address_state."','".$address_zip."','".$address_country."','".$mc_gross."','".$mc_fee."','".$memo."','".$payment_type."','".$payment_date."','".$txn_id."','".$pending_reason."','".$reason_code."','".$tax."','".$fecha."')"; $result = mysql_query($strQuery) or die("Subscription - paypal_payment_info, Query failed:<br>" . mysql_error() . "<br>" . mysql_errno()); // insert subscriber info into paypal_subscription_info table $strQuery2 = "insert into paypal_subscription_info(subscr_id , sub_event, subscr_date ,subscr_effective,period1,period2, period3, amount1 ,amount2 ,amount3, mc_amount1, mc_amount2, mc_amount3, recurring, reattempt,retry_at, recur_times, username ,password, payment_txn_id, subscriber_emailaddress, datecreation) values ('".$subscr_id."', '".$txn_type."','".$subscr_date."','".$subscr_effective."','".$period1."','".$period2."','".$period3."','".$amount1."','".$amount2."','".$amount3."','".$mc_amount1."','".$mc_amount2."','".$mc_amount3."','".$recurring."','".$reattempt."','".$retry_at."','".$recur_times."','".$username."','".$password."', '".$txn_id."','".$payer_email."','".$fecha."')"; $result = mysql_query($strQuery2) or die("Subscription - paypal_subscription_info, Query failed:<br>" . mysql_error() . "<br>" . mysql_errno()); mail($notify_email, "VERIFIED IPN", "$res\n $req\n $strQuery\n $struery\n $strQuery2"); } } // if the IPN POST was 'INVALID'...do this else if (strcmp ($res, "INVALID") == 0) { // log for manual investigation mail($notify_email, "INVALID IPN", "$res\n $req"); } } fclose ($fp); } ?> <?php // read the post from PayPal system and add 'cmd' $req = 'cmd=_notify-validate'; foreach ($_POST as $key => $value) { $value = urlencode(stripslashes($value)); $req .= "&$key=$value"; } // post back to PayPal system to validate $header = "POST /cgi-bin/webscr HTTP/1.0\r\n"; // If testing on Sandbox use: // $header .= "Host: www.sandbox.paypal.com:443\r\n"; $header .= "Host: www.paypal.com:443\r\n"; $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; $header .= "Content-Length: " . strlen($req) . "\r\n\r\n"; // If testing on Sandbox use: //$fp = fsockopen ('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30); $fp = fsockopen ('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30); // assign posted variables to local variables $item_name = $_POST['item_name']; $item_number = $_POST['item_number']; $payment_status = $_POST['payment_status']; $payment_amount = $_POST['mc_gross']; $payment_currency = $_POST['mc_currency']; $txn_id = $_POST['txn_id']; $receiver_email = $_POST['receiver_email']; $payer_email = $_POST['payer_email']; //set email variables $From_email = "From: xxx; $Subject_line = "Your Purchase fxxx"; $email_msg = "To $payer_email, Thank you for your purchase of $item_name. You are now able to log in using details below: User: $payer_email Password : password Log in to your account using the link below and change your password as soon as possible. You can purchase more courses by visiting your profile page Kind Regards "; $email_msg .= "\n\nThe details of your order are as follows:"; $email_msg .= "\n\n" . "Transaction ID: " . $txn_id ; $email_msg .= "\n" . "Payment Date: " . $payment_date; if (!$fp) { // HTTP ERROR } else { fputs ($fp, $header . $req); while (!feof($fp)) { $res = fgets ($fp, 1024); if (strcmp ($res, "VERIFIED") == 0) { // check the payment_status is Completed // check that txn_id has not been previously processed // check that receiver_email is your Primary PayPal email // check that payment_amount/payment_currency are correct // process payment $mail_From = $From_email; $mail_To = $payer_email; $mail_Subject = $Subject_line; $mail_Body = $email_msg; mail($mail_To, $mail_Subject, $mail_Body, $mail_From); } else if (strcmp ($res, "INVALID") == 0) { // log for manual investigation $mail_From = $From_email; $mail_To = $receiver_email; $mail_Subject = "INVALID IPN POST"; $mail_Body = "INVALID IPN POST. The raw POST string is below.\n\n" . $req; mail($mail_To, $mail_Subject, $mail_Body, $mail_From); } } fclose ($fp); }
  24. Hi All I am a little new to sessions, I want to do a few things to record the session for a user. 1. User is logged in until logged out 2. Time on system is recorded and logged in database Can any body give me some guidance please?
×
×
  • 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.