Class Name: ReturnVars
Date Created: 9/19/06
Author: Chase Spell
Purpose: Stores variable/value pairs in an associative
array. Echos the final product as a url-encoded string
formatted as a GET request. Intended to be used
to return data from a php script to a Flash movie, but
could be used for any system that accepts GET statements for input.
By : Syntax
/****************************************
Class Name: ReturnVars
Date Created: 9/19/06
Author: Chase Spell
Purpose: Stores variable/value pairs in an associative
array. Echos the final product as a url-encoded string
formatted as a GET request. Intended to be used
to return data from a php script to a Flash movie, but
could be used for any system that accepts GET statements for input.
*****************************************/
class ReturnVars {
var $CurrentVars;
var $Vars = array();
function __construct() {
//Properties
$this->CurrentVars = 0; //Number of Var/Val pairs in the "Vars" array
}
//Methods
//Adds a new var/val pair to Vars and updates CurrentVars
function AddVar($name,$value) {
//if ($name != "" && $value != "") {
$this->Vars[$name] = $value;
$this->CurrentVars = $this->CurrentVars + 1;
//}
}
//Removes var/val pair from Vars array, $name corresponds to an existing variable name in the array
function RemoveVar($name) {
if (array_key_exists($name,$this->Vars)) {
unset($this->Vars[$name]);
$this->CurrentVars = $this->CurrentVars - 1;
}
}
//For/Each loop goes through Var adding each pair to a string in this format: "(var)=(value)&" and
//and echos that string for output
function PrintData($printandexit = true) {
$output = "";
if ($this->CurrentVars > 0) {
foreach ($this->Vars as $var => $val) {
$output .= urlencode($var)."=".urlencode($val)."&";
}
echo $output;
} else {
echo "No data was returned.";
}
if ($printandexit = true) {
exit;
}
}
}
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |
More Miscellaneous Code Articles
More By Codewalkers
developerWorks - FREE Tools! |
This demonstration gives you an overview of IBM® Rational® Build Forge Express Edition, a global offering that provides a framework to automate and execute software processes. Rational Build Forge provides a software assembly line that can support all of your tools, technologies, and platforms so you can achieve a repeatable, reliable, and traceable build and release process. FREE! Go There Now!
|
|
|
|
Attend this launch webcast with Scott Hebner, Vice President of IBM Rational Marketing and Strategy, for an overview of Rational’s new software offerings and resources to help modernize and accelerate software innovation on i on Power Systems – while ensuring past application investments are protected and continue to grow. Learn how these solutions are helping customers extend their core i5/OS solutions toward modern architectures such as SOA and web technologies to deliver business improvements that stand the test of time. FREE! Go There Now!
|
|
|
|
XML has become a common way of storing business data as flat files and many data server vendors including IBM have provided ways to store this data within relational database systems. Increasingly collections of XML files are accessed like databases using an xQuery and other XML standard mechanisms. Businesses find the need to combine the traditional tabular structured data with XML formatted data. In this webcast, you’ll learn about IBM’s WebSphere Federation Server technology, which provides users with the ability to integrate these two data formats. FREE! Go There Now!
|
|
|
|
Portfolio Management is about effectively managing portfolio value by aligning portfolio investments with business goals. This complimentary e-kit provides a collection of materials that can help you understand how IBM Rational enables and automates best practices for improved governance and clear visibility into portfolio and project performance across the entire IT project lifecycle. FREE! Go There Now!
|
|
|
|
This Fall, IBM Rational talks to you directly through a special teleconference series giving you access to the best minds in IBM Rational - product experts and market thought leaders who will answer your questions during these pre-scheduled telephone conference calls. Register today! FREE! Go There Now!
|
|
|
|
Join this Rational Talks to You teleconference on November 29 at 1:00 pm ET to participate in an interactive discusssion with Grady Booch around architecture and reuse. Get your questions answered! FREE! Go There Now!
|
|
|
|
As organizations have grown increasingly dependent on online software, the risk of malicious attacks has also become far more serious. Fortunately, well-governed organizations can protect their Web applications by injecting vulnerability assessments and ethical hacks into their software development and delivery processes. This paper describes 12 of the most common hacker attacks and provides basic rules that you can follow to help create more hack-resistant Web applications. FREE! Go There Now!
|
|
|
|
Informix Dynamic Server (IDS) Express Edition offers outstanding online transaction processing (OLTP) database performance, while helping to simplify and automate many of the tasks associated with deploying databases for small business applications. IDS 11 further extends the ease of management and applications integration with the Admin API and Scheduler, high availability with Continuous Log Restore for backup server recovery in case of a primary server failure, and column level encryption to protect personal and company private data. FREE! Go There Now!
|
|
|
|
In this webcast, IBM Rational will discuss the importance of Web application security and will share techniques and best practices to introduce application security testing into current QA processes including: understanding common security vulnerabilities and techniques to integrate security testing with defect tracking and remediation systems in an effort to safeguard sensitive online information. FREE! Go There Now!
|
|
|
|
Viper 2 brings a great value to developer communities including SQL, XML, PHP, Ruby, .NET and Java. You probably already know that DB2 Express-C is free for developers to develop, deploy and distribute. Viper 2 provides a variety of means that help move your application from the development stage to deployment more rapidly. This webcast shows how to best utilize the latest tools available for developing DB2 applications. FREE! Go There Now!
|
|
|
|
All FREE IBM® developerWorks Tools! |