3 апреля 2012 1 комментарий

Получить домен из URL:

parse_url($url,PHP_URL_HOST)
Categories: PHP Tags:
15 марта 2012 Нет комментариев

Configuration:

root@irina-HP-620:/etc/ppp/peers# cat intelcom
noipdefault
defaultroute
replacedefaultroute
hide-password
noauth
persist
plugin rp-pppoe.so rp_pppoe_service Intelcom6 eth0
user "user"
usepeerdns

Passwords:

root@irina-HP-620:/etc/ppp/peers# cat /etc/ppp/chap-secrets 
"user" * "password"

Up:

root@irina-HP-620:/etc/ppp/peers# pon intelcom

Down:

root@irina-HP-620:/etc/ppp/peers# poff intelcom
Categories: Linux Tags: ,

Для удаления ^M (DOS перевод строки):

tr -d \\r < dosfile > newfile
Categories: Unix Tags:
29 февраля 2012 Нет комментариев

/administrator/components/com_users/controller.php
В
class UsersController extends JController
в конце выполнения
function save()

Categories: CMS Tags:
29 февраля 2012 Нет комментариев

На примере SELECT. Если одно поле:

$getdb=&JFactory::getDBO();
$q="SELECT mfo FROM jos_users WHERE mfo!='0'";
$getdb->setQuery($q);
$arr=$getdb->loadResultArray();

Если много:

$q="SELECT username, mfo FROM jos_users WHERE mfo!='0'";
$arr=$getdb->loadObjectList();
foreach ($arr as $a) {
	$mfo=$a->mfo; $username=$a->username;
}
Categories: CMS Tags: ,
29 февраля 2012 Нет комментариев
$j_user=&JFactory::getUser();
$user_mfo=$j_user->mfo;
Categories: CMS Tags: ,
29 февраля 2012 3 комментария

Для себя. Без подробностей.

if ($_GET['format']!='raw') {
	header("Location: /?option=com_cn&format=raw&$query=$file_hash");
}
else {
	$content_type="application/octet-stream";
	$mime=&JFactory::getDocument();
	$mime->setMimeEncoding($content_type);
	header("Content-Type: $content_type");
	header("Accept-Ranges: bytes");
	header("Content-Length: ".filesize($file_path));
	header("Content-Disposition: attachment; filename=".$file_name);
	readfile($file_path);
}
Categories: CMS Tags: ,