Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

122
Vistas
execute iplog.php on click of links

i am logging visitors IP by the following code below

$iplogfile = 'ips.txt';
    $ipaddress = $_SERVER['REMOTE_ADDR'];
        $webpage = $_SERVER['SCRIPT_NAME'];
            $timestamp = date('d/m/Y h:i:s');
            $browser = $_SERVER['HTTP_USER_AGENT'];
        $fp = fopen($iplogfile, 'a+');
        chmod($iplogfile, 0777);
    fwrite($fp, '['.$timestamp.']: '.$ipaddress.' '.$webpage.' '.$browser. "\r\n");
fclose($fp);

but i want it to be execute only when user clicks on this particular links

<a href="tel:+1 (000) 000-0000" class="btn-blue btn-red">Book Now</a>
<a href="tel:+1 (111) 111-1111" class="btn-blue btn-red">Call Now</a>

can someone help me out here? i cannot figure out how to acheive it :(

Thanks alot for your help and input.

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

In order to execute this on clicking particular links then you should follow one of the following ideas as example:

1- Query strings, You can add a URL query parameter so you can check if it exists or not using $_GET, If it exists you can call your code.

2- You can create a new PHP file, Let's name it (track.php), And let's use AJAX to send requests to track.php on clicking the links you define using a class as example.

3- You can check what is the current path and URL and to set conditions using STRPOS to define whether the URL has the page you need to run the function for or not.

about 4 years ago · Juan Pablo Isaza Denunciar

0

You can call a function using onclick attribute in the HTML anghor tag. onclick="myFunction()"

<a onclick="myFunction()" href="tel:+1 (000) 000-0000" class="btn-blue btn-red">Book Now</a>
<a onclick="myFunction()" href="tel:+1 (111) 111-1111" class="btn-blue btn-red">Call Now</a>

<script type='text/javascript'>

function myFunction()
{
    // add your code here
}

</script>
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda