Page 1 of 1

Frontend login by Ionrock

Posted: Tue 9. Aug 2005, 23:22
by d-lexy
Hello,

I just installed the module on 1.2.3
The module is accessible from backend and shows no problems.

However, I can still see the "protected" content without being asked to enter my login info.

Has anyone else experienced this?

Regads,
Alex

Posted: Wed 10. Aug 2005, 10:08
by volkman
did you protect the content (structure) from the backend (module)? Did you disable the cache in the structure(s) and respective articles you want to protect?
I am using the mod in 1.2.3, no problems after diabling cache for that structures(articles)

volkman

Posted: Wed 10. Aug 2005, 16:22
by d-lexy
Danke volkman!

What happened was that I installed this module on a plain new system just to test out. What I failed to do was create a layout and a template. After I tried your suggestions and it still didnt work, I went into the script and after looking at it realized, that the login prompt is printed into the "main" section of the layout. I then created the layout and the template, cleared the cache, made sure everything is protected as it should, and now everything is working great!

Like you mentioned, Cache is important. I keep forgetting about it as it was introduced in 1.2.3.

Regards,
Alex

Posted: Thu 11. Aug 2005, 09:43
by volkman
Hi Alex,
did you find the post
http://www.phpwcms.de/forum/viewtopic.php?t=7941
concerning the use of phpmailer (used by phpwcms) instead of the PEAR class mailer? Sends an automatic mail with information to your users as soon as you set em up in ionrocks mod.
You have to modify the file app_header-php in the mod then to:

Code: Select all

<?php
// front end users module application header
// file for including main functions/classes/configurations

require_once "include/inc_ext/phpmailer/class.phpmailer.php"; // PHP mail class
require_once "config/phpwcms/conf.inc.php";  //config

?>
have a good one
volker

Posted: Thu 11. Aug 2005, 23:44
by d-lexy
Hey Volkman,

I've seen your post but only got around it now.

But what file did you put this code into:

Code: Select all

<?php
$action = "phpwcms.php?do=modules&p=" . $mod['num'] . "&c=1&user-do=add";

if ($_POST['submit'] == "Submit") {
   $values = $_POST;
   $myuser = new UserAddition;
   if ($myuser->checkValues($_POST)) {
      if ($myuser->insertUser($_POST)) {


      $mail = new PHPMailer();  //Mail class
      $email_address         = $_POST['email_address'];
      $email_fullname         = $_POST['full_name'];
      $mail->Mailer          = $phpwcms['SMTP_MAILER'];
      $mail->Host          = $phpwcms['SMTP_HOST'];
      $mail->Port          = $phpwcms['SMTP_PORT'];
      if($phpwcms['SMTP_AUTH']) {
         $mail->SMTPAuth    = 1;
         $mail->Username    = $phpwcms['SMTP_USER'];
         $mail->Password    = $phpwcms['SMTP_PASS'];
      }
      $mail->SMTPKeepAlive    = false;
      $mail->From       = $phpwcms['SMTP_FROM_EMAIL'];
      $mail->FromName    = $phpwcms['SMTP_FROM_NAME'];
      $mail->AddAddress("$email_address", "$email_fullname");

      $mail->Subject = "Zugangsdaten";

      $mail->Body    = '
  Wilkommen beim geschlossenen Benutzerbereich!

  Ihr Zugang ist eingerichtet und aktiviert. Mit dem Link unten, Ihrem
  Benutzernamen und Passwort erhalten Sie sofort Zugang:

   http://www.servername.com/index.php?login
   Benutzername: ' . $_POST['username'] . '
   Passwort:     ' . $_POST['password'] . '

  Herzlichst, Ihr Online-Team.
   ';

      if(!$mail->SetLanguage($phpwcms['default_lang'])) {
         $mail->SetLanguage('de');
      } 
You've been a great help!

Thanks again!

Posted: Fri 12. Aug 2005, 08:59
by volkman
sorry. that has to be put into
inc_act/users.add.php to replace the code there

Code: Select all

<?php
$action = "phpwcms.php?do=modules&p=" . $mod['num'] . "&c=1&user-do=add";

if ($_POST['submit'] == "Submit") {
	$values = $_POST;
	$myuser = new UserAddition;
	if ($myuser->checkValues($_POST)) {
		if ($myuser->insertUser($_POST)) {
			/* will uncomment later...
			$mail_object =& Mail::factory('mail');
			$recipient = $_POST['name'];
			$headers['From'] = "webmaster@yogahouston.org";
			$headers['Subject'] = "Your Yoga Association of Houston Account Info";
			$message = '
Hello, 

Your account has been created at. You can login by going to the following url:

	http://whatevertheurlis.com
	username: ' . $_POST['name'] . '
	password: ' . $_POST['password'] . '

Put anything else you want here.
	';
			if (!$mail_object->send($recipient, $headers, $message))
				die("Error sending mail...");
			*/
			echo "<div id=\"messageArea\">";
			echo "Mail has been sent to $_POST[email_address]<br />";
			echo $myuser->getMessage();
			echo "</div>\n";
			include ($mod['path'] . "/inc_act/users.default.php");
		} else {
.......

Trouble logging in

Posted: Sat 13. Aug 2005, 22:27
by RolandTG
Hello!

I'm a phpWCMS newbee, but have som experience with php. And I'm loving phpWCMS so far.

Just installed 1.2.3-DEV, and ionrocks frontend login module.
I'm trying to set up a personal web-page, but needs to have som restricted areras.

I have made one user in the fue-tables, who should have access to the page I'm trying to show.
The login-fields show up correctly, but nothing happens when the login button are used. The form action on the button is "index.php?id=6,4,0,0,1,0", and the category(acatid) is 6, so this looks OK ???

What have I forgotten to do?

best regards
Knut Harald

Posted: Sun 14. Aug 2005, 12:48
by volkman
hello,
i had to turn off cache on the structure/page to make it work...

volkman

Posted: Sun 14. Aug 2005, 22:28
by RolandTG
Thanks, but it didn't help. :?

This is my config so far...

Startpage (ID0, visible, public)
....
Login (ID4, visible public, no articles)
Restricted area (ID5, visible for users logged on, cache off, visible, public, no articles)
House (ID6, visible for users logged on, cache off, visible, public)
Article 1(article ID4, visible for users logged on, cache off, visible, public)

And I have one user in the feu-tables with user ID 1.
And in the permission table with access to acatid 5 (have also tried 6).

The pages not under restriced works as expected.
When I try to access the House(or the Article 1), the Login fields appeares (as expected) but nothing happens when I press the Login button.
Should it give some message if the logon credentials where wrong?

Somebody have some idea to what I've missed???

-Knut Harald

Posted: Mon 15. Aug 2005, 00:17
by Kulinarisk
Been on vacation:-) One question; where can I find the Mod? (been looking like mad)

Posted: Mon 15. Aug 2005, 05:39
by d-lexy
Kulinarisk wrote:Been on vacation:-) One question; where can I find the Mod? (been looking like mad)
I can't find a direct link to it neither, but I went to the URL where Ionrock's new calendar mod is and backtracked into the directory that also contained the login mod:

http://ionrock.org/downloads/frontend_u ... onrock.zip

Posted: Mon 15. Aug 2005, 09:02
by volkman
hello rolandtg:
took me quite a while to find out how to get that baby run, too. here's my setup:
first i created the structure and pages for all sections including the ones that will be hidden later, INCLUDING one for the structure/page the login will showup. after a successful login, this is the first page shown to your "members". (first setup ALL pages as regular pages shown to everyone. the mod later will set the option for hiding!)
my structure looks like this:

nav1
subnav1.1
subnav1.2
...
nav2
subnav2.1
subnav2.2
...
nav6
subnav6.1
subnav6.2
subnav6.2

where nav6 and all subnavs (6.1, 6.2, ...) have content (pages). then i use the mod to protect/hide em (all or just nav6) and assign users to the pages (dont forget this, otherwise nogo). regular visitors dont "see" nav6 and the sub-structure. if a member uses the direct link (url) to nav6 (the page), the login fires up. After sending the login-data, the regular content of nav6 is showing up together with the complete sub-strukture and pages. my members get an automatic email with the login data (url, username, pwd)

hope that helps

volkman

Posted: Mon 15. Aug 2005, 13:33
by Kulinarisk
thanks d-lexy 8)

Posted: Mon 15. Aug 2005, 15:33
by d-lexy
Hi Volkman,

I tried replacing the content of my user.add.php file to:

Code: Select all

<?php
$action = "phpwcms.php?do=modules&p=" . $mod['num'] . "&c=1&user-do=add";

if ($_POST['submit'] == "Submit") {
   $values = $_POST;
   $myuser = new UserAddition;
   if ($myuser->checkValues($_POST)) {
      if ($myuser->insertUser($_POST)) {


      $mail = new PHPMailer();  //Mail class
      $email_address         = $_POST['email_address'];
      $email_fullname         = $_POST['full_name'];
      $mail->Mailer          = $phpwcms['SMTP_MAILER'];
      $mail->Host          = $phpwcms['SMTP_HOST'];
      $mail->Port          = $phpwcms['SMTP_PORT'];
      if($phpwcms['SMTP_AUTH']) {
         $mail->SMTPAuth    = 1;
         $mail->Username    = $phpwcms['SMTP_USER'];
         $mail->Password    = $phpwcms['SMTP_PASS'];
      }
      $mail->SMTPKeepAlive    = false;
      $mail->From       = $phpwcms['SMTP_FROM_EMAIL'];
      $mail->FromName    = $phpwcms['SMTP_FROM_NAME'];
      $mail->AddAddress("$email_address", "$email_fullname");

      $mail->Subject = "Zugangsdaten";

      $mail->Body    = '
  Wilkommen beim geschlossenen Benutzerbereich!

  Ihr Zugang ist eingerichtet und aktiviert. Mit dem Link unten, Ihrem
  Benutzernamen und Passwort erhalten Sie sofort Zugang:

   http://www.servername.com/index.php?login
   Benutzername: ' . $_POST['username'] . '
   Passwort:     ' . $_POST['password'] . '

  Herzlichst, Ihr Online-Team.
   ';

      if(!$mail->SetLanguage($phpwcms['default_lang'])) {
         $mail->SetLanguage('de');
      } 
?>
but I get an error that there is an unexpected $ on the closing ?> line of the file. I'm probably missing some code but I dont know what.

Regards,
Alex

Posted: Mon 15. Aug 2005, 17:23
by volkman
sorry alex,
i just copied the part that has to be changed. here is the complete one. Ther german "blablabla" on the beginning just says "Please provide a Username and Password for the new user, it will be sent automatic..." The sentence will show up in the backend, when you setup the user.
hope that helps

volkman

Code: Select all

<p> Bitte geben Sie eine E-Mail-Adresse und ein Passwort f&uuml;r der Benutzer an. Der neue Benutzer erh&auml;lt ein E-Mail mit Instruktionen zum Login. </p>

<?php
$action = "phpwcms.php?do=modules&p=" . $mod['num'] . "&c=1&user-do=add";

if ($_POST['submit'] == "Submit") {
	$values = $_POST;
	$myuser = new UserAddition;
	if ($myuser->checkValues($_POST)) {
		if ($myuser->insertUser($_POST)) {


		$mail = new PHPMailer();
		$email_address			= $_POST['email_address'];
		$email_fullname			= $_POST['full_name'];
		$mail->Mailer 			= $phpwcms['SMTP_MAILER'];
		$mail->Host 			= $phpwcms['SMTP_HOST'];
		$mail->Port 			= $phpwcms['SMTP_PORT'];
		if($phpwcms['SMTP_AUTH']) {
			$mail->SMTPAuth 	= 1;
			$mail->Username 	= $phpwcms['SMTP_USER'];
			$mail->Password 	= $phpwcms['SMTP_PASS'];
		}
		$mail->SMTPKeepAlive 	= false;
		$mail->From 		= $phpwcms['SMTP_FROM_EMAIL'];
		$mail->FromName 	= $phpwcms['SMTP_FROM_NAME'];
		$mail->AddAddress("$email_address", "$email_fullname");

		$mail->Subject = "Zugangsdaten Verein-CED";

		$mail->Body    = '
  Willkommen beim geschlossenen Benutzerbereich des Verein CED! 

  Ihr Zugang ist eingerichtet und aktiviert. Mit dem Link unten, Ihrem
  Benutzernamen und Passwort erhalten Sie sofort Zugang:

	' . $phpwcms["site"] . 'index.php?login_xql
	Benutzername: ' . $_POST['username'] . '
	Passwort:     ' . $_POST['password'] . '

  Herzlichst, Ihr Online-Team Kompetenznetz-CED.
	';

		if(!$mail->SetLanguage($phpwcms['default_lang'])) {
			$mail->SetLanguage('de');
		}

		if(!$mail->Send())
			{
			   echo "Das Best&auml;tigungs-E-Mail konnte nicht verschickt werden. <p>";
			   echo "Mailer Error: " . $mail->ErrorInfo;
		 	  exit;
			}
			echo "<div id=\"messageArea\">";
			echo "Ein E-Mail wurde automatisch an die Adresse $_POST[email_address] verschickt<br />";
			echo $myuser->getMessage();
			echo "</div>\n";
			include ($mod['path'] . "/inc_act/users.default.php");
		} else {
			echo "<div id=\"messageArea\">";
			echo $myuser->getMessage();
			echo "</div>\n";
			include ($mod['path'] . "/inc_tmpl/users.forms.php");
		}
			
	} else {
		echo "<div id=\"messageArea\">" . $myuser->getMessage() . "</div>\n";
		include ($mod['path'] . '/inc_tmpl/users.forms.php');
	}
} else {
	include ($mod['path'] . '/inc_tmpl/users.forms.php');
}

?>