Login box

Download plugins, language packs and stuff.

Postby ivanh » Tue Apr 29, 2008 8:00 pm

lol no luck at all ;'[
thanks for trying to help tho, much appreciated
kinda odd how this used to work for me =s
i might have to make my site transitional instead of strict and use an iframe in it =(
ivanh
 
Posts: 75
Joined: Thu Aug 16, 2007 2:41 pm

Postby Partyism » Wed Jun 11, 2008 4:09 pm

Hi i tried this mod again but i cant seem to logout in any kind of way?!
edit: lol suddenly it works :s
Partyism
 
Posts: 399
Joined: Tue Sep 25, 2007 6:24 pm

Postby Partyism » Thu Jul 31, 2008 7:21 am

Well, it stopped working.

When i try to logout i get this error.

Warning: Cannot modify header information - headers already sent by (output started at /home/partyism/domains/partyism.nl/public_html/artikelen/plugins/latest_comments.php:138) in /home/partyism/domains/partyism.nl/public_html/artikelen/loginbox.php on line 61

Warning: Cannot modify header information - headers already sent by (output started at /home/partyism/domains/partyism.nl/public_html/artikelen/plugins/latest_comments.php:138) in /home/partyism/domains/partyism.nl/public_html/artikelen/loginbox.php on line 67

When i deactive the latest comments it just works
any idea?

edit: fixed it myself, by default in latest_comments.php at the end there a two blank lines, just delete those to and the problem is gone. Only the latest comments is generating a url that isnt working: http://partyism.nl/index.php/2008/07/27/%7Blink%7D#1511 any idea?
Partyism
 
Posts: 399
Joined: Tue Sep 25, 2007 6:24 pm

Postby scottdallas » Tue Oct 28, 2008 12:34 am

I found that I get that problem if I try to put any css styles or HTML.. basically any code at the beginning of the loginbox.php file or at the top of the file. What I've found if is you change and format the form down in the code later where the html for the form is at it stops the errors.

Are you including or iframing your loginbox? I iframed it, it seems to function smoothest like this so far...
Everyday I'm tumblin http://scodal.tumblr.com
User avatar
scottdallas
 
Posts: 2209
Joined: Thu May 04, 2006 6:46 pm
Location: US

Postby Partyism » Tue Oct 28, 2008 8:02 am

Hey Scott,

I only included it and it works fine for me!

index.php
Code: Select all
<?PHP include("artikelen/loginbox.php"); ?>   


loginbox.php
Code: Select all
<?php
///////////////////////////////////////////////////////////////////
//
//Login box by FI-DD
//http://english.cutenews.ru/forum/profile.php?mode=viewprofile&u=2
//Based on:http://www.xs4all.nl/~cvdtak/loginbox_1.0.htm
//
///////////////////////////////////////////////////////////////////

if (!defined('CN_INIT_LOGINBOX')) {

   define('CN_INIT_LOGINBOX', true);

   $echo = cute_lang();
   if(session){
      session_start();
   }
   $username = $_POST['username'];
   $password = $_POST['password'];
   
   if($_POST['act'] == 'dologin'){
      $is_logged_in = false;
         if ($username){
            $cmd5_password = md5x($password);
      
            if (check_login($username, $cmd5_password)){
               $cookie_logged = true;
               
               if(cookie){
                  @setcookie('login_username', $username, time() + 3600 * 24 * 365);
               }
               if(session){
                  session_register('login_username');
                  $_SESSION['login_username'] = $username;
               }
      
            } else {
               $error = '<font color="red">'.$echo['loginError'].'</font>';
               $cookie_logged = false;
            }
         }

      
      if ($cookie_logged){
         $is_logged_in = true;
      
         if ($_POST['act'] == 'dologin'){
            $sql->update(array(
            'table'    => 'users',
            'where'    => array("username = $username"),
            'values' => array('last_visit' => (time() + $config_date_adjust * 60))
            ));
         }
         
         header('Location: '.$PHP_SELF);
      }
   }
   
   if($_GET['act'] == 'logout'){
      if(cookie){
         setcookie('login_username', '', time() - 3600 * 24 * 365);
      }
      if(session){
         @session_destroy();
         @session_unset();
      }
      header('Location: '.$PHP_SELF);
   }
   
   if(cookie){
      if(!$_COOKIE['login_username']){
         $is_logged_in = false;
      }
      else{
         $is_logged_in = true;
      }
   }
   if(session){
      if(!session_is_registered('login_username') || $_SESSION['login_username'] == "") {
         $is_logged_in = false;
      }
      else{
         $is_logged_in = true;
      }
   }

}
else{

   if (!$is_logged_in){
   
   //The login box
   ?>
   <form method="post" action="<?=$PHP_SELF; ?>">
   <table>
      <tr>
         <td>Gebruikersnaam: <input type="text" name="username" size="14"></td>
         <td><td>Wachtwoord: <input type="password" name="password" size="14"></td>
         <td><input type="submit" value="OK"></td>
      <tr>
   </table>
   <input type="hidden" name="act" value="dologin">
</form>
   <?
   
   
   }
   else{
      echo 'Ingelogd als: <strong>'.($username ? $username : (cookie ? $_COOKIE['login_username'] : $_SESSION['login_username'])).'</strong>
      <a href="http://www.mysite.com/cuteru.nl/artikelen/?mod=personal" target="_blank">Profiel wijzigen</a>
      <a href="http://www.mysite.com/leden"><span class="new">Leden</span></a>
      <a href="http://www.mysite.com/cuteru/?mod=addnews" target="_blank">Nieuws Submit</a>
      <a href="http://www.mysite.com/cuteru/index.php?mod=options&action=pm" target="_blank">Inbox ('.count_unread_messages().')</a>
      <a href="'.$PHP_SELF.'?act=logout">Log uit</a>';
   }
   
   echo $error;

}

?>


Make sure you delete the last 2 blank lines in latest_comments.php That solves the error
Partyism
 
Posts: 399
Joined: Tue Sep 25, 2007 6:24 pm

Postby scottdallas » Tue Oct 28, 2008 3:34 pm

Cool! I just removed the last two lines in /plugins/latest_comments.php and uploaded. I'll have to try to include it instead of iframe it and see how it reacts. The whole page refreshes now doesn't it?
Everyday I'm tumblin http://scodal.tumblr.com
User avatar
scottdallas
 
Posts: 2209
Joined: Thu May 04, 2006 6:46 pm
Location: US

Postby Partyism » Tue Oct 28, 2008 4:35 pm

Jep it does
Partyism
 
Posts: 399
Joined: Tue Sep 25, 2007 6:24 pm

How to salute to Nickname?

Postby faustao » Fri Nov 28, 2008 3:13 pm

Hi,

How can I make it show "Logged in as '$name'" instead of "Logged in as '$username'" ?

Thanks a lot for your help.
faustao
 
Posts: 8
Joined: Fri Nov 28, 2008 10:10 am
Location: Brazil

Postby FI-DD » Fri Dec 05, 2008 6:21 pm

Try to change this:
Code: Select all
echo 'Logged in as <b>'.($username ? $username : (cookie ? $_COOKIE['login_username'] : $_SESSION['login_username'])).'</b>. <br /><a href="'.$PHP_SELF.'?act=logout">Log out.</a>';


to this:
Code: Select all
echo 'Logged in as <b>'.($username ? $user_name[$username] : (cookie ? $user_name[$_COOKIE['login_username']] : $user_name[$_SESSION['login_username']])).'</b>. <br /><a href="'.$PHP_SELF.'?act=logout">Log out.</a>';
User avatar
FI-DD
Admin
 
Posts: 2971
Joined: Thu Sep 22, 2005 11:27 am
Location: Germany

Postby faustao » Sat Dec 06, 2008 4:47 am

Thank you FI-DD. You are the best.
faustao
 
Posts: 8
Joined: Fri Nov 28, 2008 10:10 am
Location: Brazil

Postby Triton » Wed Mar 11, 2009 7:24 am

I was having trouble with this one too, but then I think that I fixed it. My problem was related to something brought up in another post, so I posted my fix there:
http://forums.cutenewsru.com/using-log- ... html#15693
Triton
 
Posts: 7
Joined: Tue Mar 10, 2009 2:00 pm

Postby DarkSlim » Mon Oct 12, 2009 4:44 pm

It's pretty buggy, but after some work I managed to make it work 100%!
The log in box itself does-not use iframe, but after the login, the welcome
message is in an iframe that I made to look normally (without borders etc')

This is my code (with my design etc' you can change it as you want):


This is the Login Box code that you put where you want it to
show in the page:
Code: Select all
<!------ Login Box------>
<? if (!$is_logged_in){ ?>
<div align="center">
<table border="0" cellspacing="0" cellpadding="0" width="138" align="center">
<form name="login" action="" method="post" onsubmit="return process_form(this)">
  <tr>
   <td width="55" style="font-size:14px;"><div align="left">User:</div></td>
   <td><input tabindex="1" type="text" name="username" value="<?=$lastusername; ?>" style="width:73px"></td>
  </tr>
  <tr>
   <td  style="font-size:14px;"><div align="left">Password:</div></td>
    <td><input type="password" name="password" style="width:73px"></td>
  </tr>
  <tr>
   <td></td>
   <td><div align="center"><input accesskey="s" type="submit" style="font-size:12px;width:45px;" value="Log In"></div></td>
   </tr>
   <tr>
    <td align="center" colspan="3"><font size="1"><?=$result; ?></td>
  </tr>
<input type="hidden" name="action" value="dologin">
</form>
</table></div>


<?
}

elseif ($is_logged_in){
?>

<iframe name="loginbox" src="cms/indexlog.php" width="138" height="100" frameborder="0" marginheight="0" marginwidth="0"  align="center">
  <font size="2">Your browser does not support I-Frames</font>
</iframe>
<?
}
?>
<!------ ENDLogin Box------>



* Change "cms/indexlog.php" to your location of the cutenews ru directory!

Then, make a new file in the cutenews ru directory called: indexlog.php,
and pase this inside (it is a modified version of cnru index.php):

Code: Select all
<?php

$PHP_SELF             = 'indexlog.php';
$config_cutenews_version = 'CuteNews.RU';
$config_cutenews_built    = '2.5.4';

#-------------------------------------------------------------------------------


include_once 'head.php';

@chmoddir($cutepath.'/data', chmod);
@chmoddir($cutepath.'/cache', chmod);
@chmod($cutepath.'/data', 0755);

$timer = new microTimer;
$timer->start();

if ($action == 'logout'){
   setcookie('md5_password', '', time() - 3600 * 24 * 365, '/');
   setcookie('username', '', time() - 3600 * 24 * 365, '/');
   setcookie('login_referer', '');
   @session_destroy();
   @session_unset();
   @setcookie(session_name(), '');
?>

<!-- Javascript redirect -->
<script type="text/javascript">self.location.href="<?=$_SERVER['PHP_SELF']; ?>";</script>

<?
}

b64dck();

// If User is Not Logged In, Display The Logout Message
if (!$is_logged_in){
   if (session){
      @session_destroy();
      @session_unset();
   }

   setcookie('username', '', time() - 3600 * 24 * 365, '/');
   setcookie('password', '');
   setcookie('md5_password', '', time() - 3600 * 24 * 365, '/');
   setcookie('login_referer', '');
   //echoheader('user', $echo['header']);
?>

<!-- The Logout Message -->
<br>You have logged out successfuly!

<?
   //echofooter();
} elseif ($is_logged_in){
   if (check_referer){
      $self = $_SERVER['SCRIPT_NAME'];

      if (!$self){
         $self = $_SERVER['REDIRECT_URL'];
      }

      if (!$self){
         $self = $PHP_SELF;
      }

      if (!eregi($self, $HTTP_REFERER) and $HTTP_REFERER){
         echo sprintf($echo['badReferer'], $PHP_SELF);
         exit;
      }
   }

   //Logged in Message
    echo '<div align="right" dir="rtl"><font size="1px" face="arial"><br><font size="2px">Welcome, <br><b>'.($username ? $username : (cookie ? $_COOKIE['login_username'] : $_SESSION['login_username'])).'</b>. <br /><br><a href="'.$PHP_SELF.'?action=logout">Log Out</a></div>';


}
?>



* I have adjusted it to english and all, but you may still need to change it a little bit (havn't checked)
so it will look perfectly as you want it (as I used it for a "right to left" language)

Thats it, you will be able to show a log in box without an iframe (while not logged in)
and when logging in, it is directing it to load a nice stealth iframe, and when logging out it
goes back to the awesome login box. :D

Hope that helps ^^
User avatar
DarkSlim
 
Posts: 298
Joined: Thu Aug 06, 2009 4:18 pm
Location: IL

Postby Goberg » Mon May 31, 2010 3:45 am

I have a problem with redirecting after logging in.

I have the login box in a file called view-films.php, this is also the file that i am showing the full story articles in. So if anyone is reading an article, say the url to the article is http://www.myurl.com/view-films.php?id=11 . The user could log in from this site but they get redirected to http://www.myurl.com/view-films.php instead of http://www.myurl.com/view-films.php?id=11.

I am using FIDDs original script and it is working good for me, I just want this redirection to work. Any help?
Goberg
 
Posts: 79
Joined: Thu Jan 18, 2007 2:31 pm

Postby DarkSlim » Mon May 31, 2010 7:56 am

Goberg wrote:I have a problem with redirecting after logging in.

I have the login box in a file called view-films.php, this is also the file that i am showing the full story articles in. So if anyone is reading an article, say the url to the article is http://www.myurl.com/view-films.php?id=11 . The user could log in from this site but they get redirected to http://www.myurl.com/view-films.php instead of http://www.myurl.com/view-films.php?id=11.

I am using FIDDs original script and it is working good for me, I just want this redirection to work. Any help?


I don't really use FI-DD's login box, but try this:

Find:
Code: Select all
   //The login box
   ?>
   <form method="post" action="<?=$PHP_SELF; ?>">


Now change the: <?=$PHP_SELF; ?>
To: http://www.myurl.com/view-films.php
The page that you want to be transfered to :)
User avatar
DarkSlim
 
Posts: 298
Joined: Thu Aug 06, 2009 4:18 pm
Location: IL

Postby Goberg » Mon May 31, 2010 9:41 am

DarkSlim wrote:Find:
Code: Select all
   //The login box
   ?>
   <form method="post" action="<?=$PHP_SELF; ?>">


Now change the: <?=$PHP_SELF; ?>
To: http://www.myurl.com/view-films.php
The page that you want to be transfered to :)


I don't want it to go to http://www.myurl.com/view-films.php , I want it to go to http://www.myurl.com/view-films.php?id={id} where {id} is the news-item the user is currently viewing.
Goberg
 
Posts: 79
Joined: Thu Jan 18, 2007 2:31 pm

PreviousNext

Return to Additional Downloads



Who is online

Users browsing this forum: No registered users and 0 guests

cron