dongzhong1891 2012-02-22 11:31
浏览 14
已采纳

系统函数调用,有什么建议吗?

I have a build a website where users need to login to, and the authentication is based on SESSION variables and DB.

To simplify, let me describe it like this: I have simple users who belong to groups, and I have group managers. All of them own a subscription. When a group manager decides to upgrade a service, it is done for all his users immediately. I would need to update all subscriptions and I would need to go and charge for each subscription individually.

So. What I need to do is go to the DB, and start going one by one:

1. charge
2. receive status from cc company.
3. update the DB entry accordingly.
4. repeat for next simple user

The thing is, that when a group manager is updating the service, I would need to fire a batch process, which might take a while to complete, but if the group manager closes the browser for some reason (presses the stop button, power goes out, zillion other reasons the connection goes out), the action wouldn't complete. And users will be left untreated.

I thought the way to go about this would be to start a shell command with a PHP script. I would send the parameters to the script like system("php batch.php?ID=$group_id?process=all") which in turn would probably get the job done.

My issue is, that I am used to authenticating my users and the data throughout the website, as said, by SESSION parameters etc. But in this case (calling a system command), I cannot really go and check who actually fired that script. It could be a user, it could be the script I intended.

I would like to prevent users accessing that script, and I want that script to be completed after it has been issued.

How can I accomplish that ? Any other suggestions ?

Thanks!

  • 写回答

1条回答 默认 最新

  • dsdsds12222 2012-02-22 11:34
    关注
    1. Pass the values as argv parameters (php batch.php $group_id all)
    2. Check whether these exist in $_SERVER['argv']

    For the record, $_SERVER['argv'] is the $_GET for the command line. Webpages can't set argv values, so you're safe.

    Better of course would be to simply not put this file in your web directory.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 vscode的问题提问
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM