Jump to content

Samurai Legend

Members
  • Content Count

    396
  • Joined

  • Last visited

  • Days Won

    2

Samurai Legend last won the day on July 1

Samurai Legend had the most liked content!

Community Reputation

9 Neutral

About Samurai Legend

  • Rank
    Trainee
  • Birthday 02/24/1999

Recent Profile Visitors

11,907 profile views
  1. Does anyone have a working IPN?
  2. Hello, when I reach for an address it doesn't work! <!DOCTYPE html > <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> <title>Locator</title> <style> /* Always set the map height explicitly to define the size of the div * element that contains the map. */ #map { height: 100%; } /* Optional: Makes the sample page fill the window. */ html, body { height: 100%; margin: 0; padding: 0; } </style> </head> <body style="margin:0px; padding:0px;" onload="initMap()"> <div> <label for="raddressInput">Search:</label> <input type="text" id="addressInput" size="15"/> <label for="radiusSelect">Radius:</label> <select id="radiusSelect" label="Radius"> <option value="50" selected>50 Miles</option> <option value="30">30 Miles</option> <option value="20">20 Miles</option> <option value="10">10 Miles</option> </select> <input type="button" id="searchButton" value="Search"/> </div> <div><select id="locationSelect" style="width: 10%; visibility: hidden"></select></div> <div id="map" style="width: 100%; height: 90%"></div> <script> var customLabel = { restaurant: { label: 'R' }, bar: { label: 'B' } }; var map; var markers = []; var infoWindow; var locationSelect; function initMap() { /* var map = new google.maps.Map(document.getElementById('map'), { center: new google.maps.LatLng(-33.863276, 151.207977), zoom: 12 });*/ var sydney = {lat: -33.863276, lng: 151.207977}; map = new google.maps.Map(document.getElementById('map'), { center: sydney, zoom: 11, mapTypeId: 'roadmap', mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU} }); var infoWindow = new google.maps.InfoWindow; searchButton = document.getElementById("searchButton").onclick = searchLocations; locationSelect = document.getElementById("locationSelect"); locationSelect.onchange = function() { var markerNum = locationSelect.options[locationSelect.selectedIndex].value; if (markerNum != "none"){ google.maps.event.trigger(markers[markerNum], 'click'); } }; // Change this depending on the name of your PHP or XML file downloadUrl('markers.xml', function(data) { var xml = data.responseXML; var markers = xml.documentElement.getElementsByTagName('marker'); Array.prototype.forEach.call(markers, function(markerElem) { var id = markerElem.getAttribute('id'); var name = markerElem.getAttribute('name'); var address = markerElem.getAttribute('address'); var type = markerElem.getAttribute('type'); var point = new google.maps.LatLng( parseFloat(markerElem.getAttribute('lat')), parseFloat(markerElem.getAttribute('lng'))); var infowincontent = document.createElement('div'); var strong = document.createElement('strong'); strong.textContent = name infowincontent.appendChild(strong); infowincontent.appendChild(document.createElement('br')); var text = document.createElement('text'); text.textContent = address infowincontent.appendChild(text); infowincontent.appendChild(document.createElement('br')); var text = document.createElement('text'); text.textContent = type infowincontent.appendChild(text); var icon = customLabel[type] || {}; var marker = new google.maps.Marker({ map: map, position: point, label: icon.label }); marker.addListener('click', function() { infoWindow.setContent(infowincontent); infoWindow.open(map, marker); }); }); }); } function createMarker(latlng, name, address) { var html = "<b>" + name + "</b> <br/>" + address; var marker = new google.maps.Marker({ map: map, position: latlng }); google.maps.event.addListener(marker, 'click', function() { infoWindow.setContent(html); infoWindow.open(map, marker); }); markers.push(marker); } function createOption(name, distance, num) { var option = document.createElement("option"); option.value = num; option.innerHTML = name; locationSelect.appendChild(option); } function searchLocations() { var address = document.getElementById("addressInput").value; var geocoder = new google.maps.Geocoder(); geocoder.geocode({address: address}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { searchLocationsNear(results[0].geometry.location); } else { alert(address + ' not found'); } }); } function searchLocationsNear(center) { clearLocations(); var radius = document.getElementById('radiusSelect').value; var searchUrl = 'locator.php?lat=' + center.lat() + '&lng=' + center.lng() + '&radius=' + radius; downloadUrl(searchUrl, function(data) { var xml = parseXml(data); var markerNodes = xml.documentElement.getElementsByTagName("marker"); var bounds = new google.maps.LatLngBounds(); for (var i = 0; i < markerNodes.length; i++) { var id = markerNodes[i].getAttribute("id"); var name = markerNodes[i].getAttribute("name"); var address = markerNodes[i].getAttribute("address"); var distance = parseFloat(markerNodes[i].getAttribute("distance")); var latlng = new google.maps.LatLng( parseFloat(markerNodes[i].getAttribute("lat")), parseFloat(markerNodes[i].getAttribute("lng"))); createOption(name, distance, i); createMarker(latlng, name, address); bounds.extend(latlng); } map.fitBounds(bounds); locationSelect.style.visibility = "visible"; locationSelect.onchange = function() { var markerNum = locationSelect.options[locationSelect.selectedIndex].value; google.maps.event.trigger(markers[markerNum], 'click'); }; }); } function clearLocations() { infoWindow.close(); for (var i = 0; i < markers.length; i++) { markers[i].setMap(null); } markers.length = 0; locationSelect.innerHTML = ""; var option = document.createElement("option"); option.value = "none"; option.innerHTML = "See all results:"; locationSelect.appendChild(option); locationSelect.style.visibility = "visible"; } function downloadUrl(url, callback) { var request = window.ActiveXObject ? new ActiveXObject('Microsoft.XMLHTTP') : new XMLHttpRequest; request.onreadystatechange = function() { if (request.readyState == 4) { request.onreadystatechange = doNothing; callback(request, request.status); } }; request.open('GET', url, true); request.send(null); } function doNothing() {} </script> <script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAiD-SlkJEGkpgDYr9m14O98uy-ulcB9sU&&callback=initMap"> </script> </body> </html> locator.php - <?php error_reporting(E_ALL & ~E_NOTICE); require("configuration/connect.php"); // Start XML file, create parent node $doc = new DOMDocument('1.0', 'UTF-8'); $node = $doc->createElement("markers"); try { $database = new Connection(); $db = $database->openConnection(); // Get parameters from URL $center_lat = $_GET["lat"]; $center_lng = $_GET["lng"]; $radius = $_GET["radius"]; //$center_lat = $_GET['lat'] = (isset($_GET['lat']) && is_float($_GET['lat'])) ? abs(intval($_GET['lat'])) : //$center_lng = $_GET['lng'] = (isset($_GET['lng']) && is_float($_GET['lng'])) ? abs(intval($_GET['lng'])) : ''; //$radius = $_GET['lng'] = (isset($_GET['radius']) && is_float($_GET['radius'])) ? abs(intval($_GET['radius'])) : ''; //$query = 'SELECT * FROM markers'; // Set the appropriate content-type header and output the XML header('Content-type: text/xml'); $query = sprintf("SELECT id, name, address, lat, lng, type, ( 3959 * acos( cos( radians('%s') ) * cos( radians( lat ) ) * cos( radians( lng ) - radians('%s') ) + sin( radians('%s') ) * sin( radians( lat ) ) ) ) AS distance FROM markers HAVING distance < '%s' ORDER BY distance LIMIT 0 , 20", $center_lat, $center_lng, $center_lat, $radius); $stmt = $db->prepare($query); $stmt->setFetchMode(PDO::FETCH_ASSOC); $stmt->execute(); $result = $stmt->fetchAll(); // Iterate through the rows, adding XML nodes for each foreach ($result as $row) { $entry = $doc->createElement('marker'); $entry->setAttribute('id', $row['id']); $entry->setAttribute('name', $row['name']); $entry->setAttribute('address', $row['address']); $entry->setAttribute('lat', $row['lat']); $entry->setAttribute('lng', $row['lng']); $entry->setAttribute('type', $row['type']); $entry->setAttribute('distance', $row['distance']); $node->appendChild($entry); } $doc->appendChild($node); // Save the XML echo $doc->saveXML(); echo 'Bytes written: '.$doc->save("markers.xml"); $database->closeConnection(); } catch (PDOException $e) { echo "There is some problem in connection: " . $e->getMessage(); } ?> Can someone help me out on this please?
  3. @Magictallguy <?php error_reporting(E_ALL & ~E_NOTICE); require("configuration/connect.php"); // Start XML file, create parent node $doc = new DOMDocument('1.0', 'UTF-8'); $node = $doc->createElement("markers"); try { $database = new Connection(); $db = $database->openConnection(); // Get parameters from URL $center_lat = $_GET["lat"]; $center_lng = $_GET["lng"]; $radius = $_GET["radius"]; //$query = 'SELECT * FROM markers'; // Set the appropriate content-type header and output the XML header('Content-type: text/xml');*$query = sprintf("SELECT id, name, address, lat, lng, type, ( 3959 * acos( cos( radians('%s') ) * cos( radians( lat ) ) * cos( radians( lng ) - radians('%s') ) + sin( radians('%s') ) * sin( radians( lat ) ) ) ) AS distance FROM markers HAVING distance < '%s' ORDER BY distance LIMIT 0 , 20", $center_lat, $center_lng, $center_lat, $radius); $distance = 0; $stmt = $db->prepare($query); $stmt->setFetchMode(PDO::FETCH_ASSOC); $stmt->execute(); $result = $stmt->fetchAll(); // Iterate through the rows, adding XML nodes for each foreach ($result as $row) { $entry = $doc->createElement('marker'); $entry->setAttribute('id', $row['id']); $entry->setAttribute('name', $row['name']); $entry->setAttribute('address', $row['address']); $entry->setAttribute('lat', $row['lat']); $entry->setAttribute('lng', $row['lng']); $entry->setAttribute('type', $row['type']); $entry->setAttribute('distance', $row['distance']); $node->appendChild($entry); } $doc->appendChild($node); // Save the XML echo $doc->saveXML(); echo 'Bytes written: '.$doc->save("markers.xml"); $database->closeConnection(); } catch (PDOException $e) { echo "There is some problem in connection: " . $e->getMessage(); } ?> Okay, I have got this working thank you all!
  4. $query = sprintf("SELECT id, name, address, lat, lng, type, ( 3959 * acos( cos( radians('%s') ) * cos( radians( lat ) ) * cos( radians( lng ) - radians('%s') ) + sin( radians('%s') ) * sin( radians( lat ) ) ) ) AS distance FROM markers HAVING distance < '%s' ORDER BY distance LIMIT 0 , 20", $center_lat, $center_lng, $center_lat, $radius); $stmt = $db->prepare($query); $stmt->setFetchMode(PDO::FETCH_ASSOC); $stmt->execute(); $result = $stmt->fetchAll(); Now when using this, it doesn't create which makes an empty XML file. Can anyone see the problem?
  5. @Shades Man, thanks for the reply! I've been waiting as I tried so much to get it working. It always throws errors at me. I used what you provided me. When I go on the file, there is no errors it just shows blank white web page. However, there's no XML file created? If someone knows the answer and can help please let me know! If any other information is needed please let me know. What I am working on is very important to me. Thanks once again for helping me out. I think the spacing was created by the forums...On Sublime Text it has no spacing. Thanks @Uridum for replying and taking your time to read. I appreciate it. @Uridium- Thank you so much for helping me out privately, without you I wouldn't have been able to fix the issue. + 1 @Shades - Thank you too, for providing a better copy of what I wrote although it didn't work, it still helped me out big time as your fixes helped me and Illusion remove the main issue.
  6. Hello, as most of you know I am learning PHP. In order for me to learn, I like to practise and make things. Hopefully soon when I have enough experience Ill be moving onto Laravel and learn more about the framework. Error - This page contains the following errors: error on line 1 at column 1: Document is empty Below is a rendering of the page up to the first error. File - <?php include 'configuration/connect.php'; try { $database = new Connection(); $db = $database->openConnection(); // Get parameters from URL //$center_lat = $_GET["lat"]; //$center_lng = $_GET["lng"]; //$radius = $_GET["radius"]; $center_lat = (array_key_exists('lat', $_GET) && is_string($_GET['lat'])) ? $_GET['lat'] : ''; $center_lng = (array_key_exists('lng', $_GET) && is_string($_GET['lng'])) ? $_GET['lng'] : ''; $radius = (array_key_exists('radius', $_GET) && is_string($_GET['radius'])) ? $_GET['radius'] : ''; // Start XML file, create parent node $dom = new DOMDocument("1.0"); $node = $dom->createElement("markers"); $parnode = $dom->appendChild($node); $sql = "SELECT bID, bNAME, bADDRESS, bLAT, bLNG, ( 3959 * acos( cos( radians('%s') ) * cos( radians( lat ) ) * cos( radians( lng ) - radians('%s') ) + sin( radians('%s') ) * sin( radians( lat ) ) ) ) AS distance FROM bookers HAVING distance < '%s' ORDER BY distance LIMIT 0 , 20"; header("Content-type: text/xml"); // Iterate through the rows, adding XML nodes for each foreach ($db->query($sql) as $row) { $node = $dom->createElement("marker"); $newnode = $parnode->appendChild($node); $newnode->setAttribute("id", $row['bID']); $newnode->setAttribute("name", $row['bNAME']); $newnode->setAttribute("address", $row['bADDRESS']); $newnode->setAttribute("lat", $row['bLAT']); $newnode->setAttribute("lng", $row['bLNG']); $newnode->setAttribute("distance", $row['distance']); } echo $dom->saveXML(); $database->closeConnection(); } catch (PDOException $e) { echo "There is some problem in connection: " . $e->getMessage(); } ?> I believe it is something got to do with the XML part. However, I can not seem to see what is wrong? ? no one can't help me?
  7. Anyone know a good tutorial to start a website using PDO?
  8. Thank you for the clarification! Will be checking out the link seems really useful. You know what it is, there's just a lot of people who take the piss out of PHP and how FaceBook is run on PHP. Just made me thought what has happened lmao? But then to mention Laravel, that's probably one of the best PHP frame works out there. Well, it's the only one that I have used.
  9. Oooo, maybe a different theme will be better. E.g. Samurai Theme.
  10. I want to get back into backend developing. They only language I used is PHP and reading a lot of stuff lately. PHP is apparently dying? What is your thoughts on this. Where should I start? What language and why.
  11. It's not even that, I am actually good at the game. I took a month break or so and when I came back to play. It just seems like the person who I shoot first I mow them down legit but then they somehow have unlimited health? Makes no sense. I had couple of situations where I had a Gold/Purple armour and the opponent had a blue armour. Somehow, when I land the shot firsts I just die???
  12. Man was blawing mandem to much in this game. I am too good with the Kraber. However, the game has died out and it seems like there's to many hackers in the game. Anyone play Fornite?
  13. Did someone buy the .com domain? Seems like someone has as it redirects me to an empty folder.
  14. Laravel Valet is amazing.
×
×
  • Create New...