PDA

View Full Version : Video tutorial - Submit from AMS to PHP/MySQL



Corey
08-28-2002, 09:56 PM
Click Here For Tutorial (http://www.indigorose.com/ubbthreads/showthreaded.php?Cat=&Board=UBB2&Number=10699&page =0&view=collapsed&sb=5&o=0)

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)

eric_darling
08-28-2002, 10:15 PM
Corey - you are my hero! Thanks for coming through again.

Eric
08-29-2002, 12:23 AM
Corey:

I almost wet my pants when I saw the thread title (I'm trying to migrate a lot of my stuff to MySQL/PHP.

However...currently I'm on a 36KB connection, so before I download, will your code work with the new PHP default "register_globals off" ???

Tnx.

Eric

Corey
08-29-2002, 12:33 AM
It should. Download the attachment (it's tiny) and try it...

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)

Eric
08-29-2002, 01:37 AM
My gosh...it's half-past Midnight here in California...it looks like I'm not the only NightOwl?

But, tooooooo many nights up until 3AM so am pulling the plug now. Will take a look at everything manana (did download the file :-)

WOW...this APMS 4.0 is one KICK-BUTT piece of work !!!

Nice job on the tutorials. "One pix is worth a thousand words."

Tnx.

Eric

Eric
08-29-2002, 01:41 AM
OH...just as I'm pulling the switch...a thought.

What about the Reverse of this?

1. End user connects to website via APMS (triggers dialer, browsers, etc.

2. Specialized offline dataform in APMS gets populated FROM an online MySQL DB.

3. End user may or may not enter some local data (or pre-set options via radio buttons) ... interacts with downloaded MySQL data...some simple math calculations.

4. End user gets on-screen result(s) and option to print.

5. Etc., Etc.

??????

Tnx.

Eric

P.S. ZZZZZZZZZZZZzzzzzzzzzzzzzzzzzzzzzzzzzzz

Corey
08-29-2002, 02:17 AM
Sure, that's simple to do. You can even add transaction processing if you like... No problem at all, that's why AutoPlay Media Studio is so powerful, you can do stuff like that in no time. At some point when I get more time I'll definitely set up a vid tute on how to create a full catalog including transaction processing and online database integration in AMS. That I promise, I had tht already planned. It will be PHP/MySQL based of course so feel free to "wet your pants" as you said... In fact wet them twice because I promise it'll be an extra good tute.

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)

Eric
08-29-2002, 09:16 AM
YESSSSSSSSSSSSS!!! You guys have really gone in an incredible direction with this product!!!

Umh, with respect to MySQL/PHP...puhleeeezzzze remember the 'register_globals off' scenario most of us are now faced with on the planet (but hey...I'm all for better security).

Really...impressive...you guys are keeping up on the world:

1. Flash
2. MySQL/PHP
3. Other stuff I'm sure I haven't gotten to yet

But then, of course, what else are you going to do in those COLD winters up there??? :-) :-) :-)

Tnx again.

Eric

Corey
08-29-2002, 11:55 AM
Eric, if you are using registerglobals_off then I assume you understand how to use it? If not perhaps you should check out some stuff...

Bottom line, it's not much harder to type $_POST['myVar'] than $myVar is it?

I'll probably start coding for globals off anyhoo, I've been meaning to for a bit, but you shoud personally understand what you're doing before you set out to handle secure data, don't rely on others...

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)

Eric
08-30-2002, 12:33 AM
Tnx...I'm a Newbie to MySQL/PHP and pretty frustrated having just bought TWO books (also for the sample app scripts on the CD :-)

Then PHP 4.whatever came out and the whole register_globals off thing.

HOWEVER, trying to also wade through this, as a Newbie Perl Hacker I got some help from one of the Gurus and came up with v1.0 of a script to convert the variables...although I think it still needs some tweaking up.

You're more than welcome to it if you have Perl 5.6 ... just get me an e-mail address & I'll send it...or tell me how to upload it here.

"Duh!" (on me) ... check the next post :-)

Eric

Eric
08-30-2002, 12:35 AM
Here you go (doubt the ####'s will format correctly in the post however)...

#!/usr/bin/perl
#
################################################## ######
### chgphpvars.pl Perl 5.6 ###
### Version 1.0 Beta2 Date: 8/13/02 ###
### Author: Eric Hilding a/k/a RocketMan ###
### Send Bugs and/or suggestions to: cpv@hilding.com ###
### ###
### FOR: CHANGING PHP FILE SCRIPT VARIABLES ###
### DUE TO NEW BUMMER register_globals off SITUATION ###
### ###
### No Warranties Implied #### Use At Your Own Risk ###
################################################## ######
# Special thanks to Tad at comp.lang.perl.misc for help
#
use strict;
use warnings;
#
# RAW DATA FILE ENTRY FORMAT
# $infile will be: The raw .php file to change all variables
# $outfile will be: The modified .php file with variables changed
#
print "Enter PHP File Name: "; #Input file
my $infile = " ";
chomp ($infile = <STDIN>);
print "Enter Modified PHP File Name: "; #Output file
my $outfile = " ";
chomp ($outfile = <STDIN>);
open (INFILE, $infile) ||
die "could not open '$infile' $!"; #open file for reading or die
open (OUTFILE ,">>$outfile") ||
die "could not open '$outfile' $!"; #open file for appending or die
print "\n\n\n";
my $line = " ";
while ($line = <INFILE>) {
$line =~ s/\$(\w+)/ print "RE: $line\n\n";
prompt_for_decision($1) /ge;
print OUTFILE "$line"; #write line to file
}
close (INFILE); #close input file
close (OUTFILE); #close output file
#
sub prompt_for_decision {
my $name = shift;
print "What should \$'$name' be replaced with?\n\n";
my $_POST = " ";
my $_GET = " ";
my $_COOKIE = " ";
my $_SERVER = " ";
my $_ENV = " ";
my $_REQUEST = " ";
print "1 = \$_POST['$name']\n";
print "2 = \$_GET['$name']\n";
print "3 = \$_COOKIE['$name']\n";
print "4 = \$_SERVER['$name']\n";
print "5 = \$_ENV['$name']\n";
print "6 = \$_REQUEST['$name']\n";
print "7 = Other Code\n";
print "8 = Do NOT Replace\n";
chomp(my $option = <STDIN>);
print "\n";
my $ans = " ";
$ans = "\$_POST['$name']" if $option == 1;
$ans = "\$_GET['$name']" if $option == 2;
$ans = "\$_COOKIE['$name']" if $option == 3;
$ans = "\$_SERVER['$name']" if $option == 4;
$ans = "\$_ENV['$name']" if $option == 5;
$ans = "\$_REQUEST['$name']" if $option == 6;
if ($option == 7) {
print "Enter code: ";
chomp(my $othercode = <STDIN>);
print "\n";
$ans = $othercode;
}
$ans = "\$$name" if $option == 8;
return $ans;
}
### END OF PERL SCRIPT

Eric
08-30-2002, 12:41 AM
P.S. I tried to use Perl2Exe to convert this to a "standalone" but due to the way I installed Perl, had trouble getting several of the .pm files to integrate &amp; moved on to other more pressing issues (like APMS 4.0 :-)

Eric

Corey
08-30-2002, 01:43 AM
I never use Perl. It's pretty powerful though. I'm strictly PHP. Listen Eric the register_globals thing is no big issue, it's quite easy to understand and compensate for. I;d be happy to help you out, what is it you don't get about it?

It's just a way of tightening up security by ensuring that only the variables you are actually using get passed to a given script. Pretty simple...

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)

Eric
08-31-2002, 12:24 AM
Hey Corey...thanks for the offer. I bought:

1. PHP &amp; MySQL for Dummies :-)
2. Build Your Own Database Driven Website Using PHP &amp; MySQL (very good: http://www.sitepoint.com)

But then PHP 4.??? came out. I'm still trying to get a firm answer from my ISP about certain aspects of how they are going to run things, and need to migrate all my stuff over to a new Server there.

When I get all that wrapped up...and my other project finished, I'll be back at you for some help. REALLY appreciate your offer...you guys are the best up there!

Regards,

Eric

Corey
08-31-2002, 01:45 AM
No probs, anytime.

For me my PHP bible has been Leon Atkinson's CORE PHP, can't reccomend it enough, it has everything. but nowadays I just go to the online php manual, it's fantastic. The way they laid it out is incredible, you can find exactly the function you need quickly and then learn about it quickly and then get some working examples wuickly. That's what I love, quick is everything for me...

Anyhoo you're going to be amazed how easy it is to learn PHP, and all the cool things you can do with it. I only know a very small portion of it, as most people do, and I have been able to accomplish lots of really cool stuff...

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)