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 whitepaper presents the benefits of successfully introducing static analysis into your organization using IBM Rational Software Analyzer. Additionally, it identifies some common pitfalls that can hinder the effective use of static analysis tooling as well as presents 10 simple strategies designed to help you quickly realize the value of static analysis using Rational Software Analyzer. FREE! Go There Now!
|
|
|
|
Join us for this on demand webcast to learn about developing complex systems more quickly and efficiently. We'll cover market drivers for developing, governing and reusing systems software assets and how you can develop system software assets with Rational Asset Manager. FREE! Go There Now!
|
|
|
|
Visit IBM developerWorks to download a free trial of the latest release of IBM Lotus Sametime Standard V8.0. Lotus Sametime Standard V8.0 is a platform for unified communications and collaboration that combines security features with an extensible, open solution including integrated Voice over IP, geographic location awareness, mobile clients, and a robust Business Partner community offering telephony and video integration. FREE! Go There Now!
|
|
|
|
Visit IBM developerWorks to download a free trial version of WebSphere Extended Deployment Compute Grid, which lets you schedule, execute, and monitor batch jobs. Because online transaction processing and batch jobs execute simultaneously on the same server resources, you can avoid costly duplication of resources. Compute Grid supports job types of Java transactional batch, compute-intensive and a new type called "native execution", which enables non-Java workloads to run on distributed end points. FREE! Go There Now!
|
|
|
|
This tutorial shows new users of IBM WebSphere Business Monitor Version 6.0.2 how to perform the "Hello World" equivalent for monitoring business process applications. It is intended to help you get familiar with the capabilities of the product. FREE! Go There Now!
|
|
|
|
Rational Modeling Extension for Microsoft .NET enhances usability for code generation supporting a more intelligent refactoring. The latest enhancements enable organizations with Java and .NET systems and software development maintain architectural integrity across heterogeneous platforms. FREE! Go There Now!
|
|
|
|
Get a free trial download of the latest version of IBM Rational Performance Tester V7.0.1, a load and performance testing solution for teams concerned about the scalability of their Web-based applications. Combining multiple ease-of-use features with granular detail, Rational Performance Tester simplifies the test-creation, load-generation and data-collection processes that help teams ensure the ability of their applications to accommodate required user loads. FREE! Go There Now!
|
|
|
|
As businesses grow increasingly dependent upon Web applications, these complex entities grow more difficult to secure. Most companies equip their Web sites with firewalls, Secure Sockets Layer (SSL), and network and host security, but the majority of attacks are on applications themselves – and these technologies cannot prevent them. This paper explains what you can do to help protect your organization, and it discusses an approach for improving your organization’s Web application security. FREE! Go There Now!
|
|
|
|
Attend this launch webcast with Scott Hebner, Vice President of IBM Rational Marketing and Strategy, where he will overview Rational’s new offerings and programs to help customers accelerate software innovation on System z. He will discuss how these solutions help organizations extend their core business processes toward modern architectures such as SOA and web technologies to deliver business improvements that stand the test of time. FREE! Go There Now!
|
|
|
|
User communities play an important role in communication and collaboration around products, solutions and other areas of special interest to members. Successful communities are able to provide the right mix of content and services to deliver a value proposition that resonates with each audience. Join Tom Inman, VP of Marketing for Information and Platform Solutions as he introduces the new LeverageINFORMATION community. During this webcast, learn about the value provided by the community and how customers and partners derive value from the community in addressing their own technical and business challenges. FREE! Go There Now!
|
|
|
|
All FREE IBM® developerWorks Tools! |