GlobalSCAPE Website
Products Solutions Downloads Support Store News GlobalSCAPE Blog Company

GlobalSCAPE User Forum

Forums Register Login My Profile Inbox Address Book My Subscription My Forums

Member List Search Calendars FAQ Ticket List Log Out

PHP Postcardscript Help!!!

 
Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [EFT Server] >> EFT Server Scripting >> PHP Postcardscript Help!!! Page: [1]
Login
Message << Older Topic   Newer Topic >>
PHP Postcardscript Help!!! - 4/25/2009 11:03:50 AM   
norwichchris

 

Posts: 1
Joined: 4/25/2009
Status: offline
I am trying to use a php postcard script on The CUTE FTP server and I have encountered the following problems:

The email is sent but the URL for the image/postcard data either doesnot work or just sends it back to the homepage.

I have tested the script on another webserver and it did work fine i thought then it sudenly stopped.
Here is the script:

<?php
/*************************************************
Usage:
* Step 1.
*     Copy your normal sized image into the images directory
*     and the thumbnails with the same name into the thumbs directory.
*     We recommend to use 640x480 for normal images and
*     128x96 for thumbnails.
*
* Step 2.
*     Edit the senderName and senderEmail to a valid name and email.
*
* Step +1.
*     Set the postcardURL to the URL where you installed the script
*     if the address in the email is invalid.
*
****************************************************/

// CHANGE PARAMETERS HERE BEGIN
$columns = 5;
$senderName  = 'chris postcards'; // Eg.: John's Postcards
$senderEmail = 'chris@mysite.atbhost.net';  // Eg.: john@postcard.com
// Change only if you have problems with urls
$postcardURL = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'];
// CHANGE PARAMETERS HERE END



// This function displays the available images
function displayPhotos(){
   global $columns;
  
   $act = 0;
   // Open the actual directory
   if ($handle = opendir("thumbs")) {
       // Read all file from the actual directory
       while ($file = readdir($handle))  {
           if (!is_dir($file)) {
               if ($act == 0) echo "<tr>";
               echo "<td align='center'><img src='thumbs/$file' alt='postcard' /><br/><input type='radio' name='selimg' value='$file' /></td>";
               $act++;
               if ($act == $columns){
                   $act = 0;
                   echo "</tr>";
               }
             }
       }
       echo "</tr>";
   }   
}

?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html><head>



<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Holidays from Home</title>
<link rel="stylesheet" type="text/css" media="screen" href="Template.php_files/hfhcss.css">
<script src="Template.php_files/textsize.js"></script>

<!-- Fix some IE hell -->
<!--[if lt IE 7]>
<style>
#menu a {height: 1%;}
</style>
<script defer type="text/javascript" src="/pngfix.js"></script>
<![endif]-->

</head><body>
<div class="centrepane">
   <div class="headlinks">
       <a href="http://www.holidaysfromhome.co.uk/">Home</a> |
       <a href="http://www.holidaysfromhome.co.uk/members/index.php">Members Area</a> |
       Change text size <a href="javascript:ts('body',1)"><b>A+</b></a>
       <a href="javascript:ts('body',-1)"><b>A-</b></a>
   </div>
   <div class="donate"><form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input name="cmd" value="_s-xclick" type="hidden"> <input name="hosted_button_id" value="1094124" type="hidden"> <input style="width: 160px; height: 54px;" src="Template.php_files/donate.gif" name="submit" alt="" type="image" border="0"> <img alt="" src="Template.php_files/pixel.gif" width="1" border="0" height="1">
</form></div>
   <br>

   <a href="http://www.holidaysfromhome.co.uk/"><img src="Template.php_files/logo.gif" border="0"></a><a href="http://www.holidaysfromhome.co.uk/"><img src="Template.php_files/title.gif" border="0"></a><br>
<!-- End Main Header -->
<!-- Main Sidebar -->
   <div class="menuleft">
       <ul id="menu">
           <li><a href="http://www.holidaysfromhome.co.uk/">Home</a></li>
           <li><a href="http://www.holidaysfromhome.co.uk/page.php?id=4">What are Virtual Holidays</a></li>
           <li><a href="http://www.holidaysfromhome.co.uk/page.php?id=3">About Us</a></li>
           <li><a href="http://www.holidaysfromhome.co.uk/page.php?id=18">Take a Holiday</a></li>
           <li><a href="http://www.holidaysfromhome.co.uk/page.php?id=30">East Anglian Pilot </a></li>
           <li>
             <div align="left"><a href="http://www.holidaysfromhome.co.uk/page.php?id=7">Links and Partnerships</a></div>
           </li>
           <li><a href="http://www.holidaysfromhome.co.uk/page.php?id=2">Testimonials</a></li>
           <li><a href="http://www.holidaysfromhome.co.uk/page.php?id=6">Events</a></li>
           <li><a href="http://www.holidaysfromhome.co.uk/page.php?id=5">Donations</a></li>
           <li><a href="http://www.holidaysfromhome.co.uk/page.php?id=47">Shop</a></li>
           <li><a href="http://www.holidaysfromhome.co.uk/page.php?id=26">Media</a></li>
           <li><a href="http://www.holidaysfromhome.co.uk/members/login.php">Members Area</a></li>
           <li><a href="http://www.holidaysfromhome.co.uk/page.php?id=17">Contact</a> </li>
       </ul>
</div>
<div class="content">
<!-- End Main Sidebar -->

<p>&nbsp;</p>
<p>Please view below our postcard system designed by a volunteer working for the Norfolk Voluntary services. Please follow the instructions below to send an </p>
<p>Please select an image from the menu, then enter the recipients email address and a short message. Then hit the submit button.</p>
<!-- Begins postcard script -->
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
</div>
<div id="caption"><p>&nbsp;</p>
</div>
   <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
     <div align="center"></div>
     <div align="justify">    
        <?php if ( (!isset($_POST['submit'])) && (!isset($_GET['show'])) ) { ?>
      
        <p>&nbsp;</p>
     </div>
     <table align="center">
                  <?php displayPhotos(); ?>
     </table>       
           <div align="center">
        <table width="40">
               <tr>
                 <td>                    <p align="center">Send to (email address):
                   <input type="text" name="email" size="30"/>
                   </p>                    <p align="center">&nbsp;  </p></td></tr>
               <tr>
                 <td>
                     <div align="center">
                         <textarea name="message" rows="10" cols="40">Please enter your message here</textarea>
                     </div></td></tr>
               <tr><td align="center">
                 <div align="center">
                   <input type="submit" value="Send card!" name="submit"/>
                 </div></td></tr>
        </table>
     </div>
</form>
      <?php } else if ( (isset($_POST['submit'])) && (!isset($_GET['show'])) ) {
           $pic = isset ($_POST['selimg']) ? $_POST['selimg'] : '';
           $filename = date('YmdGis');
           $f = fopen('messages/'.$filename.".txt","w+");        
           fwrite($f,$pic."\n");
           fwrite($f,$_POST['email']."\n");
           fwrite($f,htmlspecialchars($_POST['message'])."\n");
           fclose($f);
          
           // Compose the mail
               $from   = "From: $senderName <$senderEmail>\r\n";
             $replay = "Reply-To: $senderEmail\r\n";   
             $params = "MIME-Version: 1.0\r\n";
             $params .= "Content-type: text/plain; charset=iso-8859-1\r\n";
             $mailtext = "You have just received a virtual postcard!\r\n\r\n"
                     . "You can pick up your postcard at the following web address:\r\n"
                     . "$postcardURL"."?show=$filename\r\n\r\n"
                     . "We hope you enjoy your postcard, and if you do, please take a moment to send a few yourself!\r\n\r\n"
                     . "Regards,\r\n"
                     . "MicroPostcard\r\n"
                     . $postcardURL;
                    

           // Send email         
             @mail($_POST['email'],"You've received a postcard",$mailtext,$from.$replay.$params);

?>          
      
           <center>
             Your postcard was sended succesfuly!<br/><br/>
             <img src='images/<?php echo $pic; ?>' alt="postcard" /><br/><br/><br/>
                 <?php echo nl2br(htmlspecialchars($_POST['message'])); ?></center>           
                  <?php } else if ( (!isset($_POST['submit'])) && (isset($_GET['show'])) ) {
                   $file = isset($_GET['show']) ?  $_GET['show'] : ''          ;
                   $content = file('messages/'.$file.".txt");
                   $pic   = $content['0'];
                   unset ($content['0']);
                   unset ($content['1']);
                   $main = "";
                   foreach ($content as $value) {
                     $main .= $value;
                   }
                   ?>          
  <center>Your postcard!<br/><br/>
  <img src='images/<?php echo $pic; ?>' alt="postcard" />
  <br/><br/><br/>
  <?php echo nl2br(htmlspecialchars($main)); ?>
  </center>           
     
<?php } ?>

Any help would be much appreciated

-chris
Post #: 1
RE: PHP Postcardscript Help!!! - 12/7/2009 7:49:43 AM   
BULL

 

Posts: 404
Joined: 7/27/2006
Status: offline
Did you figure your issue out? BTW Cute FTP Server is a product that globalscape had along time ago.
If anything I would recommend that you test your script on EFT 6.1 CORE.

(in reply to norwichchris)
Post #: 2
Page:   [1]
All Forums >> [EFT Server] >> EFT Server Scripting >> PHP Postcardscript Help!!! Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Forum Software © ASPPlayground.NET Advanced Edition 2.5.5 Unicode

0.719