• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Trying to load php to canvas for mailing function. VERY detailed, take your time on this

Explorer ,
Jan 01, 2020 Jan 01, 2020

Copy link to clipboard

Copied

Attempt number 2 at posting this, it got auto flagged because it detected urls.. ugh.. might be a bug because I used the tags last time..

OK I'm on the home stretch guys! In a previous post I recieved a jQuery code for loading urls, however I'm not sure how to use it, and I promised to make it its own topic after new years. Prerequesit, I have already placed this in my html: 

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

 
I'm trying to use:

$.load()

 to try to get my php file to read the values of my component input text fields AND dynamic text fields (in the canvas), in order to send them in the e-mail. It also generates a text file containing the same details, in which the Ecard itself will fetch (later on that).

First, here's my original SendEcard php file, still contains old ActionScript (I must ask for help updating this).

<? 
register_globals( 'NGPCFRES' );

$CreateEcard = date(U); 
$filename = $CreateEcard.".txt"; 
$ToEmail = $_POST["ToEmail"]; 
$FromEmail = $_POST["FromEmail"]; 
$ToName = $_POST["ToName"]; 
$FromName = $_POST["FromName"]; 
$Greeting = $_POST["Greeting"]; 
$IntroMessage = $_POST["IntroMessage"]; 
$EndMessage = $_POST["EndMessage"]; 
$EcardSelect = $_POST["selected"]; 
$Today = (date ("l dS of F Y ( h:i:s A )",time())); 
$Created = "Ecard Created on $Today"; 
$EcardNum = $_POST['EcardSelect'];
$EcardText = "ToName={$_POST['ToName']}&ToEmail={$_POST['ToEmail']}&FromName={$_POST['FromName']}&FromEmail={$_POST['FromEmail']}&Greeting={$_POST['Greeting']}&IntroMessage={$_POST['IntroMessage']}&Created={$_POST['Created']}&"; 
$fp = fopen( "dBText/$filename","w"); 
fwrite($fp, $EcardText, 10000); 
fclose( $fp ); 
######Email Card######## 
## You can change the subject and the message part around. 
## Make sure to change the Link as stated in the Tutorial. 
## (Change from 'someSite' to your actual site - leave the rest the same 
$ToSubject = "E-card from $FromName"; 
$Message = "$ToName,\nYou have recieved a Flash E-card from $FromName. \nClick the following link to view your card:\n\n http://www.MYSITE.com/SelectCard.php?EcardText=$CreateEcard&ENum=$EcardNum\n\n-----------------------------------\nHere is the message that was sent:\n$ToName,\n$Greeting\n$IntroMessage\n\n-$FromName\n\n\n-----------------------------------\nThis card was sent by Bunny and Panda E-Cards\n\nMaking you smile a little more each time."; 

mail($ToName." <".$ToEmail.">",$ToSubject, $Message, "From: ".$FromName." <".$FromEmail.">"); 

## This next line returns a success message to the movie. 
print "_root.holder.Status=\n Copy the following link to view your card:\n http://www.MYSITE.com/SelectCard.php?EcardText=$CreateEcard%26ENum=$EcardNum\n"; 

function register_global_array( $sg ) {
    Static $superGlobals    = array(
        'e' => '_ENV'       ,
        'g' => '_GET'       ,
        'p' => '_POST'      ,
        'c' => '_COOKIE'    ,
        'r' => '_REQUEST'   ,
        's' => '_SERVER'    ,
        'f' => '_FILES'     ,
        'n' => '_SESSION'
    );
    Global ${$superGlobals[$sg]};
    foreach( ${$superGlobals[$sg]} as $key => $val ) {
        $GLOBALS[$key]  = $val;
    }
}
function register_globals( $order = 'gpc' ) {
    $_SERVER;       //See Note Below
    $_ENV;
    $_REQUEST;
    $order  = str_split( strtolower( $order ) );
    array_map( 'register_global_array' , $order );
}
?>

-ToEmail, ToName, FromName, Greeting, IntroMessage are component text inputs, wondering if I have to change the format in which they are shown here.
-FromEmail, Status, EcardSelect are dynamic text boxes, so I guess I leave those as is? (although I might consider making Status a component input just so users can select/copy the URL that's supposed to be generated there).
-Where it says print "root holder Status" is the old ActionScript from Flash. Status is now located when index spawns iframe0 and it contains "Ecards html" (Status is there). Would I then simply have to put:

print "this.Status=
or
print "this.Status.text=


I won't post the send button's code just to keep things short, but the button should contain this code.. somehow...

$.load("SendEcard.php", function(response, status, xhr) {
if (status == "error") {
console.log(xhr.status + " " + xhr.statusText);
} else if(status == "success"){
parseF(response);
}
});

function parseF(r){
// handle the return r from your php file
}

Not sure if I'm supposed to include more details to make it work, I am indeed migrating from Flash to Canvas blind, but hopefully getting this part done will at least let me see how things work.

The end result should be the php printing an URL into the Status textfield (when I manually visit SendEcard php, it successfully generates the text file which is supposed to contain all the details for the Ecard itself to "fetch" from and print to its own dynamic text fields). When I manually visited it SelectEcard php, it does create the textfile, but no details since I didn't use the send button... and that's where I'm having trouble, getting the button to use the above code correctly.

 

Finally, here is a "shortened" version of my "SelectEcard php" file:

<HTML>
<HEAD>

<TITLE>Here's your Ecard - from Bunny & Panda E-Cards</TITLE>

<?
register_globals( 'NGPCFRES' );

function register_global_array( $sg ) {
    Static $superGlobals    = array(
        'e' => '_ENV'       ,
        'g' => '_GET'       ,
        'p' => '_POST'      ,
        'c' => '_COOKIE'    ,
        'r' => '_REQUEST'   ,
        's' => '_SERVER'    ,
        'f' => '_FILES'     ,
        'n' => '_SESSION'
    );
    Global ${$superGlobals[$sg]};
    foreach( ${$superGlobals[$sg]} as $key => $val ) {
        $GLOBALS[$key]  = $val;
    }
}
function register_globals( $order = 'gpc' ) {
    $_SERVER;       //See Note Below
    $_ENV;
    $_REQUEST;
    $order  = str_split( strtolower( $order ) );
    array_map( 'register_global_array' , $order );
}

switch ($_GET['ENum']) {

## Birthday Cards

	case '1':
	$goto = "ecards/birthdaycards/birthday1.html?EcardText=".$EcardText;
	$Dimensions = "WIDTH=700 HEIGHT=564";
	break;

	case '2':
	$goto = "ecards/birthdaycards/birthday2.html?EcardText=".$EcardText;
	$Dimensions = "WIDTH=700 HEIGHT=564";
	break;

}

?>

<?php

$url = 'http://www.MYSITE.com/images/wallpaper.png';

?>
</head>

<body bgcolor="#FFFFFF" topmargin="0" leftmargin="0" rightmargin="0" marginheight="0" marginwidth="0">
<br>
<br>
<br>
<br>
<center>
<OBJECT
 <? print "$Dimensions";?>>
 <PARAM NAME=movie VALUE="<? print "$goto";?>"><EMBED src="<? print "$goto";?>"<? print "$Dimensions";?></EMBED>
</OBJECT>
</center>
<style type="text/css">
body
{
background-image:url('<?php echo $url ?>');
}
</style>
</BODY>
</HTML>


The ACTUAL E-Card itself should also have:

$.load()

but this time loading the text file that is generated.


Here's the old ActionScript I used back in flash for reference if it makes it easier to show what it is I was doing:

loadVariablesNum ("http://www.MYSITE.com/dBText/"+EcardText+".txt", 0);


Thanks again for your time everyone. I THINK this is the very end of it all. So far the site is working in terms of navigation and no console errors (except for items in this topic). It was quite a ride going from Flash to Canvas. OMG... my head is spinning.

TOPICS
Code

Views

269

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation