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 phython如何实现以下功能?查找同一用户名的消费金额合并—
  • ¥15 ARIMA模型时间序列预测用pathon解决
  • ¥15 孟德尔随机化怎样画共定位分析图
  • ¥18 模拟电路问题解答有偿速度
  • ¥15 CST仿真别人的模型结果仿真结果S参数完全不对
  • ¥15 误删注册表文件致win10无法开启
  • ¥15 请问在阿里云服务器中怎么利用数据库制作网站
  • ¥60 ESP32怎么烧录自启动程序,怎么查看客户esp32板子上程序及烧录地址
  • ¥50 html2canvas超出滚动条不显示
  • ¥15 java业务性能问题求解(sql,业务设计相关)