• the install says that everything went fine but when i go to do the admin login i get the following error list
    Warning: Cannot modify header information – headers already sent by (output started at /home/mstamper/public_html/blog/wp-config.php:36) in /home/mstamper/public_html/blog/wp-login.php on line 123
    Warning: Cannot modify header information – headers already sent by (output started at /home/mstamper/public_html/blog/wp-config.php:36) in /home/mstamper/public_html/blog/wp-login.php on line 124
    Warning: Cannot modify header information – headers already sent by (output started at /home/mstamper/public_html/blog/wp-config.php:36) in /home/mstamper/public_html/blog/wp-login.php on line 126
    Warning: Cannot modify header information – headers already sent by (output started at /home/mstamper/public_html/blog/wp-config.php:36) in /home/mstamper/public_html/blog/wp-login.php on line 127
    Warning: Cannot modify header information – headers already sent by (output started at /home/mstamper/public_html/blog/wp-config.php:36) in /home/mstamper/public_html/blog/wp-login.php on line 128
    Warning: Cannot modify header information – headers already sent by (output started at /home/mstamper/public_html/blog/wp-config.php:36) in /home/mstamper/public_html/blog/wp-login.php on line 129
    Warning: Cannot modify header information – headers already sent by (output started at /home/mstamper/public_html/blog/wp-config.php:36) in /home/mstamper/public_html/blog/wp-login.php on line 149
    any help would be appreciated.
    thanks
    mark s

Viewing 15 replies - 1 through 15 (of 17 total)
  • Thread Starter mstamper

    (@mstamper)

    i read the faq and since i do not know heads or tails about php code i am including the contents of the wp-login.php file below. please show me what to edit and i will take care of it.
    would it be easier to just dump the whole file set and start over?
    thanks
    mark
    ———————————————————————————————-
    <?php
    require(dirname(__FILE__) . ‘/wp-config.php’);
    if (!function_exists(‘add_magic_quotes’)) {
    function add_magic_quotes($array) {
    foreach ($array as $k => $v) {
    if (is_array($v)) {
    $array[$k] = add_magic_quotes($v);
    } else {
    $array[$k] = addslashes($v);
    }
    }
    return $array;
    }
    }
    if (!get_magic_quotes_gpc()) {
    $_GET = add_magic_quotes($_GET);
    $_POST = add_magic_quotes($_POST);
    $_COOKIE = add_magic_quotes($_COOKIE);
    }
    $wpvarstoreset = array(‘action’,’mode’,’error’,’text’,’popupurl’,’popuptitle’);
    for ($i = 0; $i < count($wpvarstoreset); $i = $i + 1) {
    $wpvar = $wpvarstoreset[$i];
    if (!isset($$wpvar)) {
    if (empty($_POST[“$wpvar”])) {
    if (empty($_GET[“$wpvar”])) {
    $$wpvar = ”;
    } else {
    $$wpvar = $_GET[“$wpvar”];
    }
    } else {
    $$wpvar = $_POST[“$wpvar”];
    }
    }
    }
    switch($action) {
    case ‘logout’:
    setcookie(‘wordpressuser_’.$cookiehash, ” “, time() – 31536000, COOKIEPATH);
    setcookie(‘wordpresspass_’.$cookiehash, ” “, time() – 31536000, COOKIEPATH);
    header(‘Expires: Wed, 11 Jan 1984 05:00:00 GMT’);
    header(‘Last-Modified: ‘ . gmdate(‘D, d M Y H:i:s’) . ‘ GMT’);
    header(‘Cache-Control: no-cache, must-revalidate’);
    header(‘Pragma: no-cache’);
    if ($is_IIS) {
    header(‘Refresh: 0;url=wp-login.php’);
    } else {
    header(‘Location: wp-login.php’);
    }
    exit();
    break;
    case ‘login’:
    if(!empty($_POST)) {
    $log = $_POST[‘log’];
    $pwd = $_POST[‘pwd’];
    $redirect_to = $_POST[‘redirect_to’];
    }
    $user = get_userdatabylogin($log);
    if (0 == $user->user_level) {
    $redirect_to = get_settings(‘siteurl’) . ‘/wp-admin/profile.php’;
    }
    function login() {
    global $wpdb, $log, $pwd, $error, $user_ID;
    global $tableusers, $pass_is_md5;
    $user_login = &$log;
    $pwd = md5($pwd);
    $password = &$pwd;
    if (!$user_login) {
    $error = __(‘Error: the login field is empty.’);
    return false;
    }
    if (!$password) {
    $error = __(‘Error: the password field is empty.’);
    return false;
    }
    $query = “SELECT ID, user_login, user_pass FROM $tableusers WHERE user_login = ‘$user_login’ AND user_pass = ‘$password'”;
    $login = $wpdb->get_row($query);
    if (!$login) {
    $error = __(‘Error: wrong login or password.’);
    $pwd = ”;
    return false;
    } else {
    $user_ID = $login->ID;
    if (($pass_is_md5 == 0 && $login->user_login == $user_login && $login->user_pass == $password) || ($pass_is_md5 == 1 && $login->user_login == $user_login && $login->user_pass == md5($password))) {
    return true;
    } else {
    $error = __(‘Error: wrong login or password.’);
    $pwd = ”;
    return false;
    }
    }
    }
    if (!login()) {
    header(‘Expires: Wed, 11 Jan 1984 05:00:00 GMT’);
    header(‘Last-Modified: ‘ . gmdate(‘D, d M Y H:i:s’) . ‘ GMT’);
    header(‘Cache-Control: no-cache, must-revalidate’);
    header(‘Pragma: no-cache’);
    if ($is_IIS) {
    header(‘Refresh: 0;url=wp-login.php’);
    } else {
    header(‘Location: wp-login.php’);
    }
    exit();
    } else {
    $user_login = $log;
    $user_pass = $pwd;
    setcookie(‘wordpressuser_’.$cookiehash, $user_login, time() + 31536000, COOKIEPATH);
    setcookie(‘wordpresspass_’.$cookiehash, md5($user_pass), time() + 31536000, COOKIEPATH);
    header(‘Expires: Wed, 11 Jan 1984 05:00:00 GMT’);
    header(‘Last-Modified: ‘ . gmdate(‘D, d M Y H:i:s’) . ‘ GMT’);
    header(‘Cache-Control: no-cache, must-revalidate’);
    header(‘Pragma: no-cache’);
    switch($mode) {
    case ‘bookmarklet’:
    $location = “wp-admin/bookmarklet.php?text=$text&popupurl=$popupurl&popuptitle=$popuptitle”;
    break;
    case ‘sidebar’:
    $location = “wp-admin/sidebar.php?text=$text&popupurl=$popupurl&popuptitle=$popuptitle”;
    break;
    case ‘profile’:
    $location = “wp-admin/profile.php?text=$text&popupurl=$popupurl&popuptitle=$popuptitle”;
    break;
    default:
    $location = “$redirect_to”;
    break;
    }
    if ($is_IIS) {
    header(“Refresh: 0;url=$location”);
    } else {
    header(“Location: $location”);
    }
    }
    break;
    case ‘lostpassword’:
    ?>
    <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”&gt;
    <html xmlns=”https://www.w3.org/1999/xhtml”&gt;
    <head>
    <title><?php _e(‘WordPress » Lost password ?’) ?></title>
    <meta http-equiv=”Content-Type” content=”text/html; charset=<?php echo get_settings(‘blog_charset’); ?>” />
    <link rel=”stylesheet” href=”<?php echo get_settings(‘siteurl’); ?>/wp-admin/wp-admin.css” type=”text/css” />
    <script type=”text/javascript”>
    function focusit() {
    // focus on first input field
    document.lostpass.user_login.focus();
    }
    window.onload = focusit;
    </script>
    </head>
    <body>
    <div id=”login”>
    <?php _e(‘Please enter your information here. We will send you a new password.’) ?>
    <?php
    if ($error) echo “<div align=\”right\” style=\”padding:4px;\”><font color=\”#FF0000\”>$error</font>
     </div>”;
    ?>
    <form name=”” action=”wp-login.php” method=”post” id=”lostpass”>
    <input type=”hidden” name=”action” value=”retrievepassword” />
    <label><?php _e(‘Login:’) ?> <input type=”text” name=”user_login” id=”user_login” value=”” size=”12″ /></label>
    <label><?php _e(‘Email:’) ?> <input type=”text” name=”email” id=”email” value=”” size=”12″ /></label>
    <input type=”submit” name=”Submit2″ value=”OK” class=”search”>
    </form>
    </div>
    </body>
    </html>
    <?php
    break;
    case ‘retrievepassword’:
    $user_login = $_POST[“user_login”];
    $user_data = get_userdatabylogin($user_login);
    // redefining user_login ensures we return the right case in the email
    $user_login = $user_data[‘user_login’];
    $user_email = $user_data->user_email;
    if (!$user_email || $user_email != $_POST[’email’]) die(sprintf(__(‘Sorry, that user does not seem to exist in our database. Perhaps you have the wrong username or email address? Try again.’), ‘wp-login.php?action=lostpassword’));
    // Generate something random for a password… md5’ing current time with a rand salt
    $user_pass = substr((MD5(“time” . rand(1,16000))), 0, 6);
    // now insert the new pass md5’d into the db
    $wpdb->query(“UPDATE $tableusers SET user_pass = MD5(‘$user_pass’) WHERE user_login = ‘$user_login'”);
    $message = “Login: $user_login\r\n”;
    $message .= “Password: $user_pass\r\n”;
    $message .= ‘Login at: ‘ . get_settings(‘siteurl’) . ‘/wp-login.php’;
    $m = mail($user_email, ‘[‘ . get_settings(‘blogname’) . “] Your weblog’s login/password”, $message);
    if ($m == false) {
    echo “The email could not be sent.
    \n”;
    echo “Possible reason: your host may have disabled the mail() function…”;
    die();
    } else {
    echo “The email was sent successfully to $user_login’s email address.
    Click here to login!“;
    // send a copy of password change notification to the admin
    mail(get_settings(‘admin_email’), ‘[‘ . get_settings(‘blogname’) . “] Password Lost/Change”, “Password Lost and Changed for user: $user_login”);
    die();
    }
    break;
    default:
    if((!empty($_COOKIE[‘wordpressuser_’.$cookiehash])) && (!empty($_COOKIE[‘wordpresspass_’.$cookiehash]))) {
    $user_login = $_COOKIE[‘wordpressuser_’.$cookiehash];
    $user_pass_md5 = $_COOKIE[‘wordpresspass_’.$cookiehash];
    }
    function checklogin() {
    global $user_login, $user_pass_md5, $user_ID;
    $userdata = get_userdatabylogin($user_login);
    if ($user_pass_md5 != md5($userdata->user_pass)) {
    return false;
    } else {
    return true;
    }
    }
    if ( !(checklogin()) ) {
    if (!empty($_COOKIE[‘wordpressuser_’.$cookiehash])) {
    $error=”Error: wrong login/password”; //, or your session has expired.”;
    }
    } else {
    header(“Expires: Wed, 5 Jun 1979 23:41:00 GMT”); /* private joke: this is Michel’s birthdate – though officially it’s on the 6th, since he’s GMT+1 ?? */
    header(“Last-Modified: ” . gmdate(“D, d M Y H:i:s”) . ” GMT”); /* different all the time */
    header(“Cache-Control: no-cache, must-revalidate”); /* to cope with HTTP/1.1 */
    header(“Pragma: no-cache”);
    header(“Location: wp-admin/”);
    exit();
    }
    ?>
    <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”&gt;
    <html xmlns=”https://www.w3.org/1999/xhtml”&gt;
    <head>
    <title><?php printf(__(‘WordPress > %s > Login form’), get_settings(‘blogname’)) ?></title>
    <meta http-equi

    No, no need to start over.
    The error you got is caused by Whitespace.
    Somewhere before the very first
    <?php
    or after the last
    ?>
    is a whitespace or a carriage return. Get rid of that, and all will be well.
    Open wp-config.php in Notepad / BBEDit / WordPad or similar.
    Check that the very first thing, right at the start, is
    <?php
    Then check that the last thing is
    ?>
    If it looks that at the end, put the cursor between the ? and the >
    Then hold down the delete key for a moment or two
    You should have just a
    ?
    Type the > character, and then save. Do not press return. just save.
    that file should then work.

    did as you asked… same error. i have dumped the login file and uploaded the one from my local machine. ( i checked the local file first for the things you suggested and there were not any whitespaces)
    what do you suggest i try next?
    thanks for the help.
    mark

    Can you login ??

    I don’t understand … the install went okay, but the whitespace issue caused a problem.
    To remedy that, you’ve uploaded a new wp-config.php ?
    Did you complete the connection details in wp-config.php ?
    What happens if you try to login ?
    Do you get any error messages ?

    Thread Starter mstamper

    (@mstamper)

    okay, here is what i have done….
    wordpad wants to save the config file as wp-config.php.txt , i upload that file and then rename it as wp-config.php. i have done that 3 times.
    i have deleted the wp-login.php file and uploaded it 2 times, the second time i did as you asked and checked for the whitespace issue.
    i continue to get the error of Warning: Cannot modify header information – headers already sent by (output started at /home/mstamper/public_html/blog/wp-config.php:34) in /home/mstamper/public_html/blog/wp-login.php on line 123
    i also get this on lines 124, 126, 127, 128, 129, and 149.
    crazy huh?
    thanks
    mark

    Yes but what filetype is it ?

    Ignore what WordPad wants, to do just give it a .php extension.
    Try using Notepad.
    It must have a .php extension, and it mustn’t have any whitespace.
    A ‘headers already sent’ error means that there is whitespace there, and the error above shows it is in wp-config.php.
    Given that the install worked, there is something after the last ?>
    There literally can be *nothing at all* after that last >

    Thread Starter mstamper

    (@mstamper)

    i went into the cpanel editor and rechecked the end of the config file. there were 3 whitespaces. i deleted them and tried to login again…..SUCCESS!
    thanks everyone. i am a greatful newbie.
    later
    mark

    Yay !!!!

    Well it sounds OK but as an example if you change gif to jpg in the filename it does not change the file type. MS editors are notorious for screwing this up and adding an inappropriate extension.

    Thread Starter mstamper

    (@mstamper)

    new issue….. this is what i get after i post and then click on view site
    7/27/2004
    first blog post
    Filed under:
    Fatal error: Call to undefined function: the_category() in /home/mstamper/public_html/blog/index.php on line 40
    is there something else i need to check now?
    mark

    Are you on a Windows server MIIS ?

    Thread Starter mstamper

    (@mstamper)

    no i am being served on a
    linux version 2.4.26-hn-1.6-p4
    run on an apache (unix) version 1.3.31
    the mysql version is 4.0.20-standard
    the php version is 4.3.8

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘newbie – what did i do wrong?’ is closed to new replies.