5 Replies - 497 Views - Last Post: 21 June 2012 - 03:44 PM Rate Topic: -----

#1 ahmedkaka2222  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 20-June 12

error in login

Posted 20 June 2012 - 04:24 PM

hi guys this my first time in php i have create this php file but when i run it's give me this following thing:



username
password
"; } else { echo"
ur logged in".$_SESSION['username']." logout"; } ?>


so the question is it error in the code or i have problem with my xampp server
:::
thank u.

Attached File(s)

  • Attached File  index.php (716bytes)
    Number of downloads: 20

Is This A Good Question/Topic? 0
  • +

Replies To: error in login

#2 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10438
  • View blog
  • Posts: 38,651
  • Joined: 27-December 08

Re: error in login

Posted 20 June 2012 - 05:16 PM

Post your code using code tags: :code:

The output means the following probably isn't enclosed within your PHP tags.
Was This Post Helpful? 0
  • +
  • -

#3 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6048
  • View blog
  • Posts: 23,473
  • Joined: 23-August 08

Re: error in login

Posted 20 June 2012 - 05:52 PM

The code:

<?php
session_start();
?>

<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?php 
if ( ! isset($_SESSION['uid'])) {
	echo "<form action='login_parse.php' method='post'>
	username <input type='text' name='username'><p>
password <input type='password' name='password'><p>
<input type='submit' name='submit' value='login' />
";
	
} else {
	echo"<p> ur logged in".$_SESSION['username']." &bull; <a href='logout.php'>logout</a>";
}

?>
</body>
</html>

Was This Post Helpful? 0
  • +
  • -

#4 ahmedkaka2222  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 20-June 12

Re: error in login

Posted 21 June 2012 - 10:01 AM

guys it's still didn't work could the problem be in my xampp server!!!!
Was This Post Helpful? 0
  • +
  • -

#5 e_i_pi  Icon User is offline

  • = -1
  • member icon

Reputation: 793
  • View blog
  • Posts: 1,679
  • Joined: 30-January 09

Re: error in login

Posted 21 June 2012 - 01:42 PM

Have you checked the error logs to see if any errors have actually been logged? How about displaying errors on the screen? You can do that by putting this at the top of your code:
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 1);


If there are errors diaplyed, that means your code has problems. If there are no errors, then yes, it could be an XAMPP problem. In which case you'd have to look in the Apache logs to where the issue is.
Was This Post Helpful? 0
  • +
  • -

#6 Atli  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3715
  • View blog
  • Posts: 5,972
  • Joined: 08-June 10

Re: error in login

Posted 21 June 2012 - 03:44 PM

It looks very much like the PHP codes isn't being executed at all, but just being sent to the browser. That usually happens because of one of tow things:

First, because people new to these things simply open a .php file in their browser like they would a .html file, thus bypassing the HTTP server altogether. Make sure your URL looks something like http://localhost/file.php, rather than something like file:///C:/path/to/file.php.

Or, second, because your HTTP server is poorly configured and doesn't recognize PHP code. In this case, you'd have to dig into the config to find out why that's happening, which requires some know-how about your chosen server. - For XAMPP, this is rarely an issue, as it takes care of setting the HTTP server up for you.

This post has been edited by Dormilich: 21 June 2012 - 11:26 PM
Reason for edit:: typo

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1