0
function geting_Ip() {
    $ip = $_SERVER['REMOTE_ADDR'];

    if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
        $ip = $_SERVER['HTTP_CLIENT_IP'];
    } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
        $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
    }

    return $ip;
}
Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141
David
  • 23
  • 5
  • where are you using this as and how is it included/required? the error's pretty obvious – Funk Forty Niner Sep 28 '16 at 17:11
  • yes i am calling this in a function function cart_page() { global $connect; if (isset($_GET['add_cart'])) { $ip_addrs=geting_Ip(); $product_id= $_GET['add_cart']; $qry="SELECT * FROM cart WHERE p_id='$product_id' AND ip_address='$ip_addrs'"; – David Sep 28 '16 at 17:11

0 Answers0