Jump to content


  • Posts

  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

bravo14's Achievements

Advanced Member

Advanced Member (4/5)



  1. I found it on a tutorial to store a remember me cookie. I am not sure if the openssl_random_pseudo_bytes(4) part of the function is generating anything
  2. I am using the code below, to encrypt cookie, but the hex2bin is generating the following error Warning: hex2bin(): Input string must be hexadecimal string in $key = hex2bin(openssl_random_pseudo_bytes(4)); $cipher = "aes-256-cbc"; $ivlen = openssl_cipher_iv_length($cipher); $iv = openssl_random_pseudo_bytes($ivlen); $ciphertext = openssl_encrypt($value, $cipher, $key, 0, $iv); return( base64_encode($ciphertext . '::' . $iv. '::' .$key) ); Can anyone point me in the right firection to correct this?
  3. Hi all Using a from with this code <form class="search-form"> <input type="text" placeholder="Search..." id="txtSearch" autocomplete="off" value=""> <button id="btnSearch" class="search-btn"> <i class="flaticon-magnifying-glass"></i> </button> </form> and the jquery below <script type="text/javascript"> var q = $("#txtSearch").val(); $('#btnSearch').click(function(){ location.href = "/recipes/search/" + q; }); </script> I am trying to redirect to a page /recipes/search and then the inpit value from the search field, but the input value is not appending. I am hoping I am missing something simple?
  4. I have added the &c='+country that is where the problem is occurring, in this line var url = query + '&c='+country;
  5. Hi I am trying to pass 2 variables to a URL using typeahead, but the URL that it gerjneates is incorrectly formatted. The code I am using on the function is $('#txtLocation').typeahead({ source: function (query, process) { var country = $('#txtCountry').val(); var url = query + '&c='+country; //var uri = encodeURI(url); //alert(uri); return $.get('ajax/search_locations.php', { query: encodeURI(url) }, function (data) { data = $.parseJSON(data); return process(data); }); }, //showHintOnFocus:'all' }); The URL in the debugger is /ajax/search_locations.php?query=b%26c%3DUnited%2520Kingdom it should be /ajax/search_locations.php?query=b&c=United%2520Kingdom Any help or pointers on where I am going wrong would be fantastic
  6. Hi all I am trying to get the lat and long properties from the googlemaps geocoding api. $xml=simplexml_load_file($url); if ($xml === false) { echo "Failed loading XML\n"; foreach(libxml_get_errors() as $error) { echo "\t", $error->message; } } else{ $path = $xml->xpath( "/GeocodeResponse/result/geometry/location"); $lat = $path->lat; $lng = $path->lng; echo $lat; echo $lng; $sql1 = "UPDATE tbl_clubs set lat='$lat',lng='$lng' where club_id =$id"; echo $sql1; $result1 = mysqli_query($dbConn,$sql1) or die($mysqli_error($dbConn)); } This is the XML I am using <GeocodeResponse> <status>OK</status> <result> <type>establishment</type> <type>point_of_interest</type> <type>stadium</type> <formatted_address>Aldridge Rd, Perry Barr, Birmingham B42 2ET, UK</formatted_address> <address_component> </address_component> <address_component> </address_component> <address_component> </address_component> <address_component> <long_name>West Midlands</long_name> <short_name>West Midlands</short_name> <type>administrative_area_level_2</type> <type>political</type> </address_component> <address_component> <long_name>England</long_name> <short_name>England</short_name> <type>administrative_area_level_1</type> <type>political</type> </address_component> <address_component> <long_name>United Kingdom</long_name> <short_name>GB</short_name> <type>country</type> <type>political</type> </address_component> <address_component> <long_name>B42 2ET</long_name> <short_name>B42 2ET</short_name> <type>postal_code</type> </address_component> <geometry> <location> <lat>52.5196698</lat> <lng>-1.8986236</lng> </location> <location_type>GEOMETRIC_CENTER</location_type> <viewport> <southwest> <lat>52.5183208</lat> <lng>-1.8999726</lng> </southwest> <northeast> <lat>52.5210188</lat> <lng>-1.8972746</lng> </northeast> </viewport> </geometry> But I am getting the following response Notice: Trying to get property of non-object in /home/sites/1a/9/95f15f28a6/public_html/results/getLatLng.php on line 22 I am guessing my path is wrong, any guidance would be great
  7. Hi all I am having problems with a script that uploads photo and adds watermarks to them. Whenever I try and upload a photo I get the following error Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 24576 bytes) in /home/sites/4a/1/13cb47e429/public_html/control/photos/processProduct.php on line 163 Line 163 is $image = imagecreatefromstring(file_get_contents($photo)); Let me know if you need the entire function for this and I will add it, but not sure what is wrong with the script, I have never seen this error before.
  8. Hi I am using the javascript below to carry put an ajax call. $('#tokenfield') .on('tokenfield:createdtoken', function (e) { $.ajax({ url: 'processProduct.php?action=addTag', type: 'post', data: {tag:e.attrs.value ,photo:83}, }); }); .tokenfield({ autocomplete: { source: function (request, response) { jQuery.get("processProduct.php?action=getTags", { query: request.term }, function (data) { data = $.parseJSON(data); response(data); }); }, delay: 100 }, showAutocompleteOnFocus: true }); When the page loads I get the following error in the console yntaxError: expected expression, got '.' [Learn More] index.php:416 the unexpected '.' is the following line .tokenfield({ I am sure that the answer is really simple, but I can't figure it out at the moment, any hepp would be fantastic
  9. Hi I am trying to use SimpleXML to parse the wordpress export XML file, but when parsing it I am not able to view all elements of the file. Each 'item' is made up in the XML as follows <item> <title></title> <link>http://www.dannykingracing.co.uk/?p=396</link> <pubDate>Fri, 21 Oct 2016 10:48:48 +0000</pubDate> <dc:creator><![CDATA[@dmin]]></dc:creator> <guid isPermaLink="false"></guid> <description></description> <content:encoded><![CDATA[ ]]></content:encoded> <excerpt:encoded><![CDATA[]]></excerpt:encoded> <wp:post_id>396</wp:post_id> <wp:post_date><![CDATA[2016-10-21 11:48:48]]></wp:post_date> <wp:post_date_gmt><![CDATA[2016-10-21 10:48:48]]></wp:post_date_gmt> <wp:comment_status><![CDATA[closed]]></wp:comment_status> <wp:ping_status><![CDATA[closed]]></wp:ping_status> <wp:post_name><![CDATA[396]]></wp:post_name> <wp:status><![CDATA[publish]]></wp:status> <wp:post_parent>0</wp:post_parent> <wp:menu_order>1</wp:menu_order> <wp:post_type><![CDATA[nav_menu_item]]></wp:post_type> <wp:post_password><![CDATA[]]></wp:post_password> <wp:is_sticky>0</wp:is_sticky> <category domain="nav_menu" nicename="menu"><![CDATA[Menu]]></category> <wp:postmeta> <wp:meta_key><![CDATA[_menu_item_type]]></wp:meta_key> <wp:meta_value><![CDATA[post_type]]></wp:meta_value> </wp:postmeta> <wp:postmeta> <wp:meta_key><![CDATA[_menu_item_menu_item_parent]]></wp:meta_key> <wp:meta_value><![CDATA[0]]></wp:meta_value> </wp:postmeta> <wp:postmeta> <wp:meta_key><![CDATA[_menu_item_object_id]]></wp:meta_key> <wp:meta_value><![CDATA[395]]></wp:meta_value> </wp:postmeta> <wp:postmeta> <wp:meta_key><![CDATA[_menu_item_object]]></wp:meta_key> <wp:meta_value><![CDATA ]></wp:meta_value> </wp:postmeta> <wp:postmeta> <wp:meta_key><![CDATA[_menu_item_target]]></wp:meta_key> <wp:meta_value><![CDATA[]]></wp:meta_value> </wp:postmeta> <wp:postmeta> <wp:meta_key><![CDATA[_menu_item_classes]]></wp:meta_key> <wp:meta_value><![CDATA[a:1:{i:0;s:0:"";}]]></wp:meta_value> </wp:postmeta> <wp:postmeta> <wp:meta_key><![CDATA[_menu_item_xfn]]></wp:meta_key> <wp:meta_value><![CDATA[]]></wp:meta_value> </wp:postmeta> <wp:postmeta> <wp:meta_key><![CDATA[_menu_item_url]]></wp:meta_key> <wp:meta_value><![CDATA[]]></wp:meta_value> </wp:postmeta> </item> however when parsing it all I get is [title] => SimpleXMLElement Object ( ) [link] => http://www.dannykingracing.co.uk/?p=396 [pubDate] => Fri, 21 Oct 2016 10:48:48 +0000 [guid] => [description] => SimpleXMLElement Object ( ) [category] => Menu the code I am using is: <?php $items = $xml->channel->item; foreach ($items as $item){ print_r($item); } ?> My question is how can I view all of the elements of the XML file, I am clearly missing somethin I just can't figure it out.
  10. Hi I have an XML file listing vehicle details, one record looks like <VehicleDataFeed> <VehicleRecord> <GUID>0dc50ce0-32e2-4785-a6a5-266071944792</GUID> <ReferenceID>0002878523</ReferenceID> <CompanyID>2</CompanyID> <DivisionID>2</DivisionID> <BranchID>2</BranchID> <Location>Auction</Location> <VehicleRecordID>890058</VehicleRecordID> <StockNumber>BU101206</StockNumber> <RegistrationNumber>SL61 TUA</RegistrationNumber> <RegistrationDate>2011-09-29T00:00:00+01:00</RegistrationDate> <MakeDescription>ALFA ROMEO</MakeDescription> <ModelDescription>GIULIETTA</ModelDescription> <SpecDescription>Veloce Tb</SpecDescription> <Colour>Silver</Colour> <BodyStyle>5 Door</BodyStyle> <Transmission>Manual</Transmission> <EngineSize>1368</EngineSize> <FuelType>Petrol</FuelType> <Mileage>40610</Mileage> <RetailPrice>7500.00</RetailPrice> <RetailPricePreVAT>7500.00</RetailPricePreVAT> <VehicleType>Passenger</VehicleType> <Qualifying>N</Qualifying> <Profile>Trade</Profile> <InternetPrice>7500.00</InternetPrice> <Options> <option>ABS</option> <option> Alloy Wheels</option> <option> Adjustable Steering Colmn</option> <option> Air Conditioning</option> <option> C D Player</option> <option> Height Adjustable Drivers Seat</option> <option> Multiple Airbags</option> <option> Remote Central Locking</option> </Options> <InternetNotes /> <PreviousOwners>1</PreviousOwners> <VehicleCode /> </VehicleRecord> I am trying to search for a record on vehicle record id using the following <?php if(!isset($_GET['GUID']) && ($_GET['REF']) && ($_GET['VehID'])){ header('Location: Vehicles.php'); } else{ $guid = $_GET['GUID']; $ref = $_GET['REF']; $vId = $_GET['VehID']; } ?> <?php $url = "url to xml file"; //echo $url; $vehicles =simplexml_load_file($url); $value = $vehicles->xpath("string(//VehicleRecord/VehicleRecordID[contains(text(), $vId)]"); if(count($value) ==0) { // if found header('Location:Vehicles.php'); } ?> But am getting the following errors Warning: SimpleXMLElement::xpath(): Invalid expression in /Applications/MAMP/htdocs/VehicleSearch/vehicle.php on line 19 Warning: SimpleXMLElement::xpath(): xmlXPathEval: evaluation failed in /Applications/MAMP/htdocs/VehicleSearch/vehicle.php on line 19
  11. Hi I am using a datetimepicker in bootstrap and the date format being displayed is dd/mm/yyyy H:i I need it converted to yyyy-mm-dd H:i The code I am using is $newsdate = strtotime($_POST['txtDate']); $news_date = date('Y-m-d H:i:s', $newsdate); However on date like to day 10th April which I would have as 10/04/2017 the code is converting that to 2017-10-04 instead of 2017-04-10 How can I get the dates converted correctly?
  12. Hi I have a mysql query that generates a league table based on wins, losses and draws etc, but also points difference between how many they score and how many are scored against them. The query works except for the points difference part, the offending part of the query is shown below @F:=SUM(IF(tbl_clubs.club_id = tbl_fixtures.away,tbl_fixtures.awayscore,0)) + SUM(IF(tbl_clubs.club_id = tbl_fixtures.home,tbl_fixtures.homescore,0)) as `F`, @A:=SUM(IF(tbl_clubs.club_id = tbl_fixtures.home,tbl_fixtures.awayscore,0)) + SUM(IF(tbl_clubs.club_id = tbl_fixtures.away,tbl_fixtures.homescore,0)) as `A`, SUM(@F - @A) as `PtsDiff`, Using the code above I am getting NULL as a result even though there should be a figure calculated.
  13. Hi all I have a xml file that builds a league table, but want to provide other sites with access to it for a charge. Is there a way I can check the domain using the xml file has permission to do so? I intended on keeping a key in a database with the URL but how can I get the URL using the xml file?
  14. Think part of my problem is on some parts of the menu I will need to get menu options from a different table as well as the pages menu if that makes sense.
  • 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.