ip help

Started on the old forum in August 2015 · view the original in the archive · old links redirect here

16 replies · 362 views · started 11 years ago · 1 min read

5 participants
thunderwap Developer · 169 posts #1

hello

some users in my site uses opera mini or uc mini browser.their having 2 ips because opera mini ip also displays in their profile. eg. 106.79.83.85,107.167.108.205

107.167.108.205 is opear mini server ip.... how can i show only 1 ip in their profile if users using opera mini or uc mini browser?

WANT GOOD CHEAP HOSTING WITH 99% UPTIME? THEN PM ME FOR DETAILS!!

thunderwap Developer · 169 posts #3

any other way except it?

WANT GOOD CHEAP HOSTING WITH 99% UPTIME? THEN PM ME FOR DETAILS!!

thunderwap Developer · 169 posts #5

it didnt worked

$uipadd = mysql_fetch_array(mysql_query("SELECT ipadd FROM siteusers WHERE id='".$who."'"));
$ip2=explode(",",$uipadd);
if(strpos($ip2[0],",")){
$web=explode(",",$uipadd);
$uipadd=$web[0];
}

  echo "<center><b>Ip:</b> <a href="lists.php?action=byip&who=$who">$uipadd</a></center>";

WANT GOOD CHEAP HOSTING WITH 99% UPTIME? THEN PM ME FOR DETAILS!!

GumSlone Administrator Principal · 1,690 posts #6
$db_arr = mysql_fetch_array(mysql_query("SELECT ipadd FROM siteusers WHERE id='".$who."'"));
$arr = explode(',',$db_arr['ipadd']);
$ip = $arr[0];

  echo '<center><b>Ip:</b> <a href="lists.php?action=byip&who='.$who.'">'.$ip.'</a></center>';

Advertise your mobile site for FREE with AdTwirl

External image (may be gone)

thunderwap Developer · 169 posts #7

GumSlone wrote:

$db_arr = mysql_fetch_array(mysql_query("SELECT ipadd FROM siteusers WHERE id='".$who."'"));
$arr = explode(',',$db_arr['ipadd']);
$ip = $arr[0];


echo '<center><b>Ip:</b> <a href="lists.php?action=byip&who='.$who.'">'.$ip.'</a></center>';

i tried as u given code.but still not working.same problem as like before

WANT GOOD CHEAP HOSTING WITH 99% UPTIME? THEN PM ME FOR DETAILS!!

thunderwap Developer · 169 posts #9

it shows both ip as like before. i done as you said in above code.there is no error it showing but it performs the same task as like before.

WANT GOOD CHEAP HOSTING WITH 99% UPTIME? THEN PM ME FOR DETAILS!!

GumSlone Administrator Principal · 1,690 posts #10
$arr = explode(',',$db_arr['ipadd']);

this code explodes comma separated ip,

$ip = $arr[0];

this one will show the first ip, even if there are no comma separated list

Advertise your mobile site for FREE with AdTwirl

External image (may be gone)

Ghost Senior · 366 posts #11

strange. seems to work for me. when testing it.

<?php include ('Ghost'); if ($Post == true) { echo ' ![](http://destrukt.dk/ico/phpdeveloper.jpg) alt='coding-talk.com!!' />'; echo 'Sharing Is Caring!'; } else { echo ' ![](http://img98.imageshack.us/img98/6476/av3ro4.jpg) alt='the username GHOST has been comprimised!' />'; echo 'OMG SOMEBODY HELP ME!!'; } ?>
kevk3v Senior · 332 posts #12

I think it shows 106.79.83.85107.167.108.205 or 106.79.83.85 107.167.108.205 and not 106.79.83.85,107.167.108.205

Mobile chat, iphone chat, android chat, chat, rooms http://www.aiochat.com

thunderwap Developer · 169 posts #13

GumSlone wrote:

$arr = explode(',',$db_arr['ipadd']);

this code explodes comma separated ip,

$ip = $arr[0];

this one will show the first ip, even if there are no comma separated list

thanks for info.

explode means to convert string into array by using comma? is it rite?

and

implode means to convert array into string by using comma? is it rite?

WANT GOOD CHEAP HOSTING WITH 99% UPTIME? THEN PM ME FOR DETAILS!!

GumSlone Administrator Principal · 1,690 posts #14

thunderwap wrote: thanks for info.

explode means to convert string into array by using comma? is it rite?

and

implode means to convert array into string by using comma? is it rite?

yes correct, but it can be comma or any other symbol that you assign to the function

Advertise your mobile site for FREE with AdTwirl

External image (may be gone)

GumSlone Administrator Principal · 1,690 posts #15

kevk3v wrote: I think it shows 106.79.83.85107.167.108.205 or 106.79.83.85 107.167.108.205 and not 106.79.83.85,107.167.108.205

the ips from opera mini / ucweb and other proxy browser are usually listed by comma, anyway it seems that he has some different values in the database

Advertise your mobile site for FREE with AdTwirl

External image (may be gone)

something else Fellow · 2,296 posts #16

GumSloneway is a better way of doing it, however here is another way:

$uipadd = mysql_fetch_array(mysql_query("SELECT ipadd FROM siteusers WHERE id='".$who."'"));
$ip = preg_split("/[,]+/", $uipadd[0]);
echo "<center><b>Ip:</b> <a href="lists.php?action=byip&who=$who">$ip[0]</a></center>";

However i think the real problem here is the mysql array is being edited by thunderwap to:

$uipadd = mysql_fetch_array(mysql_query("SELECT ipadd FROM siteusers WHERE id='".$who."'"));
$arr = explode(',',$uipadd); //returns the first object of the mysql array which is the dual ip address
$ip = $arr[0];

  echo '<center><b>Ip:</b> <a href="lists.php?action=byip&who='.$who.'">'.$ip.'</a></center>';  

(Original post says: $web=explode(",",$uipadd); )

when it should be like this edited version:

$uipadd = mysql_fetch_array(mysql_query("SELECT ipadd FROM siteusers WHERE id='".$who."'"));
$arr = explode(',',$uipadd[0]); //The mysql array now has array index number :D (or could have stuck to gums original way with the array name)
$ip = $arr[0];

  echo '<center><b>Ip:</b> <a href="lists.php?action=byip&who='.$who.'">'.$ip.'</a></center>';  
thunderwap Developer · 169 posts #17

thank you so much something else and gumslone. it worked.

WANT GOOD CHEAP HOSTING WITH 99% UPTIME? THEN PM ME FOR DETAILS!!

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close