Connecting to your MySQL Database from a Php page using PDO (PHP Data Objects)

  In order to connect to a MySQL DB from Php, you need to frame the connection string and   Index.php <?php     include_once("config.php"); ?>   Config.php <?php     //set off all error for security purposes     error_reporting(E_ALL);         //define some contstant     define( "DB_DSN", "mysql:host=localhost;dbname=<myDBName>" );     define( "DB_USERNAME", "root" );     define( "DB_PASSWORD", "<myrootpasswordhere>" );     define( "CLS_PATH", "class" );     //include the classes     include_once( CLS_PATH . "/DBClass.php" ); ?>   DBClass.php <?php class DBClass {     public function Connect_mysqlDB(){         try {             $con = new PDO( DB_DSN, DB_USERNAME, DB_PASSWORD );             $con->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION […]

Read more

PowerShell Regular Expression: Find and Replace default username with current username in an .XML configuration file

I’ve below Config file in which there are multiple instances of user profile path (C:UsersCoreluser001.Testlab.*).  This user profile path points to a default user and needs to be updated to the currently logged on user profile path (C:Users<username>.*).   PS C:> grep -i "Coreluser001" C:TempCorelConnect-Default.config <AppPrefs xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" TrayRootDirectory="C:UsersCoreluser001.TestlabDocumentsCorelCorel ContentTrays" SelectedTray="C:UsersCoreluser001.TestlabDocumentsCorelCorel ContentTraysTray">     <Folder Provider="6253a437-710e-4bda-9e51-052b9f3f41c1" LanguageIndex="0" DisplayContentIndex="0" NumResultsIndex="0" IsSearched="true" IsActivated="true" StoredTitle="Documents" Path="C:UsersCoreluser001.TestlabDocuments" />     <Folder Provider="6253a437-710e-4bda-9e51-052b9f3f41c1" LanguageIndex="0" DisplayContentIndex="0" NumResultsIndex="0" IsSearched="false" IsActivated="true" StoredTitle="My Pictures" Path="C:UsersCoreluser001.TestlabPictures" />     <Folder Provider="6253a437-710e-4bda-9e51-052b9f3f41c1" LanguageIndex="0" DisplayContentIndex="0" NumResultsIndex="0" IsSearched="true" IsActivated="true" StoredTitle="Desktop" Path="C:UsersCoreluser001.TestlabDesktop" />     <Searchable xsi:type="Folder" Provider="6253a437-710e-4bda-9e51-052b9f3f41c1" LanguageIndex="0" DisplayContentIndex="0" NumResultsIndex="0" IsSearched="true  IsActivated="true" StoredTitle="Desktop" Path="C:UsersCoreluser001.TestlabDesktop" />     <Searchable […]

Read more

VBScript to get CPU, RAM, OS and Network parameters

Script: ‘=============================================================================== ‘ Script name   : Get-SystemInfo.vbs ‘ Author        : Govardhan Gunnala ‘ Date          : mm/dd/yyyy ‘ Objective     : Fetches Custom Details of System Information ‘ ‘ $Header: $ ‘=============================================================================== ‘ Global Statements ‘=============================================================================== On Error Resume Next ‘=============================================================================== ‘ Global Constants and Variables ‘=============================================================================== Dim strComputer ‘=============================================================================== ‘ Initialize Globals ‘=============================================================================== strComputer = "." ‘=============================================================================== ‘ main() ‘=============================================================================== Set objWMIService = GetObject("winmgmts:" _     & "{impersonationLevel=impersonate}!\" & strComputer & "rootcimv2") Set CompItems = objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem") For Each objItem in CompItems     SysRAM = objItem.TotalPhysicalMemory     GB = 1024 *1024 * 1024     SysRAMinGB = Round(SysRAM / GB,2)    […]

Read more