我正在为游戏开发一个所谓的AAC(自动帐户创建器),它基本上是一个具有为玩家创建帐户,玩家和更多东西的功能的网站.服务器只支持SHA1和plain - 这是完全不安全的.我无法深入了解源代码并进行更改.如果无论如何都要使用SHA1,我将不胜感激.我刚看过BCrypt,它很棒,但我无法真正改变源代码以适应BCrypt.我设法将SHA1放在注册上,如下所示:
$password = $input['password'];
$password = sha1($password);
Run Code Online (Sandbox Code Playgroud)
但我根本无法登录.我做错了吗?好像Laravel不会让我登录.
我有get_register和post_register,还有我有get_login和post_login.我是否需要在post_login中更改某些内容以使其登录或?任何提示?
我在WAMP上使用Laravel的php服务器(php artisan serve)和phpMyAdmin.我认为Laravel通过Auth::attempt方法laravel 检查数据库是否正在进行某种形式的哈希来检查当前的pw和登录的一个以检查对方.
我想知道如何执行这样的事情:
Table::update(array('position'=>'position+1'));
Run Code Online (Sandbox Code Playgroud)
据我所知,laravel 4将'position + 1'作为一个字符串处理,因此变为0.
我想表现得像
UPDATE table SET position = position + 1
Run Code Online (Sandbox Code Playgroud)
我能用口才吗?
编辑:没关系,doh .."DB :: table('users') - > increment('votes');"
在laravel中,当一个新用户注册到我的网站时,他们使用的电子邮件已存在于数据库中.怎么能告诉用户电子邮件已经存在?我是laravel框架的新手.示例代码也不错.
我刚开始使用Carbon扩展(到目前为止似乎非常甜),但我对这个Carbon::now()功能感到困惑.根据文档,似乎这个函数应该反映用户当前时区的当前时间,但是,我似乎比GMT提前一小时.
也就是说Carbon::now(),2015-01-01 17:26:46当我在太平洋标准时间,它实际上是当前2015-01-01 08:26:46.
我是否必须为所有实例检测并输入用户本地时区?
是什么赋予了?(我很可能对网站如何获得用户当地时间有一个根本的误解)
所以,我的模型中有以下规则:
public static $rules = array(
'name' => 'required|alpha_dash|unique:subsidiaries',
'internal_number' => 'required|alpha_dash|unique:subsidiaries',
'expedition_rate' => array('required', 'regex:/^[0-9]{1,3}(\.?)[0-9]{1,2}$/'),
'hundred_kg_rate' => array('regex:/^[0-9]{1,5}(\.?)[0-9]{1,2}$/'),
'handling' => array('regex:/^[0-9]{1,3}(\.?)[0-9]{1,2}$/'),
'insurance' => 'required|numeric',
);
Run Code Online (Sandbox Code Playgroud)
但是,出于某种原因,当正则表达式应用于patternhtml 中的属性标记时...它会中断!
结果:
<input required="true" pattern="^[0-9]{" class="form-control" ....>
_________
\
=> This right here should be
^[0-9]{1,3}(\.?)[0-9]{1,2}$
Run Code Online (Sandbox Code Playgroud) 我正在尝试获取一个Windows::Devices::Usb::UsbDevice引用我所拥有的特定USB设备的对象,以便将其传递给第三方插件.由于项目限制,我无法使用C++/CX扩展名.
在查看了无数的线程,答案和引用之后,我想出了一个初始实现,它可以在我需要的WinRT类上调用静态方法.唯一的问题是,即使没有调用导致失败HRESULT,最后一次调用FromIdAsync也不起作用,给我me ERROR_INVALID_HANDLE(6)作为结果GetLastError().
简单地读取错误名称会让我误认为是获取设备的ID,因为这是我传递该调用的唯一句柄,但我尝试传递一个常量字符串(我知道这是正确的)并且它产生了相同的结果.
这就是我调用FromIdAsync*的方式:
// Retrieves static methods for UsbDevice class
ComPtr<IUsbDeviceStatics> usbDevSt;
hr = GetActivationFactory(
HStringReference(RuntimeClass_Windows_Devices_Usb_UsbDevice).Get(),
&usbDevSt
);
// Creates an event to work as a 'semaphore', for waiting for the 'FromIdAsync'
// call to be completed
Event openEvent(CreateEventEx(
nullptr,
nullptr,
CREATE_EVENT_MANUAL_RESET,
WRITE_OWNER | EVENT_ALL_ACCESS
));
if (!openEvent.IsValid()) return nullptr;
// Setups a callback for when the device enumeration is done
auto asyncOpenCb …Run Code Online (Sandbox Code Playgroud) 我最近切换到Laravel的基于环境的应用程序部署,我决定使用$ _ENV在.env文件中存储我的本地和生产服务器的凭据但是我发现调试打开时会发生异常并引发错误显示公开数据库凭据的环境变量.
现在我确定调试将始终关闭生产,因为这是我默认的,然后我在我的本地环境的本地文件夹中覆盖它,但是,如果不知何故某些调试在生产时打开并且用户强制404例外,他们需要做的就是读取页面,直到他们在普通视图中看到环境变量暴露凭证.在文档中,它表示对任何"真实"应用程序来说,保持数据库凭据远离实际配置是最佳做法.我在这里可能有点偏执.
有没有办法可以限制laravel显示的调试屏幕中显示的内容?
出于某种原因,当我尝试从数据库中获取数据时,NHibernate告诉我它无法转换NHibernate.Collection.Generic.PersistentGenericSet[Ingredient]为System.Collection.Generic.IList[Ingredient].这是我的类映射/实现的简化版本:
public class Product {
protected Product() { };
public virtual Name { get; set; }
public virtual IList<Ingredient> {
get { return new List<Ingredient>(ingredients).AsReadOnly(); }
protected set { ingredients = value; }
}
private IList<Ingredient> ingredients = new List<Ingredient>();
}
Run Code Online (Sandbox Code Playgroud)
-
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="LanchesAdmin.Core.Domain.Product, LanchesAdmin.Core" table="product" >
<id name="ID" generator="identity">
<column name="id" not-null="true" />
</id>
<property name="Name" column="name" length="64" not-null="true" />
<set name="Ingredients" table="ingredient" fetch="join" lazy="true" inverse="true">
<key column="product_id" /> …Run Code Online (Sandbox Code Playgroud) 我收到这个错误:
call_user_func_array() expects parameter 1 to be a valid callback, class 'Symfony\Component\HttpFoundation\LaravelRequest' does not have a method 'url'
Run Code Online (Sandbox Code Playgroud)
我正在使用的代码是:
routes.php文件:
<?php
Route::post('', 'app@check');
Route::get('', 'app@check');
Route::post('game', 'app@game');
Route::get('game', 'app@game');
Route::get('terminos', 'app@terminos');
Route::post('save', 'scores@savescore');
Route::get('scores', 'scores@scorelist');
Route::get('scores2468', 'scores@showscores');
Event::listen('404', function()
{
//return Response::error('404');
echo "Error 404: \n";
echo Request::url();
});
Event::listen('500', function()
{
return Response::error('500');
});
Route::filter('before', function()
{
// Do stuff before every request to your application...
});
Route::filter('after', function($response)
{
// Do stuff after every request to your application... …Run Code Online (Sandbox Code Playgroud) class Profile extends Eloquent {
protected $fillable = array('name', 'last_name', 'website', 'facebook', 'twitter', 'linkedin', 'google_plus');
public static function boot(){
parent::boot();
self::updating(function($model){
$model->name = Crypt::encrypt($model->name);
$model->last_name = Crypt::encrypt($model->last_name);
$model->facebook = Crypt::encrypt($model->facebook);
$model->twitter = Crypt::encrypt($model->twitter);
$model->linkedin = Crypt::encrypt($model->linkedin);
$model->website = Crypt::encrypt($model->website);
$model->google_plus = Crypt::encrypt($model->google_plus);
});
}
}
Run Code Online (Sandbox Code Playgroud)
我也在使用调用事件..
$user->profile()->update(array(
'name' => e($input['name']),
'last_name' => e($input['last_name']),
'website' => e($input['website']),
'facebook' => e($input['facebook']),
'twitter' => e($input['twitter']),
'linkedin' => e($input['linkedin']),
'google_plus' => e($input['google_plus'])
));
Run Code Online (Sandbox Code Playgroud)
由于某种原因,它没有触发任何事件...我试图在将用户信息保存到数据库之前对其进行加密
php ×8
laravel ×7
eloquent ×2
laravel-4 ×2
c# ×1
c++ ×1
datetime ×1
html ×1
laravel-3 ×1
mysql ×1
nhibernate ×1
php-carbon ×1
regex ×1
security ×1
validation ×1
visual-c++ ×1
wrl ×1