// like an array, but with one important difference
var myObj = {
name : "Some Dude",
age : "20"
}
for (var i in myObj) {
if (myObj.hasOwnProperty(i)) {
alert(myObj[i]); // actual properties
} else {
// ignore inherited properties like "length"
}
}
var myArray = new Array("I","Like","Pie");
for (var i in myArray) {
alert(myArray[i]);
}
eh
class inursql {
function connect($hostname, $username, $password, $database) {
global $hostname, $username, $password, $database;
$c = mysql_connect($hostname, $username, $password) or die(mysql_error());
mysql_select_db($database, $c);
return $c;
}
function query($sql) {
$query = mysql_query($sql) or die(mysql_error());
return $query;
}
function grab($query) {
$array = mysql_fetch_assoc($query);
return $array;
}
function pick($query) {
$array = mysql_fetch_row($query);
return $rows;
}
}
$ch = curl_init("http://www.google.com/");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$page = curl_exec($ch);
curl_close($ch);
$curl = curl_init();
curl_setopt ($curl, CURLOPT_URL, 'http://www.google.com');
curl_exec ($curl);
curl_close ($curl);
Source/README: http://townkill.org/projects/tcl/vhost.tcl
set opernick "eggdrop"
set operpass "eggdrop123"
set operchan "#opers"
set queuemsg "Your vhost has been qeued and awaiting approval. Thank you."
set admin1 "admin1"
set admin2 "admin2"
set file "ircd.vhosts"
set path "/path/to/ircd.vhosts"
## This will automatically oper up on connect if set as 1
set operonconnect "1"
## Do NOT edit below this line unless you know what you are doing.
proc evnt:init_server {type} {
global operpass opernick operonconnect
if {$operonconnect == "1"} {
putserv "OPER $opernick $operpass"
return 1
} else {
return 0
}
}
proc reqvhost {nick uhost hand arg} {
global operchan admin1 admin2 w1 w2 w3 queuemsg
set arg [split $arg]
set w1 [lindex $arg 0]
set w2 [lindex $arg 1]
set w3 [lindex $arg 2]
putserv "PRIVMSG $operchan : User: \00315 $nick \003 ( $uhost ) has requested login/pass/vhost: $w1 / $w2 / $w3 . Awaiting approval."
putserv "PRIVMSG Memoserv : send $admin1 User: $nick ( $uhost ) has requested login/pass/vhost: $w1 / $w2 / $w3 . Awaiting approval."
utimer 10 "[putserv "PRIVMSG $operchan : Notifying admins..."]"
putserv "PRIVMSG Memoserv : send $admin2 User: $nick ( $uhost ) has requested login/pass/vhost: $w1 / $w2 / $w3 . Awaiting approval."
putserv "PRIVMSG $nick : $queuemsg"
return 1
}
proc appvhost {nick uhost hand arg} {
global operchan path file w1 w2 w3 admin1 admin2
if {$nick != $admin1} {
putserv "NOTICE $nick : You do not have permission to use this command."
return 0
} elseif {$nick != $admin2} {
putserv "NOTICE $nick : You do not have permission to use this command."
return 0
} else {
putserv "NOTICE $operchan : User: \00315 $nick \003 ( $uhost ) has approved the vhost."
set fs [open $path/ircd.vhosts a]
set arg [split $arg]
set w1 [lindex $arg 0]
set w2 [lindex $arg 1]
set w3 [lindex $arg 2]
puts $fs "vhost { vhost $w3; from { userhost *@*; }; login $w1; password $w2; };"
close $fs
putserv "REHASH"
putserv "NOTICE $operchan : $arg added. Rehashed the server."
putserv "PRIVMSG $w1 : Your vhost: $w1 / $w2 / $w3 has been accepted."
return 1
}
}
proc apphost {nick uhost handle channel arg} {
global operchan path file w1 w2 w3
if {$channel == $operchan} {
putserv "NOTICE $operchan : User: \00315 $nick \003 ( $uhost ) has approved the vhost."
set fs [open $path/ircd.vhosts a]
set arg [split $arg]
set w1 [lindex $arg 0]
set w2 [lindex $arg 1]
set w3 [lindex $arg 2]
puts $fs "vhost { vhost $w3; from { userhost *@*; }; login $w1; password $w2; };"
close $fs
putserv "REHASH"
putserv "NOTICE $operchan : $arg added. Rehashed the server."
putserv "PRIVMSG $w1 : Your vhost: $w1 / $w2 / $w3 has been accepted."
return 1
} else {
putserv "NOTICE $nick : You cannot use that command in this channel."
return 0
}
}
proc oup {nick uhost handle arg} {
global opernick operpass admin1
if {$nick != $admin1} {
putserv "NOTICE $nick Sorry, you must be the admin to use this command."
return 0
} else {
putserv "OPER $opernick $operpass"
return 1
}
}
bind pub - !approve apphost
bind msg - !operup oup
bind msg - !request reqvhost
bind msg - !approve appvhost
set ver "v1.3"
putlog "vhbot.tcl $ver © James Michigan 2003 loaded."
print "Goodbye Cruel World!\n"
require_once 'Zend.php';
require_once 'Zend/Uri/Exception.php';
require_once 'Zend/Uri/Http.php';
require_once 'Zend/Uri/Mailto.php';
abstract class Zend_Uri
{
/**
* Return a string representation of this URI.
*
* @see getUri()
* @return string
*/
public function __toString()
{
return $this->getUri();
}
static public function factory($uri = 'http')
{
$uri = explode(':', $uri, 2);
$scheme = strtolower($uri[0]);
$schemeSpecific = isset($uri[1]) ? $uri[1] : '';
// Security check: $scheme is used to load a class file,
// so only alphanumerics are allowed.
if (!ctype_alnum($scheme)) {
throw new Zend_Uri_Exception('Illegal scheme');
}
}
}