Login failure (cannot modify header) PHP/MySQL

I have a login form 100% Dreamweaver8 built using PHP/MySQL.
After logging in it fails to goto the $MM_redirectLoginSuccess page
(index.php). I did not have this issue prior to the 8.02 update. I
designed it the same way as I had before the 8.02 update. I have
checked multiple times for whitespace before and after the PHP open
and close tags in Dreamweaver and other text editors.
Below is what info is needed I hope.
Error
PHP Warning: Cannot modify header information - headers
already sent by (output started at /var/www/web4/web/login.php:4)
in /var/www/web4/web/login.php on line 72, referer:
Code (All Dreamweaver 8 Generated)
<?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 = "Account_Type";
$MM_redirectLoginSuccess = "index.php";
$MM_redirectLoginFailed = "loginfailed.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_dnsturtle, $dnsturtle);
$LoginRS__query=sprintf("SELECT Email, Password,
Account_Type FROM accounts WHERE Email=%s AND Password=%s",
GetSQLValueString($loginUsername, "text"),
GetSQLValueString($password, "text"));
$LoginRS = mysql_query($LoginRS__query, $dnsturtle) or
die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = mysql_result($LoginRS,0,'Account_Type');
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;
if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
header("Location: " . $MM_redirectLoginSuccess );
--------------------Line 72
else {
header("Location: ". $MM_redirectLoginFailed );
?>

I take it you have an include file as well on the page, to
reference the
database? Check in there for whitespace.
Gareth
http://www.phploginsuite.co.uk/
PHP Login Suite V2 - 34 Server Behaviors to build a complete
Login system.

Similar Messages

  • PHP login - Warning: Cannot modify header information

    I don't know much about PHP so if this is a FAQ / basic
    problem then sorry
    ... but I get this warning message on a page after logging in
    Warning: Cannot modify header information - headers already
    sent by (output
    started at /home/.sites/78/site58/web/elite/index.php:2) in
    /home/.sites/78/site58/web/elite/index.php on line 40
    Any help appreciated!
    Gerry

    Ah - I get it, a space before the code.
    G
    "G" <[email protected]> wrote in message
    news:e34m08$3kv$[email protected]..
    >I don't know much about PHP so if this is a FAQ / basic
    problem then sorry
    >... but I get this warning message on a page after
    logging in ...
    >
    >
    > Warning: Cannot modify header information - headers
    already sent by
    > (output started at
    /home/.sites/78/site58/web/elite/index.php:2) in
    > /home/.sites/78/site58/web/elite/index.php on line 40
    >
    > Any help appreciated!
    >
    > Gerry
    >

  • Warning: Cannot modify header information..../includes/common/KT_functions.inc.php on line 465

    Hi,
    I've moved a website from a server to another, and have got this little issue,
    I've a form witch gets submit and the user redirects to a "thank you" page, on the submittion I've added mail send so I get an email when the form is submitted, the mail part works fine, I get the emails. but after clicking the submit button this error comes up instead of redirecting to the thank you page.
    Warning:  Cannot modify header information - headers already sent by (output started at ..../index.php:79) in /...../includes/common/KT_functions.inc.php on line 465
    This is the KT_functions.inc.php part,
    function KT_redir($url) {
        $protocol = "http://";
        $server_name = $_SERVER["HTTP_HOST"];
        if ($server_name != '') {
            $protocol = "http://";
            if (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == "on")) {
                $protocol = "https://";
            if (preg_match("#^/#", $url)) {
                $url = $protocol.$server_name.$url;
            } else if (!preg_match("#^[a-z]+://#", $url)) {
                $script = KT_getPHP_SELF();
                if (isset($_SERVER['PATH_INFO']) && $_SERVER['PATH_INFO'] != '' && $_SERVER['PATH_INFO'] != $_SERVER['PHP_SELF']) {
                    $script = substr($script, 0, strlen($script) - strlen($_SERVER['PATH_INFO']));
                $url = $protocol.$server_name.(preg_replace("#/[^/]*$#", "/", $script)).$url;
                    session_write_close();
            $url = str_replace(" ","%20",$url);
            if (KT_is_ajax_request()) {
                header("Kt_location: ".$url);
                echo "Redirecting to: " . $url;
            else {
                header("Location: ".$url);
        exit;
    I'm not a coder and appreciate any help.
    Thanks in advance.

    addField("fornamn", true, "text", "", "", "", "Vänligen skriv ditt namn"); $formValidation->addField("efternamn", true, "text", "", "", "", "Vänligen skriv efternamn"); $formValidation->addField("gatu", true, "text", "", "", "", "Vänligen skriv gatuadress"); $formValidation->addField("postnummer", true, "text", "", "", "", "Vänligen ange postnummer"); $formValidation->addField("ort", true, "text", "", "", "", "Vänligen skriv ort"); $formValidation->addField("telefon", true, "numeric", "int", "5", "", "Vänligen skriv ett giltilgt telefon nummer"); $formValidation->addField("epost", true, "text", "email", "", "", "Vänligen skriv en e-post adress. dit skickar vi status på din service"); $tNGs->prepareValidation($formValidation); // End trigger //start Trigger_SendEmail trigger //remove this line if you want to edit the code by hand function Trigger_SendEmail(&$tNG) {   $emailObj = new tNG_Email($tNG);   $emailObj->setFrom("[email protected]");   $emailObj->setTo("{epost}");   $emailObj->setCC("");   $emailObj->setBCC("[email protected]");   $emailObj->setSubject("Upplåsning: {modell} Nr: {id}");   //WriteContent method   $emailObj->setContent("Hej {fornamn},
    \n");   $emailObj->setEncoding("UTF-8");   $emailObj->setFormat("HTML/Text");   $emailObj->setImportance("Normal");   return $emailObj->Execute(); } //end Trigger_SendEmail trigger if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") {   $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;   $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);   switch ($theType) {     case "text":       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";       break;        case "long":     case "int":       $theValue = ($theValue != "") ? intval($theValue) : "NULL";       break;     case "double":       $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";       break;     case "date":       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";       break;     case "defined":       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;       break;   }   return $theValue; } } $colname_phone = "-1"; if (isset($_GET['mobil_id'])) {   $colname_phone = $_GET['mobil_id']; } mysql_select_db($database_wd, $wd); $query_phone = sprintf("SELECT * FROM mobiler WHERE id = %s", GetSQLValueString($colname_phone, "int")); $phone = mysql_query($query_phone, $wd) or die(mysql_error()); $row_phone = mysql_fetch_assoc($phone); $totalRows_phone = mysql_num_rows($phone); // Make an insert transaction instance $ins_bestall = new tNG_insert($conn_wd); $tNGs->addTransaction($ins_bestall); // Register triggers $ins_bestall->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Insert1"); $ins_bestall->registerTrigger("BEFORE", "Trigger_Default_FormValidation", 10, $formValidation); $ins_bestall->registerTrigger("END", "Trigger_Default_Redirect", 99, "http://domain.com/---------.html"); $ins_bestall->registerTrigger("AFTER", "Trigger_SendEmail", 98); // Add columns $ins_bestall->setTable("bestall"); $ins_bestall->addColumn("fornamn", "STRING_TYPE", "POST", "fornamn"); $ins_bestall->addColumn("deb", "STRING_TYPE", "POST", "deb", "{phone.deb}"); $ins_bestall->addColumn("efternamn", "STRING_TYPE", "POST", "efternamn"); $ins_bestall->addColumn("gatu", "STRING_TYPE", "POST", "gatu"); $ins_bestall->addColumn("postnummer", "STRING_TYPE", "POST", "postnummer"); $ins_bestall->addColumn("ort", "STRING_TYPE", "POST", "ort"); $ins_bestall->addColumn("telefon", "NUMERIC_TYPE", "POST", "telefon"); $ins_bestall->addColumn("epost", "STRING_TYPE", "POST", "epost"); $ins_bestall->addColumn("modell", "STRING_TYPE", "POST", "modell"); $ins_bestall->addColumn("imei", "STRING_TYPE", "POST", "imei"); $ins_bestall->setPrimaryKey("id", "NUMERIC_TYPE"); // Execute all the registered transactions $tNGs->executeTransactions(); // Get the transaction recordset $rsbestall = $tNGs->getRecordset("bestall"); $row_rsbestall = mysql_fetch_assoc($rsbestall); $totalRows_rsbestall = mysql_num_rows($rsbestall); ?>  displayValidationRules();?> getErrorMsg(); ?>
    Modell:
    Pris:
    ------: Kr      -----      ----- ----
    Postförskott (Vi bjuder på postförskotts avgiften)       
    Förnamn:
              displayFieldHint("fornamn");?> displayFieldError("bestall", "fornamn"); ?>
    Efternamn:
              displayFieldHint("efternamn");?> displayFieldError("bestall", "efternamn"); ?>
    Gatuadress:
              displayFieldHint("gatu");?> displayFieldError("bestall", "gatu"); ?>
    Postnummer:
              displayFieldHint("postnummer");?> displayFieldError("bestall", "postnummer"); ?>
    Ort:
              displayFieldHint("ort");?> displayFieldError("bestall", "ort"); ?>
    Telefon:
              displayFieldError("bestall", "telefon"); ?>
    E-Post:
               displayFieldError("bestall", "epost"); ?>
              displayFieldHint("modell");?> displayFieldError("bestall", "modell"); ?>
    IMEI:
                    displayFieldHint("imei");?> displayFieldError("bestall", "imei"); ?>         -----.
    Debranding:
                Ja                        Nej
              ------           ";         }        else{           echo "Denna telefon kan ej debrandas!    Nej";         }?>         
    Here is the complete code for the form page, I've replaced some textes with "-------------"

  • Cannot Modify Header Information Errors

    Hello all,
    I am working on building an members only area to my website, and have used the "turorial" provided in dreamweaver help.  After creating the pages though I am encountering erros which I believe have to do with the redirecting.
    On my registration page (www.hondovfd.org/newsite/register.php) I am getting the error:
    Warning:  Cannot modify header information - headers already sent in /var/home/hondovfd/hondovfd.org/www/newsite/register.php on line 50
    The registration goes through, as I can see it in my database, but the error prevents anything further.
    On my login page (www.hondovfd.org/newsite/login.php) I immediatly get these two errors when loading the page:
    Warning:  session_start() [function.session-start]: Cannot send session cookie - headers already sent in /var/home/hondovfd/hondovfd.org/www/newsite/login.php on line 1074249146
    Warning:  session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /var/home/hondovfd/hondovfd.org/www/newsite/login.php:1074249146) in /var/home/hondovfd/hondovfd.org/www/newsite/login.php on line 1074249146
    And once I enter a valid username/password this error is also added:
    Warning: Cannot modify header information - headers already sent by (output started at /var/home/hondovfd/hondovfd.org/www/newsite/login.php:1074249146) in /var/home/hondovfd/hondovfd.org/www/newsite/login.php on line 68
    If you would like to try and diagnose the username/password I have been using is"test" for both fields.
    Anyone have any ideas why this is occuring?
    Thanks,
    David

    Here is the code from my login page:
    <?php virtual('/newsite/Connections/hondovfd.php');?>
    <?php if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    ?>
    <?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 = "";
      $MM_redirectLoginSuccess = "/newsite/membersonly.php";
      $MM_redirectLoginFailed = "/newsite/loginfailed.html";
      $MM_redirecttoReferrer = true;
      mysql_select_db($database_hondovfd, $hondovfd);
      $LoginRS__query=sprintf("SELECT username, password FROM login WHERE username=%s AND password=%s",
        GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
      $LoginRS = mysql_query($LoginRS__query, $hondovfd) or die(mysql_error());
      $loginFoundUser = mysql_num_rows($LoginRS);
      if ($loginFoundUser) {
         $loginStrGroup = "";
        //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/template.dwt" codeOutsideHTMLIsLocked="false" -->
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <!-- InstanceBeginEditable name="Title" -->
    <title>Login</title>
    <!-- InstanceEndEditable -->
    <meta name="description" content="Hondo Fire and Rescue serves the Arroyo Hondo and Canada Village areas of Santa Fe County, NM." />
    <meta name="keywords" content="hondo, hondo fire, hondo vfd, hondo fire department, santa fe county fire department, santa fe county, volunteer fire department, hondo volunteer fire department" />
    <link href="/newsite/stylesheet.css" type="text/css" rel="stylesheet" />
    <!--[if IE]>
    <style type="text/css">
    #mainContent, #sidebar1 { zoom: 1;}
    </style>
    <![endif]-->
    <script src="/newsite/SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
    <link href="/newsite/SpryAssets/SpryMenuBarVertical.css" rel="stylesheet" type="text/css" />
    </head>
    <body class="thrColLiqHdr">
    <div id="container">
    <div id="header"></div>
      <div id="sidebar1">
      <h3>Navigation : </h3>
      <ul id="MenuBar1" class="MenuBarVertical">
      <li><a href="/newsite/index.html">Home</a></li>
    <li><a href="/newsite/support.html">Support Hondo</a></li>
      <li><a class="MenuBarItemSubmenu" href="#">Information Menu</a>
        <ul>
          <li><a href="/newsite/people.html">Our People</a></li>
          <li><a href="http://www.google.com/maps/ms?ie=UTF8&hl=en&msa=0&msid=101620713606637979698.00045b6ead4ab4ea70b78&z=11" target="_blank">Response Area</a></li>
          <li><a href="/newsite/medical.html">Medical</a></li>
          <li><a href="/newsite/apparatus.html">Apparatus</a></li>
          <li><a href="/newsite/training.html">Training</a></li>
          <li><a href="/newsite/volunteer.html">Volunteer</a></li>
          <li><a href="/newsite/statistics.html">Statistics</a></li>
          <li><a href="/newsite/patchtrading.html">Patch Trading</a></li>
        </ul>
      </li>
      <li><a href="#">Photo Gallery</a></li>
      <li><a href="/newsite/calendar.html">Calendar</a></li>
      <li><a href="/newsite/news.html">Blog/News</a></li>
      <li><a href="/newsite/links.html">Links</a></li>
      <li><a href="/newsite/contact.html">Contact Us</a></li>
    </ul>
    <br />
    <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
      <span class="lefttext">
    <input type="hidden" name="cmd" value="_s-xclick">
    <input type="hidden" name="hosted_button_id" value="8567201">
    <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!" />
    <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
    </img></input></input>
      </span>
    </form>
    <span class="lefttext"><br />
    </span>
    <center>
      <span class="lefttext"><a href="http://www.facebook.com/pages/Santa-Fe-NM/Hondo-Volunteer-Fire-Department/74284233488" target="_blank" class="lefttext">Hondo VFD on Facebook</a></span>
    </center>
      <!-- end #sidebar1 --></div>
      <div id="sidebar2"> 
        <p>Call Statistics for November</p>
      <table width="90%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="60%">EMS Calls</td>
        <td width="40%">##</td>
      </tr>
      <tr>
        <td>Fire Calls</td>
        <td>##</td>
      </tr>
      <tr>
        <td>Other Calls</td>
        <td>##</td>
      </tr>
    </table>
      <hr />
        <div id="cse" style="width:100%;">Loading</div>
    <script src="http://www.google.com/jsapi" type="text/javascript"></script>
    <script type="text/javascript">
      google.load('search', '1');
      google.setOnLoadCallback(function(){
        new google.search.CustomSearchControl().draw('cse');
      }, true);
    </script>
         <!-- End Google Search Element -->
      </div>
      <!-- end #sidebar2 -->
      <div id="mainContent">
      <div class="top"></div><div class="wrap"><!-- InstanceBeginEditable name="Main Content" -->
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="47" class="h2">Members Only Login</td>
      </tr>
      <tr>
        <td><form id="login" name="login" method="POST" action="<?php echo $loginFormAction; ?>">
        <table width="40%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="31%">Username:</td>
        <td width="69%"><input name="username" type="text" /></td>
      </tr>
      <tr>
        <td>Password</td>
        <td><input name="password" type="password" /></td>
      </tr>
    </table>
    <input name="Submit" type="submit" />
        </form></td>
      </tr>
    </table>
      <!-- InstanceEndEditable -->
    </div>
    <div class="bottom"></div>
    </div>
         <!-- This clearing element should immediately follow the #mainContent div in order to force the #container div to contain all child floats --> <br class="clearfloat" />
      <div id="footer">
        <p align="center">&copy; Copyright 2009 Hondo Volunteer Fire Department | <a href="mailto:[email protected]">Contact Us</a><a href="http://www.legalhelpers.com/chapter-13-bankruptcy/chapter13.html"></a><br />Hosting provided by <a href="http://studiox.com/" target="_blank">Studio X</a></p>
      <!-- end #footer --></div>
    <!-- end #container --></div>
    <script type="text/javascript">
    <!--
    var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgRight:"../SpryAssets/SpryMenuBarRightHover.gif"});
    //-->
    </script>
    </body>
    <!-- InstanceEnd --></html>
    Here is the code from my registration page:
    <?php virtual('/newsite/Connections/hondovfd.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    // *** Redirect if username exists
    $MM_flag="MM_insert";
    if (isset($_POST[$MM_flag])) {
      $MM_dupKeyRedirect="/newsite/registerinvalidusername.html";
      $loginUsername = $_POST['username'];
      $LoginRS__query = sprintf("SELECT username FROM login WHERE username=%s", GetSQLValueString($loginUsername, "text"));
      mysql_select_db($database_hondovfd, $hondovfd);
      $LoginRS=mysql_query($LoginRS__query, $hondovfd) or die(mysql_error());
      $loginFoundUser = mysql_num_rows($LoginRS);
      //if there is a row in the database, the username was found - can not add the requested username
      if($loginFoundUser){
        $MM_qsChar = "?";
        //append the username to the redirect page
        if (substr_count($MM_dupKeyRedirect,"?") >=1) $MM_qsChar = "&";
        $MM_dupKeyRedirect = $MM_dupKeyRedirect . $MM_qsChar ."requsername=".$loginUsername;
        header ("Location: $MM_dupKeyRedirect");
        exit;
    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
      $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
      $insertSQL = sprintf("INSERT INTO login (username, password, email, name) VALUES (%s, %s, %s, %s)",
                           GetSQLValueString($_POST['username'], "text"),
                           GetSQLValueString($_POST['password'], "text"),
                           GetSQLValueString($_POST['email'], "text"),
                           GetSQLValueString($_POST['name'], "text"));
      mysql_select_db($database_hondovfd, $hondovfd);
      $Result1 = mysql_query($insertSQL, $hondovfd) or die(mysql_error());
      $insertGoTo = "/newsite/registersuccess.html";
      if (isset($_SERVER['QUERY_STRING'])) {
        $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
        $insertGoTo .= $_SERVER['QUERY_STRING'];
      header(sprintf("Location: %s", $insertGoTo));
    if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
      $insertSQL = sprintf("INSERT INTO login (username, password, email, name) VALUES (%s, %s, %s, %s)",
                           GetSQLValueString($_POST['username'], "text"),
                           GetSQLValueString($_POST['password'], "text"),
                           GetSQLValueString($_POST['email'], "text"),
                           GetSQLValueString($_POST['name'], "text"));
      mysql_select_db($database_hondovfd, $hondovfd);
      $Result1 = mysql_query($insertSQL, $hondovfd) or die(mysql_error());
      $insertGoTo = "/newsite/registersuccess.html";
      if (isset($_SERVER['QUERY_STRING'])) {
        $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
        $insertGoTo .= $_SERVER['QUERY_STRING'];
      header(sprintf("Location:", $insertGoTo));
    ?>
    <!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/template.dwt" codeOutsideHTMLIsLocked="false" -->
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <!-- InstanceBeginEditable name="Title" -->
    <title>Register</title>
    <!-- InstanceEndEditable -->
    <meta name="description" content="Hondo Fire and Rescue serves the Arroyo Hondo and Canada Village areas of Santa Fe County, NM." />
    <meta name="keywords" content="hondo, hondo fire, hondo vfd, hondo fire department, santa fe county fire department, santa fe county, volunteer fire department, hondo volunteer fire department" />
    <link href="stylesheet.css" type="text/css" rel="stylesheet" />
    <!--[if IE]>
    <style type="text/css">
    #mainContent, #sidebar1 { zoom: 1;}
    </style>
    <![endif]-->
    <script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
    <link href="SpryAssets/SpryMenuBarVertical.css" rel="stylesheet" type="text/css" />
    </head>
    <body class="thrColLiqHdr">
    <div id="container">
    <div id="header"></div>
      <div id="sidebar1">
      <h3>Navigation : </h3>
      <ul id="MenuBar1" class="MenuBarVertical">
      <li><a href="/newsite/index.html">Home</a></li>
    <li><a href="/newsite/support.html">Support Hondo</a></li>
      <li><a class="MenuBarItemSubmenu" href="#">Information Menu</a>
        <ul>
          <li><a href="/newsite/people.html">Our People</a></li>
          <li><a href="http://www.google.com/maps/ms?ie=UTF8&hl=en&msa=0&msid=101620713606637979698.00045b6ead4ab4ea70b78&z=11" target="_blank">Response Area</a></li>
          <li><a href="/newsite/medical.html">Medical</a></li>
          <li><a href="/newsite/apparatus.html">Apparatus</a></li>
          <li><a href="/newsite/training.html">Training</a></li>
          <li><a href="/newsite/volunteer.html">Volunteer</a></li>
          <li><a href="/newsite/statistics.html">Statistics</a></li>
          <li><a href="/newsite/patchtrading.html">Patch Trading</a></li>
        </ul>
      </li>
      <li><a href="#">Photo Gallery</a></li>
      <li><a href="/newsite/calendar.html">Calendar</a></li>
      <li><a href="/newsite/news.html">Blog/News</a></li>
      <li><a href="/newsite/links.html">Links</a></li>
      <li><a href="/newsite/contact.html">Contact Us</a></li>
    </ul>
    <br />
    <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
      <span class="lefttext">
    <input type="hidden" name="cmd" value="_s-xclick">
    <input type="hidden" name="hosted_button_id" value="8567201">
    <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!" />
    <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
    </img></input></input>
      </span>
    </form>
    <span class="lefttext"><br />
    </span>
    <center>
      <span class="lefttext"><a href="http://www.facebook.com/pages/Santa-Fe-NM/Hondo-Volunteer-Fire-Department/74284233488" target="_blank" class="lefttext">Hondo VFD on Facebook</a></span>
    </center>
      <!-- end #sidebar1 --></div>
      <div id="sidebar2"> 
        <p>Call Statistics for November</p>
      <table width="90%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="60%">EMS Calls</td>
        <td width="40%">##</td>
      </tr>
      <tr>
        <td>Fire Calls</td>
        <td>##</td>
      </tr>
      <tr>
        <td>Other Calls</td>
        <td>##</td>
      </tr>
    </table>
      <hr />
        <div id="cse" style="width:100%;">Loading</div>
    <script src="http://www.google.com/jsapi" type="text/javascript"></script>
    <script type="text/javascript">
      google.load('search', '1');
      google.setOnLoadCallback(function(){
        new google.search.CustomSearchControl().draw('cse');
      }, true);
    </script>
         <!-- End Google Search Element -->
      </div>
      <!-- end #sidebar2 -->
      <div id="mainContent">
      <div class="top"></div><div class="wrap"><!-- InstanceBeginEditable name="Main Content" -->
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="47" class="h2">Create an Account</td>
      </tr>
      <tr>
        <td><p>Please fill in the following information to create an account:</p>
        <form action="<?php echo $editFormAction; ?>" id="form1" name="form1" method="POST">
          <table width="53%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="38%">Name</td>
        <td width="62%"><input name="name" type="text" /></td>
      </tr>
      <tr>
        <td>E-Mail Address</td>
        <td><input name="email" type="text" /></td>
      </tr>
      <tr>
        <td>Desired Username</td>
        <td><input name="username" type="text" /></td>
      </tr>
      <tr>
        <td>Desired Password</td>
        <td><input name="password" type="password" /></td>
      </tr>
    </table><input name="submit" type="submit" />
    <input type="hidden" name="MM_insert" value="form1" />
    </p></form></td>
      </tr>
    </table>
      <!-- InstanceEndEditable -->
    </div>
    <div class="bottom"></div>
    </div>
         <!-- This clearing element should immediately follow the #mainContent div in order to force the #container div to contain all child floats --> <br class="clearfloat" />
      <div id="footer">
        <p align="center">&copy; Copyright 2009 Hondo Volunteer Fire Department | <a href="mailto:[email protected]">Contact Us</a><a href="http://www.legalhelpers.com/chapter-13-bankruptcy/chapter13.html"></a><br />Hosting provided by <a href="http://studiox.com/" target="_blank">Studio X</a></p>
      <!-- end #footer --></div>
    <!-- end #container --></div>
    <script type="text/javascript">
    <!--
    var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgRight:"../SpryAssets/SpryMenuBarRightHover.gif"});
    //-->
    </script>
    </body>
    <!-- InstanceEnd --></html>
    Dreamweaver also created this file:  hondovfd.php
    <?php
    # FileName="Connection_php_mysql.htm"
    # Type="MYSQL"
    # HTTP="true"
    $hostname_hondovfd = "localhost";
    $database_hondovfd = "hondovfd_org";
    $username_hondovfd = "silver";
    $password_hondovfd = "m3d1c4u2c";
    $hondovfd = mysql_pconnect($hostname_hondovfd, $username_hondovfd, $password_hondovfd) or trigger_error(mysql_error(),E_USER_ERROR);
    ?>

  • Error says: Warning: Cannot modify header information

    I keep receiving an error message after my form is sent (the form still send the information I need just wont re-direct to the next page)
    It redirects to a page that says:
    Warning: Cannot modify header information - headers already sent by (output started at /home/tommyle/public_html/newp.php:10) in /home/tommyle/public_html/newp.php on line 41
    my php code looks like this:
    <!doctype html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>Tommy Lemonade Beta</title>
    <link href="style1.css" rel="stylesheet" type="text/css">
    </head>
    <body>
    <?php
    /* Set e-mail recipient */
    $myemail = "profiles@tommylemonade";
    /* Check all form inputs using check_input function */
    $name = check_input($_POST['name'], "Enter your name");
    $subject = check_input($_POST['subject'], "Enter a subject");
    $email = check_input($_POST['email']);
    $message = check_input($_POST['message'], "Write your message");
    /* If e-mail is not valid show error message */
    if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $email))
    show_error("E-mail address not valid");
    /* Let's prepare the message for the e-mail */
    $message = "
    Name: $name
    E-mail: $email
    Subject: $subject
    Message:
    $message
    /* Send the message using mail() function */
    mail($myemail, $subject, $message);
    /* Redirect visitor to the thank you page */
    header('Location: thanks.html');
    exit();
    /* Functions we used */
    function check_input($data, $problem='')
    $data = trim($data);
    $data = stripslashes($data);
    $data = htmlspecialchars($data);
    if ($problem && strlen($data) == 0)
    show_error($problem);
    return $data;
    function show_error($myError)
    ?>
    <html>
    <body>
    <p>Please correct the following error:</p>
    <strong><?php echo $myError; ?></strong>
    <p>Hit the back button and try again</p>
    </body>
    </html>
    <?php
    exit();
    ?>
    </body>
    </html>
    This is line 41:
    header('Location: thanks.html');
    Can anybody see what I'm missing?

    Yeah, rework the code so you don't get any output before the php code is executed (like below):
    <?php
    /* Set e-mail recipient */
    $myemail = "profiles@tommylemonade";
    /* Check all form inputs using check_input function */
    $name = check_input($_POST['name'], "Enter your name");
    $subject = check_input($_POST['subject'], "Enter a subject");
    $email = check_input($_POST['email']);
    $message = check_input($_POST['message'], "Write your message");
    /* If e-mail is not valid show error message */
    if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $email))
    show_error("E-mail address not valid");
    /* Let's prepare the message for the e-mail */
    $message = "
    Name: $name
    E-mail: $email
    Subject: $subject
    Message: $message
    /* Send the message using mail() function */
    mail($myemail, $subject, $message);
    /* Redirect visitor to the thank you page */
    header('Location: thanks.html');
    exit();
    /* Functions we used */
    function check_input($data, $problem='')
    $data = trim($data);
    $data = stripslashes($data);
    $data = htmlspecialchars($data);
    if ($problem && strlen($data) == 0)
    show_error($problem);
    return $data;
    function show_error($myError)
    ?>
    <!doctype html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>Tommy Lemonade Beta</title>
    <link href="style1.css" rel="stylesheet" type="text/css">
    </head>
    <body>
    <p>Please correct the following error:</p>
    <strong><?php echo $myError; ?></strong>
    <p>Hit the back button and try again</p>
    </body>
    </html>
    <?php
    exit();
    ?>

  • Warning: Cannot modify header information

    Hi,
    When I submit a form I get
    Warning: Cannot modify header information - headers already sent by (output started at /home/aiop/public_html/events/registerEventWA.php:4) in /home/aiop/public_html/includes/common/KT_functions.inc.php on line 464
    I know this usually means i have a space either before the

    I have encountered that a few times, and always figured it out, it fixed itself, or, some other standard task remedied it, unknowingly to me.
    my mantra: I'm no guru!
    but ive seen this a few times and cant remember much details.
    I'm thinking it may have came once with SSI situations. Or it may have been something with improper syntax in my connection file. Sorry that's not a LOT of help, but i'll be lookin out and if i see it again soon, and / or if i remember the cause / remedy, i'll post.
    Best,
    ben blue

  • Cannot modify header information

    As a newby on databases. I am trying to forward a visitor to
    another page after completing their details on an insert record...
    But whatever I do I keep getting this error:
    Warning: Cannot modify header information - headers already
    sent by (output started at
    /content/StartupHostPlus/r/e/relishlunch.com/web/SignMeUp.php:1) in
    /content/StartupHostPlus/r/e/relishlunch.com/web/SignMeUp.php on
    line 52
    If I take out the redirection in the script it works ok but
    of course I don't get the redirection...
    Any ideas?

    colinwalton wrote:
    > As a newby on databases. I am trying to forward a
    visitor to another page after
    > completing their details on an insert record...
    >
    > But whatever I do I keep getting this error:
    > Warning: Cannot modify header information - headers
    already sent by (output
    > started at
    /content/StartupHostPlus/r/e/relishlunch.com/web/SignMeUp.php:1) in
    >
    /content/StartupHostPlus/r/e/relishlunch.com/web/SignMeUp.php on
    line 52
    "Headers already sent" is one of the most common errors that
    beginners
    run into. The header() function cannot perform the redirect
    if any
    output has been sent to the browser. This includes new lines
    or any
    whitespace outside the PHP tags.
    According to the error message, output was started at line 1
    of
    SignMeUp.php. Make sure there is nothing before the opening
    PHP tag.
    Also make sure there's no whitespace outside the PHP tags in
    RelishConnection.php.
    David Powers, Adobe Community Expert
    Author, "The Essential Guide to Dreamweaver CS3" (friends of
    ED)
    Author, "PHP Solutions" (friends of ED)
    http://foundationphp.com/

  • Php mysql login behavior

    Hi the list,
    I have a php/mysql site -, very simple. it's using the
    built-in user authentication behavior. this is fine, checks the
    database and either opens the correct page with a valid user/login
    or opens an error page, if there's no valid login and password set.
    what I need to do is to display a field based on the user and
    password on the receiving page, but I can't seem to get that to
    work. If I get rid of the built-in user authentication and just
    send the login and password to the receiving page as form
    variables, it works fine but then I don't have the error page
    behavior. I'm not a database guy, just kind of floundering here.Any
    help gratefully accepted.

    On Thu, 11 Oct 2007 20:47:04 +0000 (UTC), "paulelwood"
    <[email protected]> wrote:
    > what I need to do is to display a field based on the
    user and password on the
    >receiving page, but I can't seem to get that to work. If
    I get rid of the
    >built-in user authentication and just send the login and
    password to the
    >receiving page as form variables, it works fine but then
    I don't have the error
    >page behavior. I'm not a database guy, just kind of
    floundering here.Any help
    >gratefully accepted.
    Not quite sure what you mean ("display a field") but it
    sounds like
    you want the receiving page to display some information about
    the
    person who has logged in?
    In that case, in the code on your login page, after login has
    been
    verified but before the redirection to the receiving page,
    you should
    set a session variable to be the id of the person logging in.
    Then on
    your receiving page query the database for the person with
    that id and
    retrieve whatever you want. For example, get their given name
    and
    display a personalised welcome to them.
    Hope this is what you meant?
    Steve Fleischer
    steve at flyingtigerwebdesign dot com
    Hong Kong

  • AS3 / PHP / MySQL - login form

    Hello,
    I'm trying to create the most basic example I can of an AS3/PHP/MySQL interaction.  I want a Flash movie to check a user's login/pass against a DB.  I've tested the PHP code and know it's correct.  The problem must lie in the AS.  I've traced everything to make sure it goes out correctly, but it comes back as the variable names $user, $pass...and some other garbage... not the variable values I am expecting... see below.
    The PHP code correctly returns the following when tested in browser:  user=dan&pass=danpass&err=Success!
    The traced variables $user, $pass, $err return the following in Flash:
    undefined
    $pass
    $err";
        echo $returnString;
    ?>
    Here's the ActionScript:
    import flash.events.*;
    import flash.net.URLLoader;
    import flash.net.URLRequest;
    import flash.net.URLVariables;
    import flash.net.URLRequestMethod;
    logbtn.addEventListener(MouseEvent.CLICK, login)
    function login($e:MouseEvent){
      var myVariables:URLVariables = new URLVariables();
      var myRequest:URLRequest = new URLRequest("login.php");
      myRequest.method = URLRequestMethod.POST;
      myRequest.data = myVariables;
      var myLoader:URLLoader = new URLLoader;
      myLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
      myLoader.addEventListener(Event.COMPLETE, completeHandler);
      myVariables.user = loguser.text;
      myVariables.pass = logpass.text;
      myLoader.load(myRequest);
      function completeHandler(event:Event):void{
        trace(event.target.data.user);
        trace(event.target.data.pass);
        trace(event.target.data.err);
    And here's the PHP:
    <?php
      include_once "dbconnect.php";
      $user = $_POST['user'];
      $pass = $_POST['pass'];
      $sql = mysql_query("SELECT * FROM users WHERE user = '$user' AND pass = '$pass'");
      $check = mysql_num_rows($sql);
      if($check > 0){
        $row = mysql_fetch_array($sql);
        $user = $row["user"];
        $pass = $row["pass"];
        $err = "Success!";
        $returnString = "user=$user&pass=$pass&err=$err";
        echo $returnString;
    ?>
    Does anything stand out as being wrong?  I've gone over this for probably 10-15 hours trying different variations, tweaks, and reducing it in complexity.  I will really appreciate any help you can offer!  Thank you.
    -Eric

    Thanks Birnerseff! 
    I've been running the SWF from the same directory as the PHP script.  I just tried viewing it through my localhost and it worked!  I guess I'll have to do all my testing that way, but that's fine.
    Thank you very much.  I probably wouldn't have messed around with that for a long time otherwise.
    -Eric

  • CANNOT FIND mmhttpdb.php  and mysql.php  files

    does anyone know where I can download these two files from ? (in order to connect to database)
    mmhttpdb.php     mysql.php
    I deleted them accidentially.

    * Vista/Windows 7: C:\Program Files (x86)\Adobe\Adobe Dreamweaver CC\Configuration\DisabledFeatures
    * Mac OS X: /Applications/Adobe Dreamweaver CC/Configuration/DisabledFeatures
    If they no longer reside anywhere including your trash/recycle bin, you may need to re-install CC.
    Nancy O.

  • PHP MySQL Error Code 500

    May be someone can help me out with this problem.
    I have setup a new site using PHP MySQL and Dreamweaver 8.02.
    Dreamweaver connects to the database but after creating a
    recordset the recordset cannot be used.
    instead Dreamweaver returns:
    HTTP Error Code 500 internal Server Error
    Any help will be much appriciated.
    Jos

    Hello,
    I have also had the same error - namely that whilst I could connect via ftp, upload/download files, and view database tables, any attempt to view of modify recordsets resulted in error 500.
    Having checked other potential causes (e.g. selection/non-selection use of passive FTP setting, enabling of php, etc.), on the back of posts here I contacted my host and asked if if could relate to mod security, as further investigation revealed that the issue only occurred on sites where mod security had not been disabled (I don't like to disable mod security for obvious reasons - and I'm told you can't do that site by site with apache2 anyway).
    After a few false starts, the problem was resolved - with the following response from my host: "The false positives were being generated by "/_mmServerScripts/MMHTTPDB.php" and that is what we've worked around in the rules. As such, any domain on [servername] using that script in the same way shouldn't generate a false-positive moving forward."
    So it seems the answer (assuming your on an apache server of course) may be to modify the rules to allow full access for MMHTTPDB.php.
    I hope that is of help to some.

  • PHP/MySQL field recognize carriage returns?

    I'm a novice PHP/MySQL database driven site builder. I need
    to have users enter text into a field with carriage returns and
    have the database recognize and store those carriage returns so it
    displays when the data is displayed on a PHP page.
    How do I do this and please keep it simple?
    Do I need to use a particular type of MySQL datafield?
    Will I be able to use the same code on an "update"
    page?

    quote:
    Originally posted by:
    geschenk
    >>
    so it displays when the data is displayed on a PHP page
    >>
    if you just need to replace the \n - type line breaks
    generated by multiline textareas with <br /> on a page, just
    use PHP´s native "nl2br"
    (new line to break) function:
    <?php echo nl2br($row_queryname['field_name']); ?>
    That works... sort of...
    When I use the update page to modify the entry it puts the
    proper "br" code in it's proper place. However when I return to
    that page to edit the text again (as my customer likely will), it
    displays the "br" code in the text field, and if I submit the
    update with the "br" code in place, it duplicates the "br" code
    again, so I get double "br" statements. How do I get the update
    field to read the "br" code back as carriage returns?
    In addition, my insert page uses the following code to write
    the original entry, and I'm not sure where to place the "nl2br"
    statement in the following query (generated by WebAsssist DW
    extensions):
    <?php
    // WA Application Builder Insert
    if (isset($_POST["Insert_x"])) // Trigger
    $WA_connection = $nm_connect;
    $WA_table = "tb_news";
    $WA_sessionName = "WADA_Insert_tb_news";
    $WA_redirectURL = "tb_news_Results.php";
    $WA_keepQueryString = false;
    $WA_indexField = "id";
    $WA_fieldNamesStr =
    "sort|s_head|s_text|head|subhead|bodytext|photoid|photocaption|name|phone|email|linktitle |linkaddress|show_pfm|show_arch|show_cab";
    $WA_fieldValuesStr =
    "".((isset($_POST["sort"]))?$_POST["sort"]:"") ."" . "|" .
    "".((isset($_POST["s_head"]))?$_POST["s_head"]:"") ."" . "|" .
    "".((isset($_POST["s_text"]))?$_POST["s_text"]:"") ."" . "|" .
    "".((isset($_POST["head"]))?$_POST["head"]:"") ."" . "|" .
    "".((isset($_POST["subhead"]))?$_POST["subhead"]:"") ."" . "|" .
    "".((isset($_POST["bodytext"]))?$_POST["bodytext"]:"") ."" . "|" .
    "".((isset($_POST["photoid"]))?$_POST["photoid"]:"") ."" . "|" .
    "".((isset($_POST["photocaption"]))?$_POST["photocaption"]:"") .""
    . "|" . "".((isset($_POST["name"]))?$_POST["name"]:"") ."" . "|" .
    "".((isset($_POST["phone"]))?$_POST["phone"]:"") ."" . "|" .
    "".((isset($_POST["email"]))?$_POST["email"]:"") ."" . "|" .
    "".((isset($_POST["linktitle"]))?$_POST["linktitle"]:"") ."" . "|"
    . "".((isset($_POST["linkaddress"]))?$_POST["linkaddress"]:"") .""
    . "|" . "".((isset($_POST["show_pfm"]))?$_POST["show_pfm"]:"") .""
    . "|" . "".((isset($_POST["show_arch"]))?$_POST["show_arch"]:"")
    ."" . "|" . "".((isset($_POST["show_cab"]))?$_POST["show_cab"]:"")
    $WA_columnTypesStr =
    "none,none,NULL|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',n one,''|',none,''|',none,''|',none,''|',none,''|none,none,NULL|none,none,NULL|none,none,NUL L";
    $WA_fieldNames = explode("|", $WA_fieldNamesStr);
    $WA_fieldValues = explode("|", $WA_fieldValuesStr);
    $WA_columns = explode("|", $WA_columnTypesStr);
    $WA_connectionDB = $database_nm_connect;
    mysql_select_db($WA_connectionDB, $WA_connection);
    if (!session_id()) session_start();
    $insertParamsObj =
    WA_AB_generateInsertParams($WA_fieldNames, $WA_columns,
    $WA_fieldValues, -1);
    $WA_Sql = "INSERT INTO " . $WA_table . " (" .
    $insertParamsObj->WA_tableValues . ") VALUES (" .
    $insertParamsObj->WA_dbValues . ")";
    $MM_editCmd = mysql_query($WA_Sql, $WA_connection) or
    die(mysql_error());
    $_SESSION[$WA_sessionName] = mysql_insert_id();
    if ($WA_redirectURL != "") {
    if ($WA_keepQueryString && $WA_redirectURL != ""
    && isset($_SERVER["QUERY_STRING"]) &&
    $_SERVER["QUERY_STRING"] !== "" && sizeof($_POST) > 0) {
    $WA_redirectURL .= ((strpos($WA_redirectURL, '?') ===
    false)?"?":"&").$_SERVER["QUERY_STRING"];
    header("Location: ".$WA_redirectURL);
    ?>

  • Php/mysql: can't write to mysql database [SOLVED]

    I'm writing a login script using php and mysql. I got it to work on my server about a week ago, and then I set up apache, php and mysql on my netbook so that I could take my code with me and test it. Now it doesn't work. My registration script doesn't write to the mysql database but has no errors. Here is register.php:
    <?php
    define("DB_SERVER", "localhost");
    define("DB_USER", "root");
    define("DB_PASS", "swordfish");
    define("DB_NAME", "users");
    define("TBL_USERS", "users");
    $connection = mysql_connect(DB_SERVER, DB_USER, DB_PASS) or die(mysql_error());
    mysql_select_db(DB_NAME, $connection) or die(mysql_error());
    function addUser($username, $password)
    global $connection;
    $password = md5($password);
    echo("adding $username,$password<br />");
    $q = "INSERT INTO " . TBL_USERS . " VALUES ('$username', '$password')";
    echo("query: $q<br />");
    $result = mysql_query($q, $connection);
    echo("$result<br />");
    if (isset($_POST["reg"]))
    addUser($_POST["username"], $_POST["password"]);
    echo("<a href='index.php'>click here to login</a>");
    ?>
    <html>
    <head>
    <title>Register</title>
    </head>
    <body>
    <form method="Post" name="login">
    <input type="text", name="username" /> Username<br />
    <input type="text", name="password" /> Password<br />
    <input type="submit" name="reg", value="Register" />
    </form>
    </body>
    </html>
    and here is the output (without the form):
    adding lexion,6f1ed002ab5595859014ebf0951522d9
    query: INSERT INTO users VALUES ('lexion', '6f1ed002ab5595859014ebf0951522d9')
    Also, I tried manually adding the content to the database:
    $ mysql -p -u root
    Enter password:
    Welcome to the MySQL monitor. Commands end with ; or \g.
    Your MySQL connection id is 9
    Server version 5.1.42 Source distribution
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    mysql> users
    -> INSERT INTO users VALUES('lexion', 'foo')
    -> ^D
    -> Bye
    I would assume that I got something wrong with the last bit, but the php script seems like it should work. Does anybody know why it doesn't?
    Last edited by Lexion (2010-01-10 19:04:15)

    What is wrong with your PHP? Why do you think it is failing? An INSERT query doesn't return anything. Also, it's a good idea to specify which fields you are inserting into, unless you want to have to provide something for every field (tedious for tables with many fields with default values). eg:
    $q = "INSERT INTO `" . TBL_USERS . "`(`username`, `password`) VALUES ('$username', '$password')";
    As for your experiment with the mysql prompt; queries have to end with a semicolon. PHP is nice and hides that little detail from you.
    edit: Also, you're echoing text out before the HTML starts. That won't produce valid HTML. I also noticed a few other things which I corrected; look at my comments:
    <?php
    define("DB_SERVER", "localhost");
    define("DB_USER", "root");
    define("DB_PASS", "swordfish");
    define("DB_NAME", "users");
    define("TBL_USERS", "users");
    $connection = mysql_connect(DB_SERVER, DB_USER, DB_PASS) or die(mysql_error());
    mysql_select_db(DB_NAME, $connection) or die(mysql_error());
    function addUser($username, $password)
    global $connection;
    $password = md5($password);
    // echo("adding $username,$password<br />"); - Don't echo stuff before HTML starts.
    // Also, clean up user-supplied data before plugging it into a query unless you want to be vulnerable to SQL injection.
    $cleanusername = mysql_real_escape_string($username, $connection);
    $cleanpassword = mysql_real_escape_string($password, $connection); // Obviously you'd generally use some hashing algorithm like md5 or sha1 for passwords
    $q = "INSERT INTO `" . TBL_USERS . "`(`username`, `password`) VALUES ('{$cleanusername}', '{$cleanpassword}')"; // The backticks tell MySQL not to interpret any text within as a keyword (good for field names, eg a field called `date`. The curly brackets tell PHP that the stuff within refers to a variable; it's nice as PHP knows exactly what the variable name is with no possible ambiguity.
    // echo("query: $q<br />");
    $result = mysql_query($q, $connection);
    // echo("$result<br />"); - This won't do anything; in addition to INSERT queries not returning anything, the $result variable doesn't contain the results of the query, it's a pointer to them for use with mysql_result().
    ?>
    <html>
    <head>
    <title>Register</title>
    </head>
    <body>
    <?php
    if (isset($_POST["reg"]))
    addUser($_POST["username"], $_POST["password"]);
    echo("<a href='index.php'>click here to login</a>");
    ?>
    <form method="Post" name="login">
    <input type="text" name="username" /> Username<br />
    <input type="text" name="password" /> Password<br />
    <input type="submit" name="reg" value="Register" />
    </form>
    </body>
    </html>
    <?php
    mysql_close($connection); // Not strictly needed, as PHP will tidy up for you if you forget.
    ?>
    Last edited by Barrucadu (2010-01-10 17:34:20)

  • SP15 in Java engine failed, "Login Failure: all modules ignored"

    Hi
    During the installation of sp15 (with JSPM) failed, the sdm log shows:
    ERROR: Cannot connect to Host: [hostname] with user name: [J2EE_ADMIN]
    My instance was down so I started but now there is an error, when I try to log on to User management it give me the error: "Login Failure: all modules ignored".
    I checked the logs for the server and found the following:
    #1.5^H#0000000000000067000000250000596D00045A79FA4B224F#1225379843613#com.sap.engine.services.security.resource.ResourceHandl
    eImpl#sap.com/com.sap.security.core.admin#com.sap.engine.services.security.resource.ResourceHandleImpl#J2EE_GUEST#0##n/a##da7
    065c0a69511ddb438000000000000#SAPEngine_Application_Thread[impl:3]_15##0#0#Error#1#/System/Security/Audit/J2EE#Java###ACCESS.
    ERROR: Authorization check for caller assignment to J2EE resource [ : : : ].#4#SAP-J2EE-Engine#session-pool#ge
    t_session_pool#ALL#
    #1.5^H#0000000000000067000000260000596D00045A79FA4B32AC#1225379843613#com.sap.engine.services.security.authentication.loginco
    ntext#sap.com/com.sap.security.core.admin#com.sap.engine.services.security.authentication.logincontext#J2EE_GUEST#0##n/a##da7
    065c0a69511ddb438000000000000#SAPEngine_Application_Thread[impl:3]_15##0#0#Error##Java###Caller not authorized.
    [EXCEPTION]
    #1#com.sap.engine.services.security.exceptions.BaseSecurityException: Caller not authorized.
            at com.sap.engine.services.security.resource.ResourceHandleImpl.checkPermission(ResourceHandleImpl.java:627)
            at com.sap.engine.services.security.resource.ResourceHandleImpl.checkPermission(ResourceHandleImpl.java:513)
            at com.sap.engine.services.security.resource.ResourceContextImpl.checkPermission(ResourceContextImpl.java:45)
            at com.sap.engine.services.security.restriction.Restrictions.checkPermission(Restrictions.java:119)
            at com.sap.engine.services.security.server.AuthenticationContextImpl.getSessionPool(AuthenticationContextImpl.java:39
    5)
            at com.sap.engine.services.security.server.AuthenticationContextImpl.getLoginContextFactory(AuthenticationContextImpl
    .java:740)
            at com.sap.engine.services.security.server.AuthenticationContextImpl.getLoginContext(AuthenticationContextImpl.java:2
    54)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:324)
            at com.sap.engine.system.SystemLoginModule.initialize(SystemLoginModule.java:72)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:324)
            at javax.security.auth.login.LoginContext.invoke(LoginContext.java:662)
            at javax.security.auth.login.LoginContext.access$000(LoginContext.java:129)
            at javax.security.auth.login.LoginContext$4.run(LoginContext.java:610)
            at java.security.AccessController.doPrivileged(Native Method)
            at javax.security.auth.login.LoginContext.invokeModule(LoginContext.java:607)
            at javax.security.auth.login.LoginContext.login(LoginContext.java:534)
            at com.sap.security.core.logon.imp.SAPJ2EEAuthenticator.getLoggedInUser(SAPJ2EEAuthenticator.java:146)
            at com.sap.security.core.logon.imp.SAPJ2EEAuthenticator.forceLoggedInUser(SAPJ2EEAuthenticator.java:231)
            at com.sap.security.core.admin.ServletAccessToLogic.getActiveUser(ServletAccessToLogic.java:141)
            at com.sap.security.core.admin.UserAdminLogic.executeRequest(UserAdminLogic.java:438)
            at com.sap.security.core.admin.UserAdminServlet.doPost(UserAdminServlet.java:26)
            at com.sap.security.core.admin.UserAdminServlet.doGet(UserAdminServlet.java:19)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
            at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)
            at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
            at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:386)
            at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:364)
            at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:1039)
            at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:265)
            at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)
            at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:175)
            at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessio
    nMessageListener.java:33)
            at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
            at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
            at java.security.AccessController.doPrivileged(Native Method)
            at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:102)
            at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:172)
    I found the SAP Note 971249 but Iu2019m not sure it applies and even I can log on into Visual administrator.
    Log for the Visual Administrator
    <!LOGHEADER[START]/>
    <!HELP[Manual modification of the header may cause parsing problem!]/>
    <!LOGGINGVERSION[1.5.3.7185 - 630]/>
    <!NAME[/usr/sap/SID/DVEBMGS00/j2ee/admin/log/./traces/visual_administration.trc]/>
    <!PATTERN[visual_administration.trc]/>
    <!FORMATTER[com.sap.tc.logging.ListFormatter]/>
    <!ENCODING[UTF8]/>
    <!FILESET[0, 5, 10000000]/>
    <!PREVIOUSFILE[visual_administration.4.trc]/>
    <!NEXTFILE[visual_administration.1.trc]/>
    <!LOGHEADER[END]/>
    #1.5^H#C000AC11873E00000000000100CEC78D00045A541BE7A040#1225217198758#com.sap.engine.services.adminadapter.gui.tasks.LoginTas
    k##com.sap.engine.services.adminadapter.gui.tasks.LoginTask#######Thread[Thread-1,5,main]##0#0#Error#1#/System/Server/VisualA
    dministrationTool#Java###Error while trying to login to host: null
    [EXCEPTION]
    #1#java.lang.NullPointerException
            at com.sap.engine.services.security.remoteimpl.login.RemoteLoginContextHelperImpl.login(RemoteLoginContextHelperImpl.
    java:72)
            at com.sap.engine.services.security.remoteimpl.login.RemoteLoginContextHelperImplp4_Skel.dispatch(RemoteLoginContextH
    elperImplp4_Skel.java:64)
            at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:319)
            at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:200)
            at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:136)
            at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessio
    nMessageListener.java:33)
            at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
            at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
            at java.security.AccessController.doPrivileged(Native Method)
            at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:102)
            at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:172)
    Thank you very much for your help.
    Best Regards

    hi
    we had the same issue some time back when we upgraded to SP15, we opened a OSS message and SAP had to come and fix the issue.
    It was some inconsistencies in -Config DB settings and they made quite a few changes in security/configurations/ticket(config tool)
    also
    one Java parameter was wrong(config tool - server config) :
    -Djava.security.policy=/java.policy  it should be -
    > Djava.security.policy=./java.policy (The DOT was missing)
    thank you
    Jonu Joy

  • Failure: Cannot connect to retrieve Database/current.zip: Internal Server E

    Hello
    I have installed an update connection proxy and I have registered it
    smpatch get
    patchpro.backout.directory - ""
    patchpro.baseline.directory - /var/sadm/spool
    patchpro.download.directory - /var/sadm/spool
    patchpro.install.types - rebootafter:reconfigafter:standard
    patchpro.patch.source - https://getupdates1.sun.com/
    patchpro.patchset - current
    patchpro.proxy.host - ""
    patchpro.proxy.passwd **** ****
    patchpro.proxy.port - 8080
    patchpro.proxy.user - ""
    patchsvr setup -l
    Patch source URL: file:/patchsvr
    Cache location: /export/home/proxycashe
    I also did smpatch analyze > file
    and I downloaded the patches (*.jar) and copied them to
    /patchsvr/Patches
    But I don't really now from where to get the files: current.zip and detectors.jar
    I searched for them on the server and I found :
    /var/sadm/spool/cache/Database/https%3A%2F%2Fgetupdates1.sun.com%2F%2FDatabase%2Fcurrent.zip
    /var/sadm/spool/cache/https%3A%2F%2Fgetupdates1.sun.com%2F%2Fdetectors.jar
    and I copyed them in /patchsvr/Database and /patchsvr/Misc
    On an update connection client I did:
    #smpatch set patchpro.patch.source=http://192.168.0.71:3816/solaris/
    #smpatch analyze
    Failure: Cannot connect to retrieve Database/current.zip: Internal Server Error
    Can you please help me.
    Thanks.

    On the proxy I cannot execute:
    # rm /var/sadm/spool/patchsvr/*current.zip
    # rm /var/sadm/spool/patchsvr/*detectors.jar
    because /var/sadm/spool/patchsvr/ is empty.
    # patchsvr setup -l
    Patch source URL: file:/patchsvr
    Cache location: /export/home/proxycashe
    On the client:
    I removed the current.zip and detectors.jar
    # smpatch get
    patchpro.backout.directory - ""
    patchpro.baseline.directory - /var/sadm/spool
    patchpro.download.directory - /var/sadm/spool
    patchpro.install.types - rebootafter:reconfigafter:standard
    patchpro.patch.source http://192.168.0.71:3816/ https://getupdates1.sun.com/
    patchpro.patchset - current
    patchpro.proxy.host - ""
    patchpro.proxy.passwd **** ****
    patchpro.proxy.port - 8080
    patchpro.proxy.user - ""
    # smpatch analyze -C patchpro.log.level=3 -C patchpro.debug=true
    Effective proxy host : ""
    Effective proxy port : "8080"
    Effective proxy user : ""
    ... Submitting download request against a GUUS server
    ... ... Hostname of URL is 192.168.0.71
    ... ... Filename of URL is /xml/motd.xml
    ... ... File path portion of URL is /xml/motd.xml
    Defining request header : IF_MODIFIED_SINCE... valueThu Jan 01 02:00:00 EET 1970
    ... Caught IO Exception.
    ((HttpURLConnection)connection).getResponseCode() : 404
    ((HttpURLConnection)connection).getResponseMessage() : motd.xml not found
    Error: Unable to download document : "xml/motd.xml"
    Cannot connect to retrieve motd.xml: motd.xml not found
    Unable to display any message of the day notices from Sun Microsystems. Refer to the log file for additional information.
    Effective proxy host : ""
    Effective proxy port : "8080"
    Effective proxy user : ""
    ... Submitting download request against a GUUS server
    ... ... Hostname of URL is 192.168.0.71
    ... ... Filename of URL is /detector/detectors.jar
    ... ... File path portion of URL is /detector/detectors.jar
    Effective proxy host : ""
    Effective proxy port : "8080"
    Effective proxy user : ""
    Last Modified Date read: Thu Jan 01 02:00:00 EET 1970
    ... Submitting download request against a GUUS server
    ... ... Hostname of URL is 192.168.0.71
    ... ... Filename of URL is /database/current.zip
    ... ... File path portion of URL is /database/current.zip
    Defining request header : IF_MODIFIED_SINCE... valueThu Jan 01 02:00:00 EET 1970
    Key 1 : Content-Type = application/java-archive
    Key 2 : Content-Length = 3750071
    Key 3 : content-disposition = attachment; filename=detectors.jar
    Key 4 : Date = Thu, 26 Jul 2007 05:26:25 GMT
    Key 5 : Server = Apache Tomcat/4.0.5 (HTTP/1.1 Connector)
    Key 6 : Content-length = 3750071
    Defining request header : IF_MODIFIED_SINCE... valueThu Jan 01 02:00:00 EET 1970
    Key 1 : Content-Type = application/zip
    Key 2 : Content-Length = 323247
    Key 3 : content-disposition = attachment; filename=current.zip
    Key 4 : Date = Thu, 26 Jul 2007 05:26:26 GMT
    Key 5 : Server = Apache Tomcat/4.0.5 (HTTP/1.1 Connector)
    Key 6 : Content-length = 323247
    Last Modified Date value written to /var/sadm/spool/cache/Database/http%3A%2F%2F192.168.0.71%3A3816%2F%2FDatabase%2Fcurrent.zip.lmd is 0
    Date format for this value: Thu Jan 01 02:00:00 EET 1970
    Last Modified Date file updated : /var/sadm/spool/cache/Database/http%3A%2F%2F192.168.0.71%3A3816%2F%2FDatabase%2Fcurrent.zip.lmd
    Last Modified Date value written to /var/sadm/spool/cache/http%3A%2F%2F192.168.0.71%3A3816%2F%2Fdetectors.jar.lmd is 0
    Date format for this value: Thu Jan 01 02:00:00 EET 1970
    Last Modified Date file updated : /var/sadm/spool/cache/http%3A%2F%2F192.168.0.71%3A3816%2F%2Fdetectors.jar.lmd
    Effective proxy host : ""
    Effective proxy port : "8080"
    Effective proxy user : ""
    Effective proxy host : ""
    Effective proxy port : "8080"
    Effective proxy user : ""
    ... Submitting download request against a GUUS server
    ... ... Hostname of URL is 192.168.0.71
    ... ... Filename of URL is /entitlement/
    ... ... File path portion of URL is /entitlement/
    Defining request header : IF_MODIFIED_SINCE... valueThu Jan 01 02:00:00 EET 1970
    ... Caught IO Exception.
    ((HttpURLConnection)connection).getResponseCode() : 404
    ((HttpURLConnection)connection).getResponseMessage() : default not found
    Error: Unable to download entitlement information using the update server proxy.
    Cannot connect to retrieve : default not found
    # ls -laR /var/sadm/spool/cache
    /var/sadm/spool/cache:
    total 7358
    drwxr-xr-x 6 root sys 512 Jul 26 08:25 .
    drwxr-xr-x 3 root sys 512 Jul 19 00:25 ..
    drwxr-xr-x 2 root root 512 Jul 26 08:25 Database
    drwxr-xr-x 2 root root 512 Jul 26 08:26 entitlement
    -rw-r--r-- 1 root root 3750071 Jul 26 08:25 http%3A%2F%2F192.168.0.71%3A3816%2F%2Fdetectors.jar
    -rw-r--r-- 1 root root 14 Jul 26 08:25 http%3A%2F%2F192.168.0.71%3A3816%2F%2Fdetectors.jar.lmd
    drwxr-xr-x 3 root sys 512 Jul 19 00:35 updatemanager
    drwxr-xr-x 2 root root 512 Jul 26 08:26 xml
    /var/sadm/spool/cache/Database:
    total 662
    drwxr-xr-x 2 root root 512 Jul 26 08:25 .
    drwxr-xr-x 6 root sys 512 Jul 26 08:25 ..
    -rw-r--r-- 1 root root 323247 Jul 26 08:25 http%3A%2F%2F192.168.0.71%3A3816%2F%2FDatabase%2Fcurrent.zip
    -rw-r--r-- 1 root root 14 Jul 26 08:25 http%3A%2F%2F192.168.0.71%3A3816%2F%2FDatabase%2Fcurrent.zip.lmd
    /var/sadm/spool/cache/entitlement:
    total 4
    drwxr-xr-x 2 root root 512 Jul 26 08:26 .
    drwxr-xr-x 6 root sys 512 Jul 26 08:25 ..
    /var/sadm/spool/cache/updatemanager:
    total 6
    drwxr-xr-x 3 root sys 512 Jul 19 00:35 .
    drwxr-xr-x 6 root sys 512 Jul 26 08:25 ..
    drwxr-xr-x 2 root sys 512 Jul 19 00:35 analysis.results
    /var/sadm/spool/cache/updatemanager/analysis.results:
    total 4
    drwxr-xr-x 2 root sys 512 Jul 19 00:35 .
    drwxr-xr-x 3 root sys 512 Jul 19 00:35 ..
    /var/sadm/spool/cache/xml:
    total 4
    drwxr-xr-x 2 root root 512 Jul 26 08:26 .
    drwxr-xr-x 6 root sys 512 Jul 26 08:25 ..

Maybe you are looking for

  • What do I need to download "sh" files to a flash drive on my Mac?

    I have a new Viking Husqvarna sewing machine 960Q. The software update instructions from Husqvarna are: Download the update software and unzip it to a USB stick. Save the file at  the root level, do not place the file in any folder. The updates are i

  • Cover borwser & Visualizer problems

    I just installed itunes 7 and the album covers that show up in the cover browser are pixelated to the point where you can't tell what cd it is. I am having the same problem with the visualizer. All that shows up is colored blocks. Anybody have any id

  • Jaws and Cp 7.01.237 - not BFFs?

    Building for a 508 requirement that uses IE and JAWS 14 on a Windows 7 machine using the Captivate 7.01.237 version. I'll state out front that we made 508 accessible pdfs that were given extremely high marks by our mobility and sight impaired user gr

  • Program code fro Exit LMR1M002

    Any One Please Provide me ABAP Code to Implement the Exit LMR1M002. Its Urgent..... Regards AJIT Moderator message : Search for available information. Thread locked. Edited by: Vinod Kumar on Sep 26, 2011 3:25 PM

  • Ld.so.1: tar: fatal: relocation error: file /usr/sbin/tar: symbol fstatat64

    Hi Gurus. Please help in this one. When I try to use tar the following output is displayed: tar cvf 123.tar 123.txt ld.so.1: tar: fatal: relocation error: file /usr/sbin/tar: symbol fstatat64 tar xvf 123.tar ld.so.1: tar: fatal: relocation error: fil