Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

PHP 

[HELP!] Php testing page!

Hello guys,

When I pop up this code I have just written,
I get some syntax with numbers in the front of my text! - why is that. :(...

I can't figure that out. I was wondering if it has some to do with my FORM input's ??
Hope you guys can help me out 🤝 Thanks! 😈

Code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<title>Susp3cT Testing ZONE!</title>
    <meta http-equiv="content-type"
        content="text/html;charset=utf-8" />
</head>
<SCRIPT language=JavaScript>
    var message = "Copyright - Susp3cT";
    function rtclickcheck(keyp){ if (navigator.appName == "Netscape" && keyp.which == 3){     alert(message); return false; }
    if (navigator.appVersion.indexOf("MSIE") != -1 && event.button == 2) {     alert(message);     return false; } }
    document.onmousedown = rtclickcheck;
</SCRIPT>


<body [b]onload=[/b]"type_text()" ; bgColor=black text=#4d5e49><center>
<div align="center"><img src="http://dl.dropbox.com/u/66529409/susp3cth4x2.png" >
<div style="width: 900px;height: 100px;" align="center">


<form method="POST" action="news.php">
<input type="text" name="UserName"><br>
<input type="password" name="PassWord" value="password"><br>
<input type="submit" value="Submit" name="SubmitLogin"><br>
</form><br><hr>


<form method="POST" action="news.php">
<input type="test" name="Recover Password!">
<input type="submit" value="Recover Password!" name="RecoverPass"><br>
<a href="./forgotpass.php">Forgot password?</a>


<?php

$username = "Susp3cT";
$recover = 'RecoverPass';
if (isset($_POST['SubmitLogin'])){
    $username = $_POST['UserName'];
    $password = $_POST['PassWord'];
    echo "You are the best, " . $username || " This is NOT, the right username!";
}else{
    echo "<br>You need to enter something buddy!";
}

if (isset($_POST['Submitlogin'])){
    $recover = $_POST['RecoverPass'];
    echo "You\'re password is: " .$recover;


}else{
    echo "<br>You did not enter a correct username buddy!<br>" or die;
} if (isset($username ['Susp3cT'])){
    echo "<br><strong>You entered the right username!</strong> " or die;
}else{
    echo "This is not the correct username buddy";
}

?>
</body>
</html>


Do not comment on this, if you got some negative to say, about my code, well then you are welcome to FUCK OFF! - I do not tolerate people telling " Hey you did not wrote that code" - Listen, this is my own damn code, so Don't try it skid! 😈
Did figure out the flaw my self...
I needed to add a or die;
Code
if (isset($user['Susp3cT'])){
    echo "<br><strong>You entered the right username!</strong> " or die;

This is solved my problem...
(Apr 16, 2012 12:36 AM)Susp3cT Wrote:  Did figure out the flaw my self...
I needed to add a or die;
Code
if (isset($user['Susp3cT'])){
    echo "<br><strong>You entered the right username!</strong> " or die;

This is solved my problem...

And the award for the most useless and misunderstood logic goes to.... Susp3cT! Congrats mate, this made me laugh irl ;)
PHP Code

<?php 
echo "text output..." or die(); 
(Apr 16, 2012 01:44 AM)Haxalot Wrote:  @Susp3ct, acting childish and making frivolous remarks is not helping your situation. You are a novice asking for help and you should do so courteously if you would like serious answers.

Lets take your code out of the code tags and highlight it with the following key to see three things:
  • Things you've done wrong.

  • Things you can improve on.

  • Things you've done correctly.


I am only highlighting your PHP code, though for the record your HTML is far from decent. Also ignore the hiphens; they are used to indent your code for better legibility.

<?php

$username = "Susp3cT";
$recover = 'RecoverPass';
if (isset($_POST['SubmitLogin']))
{
- - -$username = $_POST['UserName'];
- - -$password = $_POST['PassWord'];
- - -echo "You are the best, ".$username || " This is NOT, the right username!";
}
else
{

- - -echo "<br>You need to enter something buddy!";
}

if (isset($_POST['Submitlogin']))
{
- - -$recover = $_POST['RecoverPass'];
- - -echo "You\'re password is: ".$recover;
}
else
{

- - -echo "<br>You did not enter a correct username buddy!<br>" or die;
}

if (isset($username['Susp3cT']))
{
- - -echo "<br><strong>You entered the right username!</strong> " or die;
}
else
{

- - -echo "This is not the correct username buddy";
}

?>


Right, now that i have showed you where you have gone wrong and where you need to/should improve upon, lets see how you would correct the above. I'm doing this to benefit your learning instead of me just telling you the answer.

Side Note: That is being lenient with the above highlighting. In reality the above code does not work at all because you haven't added checks, such as seeing if your $_POST associative array data has values.

Don't worry I fixed it.. .It's working perfectly..
I did remove the RecoverPass, since I did not use it.

This is for testing purposes. Like SQLi, XSS and so on I'm going to develop it furthermore. There will be functions to enumerate information on how to secure a site against SQLi, XSS, LFI, RFI. Like tab functions 😈
(Apr 16, 2012 03:11 PM)AntiPaste Wrote:  Actually that's not correct either [H]ell.
Use either the ternary operator or the if-statement, not both.

Ternary operator:

PHP Code

<?php 
echo ($_POST['username'] == $user) ? "You are the best {$user}" : "This is NOT, the right username!"; 

If-statement:

PHP Code

<?php 
if ($_POST['username'] == $user) echo "You are the best {$user}";
else echo 
"This is NOT, the right username!"; 

Wrong... This is the right way.

[code]
PHP Code

<?php 
if ($_POST['username'] == $user) echo "You are the best .$user"{
return 
true;
}else {
echo 
"This is NOT, the right username!";
} 


Possibly Related Threads...
Thread / Author Replies Views Last Post
[PHP] by stuped200Aug 4, 2012 06:07 AM 5 195 Aug 4, 2012 06:07 AM
Last Post: stuped200
[PHP] by CrazerMay 13, 2012 11:26 AM 6 173 May 13, 2012 11:26 AM
Last Post: YERANUK
[PHP] by tommaydpDec 15, 2011 04:35 AM 3 182 Dec 15, 2011 04:35 AM
Last Post: UnBoRn_HaCkEr