Posts Tagged ‘php’

new Israeli php mirror!

Monday, May 17th, 2010

i want to introduce the new Israeli PHP mirror which is available for your free use, enjoy!

Kayako API extension: CreateUser, UpdatePassword, DeleteUser

Wednesday, September 16th, 2009

I’ve played with the nice and clear Craig Brass Kayako API, and added some extensions to allow the following remote functions:

CreateUser, UpdatePassword, DeleteUser

get the patch from here: http://interhost.co.il/api.class.patch
installation: patch -p0 < api.class.patch

and also apply this patch:

http://interhost.co.il/wsdl.patch
install:
patch -p0 < wsdl.patch
location: integrationapi/lib

and I also extended the example (api client), get it from here:
http://www.interhost…ako.api.php.txt

usage example:

http://api.caller.com/kayako.api.php?cmd=updateEmailAddress&oldEmail=old@email.com&newEmail=new@email.com&api_password=cleartext

interface: GET/POST
usage: kayako.api.php?cmd=<command>..args..&api_password=<api_password>
Availble commands:
cmd=updateEmailAddress
a1=oldEmail
a2=newEmail

cmd=changePassword
a1=email
a2=newpassword

cmd=deleteUser
a1=email

cmd=registerUser
a1=email
a2=userpassword
a3=fullname

any comments will be appriciated.
p.s its a proof of concept example, use on your own responsibility only.

thanks

php gtk application example

Sunday, April 6th, 2008

Have you heard about PHP GTK? You can create GUI php application which can run on every operation system on which php-gtk is installed (Windows, Linux, MacOS).

The programming part is very simple, php-gtk provides you easy intuitive classes to work with.

Here is a short fast example for simple password generator  which I created using php-gtk examples:

 <?php

if (!class_exists('gtk')) {
die("Please load the php-gtk2 module in your php.ini\r\n");
}
 
$wnd = new GtkWindow();
$wnd->set_title('random pass');
$wnd->connect_simple('destroy', array('gtk', 'main_quit'));
 
$txtPassword = new GtkEntry();
 
$tbl = new GtkTable(3, 2);
$tbl->attach($txtPassword, 1, 2, 2, 3);
 
$btnGen = new GtkButton('_Generate');
$btnGen->connect_simple('clicked', 'generate', $txtPassword);
 
$bbox = new GtkHButtonBox();
$bbox->set_layout(Gtk::BUTTONBOX_EDGE);
$bbox->add($btnGen);
 
$vbox = new GtkVBox();
$vbox->pack_start($tbl);
$vbox->pack_start($bbox);
 
$wnd->add($vbox);
$wnd->show_all();
Gtk::main();
 
function generate(GtkEntry $txtPassword)
{
$chars = "abcdefghijkmnopqrstuvwxyz023456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
srand((double)microtime()*1000000);
$i = 0;
$pass = '' ;
while ($i <= 7) {
$num = rand() % 56;
$tmp = substr($chars, $num, 1);
$pass = $pass . $tmp;
$i++;
}
$random=$pass;
$txtPassword->set_text($random);
}
?>

 

 Running this: D:\php-gtk\php-gtk2>php myproj/random_pass_gtk.php

 

 

backup rotate script

Friday, January 4th, 2008

REMold.php will checks for old files/directories and deletes them, it will also check for the disk usage of a current path, if the usage is higher then wanted the script will delete all files or directories that are older then a given time span.

Useful for working with Directadmin’s backups directories for removing old backups automatically. The script will check the given path disk usage and delete older files untill the disk usage limit gained.

Tested on Debian/Ubuntu.

Update your crontab to run this script daily.

Download REMold-10php.tar.gz