Answer the question
In order to leave comments, you need to log in
How to remove the ":" sign and what's after it?
How to remove the ":" sign and what's after it?
I can not. I commented out what I was trying to use.
<?php
//Get the IP
if(getenv('HTTP_X_FORWARDED_FOR'))
{$ip = getenv('HTTP_X_FORWARDED_FOR');}
elseif(getenv('HTTP_CF_CONNECTING_IP'))
{$ip = getenv('HTTP_CF_CONNECTING_IP');}
/ /Connect to the database
$host = "localhost";
$user = "user";
$pass = "pass";
$db = "db";
$connect = @mysql_connect("$host", "$user","$pass");
@mysql_select_db("$db", $connect);
//Compare with ips in the database
$query = "
//$query = substr($query, strrpos($query, ':'));
//$$ip2 = end(explode($query, ':'));
//echo array_pop(explode($ip, ':'));
$result = @mysql_query($query);
if(@mysql_num_rows($result) > 0 ) {
exit ("You are banned!");
}else{
exit("You are not banned!");
}
?>
Answer the question
In order to leave comments, you need to log in
$var = substr($var, 0, strpos($var, ':'));
Naturally, this option works well if the colon is always there. If it is not there, you need to either do checks or use the same explode().
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question