Password Protecting a page and email notification

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm going to ask you PHP gurus if someone can give me a hand in trying to
get this resolved.  I'm fairly new to PHP and learning as I go.

I've got two page "login.php" and video.php.  Video.php is supposed to be
protected i.e. if someone clicks on the direct link or brings up the page in
a browser, it comes back with an error message and a request to link to
"login.php"... they type in their username/pasword and it opens up the
video.php so they can download videos.

I actually managed to accomplish that with the following code which sits at
the top of video.php.  I also created a form on "login.php" for user input.
So far so good.  However, we also need an email to be sent to the site owner
when someone logs in plus their name.  For the hell of me, I can't figure
out how to combine the two elements.  I tried a lot of things sofar, but
nothing works.  It's either the page gets protected OR the email gets sent,
depending on what I leave in the script. I tried using part of Jenny's
script which is great for email forms but I can't combine this whole thing.
Heeeelp!!

/*this is the code that sits at the top of the protected page* which works
actually fine for the protection*/
<?php
session_start();

 $_SESSION ['username'] = $_POST ['user'];
 $_SESSION ['userpass'] = $_POST ['pass'];
 $_Session ['authuser'] = 0;

 if (($_SESSION['username'] == 'logon')  and
    ($_SESSION['userpass'] == 'password')) {
  $_SESSION['authuser'] = 1;
 } else {
  echo "I'm sorry, access is denied <br />";
  echo "Please log in at  <a href='login.php'> HERE</a> to enter your
Username and Password";
 exit();
 }

Can this be done on one form i.e. login.php?  I have 4 textfields set up:
username, password, email, name (for the person sending the email...)..
some if clause somewhere?

Best
R.C.




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux