forked from fititnt/php-libraries
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
+ Added to CLIHelper: method getDirPath() + Added to CLIHelper: method getFilePath() + Added to CLIHelper: method getUrlDir() + Added to CLIHelper: method ggetUrlFile() + Added to WebDig: example/targets/dump-vars.php + Added to WebDig: example/targets/autentication-simple
- Loading branch information
Showing
9 changed files
with
317 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
/* | ||
* @package WebDig | ||
* @author Emerson Rocha Luiz - emerson at webdesign.eng.br - http://fititnt.org | ||
* @copyright Copyright (C) 2011 Webdesign Assessoria em Tecniligia da Informacao. All rights reserved. | ||
* @license GNU General Public License version 3. See license-gpl3.txt | ||
* @license Massachusetts Institute of Technology. See license-mit.txt | ||
* @version 0.1alpha | ||
* | ||
*/ | ||
//error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE); //better debug. Or not. Haha! | ||
include_once '../../CLIHelper/library/CLIHelper.php'; | ||
include_once '../library/WebDig.php'; | ||
|
||
|
||
|
||
$clih = new CLIHelper(); | ||
|
||
//echo $clih->getUrlDir(); | ||
|
||
$wd = new WebDig(); | ||
|
||
$wd ->setDebug('autentication-simple-debug.log', TRUE) //Setup debug file in current directory | ||
->setCookie('autentication-simple-cookie.log') //Setup cookies file | ||
->setTarget( $clih->getUrlDir() . '/targets/autentication-simple/login.php' ) //Target to go | ||
->post( array( | ||
'username' => 'user', | ||
'password' => 'pass' | ||
) | ||
) | ||
->get('content'); | ||
|
||
$wd->debug(); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
/* | ||
* @package WebDig | ||
* @author Emerson Rocha Luiz - emerson at webdesign.eng.br - http://fititnt.org | ||
* @copyright Copyright (C) 2011 Webdesign Assessoria em Tecniligia da Informacao. All rights reserved. | ||
* @license GNU General Public License version 3. See license-gpl3.txt | ||
* @license Massachusetts Institute of Technology. See license-mit.txt | ||
* @version 0.1alpha | ||
* | ||
*/ | ||
session_start(); | ||
|
||
if ( !isset($_SESSION['autorized']) ) die('You are not autorized to see this page. You must have cookies enabled'); | ||
?> | ||
<!DOCTYPE HTML> | ||
<html> | ||
<head> | ||
<title>Another example</title> | ||
</head> | ||
<body> | ||
<p>User: <?php echo $_SESSION['username']; ?></p> | ||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent semper | ||
dignissim dolor, ut aliquam arcu consectetur in. Integer ornare euismod | ||
nisi, a ultricies ligula dictum ut. Aenean id diam justo, in semper elit. | ||
In hac habitasse platea dictumst. Maecenas quis mi tellus.</p> | ||
<p>Nulla facilisi. Suspendisse potenti. Proin fermentum commodo volutpat. | ||
Nam in scelerisque est.</p> | ||
|
||
<div id="menu"> | ||
<ul> | ||
<li><a href="login.php">Login</a></li> | ||
<li><a href="result.php">Result</a></li> | ||
<li><a href="etc.php">Etc</a></li> | ||
<li><a href="login.php?logout=1">Logout</a></li> | ||
</ul> | ||
</div> | ||
</body> | ||
</html> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<?php | ||
/* | ||
* @package WebDig | ||
* @author Emerson Rocha Luiz - emerson at webdesign.eng.br - http://fititnt.org | ||
* @copyright Copyright (C) 2011 Webdesign Assessoria em Tecniligia da Informacao. All rights reserved. | ||
* @license GNU General Public License version 3. See license-gpl3.txt | ||
* @license Massachusetts Institute of Technology. See license-mit.txt | ||
* @version 0.1alpha | ||
* | ||
*/ | ||
$loginError = FALSE; | ||
session_start(); | ||
|
||
if( isset($_REQUEST['logout'])) | ||
{ | ||
$_SESSION = array(); | ||
if (ini_get("session.use_cookies")) { | ||
$params = session_get_cookie_params(); | ||
setcookie(session_name(), '', time() - 42000, | ||
$params["path"], $params["domain"], | ||
$params["secure"], $params["httponly"] | ||
); | ||
} | ||
session_destroy(); | ||
} | ||
else if( isset($_REQUEST['username']) ) | ||
{ | ||
|
||
if ( $_REQUEST['username'] == 'user' && $_REQUEST['password'] == 'pass') | ||
{ | ||
//Session | ||
$_SESSION['username'] = $_REQUEST['username']; | ||
$_SESSION['password'] = $_REQUEST['password']; | ||
$_SESSION['autorized'] = TRUE; | ||
|
||
//Redirect | ||
header('Location: result.php'); | ||
|
||
} else { | ||
$loginError = TRUE; | ||
//header('Location: error.php'); | ||
} | ||
} | ||
|
||
|
||
?> | ||
<!DOCTYPE HTML> | ||
<html> | ||
<head> | ||
<title>Login</title> | ||
</head> | ||
<body> | ||
<fieldset> | ||
<legend>Login</legend> | ||
<?php if ( $loginError ) { ?> | ||
<p>Your username and password do not mach, or you do not have one account. <a href="login.php">Try again</a></p> | ||
<?php } ?> | ||
<form action="login.php" method="post"> | ||
<label>Username</label> | ||
<input name="username" id="mod-login-username" type="text" size="15" /> | ||
<br /> | ||
<label>Password</label> | ||
<input name="password" type="password" size="15" /> | ||
<br /> | ||
<input type="submit"/> | ||
</form> | ||
</fieldset> | ||
|
||
<div id="menu"> | ||
<ul> | ||
<li><a href="login.php">Login</a></li> | ||
<li><a href="result.php">Result</a></li> | ||
<li><a href="etc.php">Etc</a></li> | ||
<li><a href="login.php?logout=1">Logout</a></li> | ||
</ul> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
/* | ||
* @package WebDig | ||
* @author Emerson Rocha Luiz - emerson at webdesign.eng.br - http://fititnt.org | ||
* @copyright Copyright (C) 2011 Webdesign Assessoria em Tecniligia da Informacao. All rights reserved. | ||
* @license GNU General Public License version 3. See license-gpl3.txt | ||
* @license Massachusetts Institute of Technology. See license-mit.txt | ||
* @version 0.1alpha | ||
* | ||
*/ | ||
session_start(); | ||
|
||
if ( !isset($_SESSION['autorized']) ) die('You are not autorized to see this page. You must have cookies enabled'); | ||
?> | ||
<!DOCTYPE HTML> | ||
<html> | ||
<head> | ||
<title>Your are logged</title> | ||
</head> | ||
<body> | ||
<p>Hi, <?php echo $_SESSION['username']; ?></p> | ||
<div id="menu"> | ||
<ul> | ||
<li><a href="login.php">Login</a></li> | ||
<li><a href="result.php">Result</a></li> | ||
<li><a href="etc.php">Etc</a></li> | ||
<li><a href="login.php?logout=1">Logout</a></li> | ||
</ul> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
/* | ||
* @package WebDig | ||
* @author Emerson Rocha Luiz - emerson at webdesign.eng.br - http://fititnt.org | ||
* @copyright Copyright (C) 2011 Webdesign Assessoria em Tecniligia da Informacao. All rights reserved. | ||
* @license GNU General Public License version 3. See license-gpl3.txt | ||
* @license Massachusetts Institute of Technology. See license-mit.txt | ||
* @version 0.1alpha | ||
* | ||
*/ | ||
|
||
echo '<fieldset><legend>$_POST</legend><pre>'; | ||
if ( isset($_POST ) && !empty( $_POST ) ){ | ||
print_r( $_POST ); | ||
} else { | ||
echo 'Not set or empty'; | ||
} | ||
echo '</pre></fieldset>'; | ||
|
||
echo '<fieldset><legend>$_GET</legend><pre>'; | ||
if ( isset( $_GET ) && !empty( $_GET ) ){ | ||
print_r( $_GET ); | ||
} else { | ||
echo 'Not set or empty'; | ||
} | ||
echo '</pre></fieldset>'; | ||
|
||
echo '<fieldset><legend>$_COOKIE</legend><pre>'; | ||
if ( isset( $_COOKIE ) && !empty( $_COOKIE ) ){ | ||
print_r( $_COOKIE ); | ||
} else { | ||
echo 'Not set or empty'; | ||
} | ||
echo '</pre></fieldset>'; | ||
|
||
echo '<fieldset><legend>$_SESSION</legend><pre>'; | ||
if ( isset($_SESSION ) && !empty($_SESSION ) ){ | ||
print_r( $_SESSION ); | ||
} else { | ||
echo 'Not set or empty'; | ||
} | ||
echo '</pre></fieldset>'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters