我有一个简单的用户注册表单,其中包含一个复选框,如果有任何项目的活动,用户可以获得每日电子邮件通知...就像Stack Overflow有一个"每天通知xxx@example.com任何新答案".
我目前在LAMP环境中实现这一点的想法如下:
在用户数据库中,如果用户希望收到每日电子邮件,请设置布尔值.
如果有任何项目活动,则使用当前时间戳更新项目.
每晚(午夜),执行一个PHP文件(可能通过cron作业),该文件扫描项目数据库以确定哪些项目当天有活动.对于具有活动的项目,将选择项目所有者名称并扫描用户表以检查用户是否希望收到每日电子邮件通知.如果是,请添加到收件人列表; 否则,忽略.
在开始实施之前,我有一些问题/关注点会受到一些指导:
我在共享托管环境中.我是否需要采取哪些预防措施才能被托管公司或接收邮件服务器误认为是垃圾邮件?
我是否需要"收集"收件人列表(一次50封电子邮件)并通过电子邮件发送每个组?这就像睡觉一样简单(30); 每次调用mail()之间?
我正在使用CodeIgniter框架,并且将让cron作业调用控制器中的相应函数以在午夜运行它.如何限制仅来自cron作业的呼叫,以防止某些未经授权的用户从浏览器调用此功能?
谢谢.
我正在考虑在亚马逊,yelp和其他在线网站上创建一个"查看此内容的用户"列表.现在我正在考虑使用'product_id','last_viewed_product_id','hits'创建一个新表,当用户从product_id = 100的页面转到product_id = 101时,它将使用product_id =创建/更新此表101,last_viewed_product_id = 100,并递增'命中'值.是否有更好的方法更优化,计算密集度更低?
以下代码从我的控制器运行,并在一台服务器上导致502错误坏网关.我无法在我的服务器上重现.502 Bad Gateway的原因是什么?
function index()
{
$this->_reload();
}
function _reload($data=array())
{
$person_info = $this->Employee->get_logged_in_employee_info();
$data['cart']=$this->sale_lib->get_cart();
$data['modes']=array('sale'=>$this->lang->line('sales_sale'),'return'=>$this->lang->line('sales_return'));
$data['mode']=$this->sale_lib->get_mode();
$data['items_in_cart'] = $this->sale_lib->get_items_in_cart();
$data['subtotal']=$this->sale_lib->get_subtotal();
$data['taxes']=$this->sale_lib->get_taxes();
$data['total']=$this->sale_lib->get_total();
$data['items_module_allowed'] = $this->Employee->has_permission('items', $person_info->person_id);
$data['comment'] = $this->sale_lib->get_comment();
$data['email_receipt'] = $this->sale_lib->get_email_receipt();
$data['payments_total']=$this->sale_lib->get_payments_total();
$data['amount_due']=$this->sale_lib->get_amount_due();
$data['payments']=$this->sale_lib->get_payments();
$data['payment_options']=array(
$this->lang->line('sales_cash') => $this->lang->line('sales_cash'),
$this->lang->line('sales_check') => $this->lang->line('sales_check'),
$this->lang->line('sales_giftcard') => $this->lang->line('sales_giftcard'),
$this->lang->line('sales_debit') => $this->lang->line('sales_debit'),
$this->lang->line('sales_credit') => $this->lang->line('sales_credit')
);
$customer_id=$this->sale_lib->get_customer();
if($customer_id!=-1)
{
$info=$this->Customer->get_info($customer_id);
$data['customer']=$info->first_name.' '.$info->last_name;
$data['customer_email']=$info->email;
}
$data['payments_cover_total'] = $this->_payments_cover_total();
$this->load->view("sales/register",$data);
}
Run Code Online (Sandbox Code Playgroud) 这是我的CodeIgniter模型中的Database_update_entry函数,它在成功提交表单后执行.
<?php
function update_entry(){
$data = array(
'sl' => $this->input->post('item_sl'),
'item_name' => $this->input->post('item_name'),
'img_url' => $this->input->post('img_url'),
'sound_url' => $this->input->post('sound_url'),
'price' => $this->input->post('price'),
'unit' => $this->input->post('unit'),
'timestamp' => time(),
);
echo "current time: ". time();
$this->db->update(MY_TABLE_NAME, $data);
}
?>
Run Code Online (Sandbox Code Playgroud)
数据库查询执行得很好....但是设置到mysql表中的时间是
00:00:00,而<?php echo time() ?>语句在浏览器中显示1307018223 ....这是一个有效的UNIX时间戳. ..你可以在这里检查时间戳的有效性.
这是在成功更新update_query之后从mySQL表中获取数据的表的屏幕截图http://s3.amazonaws.com/awesome_screenshot/658523?AWSAccessKeyId=0R7FMW7AXRVCYMAPTPR2&Expires=1307020816&Signature=AncPjnzG9p9QT7zebZp7c9teB0%3D
我究竟做错了什么???我怎样才能将法律时间戳从我的php传递给mySQL? [ps我已经检查过mysql表中的时间戳字段是时间戳字段]
我在MAMP上安装了Codeigniter和Ion Auth.我有库工作,但我不知道如何为Ion Auth构建所需的数据库表.这样做是否有首选/最佳实践方式?我应该从某个地方复制查询代码吗?运行setup-db脚本?就此而言,安装了Codeigniter,是否应该执行任何基本的数据库设置?我所做的就是设置ci_sessions表.
谢谢你的帮助.
我有兴趣将离子auth用于我的HMVC模式运行的项目.该应用程序是用Codeigniter编写的.
我面临的问题是,一旦离子auth被放置在/ app/modules/auth文件夹中,当我尝试访问模块时,我得到以下错误:
HTTP错误500(内部服务器错误):
服务器尝试完成请求时遇到意外情况.
请帮帮我,我确信我遇到了某种配置/路径问题但是无法弄清楚在哪里.
我只是从github下载了ion_auth文件并将提取的文件放在模块文件夹中我删除了所有加载库的行,例如数据库,session,因为我已经使用了配置来自动加载它们.但是我离开了ion_auth库的加载.
在模块文件夹modules/auth中,我有一个类似的应用程序结构,具有模块特定的配置,库等文件夹.
让我知道我一定做错了什么,我将继续搜索并解决这个问题并发布如果我有运气的话.
我正在使用CodeIgniter编写图像上传表单.我之前有类似的代码可以在不同的网站上工作.目前 - 接收多部分/表单数据映像的代码无声地失败.在配置服务器/脚本时,我收到了错误,例如错误的文件路径,不同的mime-types,但现在我什么都没得到.
下面的代码返回:"ABC"并在"D"之前失败而没有错误.
如果我将'photo_filedata'更改为'photo_filedata2',我会收到更有用的错误:"ABCD您没有选择要上传的文件."
我完全没有调试这个,因为我从服务器上没有任何错误.
有谁知道可能会发生什么?
服务器:WAMP,在Windows 7上运行.有一个现有项目可以正常上传文件.
function upload_photo()
{
echo "A";
$config['upload_path'] = './images/uploads/';
$config['allowed_types'] = 'gif|jpg|png';
$config['file_name'] = 'photo_' . substr(md5(time()), 0, 16);
$config['max_size'] = 2000;
$config['max_width'] = 0;
$config['max_height'] = 0;
echo "B";
$this->load->library('upload', $config);
echo "C";
$result = $this->upload->do_upload('photo_filedata');
echo "D";
if (!$result)
{
$error = $this->upload->display_errors();
$data = false;
}
else
{
$error = false;
$data = $this->upload->data();
}
$this->load->view('home-photo-upload', array('error' => $error, 'data' => $data));
}
Run Code Online (Sandbox Code Playgroud) 我想知道如何在codeigniter中向file_upload添加属性
现在我正在使用 form_open_multipart('controller');
但我想为它添加一个id属性.
任何帮助表示感谢!
我是PyroCMS的新手并且努力在论坛上获得帮助(响应缓慢,活动最少等).所以,我希望有人在这里可以提供帮助.
如何在模块之间共享资源(例如模型,控制器,视图等)?似乎每个模块都是自包含的,无法访问其他模块的资源.这将给我们带来麻烦.
我不喜欢将这些公共资源放在主要的PyroCMS安装中.这对我来说在建筑上似乎是错误的.
我希望在基于CodeIgniter的应用程序中为用户的配置文件信息提供一个干净的URL.
请查看下面的URL格式.
Actual URL : http://www.mydomain.com/index.php/users/profile/user1
Run Code Online (Sandbox Code Playgroud)
我期待用户拥有个人网址
http://www.mydomain.com/user1
http://www.mydomain.com/user2
http://www.mydomain.com/user3
Run Code Online (Sandbox Code Playgroud)
URL http://www.mydomain.com/user1应在后台执行时处理http://www.mydomain.com/index.php/users/profile/user1.
我将使用Route库从URL中删除index.php.
提前感谢您提供任何帮助.