Author Topic: How can I do this?  (Read 4564 times)

0 Members and 1 Guest are viewing this topic.

Offline Brad

  • Pre-Newbie
  • Posts: 8
    • View Profile
    • http://skins.cpanelgui.com
How can I do this?
« on: June 13, 2002, 08:25:16 AM »
I want to display something only to users that are logged in.

Is this possible?

Also, I have custom inline script that installs a skin when they click on my install button.  How can I increment the download count when they click on my button?

Thank you
Brad L - whtech@lahostnet.com
LAHostNet Web Host Solutions: http://www.lahostnet.com
cPanelGUI - Multiple Skin Windows client for cPanel http://skins.cpanelgui.com

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Re: How can I do this?
« Reply #1 on: June 13, 2002, 09:56:55 AM »
Quote from: Brad
I want to display something only to users that are logged in.


Open "includes/page_header.php". You will find this code two times:
Code: [Select]
$site_template->register_vars("user_box", $user_box);

Replace the first line with
Code: [Select]
$site_template->register_vars(array(
  "user_box" => $user_box,
  "user_loggedin" => 1,
  "user_loggedout" => 0
));


Replace the second line with
Code: [Select]
$site_template->register_vars(array(
  "user_box" => $user_box,
  "user_loggedin" => 0,
  "user_loggedout" => 1
));


After that you can use in your templates something like this:
Code: [Select]
{if user_loggedin}You are logged in{endif user_loggedin}
{if user_loggedout}You are logged out{endif user_loggedout}




Quote from: Brad
Also, I have custom inline script that installs a skin when they click on my install button.  How can I increment the download count when they click on my button?


This is not possible. PHP is a serverside script language. Your install button uses VB which is a clientside script language. So PHP dont't know anything you only doing your browser.

Greets Jan
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline Brad

  • Pre-Newbie
  • Posts: 8
    • View Profile
    • http://skins.cpanelgui.com
How can I do this?
« Reply #2 on: June 13, 2002, 04:59:34 PM »
Ok,

Not possible the way it works ..  Maybe I call Php from VB script after download?

Could I make a php like this and work, I don't do php good, will this work ..


Code: [Select]

<?php
$main_template 
0;
define&#40;'GET_CACHES', 1&#41;;
define&#40;'ROOT_PATH', './'&#41;;
include&#40;ROOT_PATH.'global.php'&#41;;
require&#40;ROOT_PATH.'includes/sessions.php'&#41;;
$user_access get_permission&#40;&#41;;
  
$sql "UPDATE ".IMAGES_TABLE.
          SET image_downloads = image_downloads + 1 
          WHERE image_id = 
$image_id";
  
$site_db->query&#40;$sql&#41;;
exit;
?>


Maybe doing away with vb and using a window.external call from php, passing fname (skin Name) as parameter?
Code: [Select]

window.external.setfilename = fname
Brad L - whtech@lahostnet.com
LAHostNet Web Host Solutions: http://www.lahostnet.com
cPanelGUI - Multiple Skin Windows client for cPanel http://skins.cpanelgui.com

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
How can I do this?
« Reply #3 on: June 13, 2002, 08:22:15 PM »
The code should work. But note that the script want know the $image_id as POST or GET request.

Greets Jan
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search