Author Topic: Login auf Startseite  (Read 15059 times)

0 Members and 1 Guest are viewing this topic.

Offline dabri

  • Jr. Member
  • **
  • Posts: 92
    • View Profile
    • http://www.12geschworene.de
Login auf Startseite
« on: September 23, 2002, 10:55:32 PM »
Ich benutze die 4images/phpBB Integration und würde gerne auf meiner Startseite meiner normalen Homepage, ein Login-Formular benutzen wie die User-Box bei 4images. Ist der User eingeloggt, sieht in der Box:

Eingeloggt als: USERNAME

wenn er nicht eingeloggt ist, erscheint das Login-Form.

Wie ist das auf meiner Startseite zu bewerkstelligen?

Ich hab schon versucht die vorhandene index.php von 4images umzubenennen (pass.php), auch das Template bekam ein anderen Namen. Hab ich die pass.php direkt aufgerufen, funktioniert auch alles wie gewünscht. Nur als ich die pss.php auf meine Startseite includen wollte, ging es nicht.

Ich wurde wenn ich mich einloggen wollte auf die pass.php weitergeleitet und nicht auf meine Startseite. Und auf der Startseite wurde immer noch das Login-Form angezeigt, nicht eingeloogt als: USERNAME.

Ist mein Vorhaben überhaupt zu realisieren?

Würde mich freuen, wenn mir Jemand auf die Sprünge helfen könnte.

Danke & Gruß Daniel

Offline Vraxor

  • Full Member
  • ***
  • Posts: 134
    • View Profile
    • http://tc-revolution.net
Login auf Startseite
« Reply #1 on: September 24, 2002, 07:50:37 AM »
Hi,

I don't know if I understoot all of what was said in German above, but I think I have the same question.

I have a site with many pages and only a part of my site is the gallery.
I would love to get the login form on every page so that users more or less have the idea that they login to a site instead of only the galleries.

In a later stage I really need this to work because I would like to inegrate many things like a news script a toplist and many more (just need to learn some PHP ;-))

So is there anyone who knows how to add this to pages outside 4images???

Cheers,
Vraxor

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Login auf Startseite
« Reply #2 on: September 24, 2002, 08:55:09 AM »
Try this:

Add this to the page BEFORE any output. This means before the <html> tag or before you output anything with "echo" or "print":
Code: [Select]
// Relativ path to your 4images install directory
define('ROOT_PATH', './4images/');
include(ROOT_PATH.'global.php');
require(ROOT_PATH.'includes/sessions.php');


You can now use anywhere you want:
Code: [Select]
if ($user_info['user_level'] >= USER) {
  echo "Hello ".$user_info['user_name']."! You are logged in;
}
else {
  echo "Please log in";
}

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

Offline Vraxor

  • Full Member
  • ***
  • Posts: 134
    • View Profile
    • http://tc-revolution.net
Login auf Startseite
« Reply #3 on: September 24, 2002, 01:29:40 PM »
Ok thanks for this info, I will give it a try soon. If it works its simply great.

I think btw. that you forgot a " in

Code: [Select]
echo "Hello ".$user_info['user_name']."! You are logged in;

This is just for if others would like to try the same and encounter errors.
I think the code should be:

Code: [Select]
if ($user_info['user_level'] >= USER) {
  echo "Hello ".$user_info['user_name']."! You are logged in";
}
else {
  echo "Please log in";
}


Cheers,
Vraxor

Offline dabri

  • Jr. Member
  • **
  • Posts: 92
    • View Profile
    • http://www.12geschworene.de
Login auf Startseite
« Reply #4 on: September 24, 2002, 03:12:52 PM »
Super klappt nun prima bei mir! Danke an Euch.

Ist es möglich, wenn der User eingeloogt ist, auf sein User-Profil zu verlinken.

Code: [Select]

profile.php?mode=viewprofile&u=1


Wie bekomme ich es hin, das man immer auf das entsprechen Profil im phpBB verlinkt wird?

Gruß Daniel

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Login auf Startseite
« Reply #5 on: September 24, 2002, 05:40:47 PM »
Code: [Select]
echo "Hello <a href='/phpBB/profile.php?mode=viewprofile&u=".$user_info['user_id']."'>".$user_info['user_name']."</a>! You are logged in;

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

Offline dabri

  • Jr. Member
  • **
  • Posts: 92
    • View Profile
    • http://www.12geschworene.de
Login auf Startseite
« Reply #6 on: September 24, 2002, 08:05:27 PM »
Hallo Jan,

danke für Deine schnelle Antwort.

Es klappt alles prima, noch eine Frage:

Der Link im Login-Status ist prima. Nun möchte ich wenn ich ausgeloggt bin auf das login.php von phpBB linken, und nach dem Login soll man wieder auf die Ursprungsseite kommen.

Code: [Select]

login.php?redirect=


Gibt es für die Redirect-URL eine Variable oder ein Funktion?

Danke & Gruß Daniel

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Login auf Startseite
« Reply #7 on: September 24, 2002, 08:18:53 PM »
Probiere es mal mit:

Code: [Select]
echo "login.php?redirect=".$HTTP_SERVER_VARS['REQUEST_URI'];

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

Offline dabri

  • Jr. Member
  • **
  • Posts: 92
    • View Profile
    • http://www.12geschworene.de
Login auf Startseite
« Reply #8 on: September 24, 2002, 08:43:20 PM »
Hallo Jan,

perfekt es klappt!

Will mich nur noch mal bei Dir bedanken! Ein super Service hier!

Danke & Gruß Daniel

Offline Clow Read

  • Newbie
  • *
  • Posts: 21
    • View Profile
    • http://vectorcandy.com
Login auf Startseite
« Reply #9 on: March 17, 2003, 06:18:59 AM »
i'm no php expert and i don't understand how i can code this one...

could someone give me step by step instructions???

Offline tosor

  • Pre-Newbie
  • Posts: 4
    • View Profile
    • tomassor.com
Re: Login auf Startseite
« Reply #10 on: May 17, 2005, 08:06:36 AM »
Hi!
I'm desperately been seeking for this kind of mod a couple of days and finally found this one. :D

I use 4images and phpbb and they are integrated with eachother. That part works without any problem. When I added the code on this topic I get the following error:
Quote
Fatal error: Cannot redeclare un_htmlspecialchars() (previously declared in /home/tomassor/public_html/gallery/includes/functions.php:134) in /home/tomassor/public_html/forums/Sources/Subs.php on line 697

Could somebody please help me?

Thanks!

Regards,
Tomas

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Re: Login auf Startseite
« Reply #11 on: May 18, 2005, 11:18:41 AM »
Search in includes/functions.php for

Code: [Select]
function un_htmlspecialchars($chars) {
  //$chars = preg_replace("/(&#)([0-9]*)(;)/esiU", "chr(intval('\\2'))", $chars);
  $chars = str_replace("&gt;", ">", $chars);
  $chars = str_replace("&lt;", "<", $chars);
  $chars = str_replace("&quot;", "\"", $chars);
  $chars = str_replace("&amp;", "&", $chars);
  return $chars;
}

and replace it with

Code: [Select]
if (!function_exists('un_htmlspecialchars')) {
function un_htmlspecialchars($chars) {
  //$chars = preg_replace("/(&#)([0-9]*)(;)/esiU", "chr(intval('\\2'))", $chars);
  $chars = str_replace("&gt;", ">", $chars);
  $chars = str_replace("&lt;", "<", $chars);
  $chars = str_replace("&quot;", "\"", $chars);
  $chars = str_replace("&amp;", "&", $chars);
  return $chars;
}
}
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline tosor

  • Pre-Newbie
  • Posts: 4
    • View Profile
    • tomassor.com
Re: Login auf Startseite
« Reply #12 on: May 18, 2005, 12:43:18 PM »
Thanks Jan!

Now a got a new error:

Quote
Warning: Invalid argument supplied for foreach() in /home/tomassor/public_html/gallery/includes/sessions.php on line 438

Fatal error: Call to a member function on a non-object in /home/tomassor/public_html/gallery/includes/sessions.php on line 273

Any idea what could be wrong now?

Regards,
Tomas

Offline Lucifix

  • Hero Member
  • *****
  • Posts: 710
    • View Profile
    • http://www.slo-foto.net
Re: Login auf Startseite
« Reply #13 on: July 18, 2007, 11:50:53 PM »
Hi,

jan when I insert this code I recived this error:

Fatal error: Call to a member function on a non-object in /home/mysite/includes/sessions.php on line 295

line 295 sessions.php:
Code: [Select]
$this->session_info = $site_db->query_firstrow($sql);
It's the same error as tosor...  :?