Login/User Problem

This is guide mostly for website tools and code, for example CMS or registration scripts.
There can also be tools.

Moderators: osRose dev team, ospRose dev team, osiRose dev team, Moderators

Login/User Problem

Postby Ultra on Thu Jun 28, 2012 2:05 am

Hi!
I have a problem with the Login or the UserCP (i think)

The problem:
When i try to login it gives:
  1. Warning: session_register() [function.session-register]: Cannot send session cache limiter - headers already sent (output started at C:\AppServ\www\Lightirose\images\login.php:22) in C:\AppServ\www\Lightirose\images\login.php on line 53


On line 53:
  1. session_register("User_Name");
  2. session_register("User_Pass");
  3. $_SESSION['account'] = $_POST['user'];
  4. echo('Logged in.... Click <a href=user.php><strong>here</strong></a>');


login.php
  1. <?php
  2. /*
  3. DynastyCMS
  4. Copyrigt (C) 2007 dynastycms
  5.  
  6. This program is free software; you can redistribute it and/or
  7. modify it under the terms of the GNU General Public License
  8. as published by the Free Software Foundation; either version 2
  9. of the License, or (at your option) any later version.
  10.  
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with this program; if not, write to the Free Software
  18. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  19. */
  20. ?>
  21. <form id="form1" name="form1" method="post" action="?op=login">
  22.   <p align="center" class="tdglobal"><span class="b01"><?php echo $DynCMS['title']; ?> User Control Panel</span></p>
  23.   <table width="200" border="0" align="center" class="liteoption">
  24.     <tr>
  25.       <td width="97" class="center"><div align="center"><b>Username:</b></div></td>
  26.       <td width="93" class="center"><input name="user" type="text" class="liteoption" id="user" size="15" maxlength="15" /></td>
  27.     </tr>
  28.     <tr>
  29.       <td class="center"><div align="center"><b>Password:</b></div></td>
  30.       <td class="center"><input name="pass" type="password" class="liteoption" id="pass" size="15" maxlength="15" /></td>
  31.     </tr>
  32.   </table>
  33.   <p align="center" class="tdglobal"><span class="center">
  34.     <input name="submit" type="submit" class="liteoption" id="submit" value="Log In" size="15" maxlength="15" />
  35.   </span></p>
  36. </form>
  37. <p align="center" class="tdglobal">
  38.   <?php
  39. if(isset($_POST['submit'])) {
  40. $U = $_POST['user'];
  41. $P = md5($_POST['pass']);
  42.  
  43. require("config.php");
  44.  
  45. $result1 = "SELECT * FROM `accounts` WHERE username='$U' and password='$P' and accesslevel >= '100'";
  46. $query = mysql_query($result1);
  47.  
  48. $count = mysql_num_rows($query);
  49.  
  50.  
  51. if($count == 1){
  52.  
  53. session_register("User_Name");
  54. session_register("User_Pass");
  55. $_SESSION['account'] = $_POST['user'];
  56. echo('Logged in.... Click <a href=user.php><strong>here</strong></a>');
  57. }
  58. else {
  59. echo "<strong>Try Again</strong>";
  60. }
  61. }
  62. ?>
  63.   <br />
  64. </p>
  65.  


user.php
  1. <?php
  2. /*
  3. DynastyCMS
  4. Copyrigt (C) 2007 dynastycms
  5.  
  6. This program is free software; you can redistribute it and/or
  7. modify it under the terms of the GNU General Public License
  8. as published by the Free Software Foundation; either version 2
  9. of the License, or (at your option) any later version.
  10.  
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with this program; if not, write to the Free Software
  18. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  19. */
  20.  
  21. if(!session_is_registered(User_Name)) {
  22. die('You must log in you noob!');
  23. }
  24.  
  25. if(!session_is_registered(User_Pass)) {
  26. die('You must log in you noob!');
  27. }
  28. ?>
  29. <form action="edit-char" method="post">
  30.  <p align="center" class="b01">Welcome: <?php echo $_SESSION['account']; ?><strong><br />
  31.     <br />
  32.     </strong>
  33.    <br />
  34.  
  35.  
  36.   <br />
  37.   <em><br />  
  38.     </em><a href="password">Change Password</a><br />
  39.     <a href="cuser-delete">Delete my character</a><br />
  40.     <a href="delete_acc">Delete my account</a><br />
  41.     <a href="change_class">Change my class </a><br />
  42.   <a href="logout">Logout</a></p>
  43. </form>
  44.  </p></p>
  45.  


First time i was using the same codes and it was work ... idk from what it is ... help?
Ultra
Rackie
Rackie
 
Posts: 226
Joined: Thu Jul 22, 2010 6:31 pm
Location: Usa

Re: Login/User Problem

Postby xadet3 on Thu Jun 28, 2012 10:27 am

You shouldn't use session_register, it's been deprecated in 5.3 and removed in 5.4.
xadet3
Pero pero
Pero pero
 
Posts: 727
Joined: Tue Jan 08, 2008 11:51 pm
Location: Norwich, England.

Re: Login/User Problem

Postby Ultra on Thu Jun 28, 2012 10:53 am

Ahmm but when i delete it it says
"You must login noob" xD
Ultra
Rackie
Rackie
 
Posts: 226
Joined: Thu Jul 22, 2010 6:31 pm
Location: Usa

Re: Login/User Problem

Postby wolfwing on Thu Jun 28, 2012 11:24 am

Then you replace it by the correct function call.
wolfwing
Clown
Clown
 
Posts: 502
Joined: Tue Mar 03, 2009 9:50 am

Re: Login/User Problem

Postby observe on Fri Jun 29, 2012 7:44 pm

try using session_start(); in the index.
observe
osRose dev
osRose dev
 
Posts: 194
Joined: Thu Sep 17, 2009 10:28 am
Location: The Netherlands

Re: Login/User Problem

Postby Ultra on Fri Jun 29, 2012 8:57 pm

observe wrote:try using session_start(); in the index.

Its the same...
I dont know from what it is...
First time it was work everything the cp and all...
Maybe give me a login and user.php ? > i have try the dynasty one but..

EDIT
I forget to add this thing with the session in the user and in the login anyway
it gives error on line 21
if(!session_is_registered(User_Name)) {
Ultra
Rackie
Rackie
 
Posts: 226
Joined: Thu Jul 22, 2010 6:31 pm
Location: Usa


Return to PHP / Web Guides, Scripts and tools.

Who is online

Users browsing this forum: No registered users and 9 guests

cron