Jump to content

Werezwolf

Members
  • Posts

    22
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Werezwolf

  1. So i was looking around and found that the contacts book (address book for Outlook) has the potential to store allot of data, and i mean more then what anyone would properly put in. Here is the list (100 Columns): Full_Name, Title, First_Name, Middle_Name, Surname, Initals, Suffix, Job_Title, Department, Organization, Email, Street_Address, City, State/Province/County, Postal_Code, Country, Telephone, Home_Tel., Fax, Other_Fax, Other_Email, Mobile, Pager, Info, Home_Post_Address, Home_Street_Address, Postal_Address, SMR_Address, Web_Site, Business_Street_2, Business_Street_3, Home_Street_2, Home_Street_3, Home_City, Home_State, Home_Postal_Code, Home_Country, Other_Street, Other_Street_2, Other_Street_3, Other_City, Other_State, Other_Postal_Code, Other_Country, Assistant's_Phone, Business_Fax, Business_Phone_2, Callback, Car_Phone, Company_Main_Phone, Home_Fax, Home_Phone_2, ISDN, Other_Phone, Primary_Phone, Radio_Phone, Telex, Account, Anniversary, Assistant's_Name_, Billing_Information, Birthday, Business_Address_PO_Box, Categories, Children, Company_Yomi, Directory_Server, E-mail_Type, E-mail_Display_Name, E-mail_2_Address, E-mail_2_Type, E-mail_Display_Name, E-mail_3_Address, E-mail_3_Type, E-mail_3_Display_Name, Gender, Government_ID_Number, Hobby, Home_Address_PO_Box, Internet_Free_Busy, Keywords, Language, Location, Manager's_Name, Mileage, Office_Location, Organizational_ID_Number, Other_Address_PO_Box, Prioity, Private, Profession, Referred_By, Sensitivity, Spouse, Surname_Yomi, User_1, User_2, User_3, User_4, Nickname I particularly like: Government_ID_Number (this could be handy) Language (I don't think that most of us would be Multi-Lingal) Mileage (Because i like the car and i want to by it at 300,000 KM) So what would you want to put in your database?
  2. That's what i get for not typing in a syntax highlighter and on my phone couldn't fix it up when i got home.
  3. Wordpress has a few options.php files one in WP-includes and one in WP-admin I haven't drilled into the word-press directories but there might be a number of them If your including or requiring a page from a wordpress functions page you might very well be inheriting it from somewhere else in these directories this may help https://www.google.com.au/search?q=option.php%20options.php%20site:https://github.com/WordPress/
  4. I completely agree with Psyco in most cases but if your typing mostly the same output you'll want to nest I have a general rule of of nesting at max is 3 if i go over i check if i can do the logic differently. Basically the flip side of the coin if(!isset($_POST["submit"])){// if there was no submit variable passed to the script (i.e. user has visited the page without clicking submit), display the form: if(!empty($_SESSION["MSG"])){echo '<div class="MSG">' . $_SESSION["MSG"] . '</div><br /><br />';}//easyer to nest this echo '<form name="LoginForm" class="formbox" id="LoginForm" action="index.php" method="post" /> Username: <input type="text" name="username" id="username"/><br /> Password: <input type="password" name="password"><br /> <input type="submit" name="submit" id="submit" value="submit" /> </form>'; unset($_SESSION["MSG"]); }//elseif do more stuff VS if(!isset($_POST["submit"]) && !empty($_SESSION["MSG"])){//There was a session message and if there was no submit variable passed to the script (i.e. user has visited the page without clicking submit), display the form: echo '<div class="MSG">' . $_SESSION["MSG"] . '</div><br /><br />'; echo '<form name="LoginForm" class="formbox" id="LoginForm" action="index.php" method="post" /> Username: <input type="text" name="username" id="username"/><br /> Password: <input type="password" name="password"><br /> <input type="submit" name="submit" id="submit" value="submit" /> </form>'; unset($_SESSION["MSG"]); }elseif(!isset($_POST["submit"])){// if there was no submit variable passed to the script (i.e. user has visited the page without clicking submit), display the form: echo '<form name="LoginForm" class="formbox" id="LoginForm" action="index.php" method="post" /> Username: <input type="text" name="username" id="username"/><br /> Password: <input type="password" name="password"><br /> <input type="submit" name="submit" id="submit" value="submit" /> </form>'; }//elseif do more stuff
  5. On member.php Your not checking if the values are set or not change if ($username && $userid) { To if(!isempty($username) && !isempty($userid){ echo "Welcome <b>$username</b>, <a href='./logout.php'>Logout</a>"; }else{ echo "Please login to access this page. <a href='./login.php'>Login here</a>"; } Depending on what you want to check you should look at this site. https://www.virendrachandak.com/techtalk/php-isset-vs-empty-vs-is_null/ On Login.php if ($_POST['loginbtn']) { should be if(isset($_POST['loginbtn'])) { and are $user and $pass ment to be $_POST['user'] and $_POST['pass] if thats the case you then should be useing if(isset($_POST['user']) && isset($_POST['pass'])) { //perform database query }else{ //user failed to provide username or password } Hope it helps you allot
  6. Just a suggestion You may want to send the userid after authentication to $_SESSION and have a script like this on your testes.php http://php.net/manual/en/reserved.variables.session.php <?php error_reporting(E_ALL | E_NOTICE); ini_set('display_errors', '1'); if(!session_id()){session_start();} require_once("./include/membersite_config.php"); if($_SESSION['userid'] != 1261){die(header('refresh:0; ../index.php', false));} //Do not pass Go, Do not collect $200 if userid is not equal to 1261 //Insert more code ?>
  7. This is basically a Show off your Logging, Error Reporting and/or Honeypot scripts for Web servers. Summary This is a php version that includes various features including randomized fake error reporting to the client and detailed logging (that is part of an ongoing project and is inspired by a few online resources). Useful for slowing down scanners, and generally seeing what happens to your server while your away. You will probably will need to change example.com to something. ./global.php <?php if(!session_id()){session_start();} $_SERVER['logdate'] = date('Dd_M_Y'); Function TarPit() { /* Send to Tarpit */ $responce = array(204,300,301,302,303,304,404,406,409,410,418,500); $array_select = array_rand($responce,1); http_response_code($responce[$array_select]); Exit(Require_once './custerr/en.php'); } Function Logging($state,$name,$message,$script){ //Int,String,String,Bool if(isset($_SERVER['HTTP_USER_AGENT'])){$_SERVER['HTTP_USER_AGENT'] = 'UserAgent Not Set';} //Logging Method $logstr = "=========================================================\r\n"; //Other,Success, Failed, Error If($state = 0){$logstr .= $name . "\r\n";}//Other elseif($state = 1){$logstr .= 'Success: '. $name . "\r\n";}//Success elseif($state = 2){$logstr .= 'Failed: '. $name . "\r\n";}//Failed elseif($state = 3){$logstr .= 'Error: '. $name . "\r\n";}//Error $logstr .= "=========================================================\r\n"; $logstr .= $_SERVER['REQUEST_TIME_FLOAT'] . "\r\n"; $logstr .= $_SERVER['date'] . "\r\n"; $logstr .= $_SERVER['HTTP_USER_AGENT'] . "\r\n"; if(isset($username)){ $logstr .= "---- User Authenticating ---- \r\n"; $logstr .= $_SERVER['REMOTE_ADDR'] . ' - ' . $username .": Attempted Login result \r\n";} elseif(isset($_SESSION['username'])){ $logstr .= "---- User Authenticated ---- \r\n"; $logstr .= $_SERVER['REMOTE_ADDR'] . ' - ' . $_SESSION['username']. "\r\n";} else{$logstr .= $_SERVER['REMOTE_ADDR'] . "\r\n";} if($script !== 0){ $logstr .= "---- Powershell ---- \r\n"; $logstr .= 'powershell.exe -ExecutionPolicy ByPass -command "' . $psScriptPath . '" < NUL -rand "' . $rand . '" < NUL -base64_username "' . $base64_username . '" < NUL -base64_password "' . $base64_password . '" < NUL'."\r\n";} if(!empty($GLOBALS['php_errormsg'])){ $logstr .= "---- php_errormsg ---- \r\n"; $logstr .= $GLOBALS['php_errormsg']."\r\n";} if(!isset($message)){ $logstr .= "---- Additional Information ----\r\n"; $logstr .= $message."\r\n";} $logstr .= "---- Session ----\r\n"; foreach ($_SESSION as $key => $value) { if(is_array($_SESSION[$key])){ foreach ($_SESSION[$key] as $key2 => $value2) { $logstr .= '$_SESSION['.$key.']['.$key2.'] = '.print_r($_SESSION[$key][$key2],true)."\r\n";} }else{$logstr .= '$_SESSION[\'' . $key . '\'] = ' . $value ."\r\n";} } $logstr .= "\r\n"; // '../Logging/'.$_SERVER['logdate'].'.txt' should preferably be outside the website root or protected by .htaccess or cmod file_put_contents('../Logging/'.$_SERVER['logdate'].'.txt', $logstr, FILE_APPEND | LOCK_EX); RETURN $logstr; } Function ErrorHandle($message,$tarpit){ //Critical Error //EXIT(ErrorHandle(Logging($state,$name,$message,$script),$tarpit)); Is Suggested //String, bool, Int //Report to Administration $headers = "From: webmaster@example.com \r\n" . "Reply-To: webmaster@example.com \r\n" . "X-Mailer: PHP/" . phpversion(); mail('webmaster@example.com', "Error Handle" . $message, $headers); $_SESSION['MSG'] = NULL; if($tarpit == 1){exit(TarPit());} else{exit(/*Destroy Session Data maybe*/);} } ?> ./custerr/en.php <?php $http_response_code = array(204,300,301,302,303,304,404,406,409,410,418,500); $http_response_name = array('No Content','Multiple Choices','Moved Permanently','Found','See Other','Not Modified','Not Found','Not Acceptable','Conflict','Gone','I am a Teapot','Internal Server Error'); $http_response_discription = array('','Just letting you know this is actually a questionnaire?','Moved permanently somewhere else. Definitely not here although','Don\'t Panic! The monkeys have found it','Go see the other guy.','This page is Definitely not modified in anyway.',' The requested URL ' . $_SERVER['REQUEST_URI'] . ' was not found by the monkeys on this server.','This is Unacceptable','Just couldn\'t decide on what to give you','It\'s Gone. Just Gone?','I am a Teapot','Internal Server Error'); $key = array_search(http_response_code(),$http_response_code); Print('<!DOCTYPE html> <html><head> <title>' . http_response_code() .' '. $http_response_name[$key] .'</title> <h1>' . http_response_code() .' '. $http_response_name[$key] .'</h1> <p>' . $http_response_discription[$key] . '</p> </body></html>'); ?> ./Test.php <?php require_once 'global.php'; $serverarray = array($_SERVER['SERVER_ADDR'],'example.com'); if(!array_search($_SERVER['SERVER_NAME'],$serverarray)){EXIT(ErrorHandle(Logging(0,'Other Server Request','Requested Server'.$_SERVER['SERVER_NAME'],0),1));} ?>
  8. Right just had to make sure. I'm unable to because it is Active Directory.
  9. I was trying to keep my post short and on topic that is all. But ill post a revision here just for you. if(!isset($_POST["submit"])){// if there was no submit variable passed to the script (i.e. user has visited the page without clicking submit), display the form: if(!empty($_SESSION["MSG"])){echo '<div class="MSG">' . $_SESSION["MSG"] . '</div><br /><br />';} echo '<form name="LoginForm" class="formbox" id="LoginForm" action="index.php" method="post" /> Username: <input type="text" name="username" id="username"/><br /> Password: <input type="password" name="password"><br /> <input type="submit" name="submit" id="submit" value="submit" /> </form>'; unset($_SESSION["MSG"]); }elseif(!empty($_POST["username"]) && !empty($_POST["password"])){//do stuff }else{// Else the user hit submit without all required fields being filled out: $_SESSION['MSG'] = '</br>Please Complete all fields</br>'; exit(header('Location: ./index.php', false)); }
  10. $YourName = $_REQUEST['YourName'] ; $FavoriteWord = $_REQUEST['FavoriteWord'] ; I would try replacing $_REQUEST with $_POST. See http://php.net/manual/en/reserved.variables.request.php http://php.net/manual/en/reserved.variables.post.php
  11. As all previous posters above have stated make sure that you start your session <?php if(!session_id()){session_start();} ?> EDIT: Actually you might not of installed PHP-Login Advanced correctly. As i have not used it myself of the installation options, you may want to try reinstalling that before you move on to my next suggestion. If there was anything about session cookies or directories you may want to keep them at default. If that dose not work you php.ini may not be configured correctly i would edit that first or if you cant your Last option is. <?php session_set_cookie_params (0,'/','mywebsite.com',0,0); if(!session_id()){session_start();} ?> For more information on session_set_cookie_params http://php.net/manual/en/function.session-set-cookie-params.php --OffTopic Dose anyone have a problem with $_SERVER['SERVER_NAME'] as a catch all ? As it may be a better suggestion session_set_cookie_params (0,'/',$_SERVER['SERVER_NAME'],0,0);
  12. I think the title is very clear but i have a site that has 2 user databases, one for web mail (Round cube) and one for a directory of content that the user has to be authenticated for. I was wondering if i should throw the password in $_SESSION and authenticate web mail if the user is logged in? Obviously i should not send that password back to the client if it be encrypted or not but i would inject the username and password into the web mail authentication handler as if the user had already filled in the form. Due to certain circumstances i am unable to merge the user databases. If there are any other possibilities do recommend them instead.
  13. I have always prefer this method of outputting HTML in blocks of echo [or print_r() ] personally, my reasoning is "mostly" everyone should know what HTML is and not much need for it to be highlighted in syntax. But it dose boil down to personal preference. if(!isset($_POST["submit"])){// if there was no submit variable passed to the script (i.e. user has visited the page without clicking submit), display the form: if(!empty($_SESSION["MSG"])){echo '<div class="MSG">' . $_SESSION["MSG"] . '</div><br /><br />';} echo '<form name="LoginForm" class="formbox" id="LoginForm" action="index.php" method="post" /> Username: <input type="text" name="username" id="username"/><br /> Password: <input type="password" name="password"><br /> <input type="submit" name="submit" id="submit" value="submit" /> </form>'; unset($_SESSION["MSG"]); }elseif(isset($_POST["submit"]){//do stuff }
  14. Ran through the old code once more and checked it. There was an old script that was meant to be removed but it essentially set $_SESSION = ''; Now i feel stooped for not commenting it out, As many people state "We learn from our mistakes".
  15. $_DIR['ROOT'] = $_SERVER['DOCUMENT_ROOT'] .'/..';//Outside the scope of WWW root $_DIR['LOG'] = $_DIR['ROOT'] .'/logs/LogFiles/' . $_SERVER['SERVER_NAME']; if (!is_dir($_DIR['LOG'])){Mkdir($_DIR['LOG'],0700,TRUE);} I created a directory to log with on my Dev server assigning all sorts of values to these logs but i got some resolving DNS names that are not associated with my website at all. Why would $_SERVER['SERVER_NAME'] be resolving other names that are not related to my server? Expected Posiblities 127.0.0.1 Internal IP Address External IP Address test.example.com (My Website URI) Unexpected Results www.baidu.com www.epochtimes.jp www.ly.com
  16. Nither do i. the problem seems to be with the file itself? i just copyed my code section by section into another file and referenced that and it works now. This is ofcoruse a bigger project ive posted somthing in Misc about Active Directory Authentication in Misc
  17. array ( 0 => '1422937575,/~Debug/index2.php', 1 => '1422937581,/~Debug/index2.php', 2 => '1422937582,/~Debug/index2.php', ) im watching my Log file aswell [03-Feb-2015 15:26:15 Australia/Melbourne] PHP Notice: A session had already been started - ignoring session_start() in C:\inetpub\wwwroot\~debug\index2.php on line 3 [03-Feb-2015 15:26:21 Australia/Melbourne] PHP Notice: A session had already been started - ignoring session_start() in C:\inetpub\wwwroot\~debug\index2.php on line 3 [03-Feb-2015 15:26:22 Australia/Melbourne] PHP Notice: A session had already been started - ignoring session_start() in C:\inetpub\wwwroot\~debug\index2.php on line 3 It works atleast
  18. pre------- PAGE1 OUTPUT -------br session_id i5naf6udl3gl4dotnjatqm23b0br session databr array ( 'HTTPS' => 1, 'DateModified' => 'Tue 03 Feb 2015 02:02:43', 'REQUEST_URI' => array ( 0 => '1422935923,/~Debug/', ), 'foo' => 'bar', )br ----------------------------br pre ------- PAGE2 OUTPUT ------- session_id: i5naf6udl3gl4dotnjatqm23b0 session data: array ( 'HTTPS' => 1, 'DateModified' => 'Tue 03 Feb 2015 02:02:43', 'REQUEST_URI' => array ( 0 => '1422935923,/~Debug/', ), 'foo' => 'bar', ) ---------------------------- I do have all this in a function but http://php.net/manual/en/language.variables.superglobals.php assures me that $_SESSION is a superglobal yet its not behaving thatway as i do have it in a function
  19. i5naf6udl3gl4dotnjatqm23b0 i5naf6udl3gl4dotnjatqm23b0 never set? Array ( [0] => 1422934817,/~Debug/index.php ) i refreshed it 5 times and switched between /~debug/ and /~debug/index.php i even deleted all sessions and started a new one results in the same No new sessions are created either. I went one step futher and added session_start(); echo session_id().' '; print_r($_SESSION); it printed i5naf6udl3gl4dotnjatqm23b0 i5naf6udl3gl4dotnjatqm23b0 Array ( [HTTPS] => 1 [DateModified] => Tue 03 Feb 2015 02:02:32 [REQUEST_URI] => Array ( [0] => 1422935072,/~Debug/index.php ) ) never set? Array ( [0] => 1422935073,/~Debug/index.php )
  20. Thanks for the Quick Reply I threw it into everysingle page including any Require or Include pages aswell i still endup with the same i can write to session but it never retrives the data. I thought it might be a permission issue but if i can write to it i should be able to read from it right?
  21. Sorry if i posted this in the wrong place but i dident see anthing about Active Directory or Security Questions But has anyone used Active Directory as their User Database? Has anyone even tryed braking Active Directory with injection attacks? Notes that i have found so far: Php Sends to CMD first so encode userdata in base64 as a transport layer $rand is a random number to prevent users from useing Success: as a ligitimate user You will need to clean up the many many spaces that powershell sends back as it is a concole Special Charicters dont need to be escaped I am using Win 2008 RC2 Apache PHP (of course) Powershell Active Directory PHP Script $psScriptPath = 'C:/Apache/PSScripts/' //Path outside Website Root $rand = mt_rand(mt_getrandmax(),mt_getrandmax()); //UTF-8 Standard only $username = utf8_decode($_POST["username"]); $password = utf8_decode($_POST["password"]); $base64_username = base64_encode($username); //Transport Layer Base64 $base64_password = base64_encode($password); //Transport Layer Base64 //The danger happens here as it is sent to powershell. $query = shell_exec('powershell.exe -ExecutionPolicy ByPass -command "' . $psScriptPath . '" < NUL -rand "' . $rand . '" < NUL -base64_username "' . $base64_username . '" < NUL -base64_password "' . $base64_password . '" < NUL');// Execute the PowerShell script, passing the parameters Powershell Script #*============================================================================= #* Script Name: adpwchange2014.ps1 #* Created: 2014-10-07 #* Author: #* Purpose: This is a simple script that queries AD users. #* Reference Website: http://theboywonder.co.uk/2012/07/29/executing-powershell-using-php-and-iis/ #* #*============================================================================= #*============================================================================= #* PARAMETER DECLARATION #*============================================================================= param( [string]$base64_username, [string]$base64_password, [string]$rand ) #*============================================================================= #* IMPORT LIBRARIES #*============================================================================= if ((Get-Module | where {$_.Name -match "ActiveDirectory"}) -eq $null){ #Loading module Write-Host "Loading module AcitveDirectory..." Import-Module ActiveDirectory }else{ write-output "Error: Please install ActiveDirectory Module" EXIT NUL Stop-Process -processname powershell* } #*============================================================================= #* PARAMETERS #*============================================================================= $username = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($base64_username)) $password = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($base64_password)) #*============================================================================= #* INITIALISE VARIABLES #*============================================================================= # Increase buffer width/height to avoid PowerShell from wrapping the text before # sending it back to PHP (this results in weird spaces). $pshost = Get-Host $pswindow = $pshost.ui.rawui $newsize = $pswindow.buffersize $newsize.height = 1000 $newsize.width = 300 $pswindow.buffersize = $newsize #*============================================================================= #* EXCEPTION HANDLER #*============================================================================= #*============================================================================= #* FUNCTION LISTINGS #*============================================================================= Function Test-ADAuthentication { Param($Auth_User, $Auth_Pass) Write-Output "Running Function Test-ADAuthenication" $domain = $env:USERDOMAIN Add-Type -AssemblyName System.DirectoryServices.AccountManagement $ct = [System.DirectoryServices.AccountManagement.ContextType]::Domain $pc = New-Object System.DirectoryServices.AccountManagement.PrincipalContext($ct, $domain) $pc.ValidateCredentials($Auth_User, $Auth_Pass).ToString() } #*============================================================================= #* SCRIPT BODY #*============================================================================= Write-Output $PSVersionTable Write-Output " " $authentication = Test-ADAuthentication "$username" "$password" if ($authentication -eq $TRUE) { Write-Output "Success:$rand Authentication" }elseif ($authentication -eq $FALSE) { Write-Output "Failed:$rand Authentication" }else { Write-Output "Error: EOS" EXIT NUL Stop-Process -processname powershell* } #*============================================================================= #* SCRIPT Exit #*============================================================================= Write-Output "End Of Script" EXIT NUL Stop-Process -processname powershell*
  22. I am trying to create a history of requested URI's (upto 3) for two purposes Login page and Error Logging. My problem is the Session is written and the values are set yet i can not retrieve the values in it upon a refresh. The use of an Array is to manage the quantity of max values (not written in yet). <?php session_start(); //printing $_SESSION['REQUEST_URI'] here will result in nothing when it should contain something. $REQUEST_URI = time().','.$_SERVER['REQUEST_URI']; if(is_array($_SESSION['REQUEST_URI'])){array_push($_SESSION['REQUEST_URI'],array($REQUEST_URI));} else{$_SESSION['REQUEST_URI'] = array($REQUEST_URI);Print('never set? ');}//if dosent exist create the array if(isset($_SESSION['REQUEST_URI'])){print_r($_SESSION['REQUEST_URI']);} ?> Session contains REQUEST_URI|a:1:{i:0;s:19:"1422925783,/~Debug/";} After a refresh i expect REQUEST_URI|a:2:{i:0;s:19:"1422925783,/~Debug/";i:1;s:28:"1422925784,/~Debug/index.php";} Yet it only contains REQUEST_URI|a:1:{i:0;s:28:"1422925784,/~Debug/index.php";}
×
×
  • 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.