$headers=[
'Host: '.$url_host,
'Connection: keep-alive',
'Pragma: no-cache',
'Cache-Control: no-cache',
'sec-ch-ua: "Not.A/Brand";v="8", "Chromium";v="114", "Google Chrome";v="114"',
'X-CSRF-Token:'.$token,
'sec-ch-ua-mobile: ?0',
'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36',
'Content-Type: application/x-www-form-urlencoded; charset=UTF-8',
'Accept: */*;q=0.5, text/javascript, application/javascript, application/ecmascript, application/x-ecmascript',
'X-Requested-With: XMLHttpRequest',
'sec-ch-ua-platform: "Windows"',
'Sec-Fetch-Site: same-origin',
'Sec-Fetch-Mode: cors',
'Sec-Fetch-Dest: empty',
'Referer:'.$url_ref,
'Accept-Language: en-RU,en;q=0.9,ru-RU;q=0.8,ru;q=0.7,en-US;q=0.6',
'Accept-Encoding: gzip, deflate',
];
HTTP/1.1 200 OK
Server: nginx
Date: Sun, 23 Jul 2023 08:29:58 GMT
Content-Type: text/javascript; charset=utf-8
Connection: keep-alive
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
X-Download-Options: noopen
X-Permitted-Cross-Domain-Policies: none
Referrer-Policy: strict-origin-when-cross-origin
X-Yatri-Language: en
X-Yatri-Country: ca
ETag: W/"ac55941fb4c4e86f3c09801981b42932"
Cache-Control: max-age=0, private, must-revalidate
X-Request-Id: ec34a81f-7440-4455-b6d5-7f55197d0856
X-Runtime: 0.103534
Transfer-Encoding: chunked
curl options:
$options=
[
CURLOPT_RETURNTRANSFER =>true,
CURLOPT_FOLLOWLOCATION =>true,
CURLOPT_SSL_VERIFYPEER =>false,
CURLOPT_COOKIESESSION=> true,
CURLOPT_COOKIEFILE =>'cookie.txt',
CURLOPT_COOKIEJAR =>'cookie.txt',
CURLINFO_HEADER_OUT =>true
];
class User extends \yii\base\BaseObject implements \yii\web\IdentityInterface
{
public $id;
public $username;
public $password;
public $authKey;
public $accessToken;
private static $users = [
'100' => [
'id' => '100',
'username' => 'admin',
'password' => 'admin',
'authKey' => 'test100key',
'accessToken' => '100-token',
],
'101' => [
'id' => '101',
'username' => 'demo',
'password' => 'demo',
'authKey' => 'test101key',
'accessToken' => '101-token',
],
];
class RegistrationForm extends Model
{
public $username;
public $email;
public $password;
/**
* {@inheritdoc}
*/
public function rules()
{
return [
['username', 'trim'],
['username', 'required'],
['username', 'unique', 'targetClass' => 'app\models\UserBasic', 'message' => 'Данный логин уже используется! Придумайте новый!'],
['username', 'string', 'min' => 2, 'max' => 255],
['email', 'trim'],
['email', 'required'],
['email', 'email'],
['email', 'string', 'max' => 255],
['email', 'unique', 'targetClass' => 'app\models\UserBasic', 'message' => 'Данный e-mail, уже используется! Придумайте новый!'],
['password', 'required'],
['password', 'string', 'min' => Yii::$app->params['user.passwordMinLength']],
];
}
/**
* Signs user up.
*
* @return bool whether the creating new account was successful and email was sent
*/
public function signup()
{
if (!$this->validate()) {
return null;
}
$date = new DateTimeImmutable(date('Y-m-d H:i:s')); // устанавливаем необходимую дату
$user = new \app\models\UserBasic();
$user->username = $this->username;
$user->email = $this->email;
$user->password_hash=Yii::$app->security->generatePasswordHash($this->password);
$user->auth_key= Yii::$app->security->generateRandomString();
$user->password_reset_token = Yii::$app->security->generateRandomString() . '_' . time();
$user->created_at= $date->getTimestamp();
$user->updated_at= $date->getTimestamp();
return $user->save();
}
}
<div class="container-fluid">
<?= Breadcrumbs::widget([
'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
]) ?>
<?= Alert::widget() ?>
<?= $content ?>
</div>
Я что то начал замечать, что сервер на который я логинюсь, через curl, супер стал зависать.