Jump to content

Apache crash, read the last post, pls!


bulgaria_mitko

Recommended Posts

when i try to create my login.php page i get this error:

[i]Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent in F:\wamp\www\nimatest\admin\login.php on line 0

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at F:\wamp\www\nimatest\admin\login.php:0) in F:\wamp\www\nimatest\admin\login.php on line 61808[/i]

this is the code im useing:

[code]<?php virtual('/nimatest/Connections/nimatest.php'); ?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
  session_start();
}

$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
  $_SESSION['PrevUrl'] = $_GET['accesscheck'];
}

if (isset($_POST['Username'])) {
  $loginUsername=$_POST['Username'];
  $password=$_POST['Password'];
  $MM_fldUserAuthorization = "UserTypeID";
  $MM_redirectLoginSuccess = "/nimatest/admin/index.php";
  $MM_redirectLoginFailed = "/nimatest/admin/loginfailed.php";
  $MM_redirecttoReferrer = true;
  mysql_select_db($database_nimatest, $nimatest);
 
  $LoginRS__query=sprintf("SELECT Username, Password, UserTypeID FROM users WHERE Username='%s' AND Password='%s'",
  get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));
 
  $LoginRS = mysql_query($LoginRS__query, $nimatest) or die(mysql_error());
  $loginFoundUser = mysql_num_rows($LoginRS);
  if ($loginFoundUser) {
   
    $loginStrGroup  = mysql_result($LoginRS,0,'UserTypeID');
   
    //declare two session variables and assign them
    $_SESSION['MM_Username'] = $loginUsername;
    $_SESSION['MM_UserGroup'] = $loginStrGroup;      

    if (isset($_SESSION['PrevUrl']) && true) {
      $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
    }
    header("Location: " . $MM_redirectLoginSuccess );
  }
  else {
    header("Location: ". $MM_redirectLoginFailed );
  }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/Admin Layout.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Нима - Администрация - Вход</title>
<!-- InstanceEndEditable -->
<?php virtual('/nimatest/includes/header.php'); ?>
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
</head>
<body onload="MM_preloadImages('/nimatest/assets/images/navigation/aboutus-over.gif','/nimatest/assets/images/navigation/ourproducts-over.gif','/nimatest/assets/images/navigation/abouttea-over.gif','/nimatest/assets/images/navigation/brewingtea-over.gif')">
<?php virtual('/nimatest/includes/navigation.php'); ?>
  <tr>
    <td id="tdContent"><h1>Администрация: <!-- InstanceBeginEditable name="Section name" -->Вход<!-- InstanceEndEditable --> </h1>
      <!-- InstanceBeginEditable name="Body Contant" -->
      <form ACTION="<?php echo $loginFormAction; ?>" id="form1" name="form1" method="POST">
        <table>
          <tr>
            <td><label for="label">Потребител:</label></td>
            <td><input type="text" name="Username" id="Username" /></td>
          </tr>
          <tr>
            <td>Парола:</td>
            <td><label for="Password"></label>
            <input type="password" name="Password" id="Password" /></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td><input type="submit" name="Submit" value="&#1042;&#1093;&#1086;&#1076;" /></td>
          </tr>
        </table>
      </form>
      <!-- InstanceEndEditable --></td>
    <td id="tdSidebar"><a href="products.php" class="current"><img src="/nimatest/assets/images/navigation/bullet.gif" alt="" width="12" height="7" />Kettles &amp; Teapots </a><a href="product.php"><img src="/nimatest/assets/images/navigation/bullet.gif" alt="" width="12" height="7" />Teacloud Teas </a> </td>
  </tr>
<?php virtual('/nimatest/includes/footer.php'); ?>
</body>
<!-- InstanceEnd --></html>[/code]
[b]
i think it is something about this line of code:
<?php virtual('/nimatest/Connections/nimatest.php'); ?>
because i dont have a folder call Connentions and a pgae named nimatest.php, should i create it and what should i write inside of it? thank you very much![/b]
Link to comment
Share on other sites

The line you've included at the top of the page is a request to apache and is probably generating some content headers of some kind which is why you're getting the error.

You could changing this:

[code]<?php virtual('/nimatest/Connections/nimatest.php'); ?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
  session_start();
}
[/code]

To this:

[code]<?php
ob_start();
virtual('/nimatest/Connections/nimatest.php');
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
  session_start();
  ob_end_flush();
}
[/code]

...But I'm not sure that will work.

Regards
Huggie
Link to comment
Share on other sites

thanks, Huggie, but now im getting this error:

[i]Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at F:\wamp\www\nimatest\admin\login.php:3) in F:\wamp\www\nimatest\admin\login.php on line 0

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at F:\wamp\www\nimatest\admin\login.php:3) in F:\wamp\www\nimatest\admin\login.php on line 6644600[/i]

witch seems to be pritty much the same ?! ??? :'(
Link to comment
Share on other sites

I've just realised something you posted before...

[quote]
I think it is something about this line of code:
[code=php:0]<?php virtual('/nimatest/Connections/nimatest.php'); ?>[/code]
because i dont have a folder call Connentions and a pgae named nimatest.php, should i create it and what should i write inside of it? thank you very much!
[/quote]

Why's this line even in your code then?  I take it you didn't write this code?  If you didn't then you can't just randomly remove things.  It might be advisable to contact the person who wrote the code.

Huggie
Link to comment
Share on other sites

hey its me again! i removed the line in the code:

[code]<?php virtual('/nimatest/Connections/nimatest.php'); ?>[/code]

and now its not getting me this warning message anymore, i created my first username so i can login into my site but then when i try to loginto the site i get this error:

[b][i]Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in F:\wamp\www\nimatest\admin\login.php on line 21

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in F:\wamp\www\nimatest\admin\login.php on line 26[/i][/b]

can you please tell me whats going on? the code for login.php is the same exept for the line of code i already told you i removed. i really dont know why it dosent want me to login me into the site, can u help me pls? thank you!
Link to comment
Share on other sites

OK, looking at the code, I'm going to guess that this line...

[code=php:0]<?php virtual('/nimatest/Connections/nimatest.php'); ?>[/code]

Is including that file as that's where it's expecting the database connection code to be.  If you've removed that line from the code then that's why it's not working.

It's implying that you should have a separate file somewhere called nimatest.php with all your db connection code in it.  Do you have this file?

Huggie
Link to comment
Share on other sites

hey, Huggie

i just saw that dreamweaver auto created the folder and the file for me, here is the code that dreamweaver put in nimatest.php:

[code]<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_nimatest = "localhost";
$database_nimatest = "nimatest";
$username_nimatest = "root";
$password_nimatest = "123";
$nimatest = mysql_pconnect($hostname_nimatest, $username_nimatest, $password_nimatest) or trigger_error(mysql_error(),E_USER_ERROR);
?>[/code]

i added the line again to login.php (im just coping the first 3 lines of login.php):
[code]<?php virtual('/nimatest/Connections/nimatest.php'); ?>
<?php
ob_start();[/code]

but i still get this warning message (it is opening my page login.php, but at the very top it gives me this warning):
[b][i]Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent in F:\wamp\www\nimatest\admin\login.php on line 87685438[/i][/b]

Link to comment
Share on other sites

now this code is causing the apache2 to crash! and i get this error:

[b][i]szAppName : Apache.exe    szAppVer : 2.0.59.200    szModName : php5apache2.dll
szModVer : 5.2.0.0    offset : 00001549[/i][/b]

and before that i get this error:

[i][b]szAppName : Apache.exe    szAppVer : 2.0.59.200    szModName : php5st.dll
szModVer : 5.2.0.0    offset : 00001549[/b][/i]

but i changed the code and now i get the first error. Something really strange is going on with my code, can someone tell me where is my error?

[code]<?php
ob_start();
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
  session_start();
}

$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
  $_SESSION['PrevUrl'] = $_GET['accesscheck'];
}

# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_nimatest = "localhost";
$database_nimatest = "nimatest";
$username_nimatest = "root";
$password_nimatest = "123";
$nimatest = mysql_pconnect($hostname_nimatest, $username_nimatest, $password_nimatest) or trigger_error(mysql_error(),E_USER_ERROR);

if (isset($_POST['Username'])) {
  $loginUsername=$_POST['Username'];
  $password=$_POST['Password'];
  $MM_fldUserAuthorization = "UserTypeID";
  $MM_redirectLoginSuccess = "/nimatest/admin/index.php";
  $MM_redirectLoginFailed = "/nimatest/admin/loginfailed.php";
  $MM_redirecttoReferrer = true;
  mysql_select_db($database_nimatest, $nimatest);
 
  $LoginRS__query=sprintf("SELECT Username, Password, UserTypeID FROM users WHERE Username='%s' AND Password='%s'",
  get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));
 
  $LoginRS = mysql_query($LoginRS__query, $nimatest) or die(mysql_error());
  $loginFoundUser = mysql_num_rows($LoginRS);
  if ($loginFoundUser) {
   
    $loginStrGroup  = mysql_result($LoginRS,0,'UserTypeID');
   
    //declare two session variables and assign them
    $_SESSION['MM_Username'] = $loginUsername;
    $_SESSION['MM_UserGroup'] = $loginStrGroup;      

    if (isset($_SESSION['PrevUrl']) && true) {
      $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
    }
    header("Location: ". $MM_redirectLoginSuccess );
  }
  else {
    header("Location: ". $MM_redirectLoginFailed );
  }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/Admin Layout.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Нима - Администрация - Вход</title>
<!-- InstanceEndEditable -->
<?php virtual('/nimatest/includes/header.php'); ?>
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
</head>
<body onload="MM_preloadImages('/nimatest/assets/images/navigation/aboutus-over.gif','/nimatest/assets/images/navigation/ourproducts-over.gif','/nimatest/assets/images/navigation/abouttea-over.gif','/nimatest/assets/images/navigation/brewingtea-over.gif')">
<?php virtual('/nimatest/includes/navigation.php'); ?>
  <tr>
    <td id="tdContent"><h1>Администрация: <!-- InstanceBeginEditable name="Section name" -->Вход<!-- InstanceEndEditable --> </h1>
      <!-- InstanceBeginEditable name="Body Contant" -->
      <form ACTION="<?php echo $loginFormAction; ?>" id="form1" name="form1" method="POST">
        <table>
          <tr>
            <td><label for="label">Потребител:</label></td>
            <td><input type="text" name="Username" id="Username" /></td>
          </tr>
          <tr>
            <td>Парола:</td>
            <td><label for="Password"></label>
            <input type="password" name="Password" id="Password" /></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td><input type="submit" name="Submit" value="&#1042;&#1093;&#1086;&#1076;" /></td>
          </tr>
        </table>
      </form>
      <!-- InstanceEndEditable --></td>
    <td id="tdSidebar"><a href="products.php" class="current"><img src="/nimatest/assets/images/navigation/bullet.gif" alt="" width="12" height="7" />Kettles &amp; Teapots </a><a href="product.php"><img src="/nimatest/assets/images/navigation/bullet.gif" alt="" width="12" height="7" />Teacloud Teas </a> </td>
  </tr>
<?php virtual('/nimatest/includes/footer.php'); ?>
</body>
<!-- InstanceEnd --></html>
<?php
ob_end_flush();
?>[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.