Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Dec 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cant login on website

    Hello, i have website 9gag clone

    Problem is i cant login to website as member, and cant login in admin panel...


    but register work fine , even Facebook reg. work


    btw. login must redirect to setting.php

    here is code of login.php
    help !

    PHP Code:
    <?php 


    include("include/config.php"); 
    include(
    "include/functions/import.php"); 

    $redirect stripslashes($_REQUEST['redirect']); 
    $r base64_decode($redirect); 
    STemplate::assign('r',$r); 

    if (
    $_SESSION['USERID'] != "" && $redirect != ""

        
    header("Location:$redirect");exit; 


    if(
    $_REQUEST['logsub']!=""

        
    $username htmlentities(strip_tags($_REQUEST['username']), ENT_COMPAT"UTF-8"); 
        
    $password htmlentities(strip_tags($_REQUEST['password']), ENT_COMPAT"UTF-8"); 

        if(
    $username==""
        { 
            
    $error=$lang['4']; 
        } 
        elseif(
    $password==""
        { 
            
    $error=$lang['5']; 
        } 
        else 
        { 
            if(!
    verify_valid_email($username)) 
            {                 
                
    $encryptedpassword md5($password); 
                
    $query="SELECT status,USERID,email,username,verified,filter,mylang from members WHERE username='".mysql_real_escape_string($username)."' and password='".mysql_real_escape_string($encryptedpassword)."'"
                
    $result=$conn->execute($query); 
                 
                if(
    $result->recordcount()<1
                { 
                    
    $error=$lang['26']; 
                } 
                elseif(
    $result->fields['status']=="0"
                { 
                    
    $error $lang['30']; 
                } 
         
                if(
    $error==""
                { 
                    
    $query="update members set lastlogin='".time()."', lip='".$_SERVER['REMOTE_ADDR']."' WHERE username='".mysql_real_escape_string($username)."'"
                    
    $conn->execute($query); 
                    
    $_SESSION['USERID']=$result->fields['USERID']; 
                    
    $_SESSION['EMAIL']=$result->fields['email']; 
                    
    $_SESSION['USERNAME']=$result->fields['username']; 
                    
    $_SESSION['VERIFIED']=$result->fields['verified']; 
                    
    $_SESSION['FILTER']=$result->fields['filter']; 
                    
    $setlang $result->fields['mylang']; 
                    if(
    $setlang != ""
                    { 
                        
    $addlang "?language=".$setlang;     
                    } 
                    if(
    $_REQUEST["remember"]=="yes"
                    { 
                        
    create_slrememberme(); 
                    } 
                     
                    if(
    $redirect == ""
                    { 
                        
    header("Location:$config[baseurl]/settings".$addlang);exit; 
                    } 
                    else 
                    { 
                        
    header("Location:$redirect");exit; 
                    } 
         
                } 
            } 
            else 
            { 
                
    $encryptedpassword md5($password); 
                
    $query="SELECT status,USERID,email,username,verified,filter,mylang from members WHERE email='".mysql_real_escape_string($username)."' and password='".mysql_real_escape_string($encryptedpassword)."'"
                
    $result=$conn->execute($query); 
                 
                if(
    $result->recordcount()<1
                { 
                    
    $error=$lang['37']; 
                } 
                elseif(
    $result->fields['status']=="0"
                { 
                    
    $error $lang['30']; 
                } 
         
                if(
    $error==""
                { 
                    
    $query="update members set lastlogin='".time()."', lip='".$_SERVER['REMOTE_ADDR']."' WHERE username='".mysql_real_escape_string($username)."'"
                    
    $conn->execute($query); 
                    
    $_SESSION['USERID']=$result->fields['USERID']; 
                    
    $_SESSION['EMAIL']=$result->fields['email']; 
                    
    $_SESSION['USERNAME']=$result->fields['username']; 
                    
    $_SESSION['VERIFIED']=$result->fields['verified']; 
                    
    $_SESSION['FILTER']=$result->fields['filter']; 
                    
    $setlang $result->fields['mylang']; 
                    if(
    $setlang != ""
                    { 
                        
    $addlang "?language=".$setlang;     
                    } 
                    if(
    $_REQUEST["remember"]=="yes"
                    { 
                        
    create_slrememberme(); 
                    } 
                     
                    if(
    $redirect == ""
                    { 
                        
    header("Location:$config[baseurl]/settings".$addlang);exit; 
                    } 
                    else 
                    { 
                        
    header("Location:$redirect");exit; 
                        
    session_start(); 
                    } 
         
                } 
            } 
        } 


    $pagetitle $lang['11']; 
    STemplate::assign('pagetitle',$pagetitle); 
    STemplate::assign('error',$error); 

    //TEMPLATES BEGIN 
    STemplate::display('login.tpl'); 
    //TEMPLATES END 
    ?>

  • #2
    Senior Coder
    Join Date
    Apr 2011
    Location
    London, England
    Posts
    2,120
    Thanks
    15
    Thanked 354 Times in 353 Posts
    You would be better served posting in the correct (PHP) forum.
    "I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
    Validate your HTML and CSS

  • #3
    New to the CF scene
    Join Date
    Dec 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ups sorry btw can you help me?

  • #4
    Senior Coder
    Join Date
    Apr 2011
    Location
    London, England
    Posts
    2,120
    Thanks
    15
    Thanked 354 Times in 353 Posts
    Quote Originally Posted by tomex009 View Post
    ups sorry btw can you help me?
    Not just at the moment, sorry.
    "I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
    Validate your HTML and CSS


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •