dongxiaowei_1234 2012-04-04 09:13 采纳率: 0%
浏览 55

检查哪个用户点击了哪个链接

I have few links on my website, how can I record into database which user clicked on which link. I have records of the links into database and users. I have created a table in which there will be userid, linkid. But im not sure how to code this php. Any ideas?

EDIT:

<a hef="page.php?id=27">pagename</a>

the link above goes to a page where the link is counted and it looks for the url into the database and redirects to that page. But i want to see which user clicked it.

  • 写回答

2条回答 默认 最新

  • dqask02082 2012-04-04 09:14
    关注

    Most easiest way would be to pass a link-identifier as the URI parameter

    An example:

    <a href="page.php?id=27&clicked=pagename">pagename</a>
    

    Now you can get what the user clicked by checking $_GET['clicked']


    It seems I misunderstood the question

    You can do this on your page.php

    $id = $_GET['id']; //Get the page id
    $userid = $_SESSION['id']; // Get the user id if stored in session
    
    //Do something with the user id
    
    header("location: ..."); //redirect to a different place
    exit;
    
    评论

报告相同问题?

悬赏问题

  • ¥170 如图所示配置eNSP
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改
  • ¥20 wireshark抓不到vlan
  • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
  • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持
  • ¥15 stata安慰剂检验作图但是真实值不出现在图上
  • ¥15 c程序不知道为什么得不到结果
  • ¥15 键盘指令混乱情况下的启动盘系统重装