Jump to content

Why is my PHP code rendering on my web page?


grennibones

Recommended Posts

Hello All,

 

I hoping someone can help me out with this. My PHP is showing up on my web page. The PHP in question suddenly renders about half way through the block right after the ">" on the last line. I can not see any reason for this behavior. The beginning half does not show up but everything after the ">" does.

 

OCIExecute($rsql1, OCI_DEFAULT);

$vrow1 = OCI_fetch_row($rsql1,OCI_ASSOC);

extract($vrow1);

/* $vcnt1 = OCIrowcount($rsql1, $row; */

if (($priv_id > 1) and ($at_cnt < 3))

{

 

Is this a configuration issue? A coding issue? Thank you for the help.

 

Link to comment
Share on other sites

Not sure if this is relevant: if it's PHP5 I noticed you have to write "<?php" every time you begin some code, as opposed to just "".

 

You're right, short tags should never be used...  This should be the case with all versions of PHP.

Link to comment
Share on other sites

Sorry, I should have also said that this is only part of the block. Here is the whole block:

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title> System Bible Login Page </title> <link rel="stylesheet" type="text/css" href="sysb_login.css"> </head> <body>
   <div id="midcon">
<?php
   error_reporting(E_ALL);
   session_start();
   $vmess = 0;
   $vcnt1 = 0;
   switch(@$_GET['do'])
   {
      case "login":
         $conn = OCILogon($usr, $pwd, $host)
                 or die ("Could not connect to Oracle.");
         $sql1 = "SELECT usr_id,
                         priv_id,
                         status,
                         at_cnt
                  FROM usr
                  WHERE UPPER(usr_name) = '$_POST[v_usrn]'";
         $rsql1 = OCIParse($conn, $sql1);
         OCIExecute($rsql1, OCI_DEFAULT);
         $vrow1 = OCI_fetch_row($rsql1,OCI_ASSOC);
         extract($vrow1);
         if (($priv_id > 1) and ($at_cnt < 3))
         {
                  sql2 = "INSERT INTO audt VALUES(seq_audt.NEXTVAL,'$usr_id',SYSDATE)";
                  $rsql2 = OCIParse($conn, $sql2);
                  header("Location:sysb_main.php");
               }
        }

         else
         {
            if($at_cnt >= 3)
            {
               $vmess1 = 2;
            }
            else
            {
               $sql3 = "UPDATE usr SET at_cnt = '$at_cnt'+1";
               $rsql3 = OCIParse($conn, $sql3);
               if(($at_cnt+1) >= 3)
               {
                  $vmess1 = 2;
               }
               else
               {
                  $vmess1 = 1;
               {
            }
            unset($do);
            include("sysb_login_form.inc");
         }
/* end of case statement */
      break;
      default:
         include("sysb_login_from.inc"); ?>
   </div>
</body>
</html>

 

(edited by kenrbnsn to add


tags)

 

Link to comment
Share on other sites

Thank you all. While I did need the $ in front of that variable it was not the cause of my problem. It's really odd. everything after The ">" in this line renders on the web page and everything before does not.

 

if (($priv_id > 1) and ($at_cnt < 3))

 

 

 

 

 

Link to comment
Share on other sites

Thank you all. While I did need the $ in front of that variable it was not the cause of my problem. It's really odd. everything after The ">" in this line renders on the web page and everything before does not.

 

if (($priv_id > 1) and ($at_cnt < 3))

 

What that tells me is that either the web server you're using doesn't support PHP or you're not invoking the web server when processing this file. How are you invoking the script?

 

Ken

Link to comment
Share on other sites

View source on that rendering, I'm sure it's all there, just not displayed because the browser sees everything from <?php.....> as a big invalid tag, then starts displaying after that.

 

Like Ken said, the PHP isn't being parsed.  Make sure it's installed correctly and that you have PHP set as a handler in your httpd.conf.

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.