| Author |
php |
vinelander
Member
Posts: 42
Location: NJ
Joined: 25.11.07 Rank: Hacker Level 2 |
|
ok I am going to show you this scblockedript that is from my site and the issue that I am having is the fact that when you go to the site and hit enter it actuially shows you its own source
<form>
<form action="home.php" method="GET">
<b>Username:</b><input type="text" name="username" id="username" />
<b>password:</b><input type="password" name="password" id="password" />
<input type="submit" value="submit" id="submit" />
</form>
<?php
if ($_GET['username'] == "krystal" && $_GET['password'] =="vineland"
{
setcookie("krystal", "krystal", time()+3600);
}
?>
<?php
if (isset($_COOKIE["krystal"]))
echo "Welcome " . $_COOKIE["krystal"] . "!<br />";
else
echo "Welcome guest!<br />";
?>
In the days when there is only darkness I shine through the night
 |
|
| Author |
RE: php |
mastergamer
Member

Posts: 432
Location:
Joined: 07.02.06 Rank: God |
|
Is your webserver set up correctly to execute PHP?
Also, you might wanna look at using sessions for that kind of login, and using POST instead of GET for logins. Basing your authentication solely on whether a cookie is set is bad.
Edited by mastergamer on 02-07-08 19:00 |
|
| Author |
RE: php |
Mephisto
Member
Posts: 150
Location:
Joined: 13.12.06 Rank: Newbie |
|
Is the extension of the file .php?
DON'T PANIC |
|
| Author |
RE: php |
mastergamer
Member

Posts: 432
Location:
Joined: 07.02.06 Rank: God |
|
|
Mephisto wrote:
Is the extension of the file .php?
And is it called home.php?
|
|
| Author |
RE: php |
vinelander
Member
Posts: 42
Location: NJ
Joined: 25.11.07 Rank: Hacker Level 2 |
|
|
mastergamer wrote:
Is your webserver set up correctly to execute PHP?
Also, you might wanna look at using sessions for that kind of login, and using POST instead of GET for logins. Basing your authentication solely on whether a cookie is set is bad.
the php is executing fine the only issue i am having now is the fact that it is showing the source code.
In the days when there is only darkness I shine through the night
 |
|
| Author |
RE: php |
Feralas
Member

Posts: 301
Location: 127.0.0.1
Joined: 25.02.08 Rank: HBH Guru |
|
|
vinelander wrote:
the php is executing fine the only issue i am having now is the fact that it is showing the source code.
The PHP wouldn't be executing correctly if it is viewable in the source code.
/-- Ipsa Scientia Potestas Est --\

\-- Knowledge itself is power. --/

To fear death is to limit life.
|
|
| Author |
RE: php |
themastersinner
Member
Posts: 27
Location:
Joined: 03.12.07 Rank: God |
|
try
<?php
if ($_GET['username'] == "krystal" && $_GET['password'] =="vineland")
{
setcookie("krystal", "krystal", time()+3600);
}
?>
<form action="home.php" method="GET">
<b>Username:</b><input type="text" name="username" id="username" />
<b>password:</b><input type="password" name="password" id="password" />
<input type="submit" value="submit" id="submit" />
</form>
<?php
if (isset($_COOKIE['krystal']))
echo "Welcome " . $_COOKIE['krystal'] . "!<br />";
else
echo "Welcome guest!<br />";
?>
Edited by themastersinner on 02-07-08 21:46 |
|
| Author |
RE: php |
c24lightning
Member
Posts: 41
Location: The infinite insanity of thought
Joined: 24.12.07 Rank: Active User |
|
Just make sure it executes properly - make a page called test.php and put
<? echo "testing"; ?>
as the source. If it doesn't show only the text testing, it isn't executing properly. If it's not executing properly, you need a new host, for example, the one in my sig (yes, it's free).


I'm a little more known over at HackThisSite (my profile). (If it says "Bad Referer", click on the URL bar and press enter.)
I despised my rank of "Newbie." |
|
| Author |
RE: php |
fashizzlepop
Member

Posts: 482
Location: Old folks home.
Joined: 08.04.08 Rank: Uber Elite |
|
Possibly you are using Notepad?
When you save in notepad it auto saves as a .txt
So if you put the name index.php it will save as index.php.txt and you will see the source code.
So make sure that under FILE TYPE it says "All files" not " Text file *.txt"
That might be your problem.
"The definition of insanity is doing the same thing over and over again and expecting different results.”
~Albert Einstein~
 |
|