8, September 2008

Need help with login.php - webmaster forum

 
Webdigity webmaster forums
This forum shares its ad revenue with its members!
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  Access_user Class (Moderator: Olaf)
Topic: Need help with login.php
« previous next »
Pages: [1] Print

Author Topic: Need help with login.php  (Read 1108 times)
Bill Cosby is my Father
*
Gender: Male
Posts: 4
28 credits
Members referred : 0


Happy with what you have to be happy with.


« on: Nov 13, 2006, 11:12:38 PM »

Hi Olaf-

Thanks for sharing your work!  I have implemented this class in my application, but I seem to be stuck on one small thing.  When a user registers, the confirmation message is sent and that works with no problem.

The problem is when the user follows the link and comes back to the login.php, the page is blank.  From my testing I can see that the account IS getting activated.  If I refresh the page, then the login.php page shows up fine, but displays the message"There is no account to activate."

Here is the code I am using to activate:
Code:
  if (isset($_GET['activate']) && isset($_GET['ident'])) {
$my_access->auto_activation = true;
$my_access->send_confirmation = true;
$my_access->activate_account($_GET['activate'], $_GET['ident']);
}

I have tried to force another page to load with
Code:
header('Location: index.php');
but no luck.

Funny thing I just tried while typing this in.  If I copy delete some characters from the validation string and then load that, the login page shows fine with the "Sorry, this activation key is not valid!" message.

It seems like this only fails for me when the activation is success.  Smiley

I have all of this loaded to my test server if you would like to have a look.  http://kram.crimsonenterprises.com Visit through proxy
Most of the links don't work yet, but you can try to register.

Thanks for having a look!
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6309
38674 credits
Members referred : 374


It's time to use PHP5!


« Reply #1 on: Nov 13, 2006, 11:22:51 PM »

Hi,

this row is wrong:
$my_access->send_confirmation = true;

remove it...and try to test with error reporting Wink


Last blog : Is your website is down? Know before your visitors do!
Bill Cosby is my Father
*
Gender: Male
Posts: 4
28 credits
Members referred : 0


Happy with what you have to be happy with.


« Reply #2 on: Nov 13, 2006, 11:39:51 PM »

First off, WOW what a quick reply!!!

I removed that line and still get the same results.  I deleted the test account you created if you want to have a second look.

Here is my entire login.php file just in case that helps.  Most of it is taken directly from your example.
Code:
<?php 
include($_SERVER['DOCUMENT_ROOT']."/classes/access_user/access_user_class.php"); 

$my_access = new Access_user;
$my_access->login_reader();
// $my_access->language = "de"; // use this selector to get messages in other languages
if (isset($_GET['activate']) && isset($_GET['ident'])) { // this two variables are required for activating/updating the account/password
$my_access->auto_activation true// use this (true/false) to stop the automatic activation
//$my_access->send_confirmation = true;
$my_access->activate_account($_GET['activate'], $_GET['ident']); // the activation method
}
if (isset(
$_GET['validate']) && isset($_GET['id'])) { // this two variables are required for activating/updating the new e-mail address
$my_access->validate_email($_GET['validate'], $_GET['id']); // the validation method 
}
if (isset(
$_POST['Submit'])) {
$my_access->save_login = (isset($_POST['remember'])) ? $_POST['remember'] : "yes"// use a cookie to remember the login
$my_access->count_visit true// if this is true then the last visitdate is saved in the database
$my_access->login_user($_POST['login'], $_POST['password']); // call the login method

$error $my_access->the_msg
?>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript" language="javascript" src="js/md_stylechanger.js"></script>
<script type="text/javascript" src="js/iehover-fix.js"></script>
<title>Login</title>
<link rel="stylesheet" type="text/css" href="style/style.css" media="screen" />

<script language="JavaScript" src="js/validator.js" type="text/JavaScript">
</script>
</head>
<body>
<!-- BEGIN MAIN CONTAINER -->
<div id="container">
<!-- BEGIN HEADER -->
<div id="header">
<p class="username">Welcome <?=$user_name?> <?=$classpath?></p>
<p class="toplinks"><a href="#">Contact Us</a> | <a href="#">Log Off</a></p>
<p>
<a href="index.html" title="Increase font size" onclick="changeFontSize(1);return false;"><img src="images/increase_font_size.png" alt="Increase Font Size" border="0" /></a>
<a href="index.html" title="Decrease size" onclick="changeFontSize(-1);return false;"><img src="images/decrease_font_size.png" alt="Decrease Font Size" border="0" /></a>
<a href="index.html" title="Revert styles to default" onclick="revertStyles(); return false;"><img src="images/reset_font_size.png" alt="Restore Default Font Size" border="0" /></a>
</p>
</div>
<!-- END HEADER -->
<!-- BEGIN NAVIGATION -->
<div id="navbar">
<ul id="nav" class="nav">
<li><a href="#">Your&nbsp;Account</a></li>
</ul>
</div>
<!-- END NAVIGATION --><br />
<div id="mainContent" class="clearfix">
<div class="left">
<div class="homeBox">
<div class="homeRedTitle">Login</div>
<div class="content">
<br />
<p>Please enter your login and password.</p>
<form name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
  <label for="login">Login:</label>
  <input type="text" name="login" size="20" value="<?php echo (isset($_POST['login'])) ? $_POST['login'] : $my_access->user?>"><br>
  <label for="password">Password:</label>
  <input type="password" name="password" size="8" value="<?php echo (isset($_POST['password'])) ? $_POST['password'] : $my_access->user_pw?>"><br>
  <label for="remember">Remember login?</label>
  <input type="checkbox" name="remember" value="yes"<?php echo ($my_access->is_cookie == true) ? " checked" ""?>>
  <br>
  <input type="submit" name="Submit" value="Login">
</form>
<p><b><?php echo (isset($error)) ? $error "&nbsp;"?></b></p>

<!-- Notice! you have to change this links here, if the files are not in the same folder -->
<p>Not registered yet? <a href="./register.php">Click here.</a></p>
<p><a href="./forgot_password.php">Forgot your password?</a></p>
</div><!-- close homebox div-->


</div><!-- close left div--><div class="homeBoxBottom">&nbsp;</div><br />
</div>

</body>
</html>

Thanks!
~ Scott
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6309
38674 credits
Members referred : 374


It's time to use PHP5!


« Reply #3 on: Nov 13, 2006, 11:49:28 PM »

what happens if you use the orig. login file with the ORIGINAL class file?

I'm wondering why you used this wrong row, thats not documented somewhere...


Last blog : Is your website is down? Know before your visitors do!
Bill Cosby is my Father
*
Gender: Male
Posts: 4
28 credits
Members referred : 0


Happy with what you have to be happy with.


« Reply #4 on: Nov 14, 2006, 12:08:59 AM »

I can see why you would wonder that.  It was just a dumb mistake by me.  Embarrassed I read the code too quickly and thought that send_confirmation was something I could set.

I have made very few modifications to access_user class, only to add new fields to user registration.  Here is my activate_account function:
Code:
function activate_account($activate_key, $key_id) {
if ($activate_key != "" && strlen($activate_key) == 32 && $key_id > 0) {
$this->id = $key_id;
if ($this->check_user("active")) {
if ($this->auto_activation) {
$upd_sql = sprintf("UPDATE %s SET active = 'y' WHERE id = %s AND MD5(pw) = '%s'", $this->table_name, $key_id, $activate_key);
if (mysql_query($upd_sql)) {
if ($this->send_confirmation($key_id)) {
$this->the_msg = $this->messages(18);
} else {
$this->the_msg = $this->messages(14);
}
} else {
$this->the_msg = $this->messages(19);
}
} else {
if ($this->send_mail($this->admin_mail, 40, 39)) {
$this->the_msg = $this->messages(36);
} else {
$this->the_msg = $this->messages(14);
}
}
} else {
$this->the_msg = $this->messages(20);
}
} else {
$this->the_msg = $this->messages(21);
}
}
Bill Cosby is my Father
*
Gender: Male
Posts: 4
28 credits
Members referred : 0


Happy with what you have to be happy with.


« Reply #5 on: Nov 14, 2006, 12:39:30 AM »

 Embarrassed  Embarrassed  Embarrassed  Embarrassed  Embarrassed  Embarrassed  Embarrassed
I
AM
AN
IDIOT
Embarrassed  Embarrassed  Embarrassed  Embarrassed  Embarrassed  Embarrassed  Embarrassed

Reading your reply got me to thinking...
Shocked .o O (Wait a minute, why didn't I get a confirmation message back after account activation?)

This project is not one I work on every day.  I often go weeks at a time without touching it.  Anway, a few weeks ago I was working on this and was having problems with the send mail functions so I replaced them with send_smtp_mail.

In one line in the send_confirmation function I had an extra _ character, making the call to send__smtp_mail instead.  Embarrassed

I corrected my mistake and

I'm VERY sorry to have wasted your time and thanks for your prompt response.

~ Scott
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6309
38674 credits
Members referred : 374


It's time to use PHP5!


« Reply #6 on: Nov 14, 2006, 08:16:56 AM »

hehe


Last blog : Is your website is down? Know before your visitors do!
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=4785
Tags : cookies font email Bookmark this thread : Digg Del.icio.us Dzone more....

Topic sponsors:
Get a permanent link here for $1.99!


Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  Access_user Class (Moderator: Olaf)
Topic: Need help with login.php
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
Sep 08, 2008, 10:25:56 AM





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!


Forum Statistics
Total Posts: 36.302
Total Topics: 7.479
Total Members: 3.908
Tutorials : 56
Resources : 143
Designs : 220
Latest Member: top10php

19 Guests, 4 Users online :

5 users online today:



Readers

Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2008 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.