Forum Affiliates Network Visit our post exchange directory
November 20, 2008, 06:50:42 PM
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
Welcome on the FAN forum!
Sign up and ask questions and get help about running forums and anything related to it!

 
Menu
  Global menu
     Home
     Forum
     PE directory
     Downloads
     Newsletters
  
  Article Categories
     Starting a forum
     Managing a forum
     Advertising
  
  About FAN
     Mission statement
     Link to us
     Contact
Welcome, Guest. Please login or register.
Did you miss your activation email?
November 20, 2008, 06:50:42 PM

Login with username, password and session length
Tags:
Pages: [1]   Go Down
  Send this topic  |  Print  
Author Topic: Can anyone help?  (Read 768 times)
0 Members and 1 Guest are viewing this topic.
Mrdudecool
Newcomer
**

Reputation: 0
Offline Offline

Admin experience:
Intermediate

Posts: 37


« on: April 24, 2007, 06:02:06 PM »

Hi,
I just need a bit of help on coding something.
I am going to use this portal linking to my forum and want it to show on the page by inserting this code into the index file. I have tried but can't get it to work so can anyone help?

Thanks
Mrdudecool
Logged
Sponsored links

Stop seeing these ads by signing up for a free account!
Harro
Big Boss
Administrator
Hero Member
*****



Reputation: 11
Offline Offline

Admin experience:
Advanced

Posts: 1953


WWW

Awards
« Reply #1 on: April 24, 2007, 09:46:32 PM »

What exactly do you want to show on the index file?
A link to the portal page?
If you explain a little more then maybe I can help you.
Logged
Mrdudecool
Newcomer
**

Reputation: 0
Offline Offline

Admin experience:
Intermediate

Posts: 37


« Reply #2 on: April 25, 2007, 06:03:34 PM »

Yeah
There is a code that should link the news onto a page on the site
You put it in the index file somewhere but i have had no luck
Logged
Harro
Big Boss
Administrator
Hero Member
*****



Reputation: 11
Offline Offline

Admin experience:
Advanced

Posts: 1953


WWW

Awards
« Reply #3 on: April 25, 2007, 07:31:00 PM »

Could you post your index.template.php file here?
And the code that needs to be added as well Smile
Logged
Mrdudecool
Newcomer
**

Reputation: 0
Offline Offline

Admin experience:
Intermediate

Posts: 37


« Reply #4 on: April 25, 2007, 08:15:15 PM »

<?PHP

/***************************************************************************
 CuteNews CutePHP.com
 Copyright (C) 2005 Georgi Avramov  (flexer@cutephp.com)
****************************************************************************/
                           
error_reporting (E_ALL ^ E_NOTICE);

require_once("./inc/functions.inc.php");
//#################

$PHP_SELF                                        = "index.php";
$cutepath                                        = ".";
$config_path_image_upload        = "./data/upimages";

$config_use_cookies = TRUE;  // Use Cookies When Checking Authorization
$config_use_sessions = FALSE;  // Use Sessions When Checking Authorization
$config_check_referer = TRUE; // Set to TRUE for more seciruty
//#################

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

// Check if CuteNews is not installed
$all_users_db = file("./data/users.db.php");
$check_users = $all_users_db;
$check_users[1] = trim($check_users[1]);
$check_users[2] = trim($check_users[2]);
if((!$check_users[2] or $check_users[2] == "") and (!$check_users[1] or $check_users[1] == "")){
    if(!file_exists("./inc/install.mdu")){ die('<h2>Error!</h2>CuteNews detected that you do not have users in your users.db.php file and wants to run the install module.<br>
    However, the install module (<b>./inc/install.mdu</b>) can not be located, please reupload this file and make sure you set the proper permissions so the installation can continue.'); }
    require("./inc/install.mdu");
    die();
}

require_once("./data/config.php");
if(isset($config_skin) and $config_skin != "" and file_exists("./skins/${config_skin}.skin.php")){
        require_once("./skins/${config_skin}.skin.php");
}else{
        $using_safe_skin = true;
        require_once("./skins/default.skin.php");
}

b64dck();
if($config_use_sessions){
@session_start();
@header("Cache-control: private");
}

if($action == "logout")
{
    setcookie("md5_password","");
        setcookie("username","");
        setcookie("login_referer","");

    if($config_use_sessions){
            @session_destroy();
            @session_unset();
            setcookie(session_name(),"");
        }
    msg("info", "Logout", "You are now logged out, <a href=\"$PHP_SELF\">login</a><br /><br>");
}


$is_loged_in = FALSE;
$cookie_logged = FALSE;
$session_logged = FALSE;
$temp_arr = explode("?", $HTTP_REFERER);
$HTTP_REFERER = $temp_arr[0];
if(substr($HTTP_REFERER, -1) == "/"){ $HTTP_REFERER.= "index.php"; }

// Check if The User is Identified


if($config_use_cookies == TRUE){
/* Login Authorization using COOKIES */

if(isset($username))
{
    if(isset($HTTP_COOKIE_VARS["md5_password"])){ $cmd5_password = $HTTP_COOKIE_VARS["md5_password"]; }
    elseif(isset($_COOKIE["md5_password"])){ $cmd5_password = $_COOKIE["md5_password"]; }
    else{ $cmd5_password = md5($password); }


    // Do we have correct username and password ?
    if(check_login($username, $cmd5_password))
    {
        if($action == 'dologin'){
                setcookie("lastusername", $username, time()+1012324305);
                if($rememberme == 'yes'){
                   setcookie("username", $username, time()+60*60*24*30);
                   setcookie("md5_password", $cmd5_password, time()+60*60*24*30);
                }
                else{
                   setcookie("username", $username);
                   setcookie("md5_password", $cmd5_password);
                }
        }

        $cookie_logged = TRUE;

    }else{
                   setcookie("username", FALSE);
                   setcookie("md5_password", FALSE);
        $result = "<font color=red>Wrong username or password</font>";
        $cookie_logged = FALSE;
    }
}
/* END Login Authorization using COOKIES */
}

if($config_use_sessions == TRUE){
/* Login Authorization using SESSIONS */
        if(isset($HTTP_X_FORWARDED_FOR)){ $ip = $HTTP_X_FORWARDED_FOR; }
        elseif(isset($HTTP_CLIENT_IP))        { $ip = $HTTP_CLIENT_IP; }
        if($ip == "")                                    { $ip = $REMOTE_ADDR; }
        if($ip == "")                                        { $ip = "not detected";}

if($action == "dologin")
{
        $md5_password = md5($password);
    if(check_login($username, $md5_password)){
                $session_logged = TRUE;

                @session_register('username');
                @session_register('md5_password');
                @session_register('ip');
                @session_register('login_referer');

                $_SESSION['username']                = "$username";
                $_SESSION['md5_password']         = "$md5_password";
                $_SESSION['ip']                                = "$ip";
                $_SESSION['login_referer']        = "$HTTP_REFERER";

        }else{
                $result = "<font color=red>Wrong username and/or password</font>";
                $session_logged = FALSE;
        }
}elseif(isset($_SESSION['username'])){ // Check the if member is using valid username/password
    if(check_login($_SESSION['username'], $_SESSION['md5_password'])){
        if($_SESSION['ip'] != $ip){ $session_logged = FALSE; $result = "The IP in the session doesn not match with your IP"; }
        else{ $session_logged = TRUE; }
        }else{
                $result = "<font color=red>Wrong username and/or password !!!</font>";
                $session_logged = FALSE;
        }
}

if(!$username){ $username = $_SESSION['username']; }
/* END Login Authorization using SESSIONS */
}

###########################

if($session_logged == TRUE or $cookie_logged == TRUE){
    if($action == 'dologin'){
        //-------------------------------------------
        // Modify the Last Login Date of the user
        //-------------------------------------------
        $old_users_db        = $all_users_db;
        $modified_users = fopen("./data/users.db.php", "w");
        foreach($old_users_db as $old_users_db_line){
           $old_users_db_arr = explode("|", $old_users_db_line);
            if($member_db[0] != $old_users_db_arr[0]){
                    fwrite($modified_users, "$old_users_db_line");
            }else{
                    fwrite($modified_users, "$old_users_db_arr[0]|$old_users_db_arr[1]|$old_users_db_arr[2]|$old_users_db_arr[3]|$old_users_db_arr[4]|$old_users_db_arr[5]|$old_users_db_arr[6]|$old_users_db_arr[7]|$old_users_db_arr[8]|".time()."||\n");
            }
        }
        fclose($modified_users);
        }

        $is_loged_in = TRUE;
}

###########################

// If User is Not Logged In, Display The Login Page
if($is_loged_in == FALSE)
{
    if($config_use_sessions){
            @session_destroy();
            @session_unset();
        }

//    setcookie("username","");
//    setcookie("password","");
//    setcookie("md5_password","");
//    setcookie("login_referer","");

    echoheader("user","Please Login");

    if($config_allow_registration == "yes"){ $allow_reg_status = "<a href='register.php'>(register)</a> "; }else{ $allow_reg_status = ""; }

    echo "
  <table width=\"100%\" border=0 cellpadding=1 cellspacing=0>
     <form  name=login action='$PHP_SELF' method=post>
     <tr>

       <td width=80>Username: </td>
       <td width='160'><input tabindex=1 type=text name=username value='$lastusername' style='width:150;'></td>
       <td>&nbsp;$allow_reg_status</a></td>
      </tr>
      <tr>
       <td>Password: </td>
       <td><input type=password name=password style='width:150'></td>
       <td>&nbsp;<a href='register.php?action=lostpass'>(lost password)</a> </td>
      </tr>
      <tr>

       <td></td>
       <td style='text-align:left'>
          <input accesskey='s' type=submit style=\"width:150; background-color: #F3F3F3;\" value='      Login...      '><br/>
       </td>
       <td style='text-align:left'><label for=rememberme title='Remmber me for 30 days, Do not use on Public-Terminals!'>
         <input id=rememberme type=checkbox value=yes style=\"border:0px;\" name=rememberme>
Remember Me</label> </td>
      </tr>

      <tr>
       <td align=center colspan=4 style='text-align:left;'>$result</td>
      </tr>
     <input type=hidden name=action value=dologin>
     </form>
    </table>";
                     
   echofooter();
}
elseif($is_loged_in == TRUE)
{

//----------------------------------
// Check Referer
//----------------------------------
if($config_check_referer == TRUE){
   $self = $_SERVER["SCRIPT_NAME"];
   if($self == ""){ $self = $_SERVER["REDIRECT_URL"]; }
   if($self == ""){ $self = "index.php"; }

   if(!eregi("$self",$HTTP_REFERER) and $HTTP_REFERER != ""){
       die("<h2>Sorry but your access to this page was denied !</h2><br>try to <a href=\"?action=logout\">logout</a> and then login again<br>To turn off this security check, change \$config_check_referer in index.php to FALSE");
   }
}
// ********************************************************************************
// Include System Module
// ********************************************************************************
if($HTTP_SERVER_VARS['QUERY_STRING'] == "debug"){ debug(); }

                            //name of mod   //access
    $system_modules = array('addnews' => 'user',
                            'editnews' => 'user',
                            'main' => 'user',
                            'options' => 'user',
                            'images' => 'user',
                            'editusers' => 'admin',
                            'editcomments' => 'admin',
                            'tools' => 'admin',
                            'ipban' => 'admin',
                            'about' => 'user',
                            'preview' => 'user',
                            'categories' => 'admin',
                            'massactions' => 'user',
                            'help' => 'user',
                            'snr' => 'admin',
                            'debug' => 'admin',
                            'wizards' => 'admin',
                            );


    if($mod == ""){ require("./inc/main.mdu"); }
    elseif( $system_modules[$mod] )
    {
        if(     $member_db[1] == 4 and $mod != 'options'){ msg('error', 'Error!', 'Access Denied for your user-level (commenter)'); }
        elseif( $system_modules[$mod] == "user"){ require("./inc/". $mod . ".mdu"); }
        elseif( $system_modules[$mod] == "admin" and $member_db[1] == 1){ require("./inc/". $mod . ".mdu"); }
        elseif( $system_modules[$mod] == "admin" and $member_db[1] != 1){ msg("error", "Access denied", "Only admin can access this module"); exit; }
        else{   die("Module access must be set to <b>user</b> or <b>admin</b>"); }
    }
    else{       die("$mod is NOT a valid module"); }
}

echo"<!-- execution time: ".$Timer->stop()." -->";
 

?>

Ok, that is a huge template, sorry.
Here is the thing that has to be added


<?PHP
 include("cutenews/show_news.php");
?>
Logged
Mrdudecool
Newcomer
**

Reputation: 0
Offline Offline

Admin experience:
Intermediate

Posts: 37


« Reply #5 on: April 26, 2007, 06:34:11 PM »

Anyone any idea or guess?
Logged
Harro
Big Boss
Administrator
Hero Member
*****



Reputation: 11
Offline Offline

Admin experience:
Advanced

Posts: 1953


WWW

Awards
« Reply #6 on: April 26, 2007, 09:14:58 PM »

To be honest I don't really understand what you need.
Where does this need to be added and what is it supposed to do?
Logged
Mrdudecool
Newcomer
**

Reputation: 0
Offline Offline

Admin experience:
Intermediate

Posts: 37


« Reply #7 on: April 26, 2007, 10:27:47 PM »

You add the code in there and it makes a frontpage on the site
Logged
Owner
Tech Support
Full Member
***

Reputation: 0
Offline Offline

Admin experience:
Professional

Posts: 185

Here to help


WWW
« Reply #8 on: July 27, 2007, 09:04:12 AM »

<?PHP

/***************************************************************************
 CuteNews CutePHP.com
 Copyright (C) 2005 Georgi Avramov  (flexer@cutephp.com)
****************************************************************************/
                           
error_reporting (E_ALL ^ E_NOTICE);

require_once("./inc/functions.inc.php");
//#################

$PHP_SELF                                        = "index.php";
$cutepath                                        = ".";
$config_path_image_upload        = "./data/upimages";

$config_use_cookies = TRUE;  // Use Cookies When Checking Authorization
$config_use_sessions = FALSE;  // Use Sessions When Checking Authorization
$config_check_referer = TRUE; // Set to TRUE for more seciruty
//#################

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

// Check if CuteNews is not installed
$all_users_db = file("./data/users.db.php");
$check_users = $all_users_db;
$check_users[1] = trim($check_users[1]);
$check_users[2] = trim($check_users[2]);
if((!$check_users[2] or $check_users[2] == "") and (!$check_users[1] or $check_users[1] == "")){
    if(!file_exists("./inc/install.mdu")){ die('<h2>Error!</h2>CuteNews detected that you do not have users in your users.db.php file and wants to run the install module.<br>
    However, the install module (<b>./inc/install.mdu</b>) can not be located, please reupload this file and make sure you set the proper permissions so the installation can continue.'); }
    require("./inc/install.mdu");
    die();
}
<?PHP
 include("cutenews/show_news.php");
?>   <--- Add it here.


require_once("./data/config.php");
if(isset($config_skin) and $config_skin != "" and file_exists("./skins/${config_skin}.skin.php")){
        require_once("./skins/${config_skin}.skin.php");
}else{
        $using_safe_skin = true;
        require_once("./skins/default.skin.php");
}

b64dck();
if($config_use_sessions){
@session_start();
@header("Cache-control: private");
}
« Last Edit: July 27, 2007, 09:05:15 AM by Owner » Logged

Tags:
Pages: [1]   Go Up
  Send this topic  |  Print  
 
Jump to:  

SEO and Advertising Techniques

Powered by MySQL Powered by PHP Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks

TinyPortal v0.9.8 © Bloc
Valid XHTML 1.0! Valid CSS!
Page created in 0.232 seconds with 29 queries.