Jump to content

beanymanuk

Members
  • Posts

    107
  • Joined

  • Last visited

Everything posted by beanymanuk

  1. Hi Ultimate Aim: To upload multiple images using ajax using a PHP script which will be fired once an image is selected and then return the resulting URL for use in rest of my JS http://peter-gosling.com/testupload/chooseimage.html simple form posts to http://peter-gosling.com/testupload/saveimage.php This PHP script below currently gets the posted image and assigns it a random number file name and echos this <?php header("Access-Control-Allow-Origin: *"); $uploaddir = '/home/petergos/public_html/testupload/images/'; $uploadfile = $uploaddir . basename($_FILES['userfile']['name']); $urlpath = "http://www.peter-gosling.co.uk/testupload/images/"; $temp = explode(".",$_FILES["userfile"]["name"]); $newfilename = rand(1,999999999) . '.' .end($temp); $newuploadfile = $uploaddir . $newfilename; echo "<p>"; if (move_uploaded_file($_FILES['userfile']['tmp_name'], $newuploadfile)) { $urlfile = $urlpath . $newfilename; echo $urlfile; } else { echo "Upload failed"; } ?> What I want to do is post my image via ajax but return the value back to my js file I'm not certain on the CORS issue Here's my first attempt http://peter-gosling.com/testupload/ HTML <!DOCTYPE html> <html> <head> </head> <body> <input type="file" accept="image/*;capture=camera" name="taskoutputfile"></input> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script type="text/javascript"> $("input[name=taskoutputfile]").on("change", function (){ var fileName = $(this).val(); console.log(fileName); get_image_url(fileName) }); //UPLOAD IMAGE RETURN URL function get_image_url(imageurl) { var dataString = "url="+imageurl; //datastring = $("input[name=sessiontitle]").val(); //AJAX code to submit form. $.ajax({ type: "POST", url: "http://www.peter-gosling.co.uk/testupload/saveimage2.php", data: dataString, cache: false, success: function(html) { alert(html); } }); } </script> </body> </html> PHP <?php header("Access-Control-Allow-Origin: *"); $uploaddir = '/home/petergos/public_html/testupload/images/'; $uploadfile = $uploaddir . basename($_POST['url']); $urlpath = "http://www.peter-gosling.co.uk/testupload/images/"; $temp = explode(".",$_POST['url']); $newfilename = rand(1,999999999) . '.' .end($temp); $newuploadfile = $uploaddir . $newfilename; echo "<p>"; if (move_uploaded_file($_FILES['userfile']['tmp_name'], $newuploadfile)) { $urlfile = $urlpath . $newfilename; return $urlfile; } else { echo "Upload failed"; } /* echo "</p>"; echo '<pre>'; echo 'Here is some more debugging info:'; print_r($_FILES); print "</pre>"; */ ?> Have attached all files Any help would be really appreciated Thankyou
  2. No errors reported when sending at all So I believe its something to do with hosting blocking .co in particular from sending emails
  3. email address on .co domain is setup as a google apps email and I have tried sending to my .com google apps email and that works ok
  4. PHP mail not sending emails to .co domain email addresses Anyone got any experience or advice on this issue? I don't know what to try or do about it
  5. How can I retrieve the latest tweets for multiple users on Twitter and display them in one feed? I can only seem to find ways to pull one account using the API v1.1 How do I go about doing this?
  6. Hi Having issues on this page in IE 7/8 where the slider isn't working works in IE 9/10 and other browsers There is an error showing in IE 7 / 8 but I'm unsure of how to fix this SCRIPT65535: Unexpected call to method or property access. jquery.min.js, line 2 character 66529 http://gamerservices.co.uk/flexslider/ Thanks in advance
  7. Hi I am trying to make a menu move from being a 4 by 2 (with each block size calculated to fit 100% width) menu docked at the bottom of the page then once any link is clicked in that menu for it to move nicely across the page to be docked on the right hand side of the page in one column (each block resized in height so the total height of the blocks fit 100% height of the users browser window) Hope that makes sense. This is what I have so far showing basic concept of menu View Menu here Any help greatly appreciated Thanks
  8. Found the problem //wrong way round array_multisort($results, SORT_DESC, $amounts); //right way round array_multisort($amounts, SORT_DESC, $results);
  9. Hi Code <?php $xml=simplexml_load_file("http://www.peter-gosling.com/testxml.xml"); foreach($xml->accumulator as $accumulator) { if(($accumulator->currency == 'GBP') && (($accumulator->game_id == 'PF') || ($accumulator->game_id == 'ST') || ($accumulator->game_id == 'TO2') || ($accumulator->game_id == 'LO2') || ($accumulator->game_id == 'KQ'))) { $results[] = (array)$accumulator; $amounts[] = (array)$accumulator->amount; } } //print_r($results); array_multisort($results, SORT_DESC, $amounts); $top4 = array_slice($results, 0, 4); print_r($top4); ?> So I want Top 4 games out of the 5 games I'm pulling out based on the amount
  10. Thats not quite right not sorting correctly so not getting the highest 4 results Array before sort Array ( [0] => Array ( [game_id] => G1 [currency] => GBP [game] => G1 [game_type] => midlet [amount] => 111830 [display_amount] => £1,118.30 ) [1] => Array ( [game_id] => G2 [currency] => GBP [game] => G2 [game_type] => midlet [amount] => 23831 [display_amount] => £238.31 ) [2] => Array ( [game_id] => G3 [currency] => GBP [game] => G3 [game_type] => midlet [amount] => 38963 [display_amount] => £389.63 ) [3] => Array ( [game_id] => G4 [currency] => GBP [game] => G4 [game_type] => midlet [amount] => 86691 [display_amount] => £866.91 ) [4] => Array ( [game_id] => G5 [currency] => GBP [game] => G5 [game_type] => midlet [amount] => 25000 [display_amount] => £250.00 ) ) I am getting result in order G5, G2, G1, G4 When result should be G1, G4, G3, G5
  11. I've got it in simple xml but not sure about the filtering bit any help I've tried this so far $xml = array_filter($xml, function($obj){ if (isset($obj->accumulator)) { foreach ($obj->accumulator as $accumulators ) { if ($accumulators->currency != 'GBP') return false; } } return true; });
  12. Hi this is what I want to do Read values from xml into two dimensional array and then filter out ones with currency GBP and then sort by amount DESC and output the top 4 results I can get xml into php ok but I don't know how to loop those results into an array and then do the rest. Any help would be muchly appreciated Thanks EG of XML <accumulators> <accumulator> <game_id>Test</game_id> <currency>EUR</currency> <game>Test</game> <game_type>midlet</game_type> <amount>22269</amount> <display_amount>€222.69</display_amount> </accumulator> <accumulator> <game_id>Test2</game_id> <currency>GBP</currency> <game>PharaohsFortunesSlots</game> <game_type>midlet</game_type> <amount>6348</amount> <display_amount>£63.48</display_amount> </accumulator> </accumulators>
  13. I am trying to output my javascript array so it works in a slider But its not outputting at the correct time I think so that the slider Jquery affects that div Any ideas on where I am going wrong? <!DOCTYPE html> <!--[if lt IE 7 ]><html class="ie ie6" lang="en"> <![endif]--> <!--[if IE 7 ]><html class="ie ie7" lang="en"> <![endif]--> <!--[if IE 8 ]><html class="ie ie8" lang="en"> <![endif]--> <!--[if (gte IE 9)|!(IE)]><!--><html lang="en"> <!--<![endif]--> <head> <meta charset="utf-8"> <title>Slider</title> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" type="text/javascript"></script> <script src="http://www.flashuser.net/tutorial/jquery-image-grid/js/jquery.flexslider-min.js" type="text/javascript"></script> <script src="http://www.flashuser.net/tutorial/jquery-image-grid/js/prettyphoto/js/jquery.prettyPhoto.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function(){ $('.flexslider').flexslider({ animation: "slide", slideshow: true, slideshowSpeed: 7000, animationSpeed: 600, prevText: 'Prev', nextText: 'Next' }); $(".slides li:not(.clone) a[rel^='prettyPhoto']").prettyPhoto({ animation_speed: 'normal', autoplay_slideshow: true, slideshow: 3000 }); }); </script> <style> .usernamenamelabel { width:100px; float:left; font-size:13px; } .flex-control-nav { display:none; } #wrap, #wrap2{ width:366px; clear:both; } </style> </head> <body> <script type="text/javascript"> window.onload = function() { var str = "test1,test2,test3,test4,test5,test6, test7, test8, test9, test10 ,test11, test12, test13,test14,test15,test16,test17,test18,test19"; var temp = new Array(); // split string put into an array temp = str.split(","); var tt = temp.length; var tt2 = tt % 9; var tt3 = 9 - tt2; //document.write(tt3); for (var ai = 0; ai < tt3; ai++) { temp.push(""); } var att = temp.length; var result = "<section class='flexslider'><ul class='slides'><li><div class='row'>"; for (var i = 0; i < att; i++) { result += "<div class='usernamenamelabel'>"+temp[i]+"</div>"; if (i % 9 == { result += "</div></li>"; if(i !=(att-1)) { result += "<li><div class='row'>"; } } else { if (i % 3 == 2) { result += "</div><div class='row'>"; } } } result += "</ul></section></div>"; //document.write(result); document.getElementById("wrap2").innerHTML = result; } </script> <div id="wrap2"></div> <div id="wrap"> <section class="flexslider"> <ul class="slides "> <li> <div class="row"> <div class="usernamenamelabel">test1</div> <div class="usernamenamelabel">test2</div> <div class="usernamenamelabel">test3</div> </div><!--end row--> <div class="row"> <div class="usernamenamelabel">test4</div> <div class="usernamenamelabel">test5</div> <div class="usernamenamelabel">test6</div> </div><!--end row--> <div class="row"> <div class="usernamenamelabel">test7</div> <div class="usernamenamelabel">test8</div> <div class="usernamenamelabel">test9</div> </div><!--end row--> </li> <li> <div class="row"> <div class="usernamenamelabel">test10</div> <div class="usernamenamelabel">test11</div> <div class="usernamenamelabel">test12</div> </div><!--end row--> <div class="row"> <div class="usernamenamelabel">test13</div> <div class="usernamenamelabel">test14</div> <div class="usernamenamelabel">test15</div> </div><!--end row--> <div class="row"> <div class="usernamenamelabel">test16</div> <div class="usernamenamelabel">test17</div> <div class="usernamenamelabel">test18</div> </div><!--end row--> </li> <li> <div class="row"> <div class="usernamenamelabel">test19</div> <div class="usernamenamelabel">test20</div> <div class="usernamenamelabel">test21</div> </div><!--end row--> <div class="row"> <div class="usernamenamelabel">test22</div> <div class="usernamenamelabel">test23</div> <div class="usernamenamelabel">test24</div> </div><!--end row--> <div class="row"> <div class="usernamenamelabel">test25</div> <div class="usernamenamelabel">test26</div> <div class="usernamenamelabel">test27</div> </div><!--end row--> </li> </ul> </section><!--end flexslider--> </div><!--end wrap--> </body> </html>
  14. I'm just getting "error" not very helpful Heres my latest code <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <title>My jQuery JSON Web Page</title> <head> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> <script type="text/javascript"> JSONTest = function() { var resultDiv = $("#resultDivContainer"); var girlID = 1124 var searchString = '' $.ajax({ //contentType: "application/json; charset=utf-8", url: "http://www.fhm.com/site/pages/girls/100sexiest2010/VotePopup.aspx/InsertVote", type: "POST", data: { girlId:1124,girlName:'', shareType:3 }, //data: "{girlId:" + girlId + ",girlName:'" + searchString + "', shareType:3}", dataType: "json", error: function (xhr, status, error) { //j$("#voteError").show("slow"); alert(xhr.statusText); alert(error); }, success: function (voteid) { switch (result) { case true: processResponse(voteid); break; default: resultDiv.html(voteid); } } }); }; </script> </head> <body> <input type="hidden" id="ctl00_Body_VotingPanel_hidSearchString" name="ctl00$Body$VotingPanel$hidSearchString"> <h1>My jQuery JSON Web Page</h1> <div id="resultDivContainer"></div> <button type="button" onclick="JSONTest()">JSON</button> </body> </html>
  15. I did wonder this Is there a way of finding out if it allows XSS or not for sure?
  16. Appologises copied wrong version of code version without the j$ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <title>My jQuery JSON Web Page</title> <head> <script language="javascript" type="text/javascript"> /* $(document).ready(function () { $("#doVote").click(function () { var girlId = 'ctl00_Body_VotingPanel_hidGirlID' var searchString = 'ctl00_Body_VotingPanel_hidSearchString' if ($("#" + girlId + "").val() == "") { girlId = 0; } else { girlId = $("#" + girlId + "").val(); } var x = $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: "/site/pages/girls/100sexiest2010/VotePopup.aspx/InsertVote", data: "{girlId:" + girlId + ",girlName:'" + escape($("#" + searchString + "").val()) + "', shareType:3}", dataType: "json", error: function (xhr, status, error) { //$("#voteError").show("slow"); //alert(xhr.statusText); //alert(error); }, success: function (voteid) { alert("SUCCESS"); $("#hidVoteId").val(voteid); $(".coverflowContainer").animate({ left: '-=631px' }, 500); displayCompetitionBox(); } }); }); }); */ </script> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> <script type="text/javascript"> JSONTest = function() { var resultDiv = $("#resultDivContainer"); var girlID = 1124 var searchString = '' $.ajax({ //contentType: "application/json; charset=utf-8", url: "http://www.fhm.com/site/pages/girls/100sexiest2010/VotePopup.aspx/InsertVote", type: "POST", // data: { girlId:1124,girlName:'', shareType:3 }, data: "{girlId:" + girlId + ",girlName:'" + searchString + "', shareType:3}", dataType: "json", error: function (xhr, status, error) { //j$("#voteError").show("slow"); alert(xhr.statusText); alert(error); }, success: function (voteid) { switch (result) { case true: processResponse(voteid); break; default: resultDiv.html(voteid); } } }); }; </script> </head> <body> <input type="hidden" id="ctl00_Body_VotingPanel_hidSearchString" name="ctl00$Body$VotingPanel$hidSearchString"> <h1>My jQuery JSON Web Page</h1> <div id="resultDivContainer"></div> <button type="button" onclick="JSONTest()">JSON</button> </body> </html>
  17. Hi I am trying to replicate this JSON post from online any ideas where I'm going wrong <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <title>TEST JSON</title> <head> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> <script language="javascript" type="text/javascript"> j$(document).ready(function () { j$("#doVote").click(function () { var girlId = 'ctl00_Body_VotingPanel_hidGirlID' var searchString = 'ctl00_Body_VotingPanel_hidSearchString' if (j$("#" + girlId + "").val() == "") { girlId = 0; } else { girlId = j$("#" + girlId + "").val(); } var x = j$.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: "http://www.fhm.com/site/pages/girls/100sexiest2010/VotePopup.aspx/InsertVotee", data: "{girlId:" + girlId + ",girlName:'" + escape(j$("#" + searchString + "").val()) + "', shareType:3}", dataType: "json", error: function (xhr, status, error) { //j$("#voteError").show("slow"); //alert(xhr.statusText); //alert(error); }, success: function (voteid) { j$("#hidVoteId").val(voteid); j$(".coverflowContainer").animate({ left: '-=631px' }, 500); displayCompetitionBox(); } }); }); }); </script> </head> <body> <input type="hidden" value="1124" id="ctl00_Body_VotingPanel_hidGirlID" name="ctl00$Body$VotingPanel$hidGirlID"> <input type="hidden" id="ctl00_Body_VotingPanel_hidSearchString" name="ctl00$Body$VotingPanel$hidSearchString"> <a id="doVote" class="voteButton">Vote Now</a> </body> </html>
  18. <?php $client = new SoapClient("http://externalservices.qa.gameserver1-mt.com/WebSiteServices.asmx?wsdl"); $aa = $_SERVER['HTTP_USER_AGENT']; $params = array(); $params["pUserAgent"] = $aa; $result = ($client->GetPlatformByUserAgent($params)); //print_r($result); foreach ($result as $res) { $res; } //echo $res." - "; if($res == "W") { //echo "DESKTOP"; ?><script type="text/javascript"> <!-- //window.location = "http://nl.info.qa.extraspel.com/" //--> </script> <?php } elseif($res == "S") { //echo "SMARTPHONE"; ?> <script type="text/javascript"> <!-- window.location = "http://nl.info.qa.extraspel.com/visit.aspx" //--> </script> <?php } elseif($res == "M") { //echo "MOBILE J2ME"; //header("Location: http://en.info.qa.extraspel.com/visit.aspx"); ?><script type="text/javascript"> <!-- window.location = "http://nl.info.qa.extraspel.com/visit.aspx" //--> </script><?php } ?>
  19. Hi Am getting the below error on this line of code Fatal error: Uncaught SoapFault exception: [soap:Server] Server was unable to process request. ---> Object reference not set to an instance of an object. in /var/www/vhosts/extraspel.com/subdomains/en.qa/httpdocs/services/websiteheaderprovider.php:6 Stack trace: #0 [internal function]: SoapClient->__call('GetPlatformByUs...', Array) #1websiteheaderprovider.php(6): SoapClient->GetPlatformByUserAgent(Array) #2 {main} thrown in websiteheaderprovider.php on line 6 $result = ($client->GetPlatformByUserAgent($params)); Any ideas?
  20. Wordpress Templates problem I have custom post types but when I try and view the pages it just defaults http://d698815.eechost.com This is a custom post type called Polish but its just defaulting to the homepage http://d698815.eechost.com/polish/hh/ Any ideas?
  21. WSDL <wsdl:definitions targetNamespace="BLANKED"><wsdl:types><s:schema elementFormDefault="qualified" targetNamespace="BLANKED"><s:element name="GetPlatformByUserAgent"><s:complexType><s:sequence><s:element minOccurs="0" maxOccurs="1" name="pUserAgent" type="s:string"/></s:sequence></s:complexType></s:element><s:element name="GetPlatformByUserAgentResponse"><s:complexType><s:sequence><s:element minOccurs="0" maxOccurs="1" name="GetPlatformByUserAgentResult" type="s:string"/></s:sequence></s:complexType></s:element></s:schema></wsdl:types><wsdl:message name="GetPlatformByUserAgentSoapIn"><wsdl:part name="parameters" element="tns:GetPlatformByUserAgent"/></wsdl:message><wsdl:message name="GetPlatformByUserAgentSoapOut"><wsdl:part name="parameters" element="tns:GetPlatformByUserAgentResponse"/></wsdl:message><wsdl:portType name="WebSiteServicesSoap"><wsdl:operation name="GetPlatformByUserAgent"><wsdl:input message="tns:GetPlatformByUserAgentSoapIn"/><wsdl:output message="tns:GetPlatformByUserAgentSoapOut"/></wsdl:operation></wsdl:portType><wsdl:binding name="WebSiteServicesSoap" type="tns:WebSiteServicesSoap"><soap:binding transport="http://schemas.xmlsoap.org/soap/http"/><wsdl:operation name="GetPlatformByUserAgent"><soap:operation soapAction="http://BLANK/GetPlatformByUserAgent" style="document"/><wsdl:input><soap:body use="literal"/></wsdl:input><wsdl:output><soap:body use="literal"/></wsdl:output></wsdl:operation></wsdl:binding><wsdl:binding name="WebSiteServicesSoap12" type="tns:WebSiteServicesSoap"><soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/><wsdl:operation name="GetPlatformByUserAgent"><soap12:operation soapAction="http://BLANK/GetPlatformByUserAgent" style="document"/><wsdl:input><soap12:body use="literal"/></wsdl:input><wsdl:output><soap12:body use="literal"/></wsdl:output></wsdl:operation></wsdl:binding><wsdl:service name="WebSiteServices"><wsdl:port name="WebSiteServicesSoap" binding="tns:WebSiteServicesSoap"><soap:address location="http://BLANK/WebSiteServices.asmx"/></wsdl:port><wsdl:port name="WebSiteServicesSoap12" binding="tns:WebSiteServicesSoap12"><soap12:address location="http://BLANK/WebSiteServices.asmx"/></wsdl:port></wsdl:service></wsdl:definitions> Code I am using <?php class GetPlatformByUserAgent{ public $useragent = 1234 ; //$a = $_SERVER['HTTP_USER_AGENT']; }; $client = new SoapClient("http://BLANK.asmx?wsdl"); $response = $client->GetPlatformByUserAgent("Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)"); echo $response ?> Error I get ( ! ) Fatal error: Uncaught SoapFault exception: [soap:Server] Server was unable to process request. ---> Object reference not set to an instance of an object. in C:\wamp\websites\projects\soap\test.php:7 Stack trace: #0 C:\wamp\websites\projects\soap\test.php(7): SoapClient->__call('GetPlatformByUs...', Array) #1 C:\wamp\websites\projects\soap\test.php(7): SoapClient->GetPlatformByUserAgent('Mozilla/4.0 (co...') #2 {main} thrown in C:\wamp\websites\projects\soap\test.php on line 7 Any ideas where I am going wrong as I'm new to SOAP calls?
  22. Thanks for your help yeah I tried jQuery noconflict(); but that didn't fix the issues I'm experiencing. I will try and upgrade everything to the newest version if I can but it may prove difficult as it was created by an integration team. Is there anyway I can easily find functions that are broken due to incompatibility issues as I've got alot of code to sift through?
  23. Hi I am having a conflict with these two jquery libraries I have tried noConflict but that has not worked. Jquery 1.4.2 and Jquery 1.8.3 conflict On suggestions on what I can do or where I can look to fix this issue?
  24. I just get the hardcoded text got data: outputting in my div and not the response request.responseText which appears ok in the alert box
×
×
  • 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.