bulgaria_mitko Posted December 19, 2006 Share Posted December 19, 2006 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 0Warning: 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> </td> <td><input type="submit" name="Submit" value="Вход" /></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 & 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] Quote Link to comment https://forums.phpfreaks.com/topic/31228-apache-crash-read-the-last-post-pls/ Share on other sites More sharing options...
HuggieBear Posted December 19, 2006 Share Posted December 19, 2006 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]<?phpob_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.RegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/31228-apache-crash-read-the-last-post-pls/#findComment-144433 Share on other sites More sharing options...
bulgaria_mitko Posted December 19, 2006 Author Share Posted December 19, 2006 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 0Warning: 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 ?! ??? :'( Quote Link to comment https://forums.phpfreaks.com/topic/31228-apache-crash-read-the-last-post-pls/#findComment-144443 Share on other sites More sharing options...
HuggieBear Posted December 19, 2006 Share Posted December 19, 2006 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 Quote Link to comment https://forums.phpfreaks.com/topic/31228-apache-crash-read-the-last-post-pls/#findComment-144445 Share on other sites More sharing options...
bulgaria_mitko Posted December 19, 2006 Author Share Posted December 19, 2006 Huggie, i use Dreamweaver and i created this code thanks to Server Behaviors->Log In User and Dreamweaver created for me. :-\ Quote Link to comment https://forums.phpfreaks.com/topic/31228-apache-crash-read-the-last-post-pls/#findComment-144492 Share on other sites More sharing options...
HuggieBear Posted December 19, 2006 Share Posted December 19, 2006 In that case, you should know what this is doing:[code=php:0]<?php virtual('/nimatest/Connections/nimatest.php'); ?>[/code] RegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/31228-apache-crash-read-the-last-post-pls/#findComment-144502 Share on other sites More sharing options...
JP128 Posted December 19, 2006 Share Posted December 19, 2006 Whenever I get that error, I type this as the very first...[code]<?phpob_start();?>[/code][code]<?phpob_end_flush();?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/31228-apache-crash-read-the-last-post-pls/#findComment-144573 Share on other sites More sharing options...
bulgaria_mitko Posted December 20, 2006 Author Share Posted December 20, 2006 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 21Warning: 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! Quote Link to comment https://forums.phpfreaks.com/topic/31228-apache-crash-read-the-last-post-pls/#findComment-145059 Share on other sites More sharing options...
HuggieBear Posted December 20, 2006 Share Posted December 20, 2006 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 Quote Link to comment https://forums.phpfreaks.com/topic/31228-apache-crash-read-the-last-post-pls/#findComment-145065 Share on other sites More sharing options...
bulgaria_mitko Posted December 20, 2006 Author Share Posted December 20, 2006 hey, Huggiei 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'); ?><?phpob_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] Quote Link to comment https://forums.phpfreaks.com/topic/31228-apache-crash-read-the-last-post-pls/#findComment-145082 Share on other sites More sharing options...
bulgaria_mitko Posted December 20, 2006 Author Share Posted December 20, 2006 can someone help me please??? ??? :'( :'( Quote Link to comment https://forums.phpfreaks.com/topic/31228-apache-crash-read-the-last-post-pls/#findComment-145367 Share on other sites More sharing options...
bulgaria_mitko Posted December 21, 2006 Author Share Posted December 21, 2006 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.dllszModVer : 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.dllszModVer : 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]<?phpob_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> </td> <td><input type="submit" name="Submit" value="Вход" /></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 & 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><?phpob_end_flush();?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/31228-apache-crash-read-the-last-post-pls/#findComment-145872 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.