Miscellaneous
|
|
|
|
<?php function getqueryvars($query,&$vars,$division) {
/*
#############################################
### Get Variables from Query 1.0b ###
#############################################
### by Otavio Real Salvador ###
#############################################
# Name: Otavio Real Salvador #
# E-mail: otavio@freedom.ind.br #
# UIN: 5906116 #
#############################################
# Usage: #
# array getqueryvars(string,array,boolean) #
# #
# Where: #
# *string* is the query that will be used #
# to send all variables to *array* where #
# value by value can be divided if you want #
# #
# Obs.: Sorry my English. #
############################################# */
parse_str($query,$urlvars);
reset($urlvars);
$vars=array();
while (list($a,$b)=each($urlvars)) {
if ($division==true) {
for ($b.=" ",$i=0,$tmp="";$i<=strlen($b);$i++) {
$segment=$b[$i];
if ($segment==" ") {
if (strlen(trim($tmp))) $vars[$a][]=$tmp;
$tmp="";
} else {
$tmp.=$segment;
}
}
} elseif (strlen(trim($b))) $vars[$a]=$b;
}
return $vars;
} ?>
|
|
|
Usage Example
|
<?php
getqueryvars($query,$var,true);
while (list($a,$b)=each($var)) {
while (list($c,$d)=each($b)) {
print $a."/".$d."<br>";
$varvalue=in_array($d,$word);
}
} ?>
|
|
|
Rate This Script
|
|
|
|