Welcome, Guest
  • Author Topic: Use this code if your Server is running php 4.1.0 or newer  (Read 30546 times)

    tony ross

    • Server what's that
    • *
    • Posts: 10
      • View Profile
      • anthony ross official site
      • Email

    i don't know if it will help but here is my link....
    http://www.ar-tist.com/Ecards/Ecards.swf
    i know i haven't changed any of the graphics, but i wanted to get the code right first... hope this is ok



    sorry, but where do i put this?

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Did you do all the changes I told you to do?
    Check all the brackets etc.
    happy flashing
    8)
    Ronald

    tony ross

    • Server what's that
    • *
    • Posts: 10
      • View Profile
      • anthony ross official site
      • Email

    Then maybe something is wrong with the variable you receive:

    for testing do this:
    Code: [Select]

    $key=$_GET['ENum'];
    echo $key; //just to make sure you reading the variable right

    switch($key){

    ... the case block

    }



    ok is this a different php page i create? i added it to the orig page and still got errors.
    thank you for your patience, i just got into this type of coding on thursday

    tony ross

    • Server what's that
    • *
    • Posts: 10
      • View Profile
      • anthony ross official site
      • Email
    YEAHHHH!!!!! ;D
    finally got my code straight, my ecards work!! thanks again for your patience and help... now I know what my students must feel like :-\... thanks again-tony ross

    p.s. I ended up using a permission of 733 on my dBText to get it to work... is that normal?

    Arclave

    • Server what's that
    • *
    • Posts: 22
    • Americanism is Live and Kicking at www.rwyouth.com
      • View Profile
      • Robert Welch Youth
    I feel for you, I'm a graphic designer by trade as well.... I'm finding that I have to learn code here and there as I go. Sorry about the screw up. I got a simular error. I couldn't find the problem. But this code is what I'm currently using. http://www.rwyouth.com/Ecards/index.php.

     I thing that the problem is caused by having a line break between the switch variables and the get variables. But I'm no php expert. Here's the code that I'm using:


    <?
    $ENum = $_GET["ENum"];
    $EcardText = $_GET["EcardText"];
    switch ($ENum) {

       case '1':
       $goto = "Ecard1.swf?EcardText=".$EcardText;
       $gotoFooter = "EcardFooter.swf?EcardText=".$EcardText."&EcardSelect=1";
       $Dimensions = "WIDTH=400 HEIGHT=700";
       $DimensionsFooter = "WIDTH=400 HEIGHT=550";
       break;

       case '2':
       $goto = "Ecard2.swf?EcardText=".$EcardText;
       $gotoFooter = "EcardFooter.swf?EcardText=".$EcardText."&EcardSelect=2";
       $Dimensions = "WIDTH=400 HEIGHT=700";
       $DimensionsFooter = "WIDTH=400 HEIGHT=550";
       break;

       case '3':
       $goto = "Ecard3.swf?EcardText=".$EcardText;
       $gotoFooter = "EcardFooter.swf?EcardText=".$EcardText."&EcardSelect=3";
       $Dimensions = "WIDTH=700 HEIGHT=525";
       $DimensionsFooter = "WIDTH=700 HEIGHT=250";
       break;

       case '4':
       $goto = "Ecard4.swf?EcardText=".$EcardText;
       $gotoFooter = "EcardFooter.swf?EcardText=".$EcardText."&EcardSelect=4";
       $Dimensions = "WIDTH=700 HEIGHT=525";
       $DimensionsFooter = "WIDTH=700 HEIGHT=250";
       break;

       case '5':
       $goto = "Ecard5.swf?EcardText=".$EcardText;
       $gotoFooter = "EcardFooter.swf?EcardText=".$EcardText."&EcardSelect=5";
       $Dimensions = "WIDTH=700 HEIGHT=525";
       $DimensionsFooter = "WIDTH=700 HEIGHT=250";
       break;
    }

    ?>
    « Last Edit: 12/08/03, 09:24 by Gene Ritter »

    Alberto

    • Server what's that
    • *
    • Posts: 3
      • View Profile
      • Email
    I have the same problem with the parser error: Parse error: parse error, expecting `T_CASE' or `T_DEFAULT' or `'}'' in /home/caraco/paginas/Ecards/SelectCard.php on line 8

    I did everything what here it is recommended but the problem is not
    solved, could help me please?

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Hi Alberto,
    could you show us line 7 through 9?
    happy flashing
    8)
    Ronald

    Arclave

    • Server what's that
    • *
    • Posts: 22
    • Americanism is Live and Kicking at www.rwyouth.com
      • View Profile
      • Robert Welch Youth
    Yeah show us the code....


    Gene

    Alberto

    • Server what's that
    • *
    • Posts: 3
      • View Profile
      • Email
    Sure! this it is the code that at the moment I am using.

    SelectCard.php:
    --------------------------
    <HTML>
    <HEAD>
    <TITLE>Here's your Flash Ecard - from the Flash-dB.com Tutorial</TITLE>
    <?
    $ENum = $_GET["ENum"];
    $EcardText = $_GET["EcardText"];
    switch ($_GET['ENum']){
      case '1':
       $goto = "Ecard1.swf?EcardText=".$EcardText;
       $gotoFooter = "EcardFooter.swf?EcardText=".$EcardText."&EcardSelect=1";
       $Dimensions = "WIDTH=400 HEIGHT=700";
       $DimensionsFooter = "WIDTH=400 HEIGHT=550";
       break;
       case '2':
       $goto = "Ecard2.swf?EcardText=".$EcardText;
       $gotoFooter = "EcardFooter.swf?EcardText=".$EcardText."&EcardSelect=2";
       $Dimensions = "WIDTH=400 HEIGHT=700";
       $DimensionsFooter = "WIDTH=400 HEIGHT=550";
       break;
       case '3':
       $goto = "Ecard3.swf?EcardText=".$EcardText;
       $gotoFooter = "EcardFooter.swf?EcardText=".$EcardText."&EcardSelect=3";
       $Dimensions = "WIDTH=700 HEIGHT=525";
       $DimensionsFooter = "WIDTH=700 HEIGHT=250";
       break;
       case '4':
       $goto = "Ecard4.swf?EcardText=".$EcardText;
       $gotoFooter = "EcardFooter.swf?EcardText=".$EcardText."&EcardSelect=4";
       $Dimensions = "WIDTH=700 HEIGHT=525";
       $DimensionsFooter = "WIDTH=700 HEIGHT=250";
       break;
       case '5':
       $goto = "Ecard5.swf?EcardText=".$EcardText;
       $gotoFooter = "EcardFooter.swf?EcardText=".$EcardText."&EcardSelect=5";
       $Dimensions = "WIDTH=700 HEIGHT=525";
       $DimensionsFooter = "WIDTH=700 HEIGHT=250";
       break;
    }
    ?>
    </head>
    <body bgcolor="#FFFFFF" topmargin="0" leftmargin="0" rightmargin="0" marginheight="0" marginwidth="0">
    <center>
    <OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
    codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0"
    <? print "$Dimensions";?>>
    <PARAM NAME=movie VALUE="<? print "$goto";?>"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFFFF> <EMBED src="<? print "$goto";?>" quality=high bgcolor=#FFFFFF  <? print "$Dimensions";?> TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED>
    </OBJECT>
    <OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
    codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0"
    <? print "$DimensionsFooter";?>>
    <PARAM NAME=movie VALUE="<?print "$gotoFooter";?>"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFFFF> <EMBED src="<? print "$gotoFooter";?>" quality=high bgcolor=#FFFFFF  <? print "$DimensionsFooter";?> TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED>
    </OBJECT>
    </center>
    </BODY>
    </HTML>
    -----------------------------

    SendEcard.php:
    -----------------------------
    <?
    $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["EcardSelect"];
    $ToName = stripslashes($ToName);
    $FromName = stripslashes($FromName);
    $Greeting = stripslashes($Greeting);
    $IntroMessage = stripslashes($IntroMessage);
    $EndMessage = stripslashes($EndMessage);
    $Today = (date ("l dS of F Y ( h:i:s A )",time()));
    $Created="Ecard Created on $Today";
    $EcardNum = $EcardSelect;
    $EcardText = "ToName=$ToName&ToEmail=$ToEmail&FromName=$FromName&FromEmail=$FromEmail&Greeting=$Greeting&IntroMessage=$IntroMessage&Created=$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 = "You have recieved a Flash Ecard from $FromName";
    $Message = "$ToName,\nYou have recieved a Flash card from $FromName. \nClick the following link to view your card:\n\n http://www.caracolonline.com/Ecards/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 from www.flash-db.com/Ecards/\n\nThe Flash-dB Team.";
    ###################
    ## This line actually sends the email - you should not have to change this.
    mail($ToName." <".$ToEmail.">",$ToSubject, $Message, "From: ".$FromName." <".$FromEmail.">");
    ## This next line returns a success message to the movie.
    print "_root.Status=Success your Card Has Been Sent!";
    #### End #########
    ## By: Jeffrey F. Hill
    ## www.flash-db.com
    ?>
    ----------------------------

    Arclave

    • Server what's that
    • *
    • Posts: 22
    • Americanism is Live and Kicking at www.rwyouth.com
      • View Profile
      • Robert Welch Youth
    These lines of code is where the problem is:

    $ENum = $_GET["ENum"];
    $EcardText = $_GET["EcardText"];
    switch ($_GET['ENum']){

    You can't switch ($_GET['ENum'];) if that variable has already been dumped into the variable $ENum.

    Try it like this:


    <?
    $ENum = $_GET["ENum"];
    $EcardText = $_GET["EcardText"];
    switch ($ENum) {



    If that still doesn't work try replacing the double quotes in the first line listed above to single quotes like so...

    $ENum = $_GET['ENum'];



    Gene

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Hi,

    The only thing I can see is this:
    Code: [Select]

    $ENum = $_GET["ENum"];
    $EcardText = $_GET["EcardText"];
    switch ($_GET['ENum'])


    1. why you ask the $_GET twice?
    2. why you use different quotes?

    If you allread asked $Enum, you dint need to ask $GET['enum'] again.

    And: be consequent by using quotes. The interpreter might get mixed up. But you will definately get mixed up after a while ;)

    I would change it to this:
    Code: [Select]

    $ENum = $_GET["ENum"];
    $EcardText = $_GET["EcardText"];
    switch ($ENum)

    happy flashing
    8)
    Ronald

    Alberto

    • Server what's that
    • *
    • Posts: 3
      • View Profile
      • Email
    Mhhhh... the problem is not fixed   :-[
    See here:
    http://www.caracolonline.com/Ecards/

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Hi,
    use either
    case 1:

    or

    case "1":
    happy flashing
    8)
    Ronald

    Arclave

    • Server what's that
    • *
    • Posts: 22
    • Americanism is Live and Kicking at www.rwyouth.com
      • View Profile
      • Robert Welch Youth
    It's a stab in the dark... But try saving your index page as a .php as opposed to .html....

    christy

    • Server what's that
    • *
    • Posts: 3
      • View Profile
      • Email
    Hello! I'm having the same error with line 8. :) Here is the code I'm using:


    <?
    $ENum = $_GET["ENum"];
    $EcardText = $_GET["EcardText"];
    switch ($ENum)
       case '1':
       $goto = "Ecard1.swf?EcardText=".$EcardText;
       $gotoFooter = "EcardFooter.swf?EcardText=".$EcardText."&EcardSelect=1";
       $Dimensions = "WIDTH=400 HEIGHT=700";
       $DimensionsFooter = "WIDTH=400 HEIGHT=550";
       break;
       case '2':
       $goto = "Ecard2.swf?EcardText=".$EcardText;
       $gotoFooter = "EcardFooter.swf?EcardText=".$EcardText."&EcardSelect=2";
       $Dimensions = "WIDTH=400 HEIGHT=700";
       $DimensionsFooter = "WIDTH=400 HEIGHT=550";
       break;
       case '3':
       $goto = "Ecard3.swf?EcardText=".$EcardText;
       $gotoFooter = "EcardFooter.swf?EcardText=".$EcardText."&EcardSelect=3";
       $Dimensions = "WIDTH=700 HEIGHT=525";
       $DimensionsFooter = "WIDTH=700 HEIGHT=250";
       break;
       case '4':
       $goto = "Ecard4.swf?EcardText=".$EcardText;
       $gotoFooter = "EcardFooter.swf?EcardText=".$EcardText."&EcardSelect=4";
       $Dimensions = "WIDTH=700 HEIGHT=525";
       $DimensionsFooter = "WIDTH=700 HEIGHT=250";
       break;
       case '5':
       $goto = "Ecard5.swf?EcardText=".$EcardText;
       $gotoFooter = "EcardFooter.swf?EcardText=".$EcardText."&EcardSelect=5";
       $Dimensions = "WIDTH=700 HEIGHT=525";
       $DimensionsFooter = "WIDTH=700 HEIGHT=250";
       break;
    }
    ?>


    I tried every variation here. I starting messing around with graphics and then realized the text wasn't showing up, so I replaced the PHP with the script in this thread, and now I'm getting the same error in line 8. I'm also using Flash MX, but I'm saving it as Flash 5. Maybe that's why it's not working? I looked at another thread that gave advice about using this tutorial with MX, but I'm afraid it didn't tell me much. I'm not really familiar with coding or actionscript, so finding my own solution is not working out too well and I'm slowly going mad. :D If someone could help me in the next few days, that would be really wonderful.

    Christy