Profile Help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Profile Help

    hi frnds i want t add country flags,country name, in lavalair profile plz help me out here is the code<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'><?php
    $db_host = "localhost";
    $db_user = "username";
    $db_pass = "password";
    $db_name = "database";
    $dbc = mysql_connect($db_host, $db_user, $db_pass);
    $dbs = mysql_select_db($db_name);

    $_dez_ip=getdezIP();

    $q = mysql_query("SELECT `cc`, `network` FROM `mobile_carrier` WHERE `num_min` <= &#39;".$_dez_ip."&#39; ORDER BY `num_min` DESC, `num_max` ASC LIMIT 1") or die("MySQL Error: ".mysql_error());
    $info = mysql_fetch_array($q);
    mysql_close();

    $cc=$info[0];
    echo &#39;Network: &#39;.$info[1]; // Mobile network
    echo &#39;Country code: &#39;.$cc; // Country code

    include("countries.php"); /* Include the country arrays to convert country code to country name */
    echo &#39;Country: &#39;.$countries[$cc];

    /* you can also download famfamfam flag icons from
    http://www.famfamfam.com/lab/icons/flags/
    to show the country flag */

    // echo &#39;Country flag : [img]flags/&#39;.strtolower($cc).&#39;.gif[/img]&#39;;

    function getdezIP(){
    $IP = "";
    if (isSet($_SERVER)) {
    if (isSet($_SERVER["HTTP_X_FORWARDED_FOR"])) {
    $IP = $_SERVER["HTTP_X_FORWARDED_FOR"];
    } elseif (isSet($_SERVER["HTTP_CLIENT_IP"])) {
    $IP = $_SERVER["HTTP_CLIENT_IP"];
    } else {
    $IP = $_SERVER["REMOTE_ADDR"];
    }
    } else {
    if ( getenv( &#39;HTTP_X_FORWARDED_FOR&#39; ) ) {
    $IP = getenv( &#39;HTTP_X_FORWARDED_FOR&#39; );
    } elseif ( getenv( &#39;HTTP_CLIENT_IP&#39; ) ) {
    $IP = getenv( &#39;HTTP_CLIENT_IP&#39; );
    } else {
    $IP = getenv( &#39;REMOTE_ADDR&#39; );
    }
    }
    if (strstr($IP, &#39;,&#39;)) {
    $ips = explode(&#39;,&#39;, $IP);
    $IP = $ips[0];
    }

    if(empty($IP)) $IP=$_SERVER["REMOTE_ADDR"];
    else if(strtolower(trim($IP))==&#39;unknown&#39;) $IP=$_SERVER["REMOTE_ADDR"];

    $numbers = preg_split( "/\./", $IP);
    $dezip=($numbers[0] * 16777216) + ($numbers[1] * 65536) + ($numbers[2] * 256) + ($numbers[3]);
    return $dezip;
    }
    ?></div>

    #2
    add from $_dez_ip=getdezIP(); to profiles and make sure yu have the table called mobile_carrier in ya database
    Want something coded email me at sales@webnwaphost.com for a prices.




    Comment


      #3
      frnd i tried but i got dis error.
      Call to undefined function: getdezip() in /home/www/sitename/index.php on line 2390



      plz help me any 1

      Comment


        #4
        post me the page with there error there
        Want something coded email me at sales@webnwaphost.com for a prices.




        Comment


          #5
          Code:
          $db_host = "localhost";
          $db_user = "username";
          $db_pass = "password";
          $db_name = "database";
          $dbc = mysql_connect($db_host, $db_user, $db_pass);
          $dbs = mysql_select_db($db_name);
          u still ent got that have you ? u need to delete that if yu have a inlcude config.php alredi on the page
          Want something coded email me at sales@webnwaphost.com for a prices.




          Comment


            #6
            its working in my login page bt i want 2 add it in profile i tried bt get errors

            Comment


              #7
              Code:
              function getdezIP(){
              $IP = "";
              if (isSet($_SERVER)) {
              if (isSet($_SERVER["HTTP_X_FORWARDED_FOR"])) {
              $IP = $_SERVER["HTTP_X_FORWARDED_FOR"];
              } elseif (isSet($_SERVER["HTTP_CLIENT_IP"])) {
              $IP = $_SERVER["HTTP_CLIENT_IP"];
              } else {
              $IP = $_SERVER["REMOTE_ADDR"];
              }
              } else {
              if ( getenv( &#39;HTTP_X_FORWARDED_FOR&#39; ) ) {
              $IP = getenv( &#39;HTTP_X_FORWARDED_FOR&#39; );
              } elseif ( getenv( &#39;HTTP_CLIENT_IP&#39; ) ) {
              $IP = getenv( &#39;HTTP_CLIENT_IP&#39; );
              } else {
              $IP = getenv( &#39;REMOTE_ADDR&#39; );
              }
              }
              if (strstr($IP, &#39;,&#39;)) {
              $ips = explode(&#39;,&#39;, $IP);
              $IP = $ips[0];
              }
              
              if(empty($IP)) $IP=$_SERVER["REMOTE_ADDR"];
              else if(strtolower(trim($IP))==&#39;unknown&#39;) $IP=$_SERVER["REMOTE_ADDR"];
              
              $numbers = preg_split( "/\./", $IP);
              $dezip=($numbers[0] * 16777216) + ($numbers[1] * 65536) + ($numbers[2] * 256) + ($numbers[3]);
              return $dezip;
              }

              i add this part in core.php

              Comment

              Working...
              X