4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Requests & Discussions) => Topic started by: dabri on September 23, 2002, 10:55:32 PM

Title: Login auf Startseite
Post by: dabri 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
Title: Login auf Startseite
Post by: Vraxor 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
Title: Login auf Startseite
Post by: Jan 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
Title: Login auf Startseite
Post by: Vraxor 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
Title: Login auf Startseite
Post by: dabri 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
Title: Login auf Startseite
Post by: Jan 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
Title: Login auf Startseite
Post by: dabri 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
Title: Login auf Startseite
Post by: Jan 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
Title: Login auf Startseite
Post by: dabri 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
Title: Login auf Startseite
Post by: Clow Read 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???
Title: Re: Login auf Startseite
Post by: tosor 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
Title: Re: Login auf Startseite
Post by: Jan 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;
}
}
Title: Re: Login auf Startseite
Post by: tosor 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
Title: Re: Login auf Startseite
Post by: Lucifix 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...  :?