add bookmark
This commit is contained in:
@@ -133,6 +133,31 @@ function text_kuri(){
|
||||
|
||||
|
||||
|
||||
//закладки - пока только куки
|
||||
function bookmark_get($hash){
|
||||
|
||||
$bookcook = 'book_'.$hash;
|
||||
|
||||
if (isset($_COOKIE[$bookcook]))
|
||||
return $_COOKIE[$bookcook];
|
||||
else
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function bookmark_set($hash, $page){
|
||||
|
||||
$bookcook = 'book_'.$hash;
|
||||
$_COOKIE[$bookcook] = $page;
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function promo_kuri($hash, $page = 1, $promo = true){
|
||||
|
||||
# test url http://klan.dv/promo/bac343b41b357fdc8243373a429caa62 (742.pdf source)
|
||||
@@ -145,6 +170,21 @@ function promo_kuri($hash, $page = 1, $promo = true){
|
||||
return False;
|
||||
}
|
||||
|
||||
if ($page == 1){
|
||||
$bookmark = bookmark_get($hash);
|
||||
if ($bookmark !== false and $bookmark > 1){
|
||||
header("HTTP/1.1 301 Moved Permanently");
|
||||
header('Location: '.SITE.'read/'.$hash.'/'.$page.'/'.$promo);
|
||||
exit();
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
bookmark_set($hash, $page);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$file = PDFSOURCE."${price['price_id']}.pdf";
|
||||
$data = pdfs_init($file, $page);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user