pg_ctl register -U <Windows user> -N postgresql -D <Data directory>
/* IE introduced HTTP-only cookies to prevent XSS attacks. Cookies
marked with httpOnly after the domain name are not accessible
from javascripts, but since curl does not operate at javascript
level, we include them anyway. In Firefox's cookie files, these
lines are preceded with #HttpOnly_ and then everything is
as usual, so we skip 10 characters of the line..
*/
if(strncmp(lineptr, "#HttpOnly_", 10) == 0) {
lineptr += 10;
co->httponly = TRUE;
}
def all_news(request):
news = News.objects.order_by('-date_added')
context = {''news': news}
return render(request, 'prosvet_logs/article.html', context)
<div class="article">
<h2>Новости</h2>
{% if news %}
{% for new in news %}
<p>{{ new.date_added|date:'M d, Y H:i' }}</p>
<p>{{ new.body|linebreaks }}</p>
{% endfor %}
{% else %}
<p>Новостей нет</p>
{% endif %}
</div>
news = News.objects.get(id=el_id)
context = {'news':news}
return render(request, 'prosvet_logs/article.html', context)
{% extends "prosvet_logs/base.html" %}
{% block content %}
<div class="article">
<h2>{{ news.title }}</h2>
<p>{{ news.date_added|date:'M d, Y H:i' }}</p>
<p>{{ news.body|linebreaks }}</p>
</div>
{% endblock content}
$phone = "+35818565";
$code = ltrim($phone, "+");
$country = null;
$max = 0;
foreach($allCountries as $c) {
if (strpos($code, $c[2]) === 0) {
if (array_key_exists(4, $c)) {
foreach($c[4] as $a) {
if (strpos($code, $c[2] . $a) === 0) {
if (strlen($c[2] . $a) > $max) {
$country = $c;
$max = strlen($c[2] . $a);
}
}
}
} else {
$country = $c;
$max = strlen($c[2]);
}
}
}
[ "Aland Islands", "ax", "358", 1, [ "185655" ] ]
не подходит под номер +3581856, правильно я понимаю?[ "Aland Islands", "ax", "358", 1, [ "185" ] ]
- подходит.я просто изменил 0 на false в strpos и почему-то он реагирует по другому, ну да ладно
$allCountries = [
[ "Western Sahara", "eh", "212", 1, [ "5288", "5289" ] ],
[ "Yemen", "ye", "967" ],
[ "Test", "te", "358", 1, [ "18" ]],
[ "Zambia", "zm", "260" ],
[ "Test", "te", "358", 1, [ "185", "188" ]],
[ "Zimbabwe", "zw", "263" ],
[ "Aland Islands", "ax", "358", 1, [ "18565" ] ]
];
$phone = "+3581856";
$code = ltrim($phone, "+");
$countries = [];
foreach($allCountries as $c) {
if (strpos($code, $c[2]) === 0) {
if (array_key_exists(4, $c)) {
foreach($c[4] as $a) {
if (strpos($code, $c[2] . $a) === 0) {
$countries[] = $c;
continue;
}
}
} else {
$countries[] = $c;
}
}
}
print_r($countries);
Array
(
[0] => Array
(
[0] => Test
[1] => te
[2] => 358
[3] => 1
[4] => Array
(
[0] => 18
)
)
[1] => Array
(
[0] => Test
[1] => te
[2] => 358
[3] => 1
[4] => Array
(
[0] => 185
[1] => 188
)
)
пусть колонки таблиц - id, a, b, c..., где id - автоинкремент
Дампим таблицу (tbl) базы А через mysqldump, меняем в файле дампа название (пусть на tbl1). Загружаем дамп в базу Б, далее