PostIT

while scratching my head…

Install Smarty in Windows June 23, 2009

Filed under: PHP — Remo @ 12:53 pm
Tags: , , ,
This document assumes that your webserver and php5 is running.

Download Smarty - http://smarty.php.net

Installation - Windows, IIS/Apache, PHP5
Extract files, rename Smarty.x.x.x to smarty (suggest OUTSIDE of your www root!)
Example: d:\smarty
Run phpinfo.php to find out your php.ini location
Edit php.ini's include_path and add the location of the libs folder.
example: include_path = ".;d:\smarty\libs"
Restart IIS/Apache
Setup these two folders INSIDE your www root:
(wwwroot)/smarty/templates  (this is where your templates will go)
(wwwroot)/smarty/configs

Setup these two folders OUTSIDE of your www root:
d:/smarty/templates_c
d:/smarty/cache

Setup security settings for the webserver to write to these four folders

In (wwwroot) create index.php and in (wwwroot)/smarty/templates/index.tpl with the following code:

index.php:
<?php
// load Smarty library
require('Smarty.class.php');

$smarty = new Smarty;

$smarty->template_dir = 'd:/inetpub/wwwroot/smarty/templates';
$smarty->config_dir = ' d:/inetpub/wwwroot/smarty/config';
$smarty->cache_dir = 'd:/smarty/smarty_cache';
$smarty->compile_dir = 'd:/smarty/smarty_templates_c';

$smarty->assign('name','fish boy!');

$smarty->display('index.tpl');
?>

index.tpl
<html>
<body>
Hello, {$name}!
</body>
</html>

Now open index.php in your web browser (requested from your webserver)

http://localhost/index.php

You can work this out to a referenced script/class:
smarty_connect.php:
<?php

// load Smarty library
require('Smarty.class.php');

class smarty_connect extends Smarty
{
   function smarty_connect()
   {
        // Class Constructor.
        // These automatically get set with each new instance.

		$this->Smarty();

		$this->template_dir = ' d:/inetpub/wwwroot/smarty/templates';
		$this->config_dir = ' d:/inetpub/wwwroot/smarty/config';
		$this->compile_dir = 'd:/smarty/templates_c';
		$this->cache_dir = 'd:/smarty/cache';

		$this->assign('app_name', 'Intranet');
   }
}
?>

index.php:
<?php
require('smarty_connect.php');

$smarty = new smarty_connect;

$smarty->assign('name','Ned');

$smarty->display('index.tpl');
?>

index.tpl:
<html>
<body>
 Hello, {$name}!
</body>
</html>

If you are getting an error that Smarty.class.php isn't found
chances are that your include_path isn't correct or
you didn't edit the one that the webserver is using,
check your phpinfo.php!

source:

http://news.php.net/php.smarty.dev/2703
 

No Active Mixer Device… May 30, 2009

Filed under: Windows — Remo @ 3:34 am
Tags: ,

Start > Run > services.msc

Start Windows Audio Service

 

Remove Windows Service May 16, 2009

Filed under: Windows — Remo @ 2:18 am
Tags: ,
1. Using INSTSERV
INSTSRV <SERVICENAME> REMOVE

2. Using SC.EXE from ResKit CD
sc delete <service_name>

3. Manually via Registry
HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services

Resource Kit can be downloaded here
 

Enable/Disable Regedit May 14, 2009

Filed under: Windows, security — Remo @ 11:13 pm
Tags: , ,

Create a VBS file, copy/paste this text into that file

Option Explicit

‘Declare variables
Dim WSHShell, n, MyBox, p, t, mustboot, errnum, vers
Dim enab, disab, jobfunc, itemtype

Set WSHShell = WScript.CreateObject(“WScript.Shell”)
p = “HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System\”
p = p & “DisableRegistryTools”
itemtype = “REG_DWORD”
mustboot = “Log off and back on, or restart your pc to” & vbCR & “effect the changes”
enab = “ENABLED”
disab = “DISABLED”
jobfunc = “Registry Editing Tools are now “

‘This section tries to read the registry key value. If not present an
‘error is generated.  Normal error return should be 0 if value is
‘present
t = “Confirmation”
Err.Clear
On Error Resume Next
n = WSHShell.RegRead (p)
On Error Goto 0
errnum = Err.Number

if errnum <> 0 then
‘Create the registry key value for DisableRegistryTools with value 0
WSHShell.RegWrite p, 0, itemtype
End If

‘If the key is present, or was created, it is toggled
‘Confirmations can be disabled by commenting out
‘the two MyBox lines below

If n = 0 Then
n = 1
WSHShell.RegWrite p, n, itemtype
Mybox = MsgBox(jobfunc & disab & vbCR & mustboot, 4096, t)
ElseIf n = 1 then
n = 0
WSHShell.RegWrite p, n, itemtype
Mybox = MsgBox(jobfunc & enab & vbCR & mustboot, 4096, t)
End If

source:

http://dougknox.com/security/scripts_desc/regtools.htm

 

Enable/Disable Windows Scripting Host (WSH) May 14, 2009

Filed under: Windows — Remo @ 11:09 pm
Tags: ,

Create REG_DWORD entries  in:

HKCU\Software\Microsoft\Windows Script Host\Settings\Enabled

and

HKLM\Software\Microsoft\Windows Script Host\Settings\Enabled

set the value to 0 (zero) to disable, and set to 1 to enable

- updated -

I found a software which can do similar task, so you don’t need to do it manually…try to download here

 

Start MySQL as Windows Service January 13, 2009

Filed under: MySQL, Windows — Remo @ 2:00 am
Tags: , ,

mysqld   –install MySQL –defaults-file=C:\my-opts.cnf