Author Topic: Easier Integration  (Read 12376 times)

0 Members and 1 Guest are viewing this topic.

Offline kholmes

  • Pre-Newbie
  • Posts: 5
    • View Profile
Easier Integration
« on: May 07, 2002, 04:03:29 AM »
Is there a way to easier integrate 4images with my site.. Instead of the user having to register to have access to certain things then register again to have access to 4 images. I like displaying "Welcome John you are now logged in"  I tried to figure out howto use 4images auth info, but it doesn't seem to work. Is there a simple way to integrate this into my site so the user doesn't have to register 2 different times.


Thanks

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Easier Integration
« Reply #1 on: May 07, 2002, 08:02:11 AM »
Hi,

try this code:

Code: [Select]
<?php
define
&#40;'ROOT_PATH', './'&#41;;
include&#40;ROOT_PATH.'global.php'&#41;;
?>

Define the root path as relativ path to the directory 4images is installed.

If the user is loggedin there is an array $user_info with the user informations. The array contains the data like this:

$user_info['user_id'] = 1;
$user_info['user_level'] = 9;
$user_info['user_name'] = "jan";
etc.

If the user is not loggedin the array contains only this two elements:

$user_info['user_id'] = -1;
$user_info['user_level'] = -1;

You can use it like this:

Code: [Select]
<?php
if ($user_info['user_id'] != GUEST) {
  echo 
"Welcome ".$user_info['user_name']." you are now logged in.<br />";
  echo 
"You last visited on ".date("d.m.Y H:i"$user_info['user_lastvisit']);
}
else {
  echo 
"Welcome Guest, please register!";
}


The constant GUEST is is defined in "includes/constants.php".

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

Offline kholmes

  • Pre-Newbie
  • Posts: 5
    • View Profile
Hi Jan.. I tried that, but I get an error
« Reply #2 on: May 09, 2002, 03:02:56 PM »
I tried what you suggested, but I am getting an error

Warning: Cannot add header information - headers already sent by (output started at /var/lib/apache/htdocs/atvnb/index2.php:3) in /var/lib/apache/htdocs/atvnb/members/photos/4images/includes/sessions.php on line 129

Warning: Cannot add header information - headers already sent by (output started at /var/lib/apache/htdocs/atvnb/index2.php:3) in /var/lib/apache/htdocs/atvnb/members/photos/4images/includes/sessions.php on line 130

This is what my code looks like

<?php
define('ROOT_PATH', './members/photos/4images/');
include(ROOT_PATH.'global.php');
?>
I also tried to define the ROOT_PATH like this
<?php
define('ROOT_PATH', '/var/lib/apache/htdocs/atvnb/members/photos/4images'); include(ROOT_PATH.'global.php');
?>
Does this have to be anywhere specific? or can it just be put anywhere in my HTML code?

Then I just copied an pasted the code that you suggested into the table where I wanted the info to be shown, but I get that error stated above..

Any help would be greatly appreciated

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Easier Integration
« Reply #3 on: May 09, 2002, 05:53:54 PM »
Code: [Select]
<?php 
define
&#40;'ROOT_PATH', './members/photos/4images/'&#41;; 
include&#40;ROOT_PATH.'global.php'&#41;; 
?>


Paste this code at the top of your php-file. Before any html output, maybe above the <head> tag.

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

Offline kholmes

  • Pre-Newbie
  • Posts: 5
    • View Profile
Thanks Jan
« Reply #4 on: May 09, 2002, 07:41:58 PM »
Thanks Jan that worked great

 :D

Offline kholmes

  • Pre-Newbie
  • Posts: 5
    • View Profile
Just another quick question?
« Reply #5 on: May 09, 2002, 08:16:50 PM »
I want to provide a login form and a register form.. I noticed that in the templates directory there are user_loginform.html and  a register_form.html  I know I can't link to these directly because there is no php code, but is there a way to make it so they can register and login without having to click the 4images section of my site, so they can go into my site login or register and then have access to 4images without being asked to login again.


Thanks again

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Easier Integration
« Reply #6 on: May 09, 2002, 09:31:19 PM »
Login is no problem. Just copy the sourcecode to the file you want. Registering must go over the gallery.

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

Offline Sammy2002

  • Newbie
  • *
  • Posts: 18
    • View Profile
    • http://www.webleben.com
Easier Integration
« Reply #7 on: May 09, 2002, 10:22:20 PM »
Meinst du, dass wenn ich phpBB und Gallery hab, ich kann die beide mit einen einzigen Login verbinden? wenn ja wie ganau bitte...:)

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Easier Integration
« Reply #8 on: May 10, 2002, 08:17:32 AM »
Nein, es geht nur um das Login-Formular. Dieses möchte er auf einer ander Seite haben.

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

Offline kholmes

  • Pre-Newbie
  • Posts: 5
    • View Profile
Tried what you said
« Reply #9 on: May 10, 2002, 02:33:44 PM »
Hi Jan,

I tried what you said to copy the info from /templated/default/user_loginform.html

and it just shows up on my page like this
{lang_user_name}
 
{lang_password}
 
  {lang_auto_login}

 
» {lang_lost_password}
» {lang_register}


I just copied and pasted this into my page..

<table width="100%" border="0" cellpadding="4" cellspacing="0">
  <tr>
    <td valign="top" align="left">
      <form action="{url_login}" method="post">
        {lang_user_name}<br />
        <input type="text" size="10" name="user_name" class="logininput" />
        <br />
        {lang_password}<br />
        <input type="password" size="10" name="user_password" class="logininput" />
        <br />
        <table border="0" cellspacing="0" cellpadding="0">
          <tr valign="top">
            <td>
              <input type="checkbox" name="auto_login" value="1" />
            </td>
            <td><span class="smalltext">{lang_auto_login}</span></td>
          </tr>
        </table>
        <br />
      <input type="submit" value="{lang_login}" class="button" />
      </form>
      &raquo; <a href="{url_lost_password}">{lang_lost_password}</a><br />
     &raquo; <a href="{url_register}">{lang_register}</a></td>
  </tr>
</table>


I know that it won't work,  just sitting inside the .php file.. IT just shows up as {url_login}, but how do I get this into my main page.

Thanks again for all the help

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Easier Integration
« Reply #10 on: May 10, 2002, 03:02:29 PM »
No, not the code from the templates. Point your browser to the url of your gallery. Then look at the sourcecode an copy the required part to the file you want. It should look like this:

Code: [Select]
<form action="login.php" method="post">
  Username:<br />
  <input type="text" size="10" name="user_name" class="logininput" />
  <br />
  Password:<br />
  <input type="password" size="10" name="user_password" class="logininput" />
  <br />
  <table border="0" cellspacing="0" cellpadding="0">
    <tr valign="top">
      <td>
        <input type="checkbox" name="auto_login" value="1" />
      </td>
      <td><span class="smalltext">Log me on automatically next visit?</span></td>
    </tr>
  </table>
  <br />
  <input type="submit" value="Log In" class="button" />
</form>


Maybe you have to change form action to the right path to the file login.php.

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

Offline Sammy2002

  • Newbie
  • *
  • Posts: 18
    • View Profile
    • http://www.webleben.com
Easier Integration
« Reply #11 on: May 10, 2002, 05:28:23 PM »
Hi,

ich hab diesen code here, ist es möglich damit, dass der user sich in die 4images einloggen kann?
Code: [Select]
<form action=/alumni/browse.php method=post>
    <tr>           <td height="17" bgcolor="#FFCC66" width="102" >
                    <div align="center">Login<br>
                      <input type="text" name="loginName" size="12" value="" maxlength=32 ">
                    </div>
                  </td>
                </tr>
                <tr>
                  <td height="17" bgcolor="#FFCC66" width="102">
                    <div align="center">Password<p><input  type="password" name="user_pwd" size=12 maxlength=32 ">
                    </p></div>
                  </td>
                </tr>
                <tr>                  <td height="2" bgcolor="#FFCC66">
                    <div align="center">
                      <input type="submit" name="login" value="Login">


Also wenn ich noch dazu diesnt code hier addiere
Code: [Select]
<form action="login.php" method="post"> kann man damit sich in beide skripte anmelden?

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Easier Integration
« Reply #12 on: May 10, 2002, 05:44:16 PM »
Nein, Du musst den oben von mir geposteten Code nehmen. Natürlich kannst Du den Code ans Layout anpassen. Du musst aber aufpassen, dass alle Formularelemente Ihre Namen behalten.

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