I have a liitle problem,any chance you could have a look..

Discussion in 'PHP' started by flippa, Nov 8, 2009.

  1. #1
    Hi

    I have uploaded a script,done all thing right,site runs great but when i go to login in to admin i keep getting this coming up in the browser..

    /admin/index.php?error=wu

    so i have gone to php myadmin and checked the user name and password there and i'm using the rights one's,

    but still i can't access the admin panel,heres the admin/index.php part on the above error,

    <script language="JavaScript">
    <?php
    if(isset($error))
    {
    if($error=="wu")print("alert('Invalid Username and password!');");
    if($error=="lo")print("alert('Your session has expired!');");
    }
    ?>
    </script>

    if you can help me i would be most greatful
     
    flippa, Nov 8, 2009 IP
  2. ShadyStudent

    ShadyStudent Peon

    Messages:
    341
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #2
    We need to see the script or part of the script that redirects to this index.php page. The code you pasted doesn't help. Also please use php or code tags. :)

    It might look like this:
    header("Location: /admin/index.php?error=wu")
    PHP:
     
    ShadyStudent, Nov 8, 2009 IP
  3. flippa

    flippa Guest

    Messages:
    53
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    }

    else

    {

    header("Location: index.php?error=wu");

    exit;

    }

    ?>

    Hi sorry don't know what php or code tags is or are
     
    flippa, Nov 8, 2009 IP
  4. ShadyStudent

    ShadyStudent Peon

    Messages:
    341
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #4
    We still need to see the rest of the code and just put "
    " and "[php]" around the code you paste.
    
    You need to show us all code that you think is relevant to solve this problem. The code you have shown us now can tell  us nothing at all in terms of what the problem can be!
    
    Also put error_reporting on as this may reveal something. Put this at the top of all your scripts or change your php.ini:
    
    [php]error_reporting(E_ALL | E_STRICT);
    PHP:
     
    ShadyStudent, Nov 8, 2009 IP
  5. flippa

    flippa Guest

    Messages:
    53
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    <?
    
    include '../conf/config.php';
    
    include '../conf/opendb.php';
    
    
    
    
    
    
    $username=trim($username);
    
    $password=trim($lpassword);
    
    
    
    $sql="select password from admin_autooptout where username='$username'";
    
    $result=mysql_query($sql);
    
    while($row=mysql_fetch_array($result))
    
    {
    
    	$dbpass=$row[0];
    
    }
    
    if($dbpass==$password)
    
    {
    
    	session_start();
    
    	$admin_username=$username;
    
    	session_register("admin_username");
    
    }
    
    else
    
    {
    
    	header("Location: index.php?error=wu");
    
    	exit;
    
    }
    
    ?>[php]
    PHP:
     
    Last edited: Nov 8, 2009
    flippa, Nov 8, 2009 IP
  6. ShadyStudent

    ShadyStudent Peon

    Messages:
    341
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Have you created the database? Did you provide the correct database username/password?

    Btw, do you know the script you are installing and what it does?
     
    ShadyStudent, Nov 8, 2009 IP
  7. flippa

    flippa Guest

    Messages:
    53
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Hi

    Thanks for the info,yes used the right database user/pw yes the script is a store its only small 180 files,so you think it should be ok,i will greate another db and run the install again,

    thanks for your help
     
    flippa, Nov 8, 2009 IP
  8. flippa

    flippa Guest

    Messages:
    53
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Hi

    what do you mean change your php.ini:mybe i can try that

    thanks
     
    flippa, Nov 8, 2009 IP
  9. ShadyStudent

    ShadyStudent Peon

    Messages:
    341
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #9
    It looks like a script you bought or is pre-made and it should require minimal changes. I don't changing anything in the php.ini fille will help.

    But do put error_reporting (that line of code I have you) on those two scripts you showed me. Also do you have access to your error_log?
     
    ShadyStudent, Nov 8, 2009 IP
  10. flippa

    flippa Guest

    Messages:
    53
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Hi
    I put the error_reporting on top like you said i am now receiving this

    error_reporting(E_ALL | E_STRICT);
    Warning: Cannot modify header information - headers already sent by (output started at /home/sell/public_html/admin/login.php:2) in /home/sell/public_html/admin/login.php on line 29

    When i try and login in the adminpanel:

    And this is the line 29 in admin login.php

    header("Location: index.php?error=wu");
     
    flippa, Nov 8, 2009 IP
  11. ShadyStudent

    ShadyStudent Peon

    Messages:
    341
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #11
    Can you use full php tags:

    
    <? //not this
    
    <?php //use this
    
    PHP:
    Also make sure there is no white space before this tag. Also what version of PHP are you using?
     
    ShadyStudent, Nov 8, 2009 IP
  12. flippa

    flippa Guest

    Messages:
    53
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #12
    hi

    PHP version 5.2.11

    hope this helps
     
    flippa, Nov 8, 2009 IP
  13. ShadyStudent

    ShadyStudent Peon

    Messages:
    341
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #13
    The above will just solve that warning but not the actual problem.

    When you said you checked db for username/password - is the password in the clear, I mean plain text and you can see it?

    What about that error_log, anything?
     
    ShadyStudent, Nov 8, 2009 IP
  14. flippa

    flippa Guest

    Messages:
    53
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #14
    Yes double checked the db user/pw in clear txt and every thing is as it should be,

    any other ideas,and thanks for your help
     
    flippa, Nov 8, 2009 IP
  15. ShadyStudent

    ShadyStudent Peon

    Messages:
    341
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #15
    Ok, can you do this:

    print_r($row); $dbpass=$row[0];
    PHP:
    Put this above that line and remove or comment out the header redirection. Paste the output you get here, you can hide some details if you want such as username/password.
     
    ShadyStudent, Nov 8, 2009 IP
  16. melol2

    melol2 Active Member

    Messages:
    511
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    80
    #16
    That error means that you have already output data to the browser before you used the header() or session_start() functions. Before that, is anything being echoed to the screen or is any HTML output to the screen?
     
    melol2, Nov 8, 2009 IP
  17. ShadyStudent

    ShadyStudent Peon

    Messages:
    341
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #17
    I don't think this would be causing the inability to login problem.
     
    ShadyStudent, Nov 8, 2009 IP
  18. melol2

    melol2 Active Member

    Messages:
    511
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    80
    #18
    This is true. But it would fix the problem he stated in his previous post. And that problem must be corrected before any others can be taken care of.
     
    melol2, Nov 8, 2009 IP
  19. flippa

    flippa Guest

    Messages:
    53
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #19
    Hi

    I have got it to work in the end,i just want to thank you very much for helping me,all i done was php_flag register_globals on in the .htaccess
    and all is well,

    regards
     
    flippa, Nov 9, 2009 IP