Welcome to Geeklog, Anonymous Saturday, November 30 2024 @ 11:33 pm EST

Geeklog Forums

Login fields on frontpage staticpage


Whoosh

Anonymous
I have an html staticpage that I am planning on using for a frontpage. I want to put the username and password fields on it so that when a user clicks "login" they enter the site.

I think I remember Dirk or someone else posting a PHP code snippet that does this. It checks to make sure the user is not logged in and if not, presents him/her a "login" button on the staticpage. If the user is logged in already, it presents a "logout" button.

The code was only about two or three lines long. I've searched for it, but with no luck.

Anyone remember that? Or maybe I'm just dreaming...
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
You're looking for this one, I assume.

bye, Dirk
 Quote

Whoosh

Anonymous
Yep. That's it. Thanks! (Don't know how you find this stuff so quickly)

One further question. I should be able to use this in a staticpage (entire BLANK page) WITH HTML right? I just tried it, removing the PHP tags as instructed in the SP docs (and enabling PHP) and got a parse error "Parse error: parse error, unexpected '

When I take out the html stuff, the snippet seems to work, but it doesn't seem to allow a blank page. (the word "login" appears in the upper left corner of the regular GL screen).

Does anyone know the proper way to use HTML with this PHP snippet?
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Quote by Whoosh: I should be able to use this in a staticpage (entire BLANK page) WITH HTML right?

No. When you're using PHP in a static page, it can only contain PHP code, not the mixture of PHP and HTML that you can use in a normal .php file.

A modified version of the static pages plugin that allows "mixed mode" is available here.

bye, Dirk
 Quote

Whoosh

Anonymous
Thanks Dirk.

I tried this plugin, but I think it has a bug. The stuff between the html tags seems fine, but the plugin adds lots of backslashes to the stuff between the php tags. Each time I save the staticpage contents, more backslashes are added to the php code. And this causes parse errors.

I'll try contacting the plugin's author to see what is going on.

Thanks again.
 Quote

All times are EST. The time is now 11:33 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content