Jump to content

Problems running php script in my PC


galafura

Recommended Posts

:-[

 

Hi,

I'm running this script in my PC:

<?

//=========================================

// Enter on the system

//=========================================

 

include "conecta.php"; //Connect to the database MySQL

 

if(($name_login) AND ($pass_login))

{

  $sql = mysql_query("SELECT * FROM tb_user WHERE apelido='$name_login' AND senha='$pass_login'") or die("SQL error :".mysql_error());

 

  if(mysql_num_rows($sql) > 0)

  {

  $id_imasters = mysql_result($sql,0,"id_user");

  $apelido_imasters = mysql_result($sql,0,"apelido");

  $senha_imasters = mysql_result($sql,0,"senha");

 

  session_start("imasters");

  session_register("id_imasters","apelido_imasters","senha_imasters");

 

  header("Location:options.php");

  }

}

?>

<html>

<head>

<title>iMasters Test Application</title>

</head>

 

<body bgcolor="#FFFFFF" text="#000000">

 

<form name="frm_login" method="post" action="<?echo $PHP_SELF;?>">

  <table width="40%" border="0" cellspacing="0" cellpadding="0">

  <tr>

    <td colspan="2"><b><font face="Arial" size="3">IDENTIFICATION</font></b></td>

  </tr>

 

  <tr>

    <td width="33%" height="25"><font face="Arial" size="2">Name:</font></td>

    <td width="67%" height="25"><font face="Arial" size="2">

    <input type="text" name="name_login"></font></td>

  </tr>

 

  <tr>

    <td width="33%" height="25"><font face="Arial" size="2">Password:</font></td>

    <td width="67%" height="25"><font face="Arial" size="2"><input type="password" name="pass_login"></font></td>

  </tr>

 

  <tr>

    <td colspan="2"><input type="submit" name="enter" value="Enter >>"></td>

  </tr>

  </table>

</form>

</body>

</html>

And I'm geting the attached picture ... Why is not running as expected ... Tks.

 

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/191057-problems-running-php-script-in-my-pc/
Share on other sites

I've had something like it printing my code as html running it on a windows server before.

 

The fix to that is that sometimes windows servers (If that is what you are using there) and the php compiler become picky and want this <?php at the beginning and will not let you get away with just  <? instead especially when embedding code.

Try that first off, cause if that is the case then the browser and webserver are trying to run your php as html code and you get fun things like what you printed to the screen.

I've had something like it printing my code as html running it on a windows server before.

 

The fix to that is that sometimes windows servers (If that is what you are using there) and the php compiler become picky and want this <?php at the beginning and will not let you get away with just  <? instead especially when embedding code.

 

That's nothing to do with Windows. Short tags (<?) can be enabled/disabled in php.ini file, and are disabled in PHP5 by default.

It is a little strange that it is taking the > in your if statement to be the end of php, but as you are checking for rows or no rows you can change

 

if(mysql_num_rows($sql) > 0)

 

to

 

if(mysql_num_rows($sql))

 

to see if it makes any difference

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.