Jump to content

saynotojava

Members
  • Content Count

    34
  • Joined

  • Last visited

Community Reputation

0 Neutral

About saynotojava

  • Rank
    Member
  1. saynotojava

    Need to get output into variable

    Ok solution found.
  2. saynotojava

    Need to get output into variable

    Currently that does not work as function before output 3 ip's instead one, for example when i was testing it with alert, each ip was displayed in 3 alert instead all 3 in one alert. Tho, could be solved if i would remove those 2 ip's and have one only, but dont know which line exactly to remove.
  3. saynotojava

    Need to get output into variable

    Same what i doing with almost any javascript- send it to ajax call so i can process it further with php. So that means i could get right ip adress with php explode, but i still need to get that output properly, as for example, when i put console log or alert into function addIP function, it loops , and if i tried to get it outside that function, then there is no output.
  4. saynotojava

    Need to get output into variable

    I have this code: <script> function findIP(onNewIP) { var myPeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection; var pc = new myPeerConnection({iceServers: [{urls: "stun:stun.l.google.com:19302"}]}), noop = function() {}, localIPs = {}, ipRegex = /([0-9]{1,3}(\.[0-9]{1,3}){3}|[a-f0-9]{1,4}(:[a-f0-9]{1,4}){7})/g, key; function ipIterate(ip) { if (!localIPs[ip]) onNewIP(ip); localIPs[ip] = true; } pc.createDataChannel(""); pc.createOffer(function(sdp) { sdp.sdp.split('/n').forEach(function(line) { if (line.indexOf('candidate') < 0) return; line.match(ipRegex).forEach(ipIterate); }); pc.setLocalDescription(sdp, noop, noop); }, noop); pc.onicecandidate = function(ice) { if (!ice || !ice.candidate || !ice.candidate.candidate || !ice.candidate.candidate.match(ipRegex)) return; ice.candidate.candidate.match(ipRegex).forEach(ipIterate); }; } function addIP(ip) { var li = document.createElement('li'); li.textContent = ip; document.getElementById("IPLeak").appendChild(li); } findIP(addIP); </script> Which read local ip, ipv6 and ipv4 and output it into HTML element by using WebRTC protocol. But i trying to get that output store into js variable instead HTML element. Tried by adding variable into function addIP , but that variable cannot be read outside that function for some reason. And another thing which i cant figure out, how to output only ipv4 ip and not all 3 ip types.
  5. saynotojava

    Ajax call without reloading ?

    Figured out that one as well - i had jquery include in http url, and for some reason firefox is blocking js load in case of protocol mismatch.
  6. saynotojava

    Ajax call without reloading ?

    Finally figured out what i was doing wrong- i need to use echo only, not session, since it is ajax call is the one which handle data back and forth. Since session is method what is used in PHP to handle data between pages, i assumed same for javascript but it was wrong assumption. But there is still one problem remaining - for some reason, ajax call is not working on https protocol . I found possible solution here: https://serverfault.com/questions/891980/ajax-post-not-working-on-https-ssl-nginx , but it's not working.
  7. saynotojava

    Ajax call without reloading ?

    So in shortly, not possible ?
  8. saynotojava

    Ajax call without reloading ?

    So i have two files, one with ajax call and second with content which is called. And i get what i need(displaying session variable so in this case), but only when i manually refresh page, while i should see result immediately after i load file with ajax call for first time. Is that possible? Test.php <?php session_start(); ?> <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script> <script type="text/javascript"> $.ajax({ type: "GET", url: 'ab.php', data: {name: 'Wayne', age: 27, country: 'Ireland'} }); </script> <?php echo $_SESSION["so"] ; ?> ab.php <?php session_start(); $name = $_GET['name']; $age = $_GET['age']; $_SESSION["so"]='kukulele'; ?>
  9. saynotojava

    Changing sorting order in pagination class

    Actually, when i tested different queries, when you dont specify ORDER in query, by default it order by ID(alias first column). So if you dont want ORDER to run , then you need to specify NULL.
  10. saynotojava

    Changing sorting order in pagination class

    There is not much difference between example code and my code, only difference is sql query and obviously HTML layout. Everything else is same as in example code.
  11. saynotojava

    Changing sorting order in pagination class

    It's a specific query in specific situation which require order by NULL to make it work properly. It does sounds like a terrible thing, but since i have this class already, it should be possible to reverse page output, so page 1 become page 10,page 2 become 9 and so on.
  12. I am using following pagination class: https://github.com/BenGriffiths/pdo-mysqli-pagination and i have specific situation where i cant use ordering inside mysql query. How do i change sorting in this pagination class, where loading first page wont load first page but last page instead ? (that way i'l get proper sorting)
  13. saynotojava

    Generting mysql queries based on table data

    1. I was copy paste-ing example code so that line was copied too. I always have it only once. 2.This is how i have it stored - ID 1 Android ID 2 Iphone ID 3 Raspberry 3.Yes it is, not just for that but also to prevent sql injection. Tho, first i want to finish my project , then i will go over entire code and switch all querys with prepared statements. 4. I dont see how at the moment. Tho, i should find it step by step. And here is sample of current working code: $conn = new mysqli($servername, $username, $password, $dbname); $result = $conn->query("SELECT temp FROM temp "); while($arow = $result->fetch_assoc()) { { $bresult = $conn->query("SELECT COUNT(`Device`) AS 'KU' FROM `table` WHERE `Device` LIKE '%{$arow['temp']}%'"); while($row = $bresult->fetch_assoc()) { echo "<font size=\"6\"> <div align=\"left\">Overall {$arow['temp']} : {$row['KU']} </div></font>"; } } } Also, what i noticed, how i using if ($result->num_rows > 0) on almost every query, yet seems to me how that might be not needed in most cases.
  14. saynotojava

    Generting mysql queries based on table data

    Working now, was loading wrong query in second loop. This thread can be closed.
  15. saynotojava

    Generting mysql queries based on table data

    Yes, just tested it and it seems php code/query can be looped inside while loop. Tho, it seems it does not load second entry in table, only first one.
×

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.