note 114558 added to configuration.changes
| From: | andy at ddtechnologies dot com | Date: | Thu, 06 Mar 2014 08:31:25 +0000 |
| Subject: | note 114558 added to configuration.changes | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-198810@lists.php.net to get a copy of this message | ||
Registry Key Handling Through PHP:
This is an ready to use code. You just need to copy this code into a PHP file.
//php Code starts from here......
//Reading the Registry
$Wshshell= new COM('WScript.Shell');
$data= $Wshshell->regRead('HKEY_LOCAL_MACHINE\SOFTWARE\7-Zip\path');
echo "Data is::".$data;
//Function for writing to the registry.
function registry_write($folder, $key, $value, $type="REG_SZ")
{
$WshShell = new COM("WScript.Shell");
$registry = "HKEY_LOCAL_MACHINE\\SOFTWARE\\" . $folder . "\\" . $key;
try{
$result = $WshShell->RegWrite($registry, $value, $type);
echo "Entry is Successfully written at:".$registry;
return($result);
}
catch(Exception $e){
echo "Some Exception in Registry writing".$e;
}
return false;
}
// Function to deleting from the Register Entry.
function registry_delete($folder, $key, $value, $type="REG_SZ")
{
$WshShell = new COM("Wscript.shell");
$registry = "HKEY_LOCAL_MACHINE\\SOFTWARE\\" . $folder . "\\" . $key;
try{
$result = $WshShell->RegDelete($registry);
echo $key." is Successfully deleted from HKEY_LOCAL_MACHINE\\SOFTWARE\\" . $folder ;
return($result);
}
catch(Exception $e){
echo "Some Exception with the code::".$e;
}
return false;
}
//Here 7-ZIP is taken as a example.
$folder = "7-ZIP";
$key = "Key_name";
$value = "Key_Value";
registry_write($folder,$key,$value);
//registry_delete($folder,$key,$value);
?>
...
-------------------------------------------------------------------------------------
http://herobot.net
----
Server IP: 72.52.91.14
Probable Submitter: 72.52.91.14
----
Manual Page -- http://php.net/manual/en/configuration.changes.php
Edit -- https://master.php.net/note/edit/114558
Del: integrated -- https://master.php.net/note/delete/114558/integrated
Del: useless -- https://master.php.net/note/delete/114558/useless
Del: bad code -- https://master.php.net/note/delete/114558/bad+code
Del: spam -- https://master.php.net/note/delete/114558/spam
Del: non-english -- https://master.php.net/note/delete/114558/non-english
Del: in docs -- https://master.php.net/note/delete/114558/in+docs
Del: other reasons-- https://master.php.net/note/delete/114558
Reject -- https://master.php.net/note/reject/114558
Search -- https://master.php.net/manage/user-notes.php