Welcome, Guest. Please login or register.
Did you miss your activation email?
05/22/12, 17:42
Home Help Search Login Register
News: Parsley Flex framework review featuring quiz application, in our Flex frameworks series
Flex SDK 4.5 mobile roadmap: begin with your mobile development
Swiz Flex framework review featuring quiz application
New homepage we release our new Homepage, take a look ...

+  Flash-db
|-+  Recent Tutorial Support
| |-+  Flash GuestBook Support (Moderators: Flash-db, vesa kortelainen, Ronald Wernecke, Mohsin Sumar, Jorge Solis)
| | |-+  guestbook php 4.5 to 5
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: guestbook php 4.5 to 5  (Read 1333 times)
Ipacus
Server what's that
*
Posts: 4


View Profile
« on: 06/07/10, 03:25 »

Hi,

I'm a newbee at flashscripting and php. I used a guestbook from this forum and restyled it
( http://www.operadellacasa.com/gastenboek_opera.html ). It worked fine until last month. The provider stated that i had to change the php file because they migrated from php 4 to php5. This is the code i used.
And, yes, it does'nt work anymore. Can anyone help me to get this php script working again.

thanx

'a desperate' Ipacus

-------------------- code --------------------------
<?php

$Submit             = $_POST["Submit"];
$Name             = $_POST["Name"];
$Email             = $_POST["Email"];
$Comments    = $_POST["Comments"];
$NumLow    = $_REQUEST["NumLow"];
$NumHigh    = $_REQUEST["NumHigh"];

//$Name      = ereg_replace("[^A-Za-z0-9 ]", "", $Name);
$Email            = ereg_replace("[^A-Za-z0-9 \@\.\-\/\']", "", $Email);
//$Comments   = ereg_replace("[^A-Za-z0-9 \@\.\-\/\']", "", $Comments);
//$Website    = eregi_replace("http://", "", $Website);
//$Website    = ereg_replace("[^A-Za-z0-9 \@\.\-\/\'\~\:]", "", $Website);

$Name             = stripslashes($Name);
$Email             = stripslashes($Email);
$Comments    = stripslashes($Comments);

// Lezen en schrijven naar de GuestBook.txt file

if ($Submit == "Yes") {

   $filename    = "GuestBook.txt";



   $fp       = fopen( $filename,"r");
   $OldData    = fread($fp, 80000);
   fclose( $fp );

// Geeft de datum weer...

   $Today  = (date (" d F Y ( h:i:s A )",time()));
// $Today  = (date ("I d F Y ( h:i:s A )",time()));
   
   $Input = "Naam: <b>$Name</b><br>Email: <b><u><a href=\"mailto:$Email\">$Email</a></u></b><br>Reactie: <b>$Comments: </b><br><i><fontsize=\"-1\">Datum: $Today</font><br><br>.:::.";


   $New = "$Input$OldData";


   $fp = fopen( $filename,"w");
   if(!$fp) die("&GuestBook=cannot write $filename ......&");
   fwrite($fp, $New, 800000);
   fclose( $fp );
}


   $filename = "GuestBook.txt";



   $fp    = fopen( $filename,"r");
   $Data    = fread($fp, 800000);
   fclose( $fp );


   $DataArray = split (".:::.", $Data);


   $NumEntries = count($DataArray) - 1;

   print "&TotalEntries=$NumEntries&NumLow=$NumLow&NumHigh=$NumHigh&GuestBook=";
   for ($n = $NumLow; $n < $NumHigh; $n++) {
   print $DataArray[$n];
      if (!$DataArray[$n]) {
         Print "<br><br><b>Niet meer reacties</b>";
      exit;
      }
   }
?>
Logged
Ronald Wernecke
Administrator
Systems Administrator
*****
Posts: 6175


View Profile WWW Email
« Reply #1 on: 06/07/10, 08:45 »

ereg_replace does not exist anymore - replace with preg_replace - that should do it
Logged

happy flashing
Cool
Ronald
Ipacus
Server what's that
*
Posts: 4


View Profile
« Reply #2 on: 06/07/10, 09:06 »

Hi,
Thank you for the quick response,.......but the preg_replace did'nt do the job. A new entry does not show in the GuestBook.

Any other ideas?

sorry for my bad english.

Ips
Logged
Ronald Wernecke
Administrator
Systems Administrator
*****
Posts: 6175


View Profile WWW Email
« Reply #3 on: 06/07/10, 12:37 »

Dont worry about your english.
The most of us are not native speakers - I am from Germany.

Anyway - to get more detailed info: what do you receive, if you call the scipt directly in the browser?
Do you receive error messages?

Is it possible to ge a life link, to have a direct look?
Logged

happy flashing
Cool
Ronald
Ipacus
Server what's that
*
Posts: 4


View Profile
« Reply #4 on: 06/07/10, 16:29 »

Hi Ronald,

I receive no error message what so ever. I tried it with

 ini_set('display_errors,1);
error_reporting(E_ALL | E_STRICT);

to enforce a return error, but when i put this code in the script the Geustbook does not work at all.

I believe that the script should work with php5. And i believe that the provider did not set the chmod=777 to the GuestBook.txt file. Therefore the entry can not be written into the GuestBook.txt file. But when i phoned the provider, they told me that the chmod of the GuestBook.txt file was 777 and therefore correct. They insist that the PHP script is wrong and should be rewritten for PHP5.
This provider does not allow to change the CHMOD of a file, you have to make a request and they will do it for you.

http://www.operadellacasa.com/gastenboek_opera.html

this is the site

greetz Ips




Logged
Ronald Wernecke
Administrator
Systems Administrator
*****
Posts: 6175


View Profile WWW Email
« Reply #5 on: 06/08/10, 04:40 »

the guestbook file is there and working.
if you call the script, you receive an internal server error (error 500).

This means, something is wrong with the script itself, or a function inside of it.

You are right - writing seams to be a problem.

Do you have access to the files via FTP?
With the FTP-Programm, you can set access rights.
Check this.
Logged

happy flashing
Cool
Ronald
Ipacus
Server what's that
*
Posts: 4


View Profile
« Reply #6 on: 06/09/10, 08:55 »

Hi,

Yes, writing to the .txt file was the problem. My provider told me on the phone that the script was the problem. So, i installed php5 on my own server and..... everything worked fine.
With this knowledge i phone the helpdesk again. Finally they changed the CHMOD of the txt file.

Thanx for your help

Ips
Logged
Ronald Wernecke
Administrator
Systems Administrator
*****
Posts: 6175


View Profile WWW Email
« Reply #7 on: 06/09/10, 12:19 »

cant ou do those changes with ftp?
It is complicated to ask your privider doing little things like that Wink
Are you paying for this webservice, or is it a free hosting service?
Logged

happy flashing
Cool
Ronald
Pages: [1] Print 
« previous next »
Jump to:  


Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!