Jump to content

Search the Community

Showing results for tags '$_SERVER'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

Found 6 results

  1. Hello, please could you help me with this PHP script? It should recognize users web browser and according it should input correct condition. I make this because SAFARI and IE don't support function ' type:''date'' '. So can you give me an advice? CODE: <?php function detect() { if (\strpos($_SERVER['HTTP_USER_AGENT'], "MSIE", "Safari") === false){ echo 'Dátum zákroku / Date of procedure [YYYY-MM-DD]'; echo '<p><input class="w3-input w3-border" required name="datum_zakroku"></p>'; }else{ '<div class="w3-text-d1"><p><b>Dátum zákroku / Date of procedure</b></p></div> <p><input class="w3-input w3-border" type="date" required name="datum_zakroku"></p>'; } } detect(); ?>
  2. Hello, please could you help me with my problem about PHP script? I need my program to detect user browser because html function 'type=''date'' ' is not supported by SAFARI and IE. Please help me with this. Thanks <?php function detect() { /*$info = $_SERVER['HTTP_USER_AGENT'];*/ /* @var $_SERVER type */ echo $_SERVER['HTTP_USER_AGENT']; $browser = get_browser(); print_r($browser); if (\strpos($browser, 'IE') === true){ echo 'Dátum zákroku / Date of procedure [YYYY-MM-DD]'; echo '<p><input class="w3-input w3-border" required name="datum_zakroku"></p>';} else if (\strpos($browser, 'Safari') === true){ echo 'Dátum zákroku / Date of procedure [YYYY-MM-DD]'; echo '<p><input class="w3-input w3-border" required name="datum_zakroku"></p>';} else{ '<div class="w3-text-d1"><p><b>Dátum zákroku / Date of procedure</b></p></div> <p><input class="w3-input w3-border" type="date" required name="datum_zakroku"></p>';} } detect() ?>
  3. BACKGROUND: A visitor arrives on a website. While still on the site he triggers an AJAX call that fills a <div> element with new HTML. Once the page is filled another AJAX call is made that seeks to read the following value as encoded JSON: $_SERVER['REMOTE_REFERER']. Instead I receive a 500 internal server error. The AJAX (function() { $("#main").html(''); $("<link/>", { rel: "stylesheet", type: "text/css", href: "./_utilities/css/yourprofile_filler.css" }).appendTo("head"); $.get('./yourprofile_filler.html', function(data) { $('#main').html(data); }).done(function(){ $.ajax({ url: './_utilities/php/visitor_ip.php', dataType: 'JSON', statusCode: { 404: function() { alert( "Page not found" ); }}, success: function(visitor_ip) { console.log(visitor_ip); } }); }); })(); The PHP <?php $referral_addr = $_SERVER['REMOTE_REFERER']; echo json_encode($referral_addr); ?> ERROR MESSAGE jquery.min.js:5 GET https://www.grammarcaptive.com/_utilities/php/visitor_ip.php 500 (Internal Server Error)send Is the $_SERVER variable not available in the moment of the AJAX? How do I otherwise make it available? Roddy
  4. QUESTION: What does it mean when the value of the QUERY_STRING looks like the following without end? &width=1920&height=1200&width=1920&height=1200&... Roddy
  5. Hi, I'm new to PHP and I was wondering if it's perfectly safe to use $_SERVER['PHP_SELF'] like so: <body<?php if(basename($_SERVER['PHP_SELF']) == 'home.php') echo ' class="home"'; ?>> … </body> As far as I understand, the $_SERVER['PHP_SELF'] variable can only be exploited when used as a link or in a form/inputs, where the variable should be wrapped into htmlspecialchars() to counter XSS attacks, am I right?
  6. dalawh

    Visitor IP

    I did a few searches and I found that though $_SERVER['REMOTE_ADDR'] gets you the IP of a visistor, it is not always accurate because they could be hiding behind a proxy. I read that it was good to check $_SERVER['REMOTE_ADDR'] and $_SERVER['HTTP_X_FORWARDED_FOR'] to see if they contained value and if they did, it meant that they were behind a proxy, so it was better to use $_SERVER['REMOTE_ADDR'] and $_SERVER['HTTP_X_FORWARDED_FOR'] instead of $_SERVER['REMOTE_ADDR']. Now my question is whether $_SERVER['REMOTE_ADDR'] and $_SERVER['HTTP_X_FORWARDED_FOR'] where the same or not. If not, what is the difference between them? I also read that $_SERVER['REMOTE_ADDR'] and $_SERVER['HTTP_X_FORWARDED_FOR'] were not always accurate because of the fact that the header could be spoofed. I tested this and it seems that the few proxies I used, the $_SERVER['REMOTE_ADDR'] and $_SERVER['HTTP_X_FORWARDED_FOR'] were not able to detect that it was behind a proxy. My question now is if there was a more accurate way to track an IP as opposed to this? I also want to know if there was any way to track the original IP of someone using a VPN or VPS?
×
×
  • Create New...