Jump to content

[SOLVED] Extranious </body></html>


stockton

Recommended Posts

I have a script the beginning of which looks like:-

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional"  "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<title>Scan Ticket Issue</title>
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="Mon, 22 Jul 2000 11:12:01 GMT" />
<META HTTP-EQUIV="Pragma" CONTENT="no-cache" />
<META HTTP-EQUIV="Expires" CONTENT="-1" />
<?php
...........
?>
<link rel="stylesheet" type="text/css" href="style/style.css">
<script language="JavaScript" type="text/javascript" src="js/TicketIssueFunctions.js"></script>

but when the source is viewed in Firefox I find all these bits added as follows:-

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional"  "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<title>Scan Ticket Issue</title>
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="Mon, 22 Jul 2000 11:12:01 GMT" />
<META HTTP-EQUIV="Pragma" CONTENT="no-cache" />
<META HTTP-EQUIV="Expires" CONTENT="-1" />
</BODY></HTML></BODY></HTML></BODY></HTML></BODY></HTML></BODY></HTML><link rel="stylesheet" type="text/css" href="style/style.css">
<script language="JavaScript" type="text/javascript" src="js/TicketIssueFunctions.js"></script>

Where does the extra "</BODY></HTML></BODY></HTML></BODY></HTML></BODY></HTML></BODY></HTML>" come from?

Link to comment
Share on other sites

OK see if you can see anything in the following as I cannot?

<?php

require_once('includes/configuration.php');     // database connect script & the rest.

    DBConnect();        // Connect to Events database



// Program entry here

    $Datum = date("Y-m-d H:i:s");    /* 2006-03-17 23:22:32 */

    $BundleNumber  = strip_tags($_REQUEST['BundleNum']);

    $Event         = $_SESSION['Event'];

    $EventName     = $_SESSION['EventName'];

    $MemberNum     = $_SESSION['MemberNum'];

    $Name          = $_SESSION['MemberName'];



    $SlotsValue    = $_SESSION['SlotsTickets'];

    $SlotsIssued   = $_SESSION['SlotsIssued'];



    $TableValue    = $_SESSION['TableTickets'];

    $TableIssued   = $_SESSION['TableIssued'];



    $BonusTickets  = $_SESSION['BonusTickets'];

    $BonusIssued   = $_SESSION['BonusIssued'];

    $TotalValue     = $_SESSION['TotalValue']; // Total value of all tickets earned excluding issues



    $TotalTickets   = $SlotsValue + $TableValue + $BonusTickets;

    $TotalIssued    = $SlotsIssued + $TableIssued + $BonusIssued;

//    CalculateSuggestion($TotalTickets - $TotalIssued);

    $RemainingTickets = $TotalTickets - $TotalIssued;



    $DIssued        = $_SESSION['DIssued'];

    $CIssued        = $_SESSION['CIssued'];

    $LIssued        = $_SESSION['LIssued'];

    $XIssued        = $_SESSION['XIssued'];

    $IIssued        = $_SESSION['IIssued'];



    $Message = "";



/*

* Get Event details

*

*/

    $SQL = "SELECT EventID, MessageID FROM Event WHERE EventID='".$Event ."'";

    $rs = mssql_query($SQL, $link);

    $row = mssql_fetch_array($rs);

    $EventID = $row['EventID'];

    $MessageID = $row['MessageID'];



    $SQLMessage = "Select Message from Message where MessageID =". $MessageID;

    $rs = mssql_query($SQLMessage, $link);

    $row = mssql_fetch_array($rs);

    $txtMessage = $row['Message'];

    $SavedBundle = $BundleNumber;



    if (($BundleNumber == "") && ($Message == ""))

        {

        $Message = "Please scan a bundle or ticket";

        $bError = TRUE;

        }

    else

        {

        IssueBundle($BundleNumber);

        $_SESSION['SlotsTickets'] = $SlotsValue;

        $_SESSION['SlotsIssued'] = $SlotsIssued;



        $_SESSION['TableTickets'] = $TableValue;

        $_SESSION['TableIssued'] = $TableIssued;



        $_SESSION['BonusTickets'] = $BonusTickets;

        $_SESSION['BonusIssued'] = $BonusIssued;

        $_SESSION['DIssued'] = $DIssued;

        $_SESSION['CIssued'] = $CIssued;

        $_SESSION['LIssued'] = $LIssued;

        $_SESSION['XIssued'] = $XIssued;

        $_SESSION['IIssued'] = $IIssued;



//        $TotalTickets = $SlotsValue + $TableValue + $BonusTickets;

//        $TotalIssued = $SlotsIssued + $TableIssued + $BonusIssued;

        }

    CalculateSuggestion($RemainingTickets);

    DBDisConnect();     // Disconnect from Events database



function CalculateSuggestion($Temp)

    {

    global $DSuggestion, $CSuggestion, $LSuggestion, $XSuggestion, $ISuggestion;

    $DSuggestion = intval($Temp/500);

    $Temp %= 500;

    $CSuggestion = intval($Temp/100);

    $Temp %= 100;

    $LSuggestion = intval($Temp/50);

    $Temp %= 50;

    $XSuggestion = intval($Temp/10);

    $ISuggestion = intval(($Temp %= 10));

    }



function IssueBundle($BundleNumber)

    {

    global $link;

    global $Event;

    global $MemberNum;

    global $SlotsValue;

    global $SlotsIssued;

    global $TableValue;

    global $TableIssued;

    global $BonusTickets;

    global $BonusIssued;

    global $RemainingTickets;

    global $TotalTickets;

    global $TotalIssued;

    global $DIssued;

    global $CIssued;

    global $LIssued;

    global $XIssued;

    global $IIssued;

    global $DSuggestion;

    global $CSuggestion;

    global $LSuggestion;

    global $XSuggestion;

    global $ISuggestion;

    global $Message;

    $SavedBundle = $BundleNumber;



    $EventID = $Event;



    if (strlen($BundleNumber) == 12)

        {

// Bundle

        $BundleSize = substr($BundleNumber, 0, 2)*10;

        $FirstNumber = substr($BundleNumber, 2, 10);

        $LastNumber = intval($FirstNumber) + (intval($BundleSize) - 1);

        if (strlen($LastNumber) < 10) $LastNumber = "0".$LastNumber;

        }

    else if (strlen($BundleNumber) == 10)

        {

// Single ticket

        $BundleSize = 1;

        $FirstNumber = substr($BundleNumber, 0, 10);

        $LastNumber = $FirstNumber;

        }

    else if ((strlen($BundleNumber) != 10) && (strlen($BundleNumber) != 10))

        {

        $Message = "Bundle/ticket ".$BundleNumber." has Incorrect length of ".strlen($BundleNumber);

        $bError = TRUE;

        }



    $SlotsTurnover  = 0;

    $TableTurnover  = 0;



    if (($RemainingTickets < 1))

        {

        $Message = sprintf("Bundle [%s] but there is nothing to issue...?...bye", $SavedBundle);

        $bError = true;

        }



    if($BundleSize > $RemainingTickets)

         {

         $Message = sprintf("Bundle size of [%d] is greater than number outstanding [%d].",$BundleSize,$RemainingTickets);

         $bError = true;

         }

// Save the size of the bundle for use when calling stored procedure

    $SizeOfBundle = $BundleSize;

/*

* Check that this bundle has not already been issued.

*/

    $SQL = sprintf("SELECT * FROM BundlesIssued WHERE FirstNumber = ".$FirstNumber);

    $rs = mssql_query($SQL, $link);

    $row = mssql_fetch_array($rs);

    $FN = $row['FirstNumber'];

    $LN = $row['LastNumber'];

    if (($FN == $FirstNumber) && ($LN == $LastNumber))

        {

        $Message = sprintf("Bundle [%s] has already been issued !", $SavedBundle);

        $bError = true;

        }

/*

* If Bundle size greater than Slots balance decrease bundle size by slots balance

*              and make slotstoissue equal to slots balance

*/

    if ($SlotsValue > 0)

        {

        if ($BundleSize > $SlotsValue)

            {

            $BundleSize -= $SlotsValue;

            $SlotsToIssue = $SlotsValue;

            }

         else if ($BundleSize < $SlotsValue)

            {

            $SlotsToIssue = $BundleSize;

            $BundleSize = 0;

            }

        }



    if ($TableValue > 0)

        {

        if ($BundleSize > $TableValue)

           {

           $BundleSize -=  $TableValue;

           $TableToIssue = $TableValue;

           }

        else if ($BundleSize < $TableValue)

           {

           $TableToIssue = $BundleSize;

           $BundleSize = 0;

           }

       }



    if ($BonusTickets > 0)

        {

        if ($BundleSize > $BonusTickets)

            {

            $BundleSize -=  $BonusTickets;

            $BonusToIssue = $BonusTickets;

            }

        else if ($BundleSize <  $BonusTickets)

            {

            $BonusToIssue = $BundleSize;

            $BundleSize = 0;

            }

        }



    if (($RemainingTickets > 0) && ($bError != TRUE))

        {

/*

*  Call spIssueScannedTickets stored procedure to update BundleIssued and TicketIssued

*                      required parameters are:-

*                              MemberNumber, EventID, BundleSize, FirstNumber, LastNumber, UserID, Invalid and

*                                      SlotsBalance & TableBalance & BonusBalance

*                                      ie the amount of tickets to issue for Slots, Tables & Bonus

*/

        $Result = 0;

        $proc = mssql_init("spIssueScannedTickets",$link);

        mssql_bind($proc, "@MemberNum", $MemberNum, SQLVARCHAR);

        mssql_bind($proc, "@iEventID", $EventID, SQLINT2);

        mssql_bind($proc, "@BatchSize", $SizeOfBundle, SQLINT2);

        mssql_bind($proc, "@FirstNumber", $FirstNumber, SQLVARCHAR);

        mssql_bind($proc, "@LastNumber", $LastNumber, SQLVARCHAR);

        mssql_bind($proc, "@UserID", $_SESSION['UID'], SQLINT2);

        mssql_bind($proc, "@SlotsBalance", $SlotsToIssue, SQLINT2);

        mssql_bind($proc, "@TableBalance", $TableToIssue, SQLINT2);

        mssql_bind($proc, "@BonusBalance", $BonusToIssue, SQLINT2);

        mssql_bind($proc, "RETVAL", $Result, SQLINT2);

        mssql_execute($proc);

        mssql_free_statement($proc);





// Update screen with new values

        switch ($SizeOfBundle)

            {

            case 500:

                ++$DIssued;

                break;

            case 100:

                ++$CIssued;

                break;

            case 50:

                ++$LIssued;

                break;

            case 10:

                ++$XIssued;

                break;

            case 1:

                ++$IIssued;

                break;

            }



//        $SlotsValue -= $SlotsToIssue;

        $SlotsIssued  += $SlotsToIssue;

//        $TableValue -= $TableToIssue;

        $TableIssued  += $TableToIssue;

//        $BonusTickets -= $BonusToIssue;

        $BonusIssued  += $BonusToIssue;



        $Message = "Bundle/ticket ".$BundleNumber." has been processed";

        } // End of if (($RemainingTickets > 0) && ($bError != TRUE))

    else if ($bError != TRUE)

        {

        print "<meta http-equiv=\"refresh\" content=\"0;URL=TI6SCAN-5.php\">";

        }

    }     // End of function IssueBundle($BundleNumber)

?>


Link to comment
Share on other sites

FYI

<?php
    $SGM = 1;  // 1 for SGM and 0 for GameSmart
    $dbservertype= "mssql";
    $servername  = "localhost";
    $dbusername  = "??";
    $dbpassword  = "??";
    $dbname      = "Events";

    $GameSmartDBServertype= "mssql";
    $GameSmartServername  = "localhost";
    $GameSmartDBUsername  = "??";
    $GameSmartDBPassword  = "??";
    $GameSmartDBName      = "Frontier";

    $SGMDBUsername            = "????";
    $SGMDBPassword            = "?????";
    $SGMDBName                = "??????";

    $link = $gp_link = '';
    $StoredProcedure = "spGetActivePromotions";
    $GP_StoredProcedure = "GETPLAYERTICKETDETAIL";
    $select  = '';
    $SimulationDate = '';
    require_once('includes/error-handler.inc');
    require_once('includes/DBConnect.inc');
    require_once('includes/DBDisConnect.inc');
    if ($SGM == 1)
        {
        require_once('includes/SGMDBConnect.inc');
        require_once('includes/SGMDBDisconnect.inc');
        }
    else
        {
        require_once('includes/GameSmartDBConnect.inc');
        require_once('includes/GameSmartDBDisConnect.inc');
        }

set_error_handler('errorHandler');
session_start();
$EarnTypes=array('BONUS', 'SLOTS','TABLES');
$UserTypes=array('Private', 'Corporal','Sergeant','Lieutenant','Major');
$GameTypes= array('SLOTS', 'AR', 'BJ', 'PB', 'POK');
//
// define variables so that various different pieces of the Ajax script should be used depending on prefix to Ajax call
$EarnRate     = 1;
// Get EarnRates(now redundant)
$ClientData   = 2;
// Get Client info which now includes get earn rates
$IssueTickets = 3;   // Issue ticket
$GetName      = 4;   // GetNameOnly
/*
* function dateconvert
*
* dateconvert is a handy function to take the aches and pains out of mysqls stupidity
* by converting data from a variable (posted from a form or just stored)
* into a format mysql will be able to store and converting the
* database date back into the british standard of date month year.
* The Script accepts day.month.year or day/month/year or day-month-year.
* example:
*
* <code>
* <?php  // using type 1
*       $date = "19.12.2005";
*       $date = dateconvert($date, 1);
*       echo $date;  // Would echo 2005-12-19 which is the format stored by mysql
* ?>
* </code>
* <code>
* <?php  // using type 2
*       $date = $row['date']; //your mysql date
*       $realdate = dateconvert($date,2);
*       echo $realdate; // would display 19/12/2005
*       ?> 
* </code> 
* 
* @author Chris McKee <pcdevils@gmail.com>  
* 
* @param  string $date - Date to be converted
* @param  string $func - which function is to be used (1 for input to mysql, 2 for output from mysql)
*/ 

function dateconvert($date,$func)
    {
    if ($func == 1)
        { //insert conversion
        list($datum,$tyd) = split('[ .]', $date);
        list($day, $month, $year) = split('[/.-]', $datum);
        $date = "$year/$month/$day $tyd";
        return $date;
        }
    if ($func == 2)
        { //output conversion
        list($datum,$tyd) = split('[ .]', $date);
        list($year, $month, $day) = split('[-.]', $datum);
        $date = "$day/$month/$year $tyd";
        return $date;
        }
    }

and

<?php
function DBConnect() {
    global $dbservertype, $servername, $dbusername, $dbpassword, $dbname, $link;
//      echo "<br>In DBConnect";
    $link = mssql_connect($servername, $dbusername, $dbpassword);
    if (!$link) {
        echo "Error = " . mssql_get_last_message();
        sprintf($Message, "At %d in %s Could not connect to %s at %s as %s",__LINE__, __FILE__, $dbname, $servername, $dbusername);
        trigger_error(E_USER_ERROR, $Message);
        exit;
        }
    if (!(mssql_select_db($dbname, $link))) {
        echo "Error = " . mssql_get_last_message();
        sprintf($Message, "At %d in %s Could not select %s at %s as %s",__LINE__, __FILE__, $dbname, $servername, $dbusername);
        trigger_error(E_USER_ERROR, $Message);
        exit;
        }

//  echo "<br>In DBConnect() link = $link<br>"; 
    return $link;
    }
?>

Link to comment
Share on other sites

ILYAS415, the PHP does not have an effect on the page layout, just the data that is displayed.

TheFilmGod, on what do you base your statement? Which code have I pasted without understanding it?

I also do not understand how the comment made by TheFilmGod is supposed to help.

Link to comment
Share on other sites

As it is right now there doesn't appear to be any direct reason for the extra head/body tags.  Though it does coincide with the location of your PHP script on the page where it's placed.

 

Try placing a few echo's throughout your script, perhaps just named "FIRST< br />" and "SECOND< br />", etc. just to see when and where's it happening, then narrow it down from there (eg. okay it's between THIRD and FOURTH, let me check there now, perhaps add some echo's between those two now)

Try to include them between your require's as well, as I noticed you had a few of them, each which might have its own code which is contributing to the tags.

 

- TAz

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.