php-general Digest 15 Jul 2001 07:38:53 -0000 Issue 756

Topics (messages 57901 through 57922):

Loop an INSERT 10 rows from a Form
        57901 by: David

Select IN array?
        57902 by: Chris Lott
        57904 by: Chris Lott
        57918 by: James Tan

Problem with FORM, SELECT and SUBMIT - select value never shows up
        57903 by: Warrick Wilson \(Avignon Reg'd Kennels\)

phpLinks
        57905 by: Greg Donald

Re: Variable name declarations?
        57906 by: Kent Sandvik

Re: postgres and php
        57907 by: Nuno Silva

Re: Best Choice
        57908 by: Evan Nemerson

Re: Alternative to phpMyAdmin
        57909 by: Evan Nemerson
        57913 by: Matthew Loff

cURL to secure page...
        57910 by: Glenn Shope

RPM Install #6 still doesn't work
        57911 by: Gaylen Fraley

Re: Australian Developers -- Contract/Partnership Oppourtunity
        57912 by: Justin French

ereg() help, plz
        57914 by: McShen

Exec, system, passthru didn't work
        57915 by: Reuben D Budiardja

Multiple languages
        57916 by: Inércia Sensorial
        57920 by: Maxim Maletsky

Re: OOP Problems
        57917 by: James Tan

Anybody using Miva or hosted at Hosting4All?
        57919 by: Daniel Baldoni

Session Question
        57921 by: Tom Malone

output plain HTML for CD Rom
        57922 by: Justin French

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------


The form is no problem but how do INSERT 10 ROWS with one insert
statement. I figure some kind of loop like I did with the form.

When form is submitted:
$query = "INSERT INTO songs VALUES ('$id',
'$songname','$rating','$video', '$album_id', '$movie')";
   $result = mysql_db_query("movies", $query);

if ($result) {
// worked



This is the form:
<form enctype="multipart/form-data" method="post"
                            action="<?php echo $PHP_SELF ?>">
<?
$i = 1;
                      while ($i <= $songsinalbum) {
?>

<TR>
<TD align="right">ID:   </TD><TD><input type=text name=id value=<? echo
$i; ?> size=3><br></TD>
<TD align="right">Songname:  </TD><TD><input type=text name='songname'
size=30><br></TD>
<TD align="right">Rating:   </TD><TD><input type=text name='rating'
value='***' size=5 maxsize=5><br></TD>
<TD align="right">Video ID:   </TD><TD><input type=text name='video'
size=2 maxsize=3><br></TD>
<TD align="right">Album ID:   </TD><TD><input type=text name='album_id'
value=<? echo $id; ?> size=2 maxsize=3><br></TD>
<TD align="right">Movie ID:   </TD><TD><input type=text name='movie'
size=2 maxsize=3><br></TD></TR>

<?
$i++;
};

?>
<input type="submit" name="submit" value="Upload">
</form>
</TABLE>





I have an array of id numbers ($catids). I would like to select from the
mysql database all records where cid is in that array.

This syntax fails:
select * from categories
where cid in $catids

What is the correct way to do this? It can be done outside of a loop, can't
it?

c




> I have an array of id numbers ($catids). 

> This syntax fails:
> select * from categories
> where cid in $catids

Never mind. I was being stupid. For the record, one needs to implode(",",
$catids) and then use that in the WHERE statement, i.e. "where cid in
($catids)"

c




dear chris,

mysql does not support 'in' clause at the momment...
the only way to this is to use the loop to generate the sql syntax..
orr.. use the implode function... to join the array into 1 string separated by
the first parameter...

$catsql = implode("or cid=", $catids);
$catsql  = ((strlen(catsql)>0)? substr(catsql, 3, strlen(catsql)): "");

$catsql = "select * from categories where " . $catsql;

Chris Lott wrote:

> I have an array of id numbers ($catids). I would like to select from the
> mysql database all records where cid is in that array.
>
> This syntax fails:
> select * from categories
> where cid in $catids
>
> What is the correct way to do this? It can be done outside of a loop, can't
> it?
>
> c





I'm a new PHP/mySQL user (all of about 10 hours so far, working thru some
web-based tutorial stuff and using resources on the Internet). I have the
following "problem":

You can try the code out at
http://www.bond.net/~warrickw/zone6jrs/testsel.php

I want to have a form that lists values in a <SELECT> menu. Eventually I
will go back to populating the form from a database. I've been working
backwards and I am down to basic HTML and a little bit of PHP to look at the
submitted values.

The problem is my page NEVER, NOT EVER recognizes the value for the
myhandlerlist <SELECT> menu. If I submit by GET, it shows up in the URL
address, but isn't recognized. I added a second <SELECT>, and THAT got
recognized, and it recognizes my <INPUT> elements, but no way can I get a
value for the myhandlerlist.

I did some searching thru the archives and generally on the Internet, and
found lots of people posting similar sorts of problems, but the proposed
solutions I saw all dealt with building the lists dynamically.  I moved away
from that to this single item list and I still can't figure out why it won't
work.

Any and all help appreciated.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
        <title>Test Selection</title>
</head>

<body>
<h1 align="center">Add/Update Handler Information</h1>
<p>On entry:</p>
<?php
        // Just a test for onentry stuff
        echo("<p>");
        if (is_array($myhandlerlist)) {
                echo("myhandlerlist is an array!\n\n");
        }
        echo("</p>");

        echo("<p>");
        if (isset($myhanderlist)) {
                echo("myhandlerlist is set to " . $myhandlerlist );
        } else {
                echo("myhandlerlist is NOT set");
        }
        echo("</p>");

        echo("<p>");
        if (isset($list2)) {
                echo("list2 is set to " . $list2 );
        } else {
                echo("list2 is NOT set");
        }
        echo("</p>");

        echo("<p>");
        if (isset($hupdate)) {
                echo("hupdate is set to " . $hupdate );
        } else {
                echo("hupdate is NOT set");
        }
        echo("</p>");

        echo("<p>");
        if (isset($hadd)) {
                echo("hadd is set to " . $hadd );
        } else {
                echo("hadd is NOT set");
        }
        echo("</p>");

        echo("<p>");
        if (isset($useraction)) {
                echo("useraction is set to " . $useraction );
        } else {
                echo("useraction is NOT set");
        }
        echo("</p>");
?>
</p>
<p>Select a handler from the list and press <b>Update</b>, or press
<b>New</b> to add a new Handler.</p>


<!-- <form action="http://www.tipjar.com/cgi-bin/test"; method="post"
name="useraction" id="useraction"> -->
<form action="<?php echo("$PHP_SELF"); ?>" method="get" name="useraction"
id="useraction">

<select name=myhandlerlist>
        <option selected value="99">Warrick Wilson</option>
</select>
<br><br>

<input type="submit" name="hupdate" value="Update Selected Handler">
<br><br>
<input type="submit" name="hadd" value="Add New Handler">
</body>
</html>


Warrick Wilson
Avignon Reg'd Kennels
Kitchener, Ontario, Canada
http://www.avignonkennels.com
mailto:[EMAIL PROTECTED]





phpLinks 2.1 beta is released.

http://phplinks.org/


Thanks,
Greg






> function sum_array( $input_array )
> {
>     var $index;
>     var $sum = 0;
>
>     for( $index = 0; $index < count( $input_array ); $index++ )
>         $sum += $input_array[ $index ];
>
>     return $sum;
> }

The array variable issue has indeed bitten me a couple of times, so now all
my arrays are called $<something>_arr. It would nice to introduce more
runtime checking of array types and complaints in case non-array values are
used in functions. But otherwise the strong type checking will just cause
more problems and more overhead with calls. I don't know if the example
above will help that much, but you could already write similar code in
functions to make sure that the values are declared on top, to make things
clearer.

--Kent







hi there!

the operators you want are ~ and ~* and !~ and !~*.
select name from table where name ~* 'test';

to see all operators availlable type \do in psql's interactive mode ;)

Regards,
Nuno Silva

Derek wrote:

> anyone know how I force a case insensitive search through a postgres
> database.
> 
> I've got a search looking for 'something like '%something%' but this won't
> find 'SOMETHING'...if you know what I mean!?
> 
> Thanks in advance for any help
> 
> Derek
> 
> 
> 
> 






> 1) Can someone please clarify if we need something else for this
> (asp,cgi,ect).

You don't need anything other than PHP & mySQL. What you are talking about 
could be done in ASP, but would be much more difficult (most people find ASP 
to be a much more difficult language). When you say CGI, you probably mean 
Perl, which is the most popular. If you want to, you can use PHP as CGI. You 
could do your entire system in Perl, but Perl is considered more difficult 
than PHP.

I think you should use PHP, but then again an ASP list would say ASP w/ an 
Access database. A Perl list would say Perl with- what does Perl use for a 
database???

> 2) If PHP is the best choice can someone please suggest perhaps to an
> ongoing PHP open-source project which would lend to such an endeavor?

The best place I have found for scripts is hotscripts.com (although they need 
more Python...) You can probably find something there to help you, but I 
doubt you could find an entire system. You could also try some advanced 
searches with google, or if you want to sort through a LOT of results, 
http://fravia.2113.ch/phplab/blue.php searches many, many search engines.




What if you were to open an SSL tunnel to the DB host, then connect through 
that???

> like you said... as long as the database provider accepts
> connections from outside, you can administer it from anywhere.
>
> if the provider doesn't accept incoming connections, no amount
> of tools and software will work for you.
>
> > -----Original Message-----
> > From: Alexander Skwar [mailto:[EMAIL PROTECTED]]On Behalf Of
> > Subject: RE: [PHP] Alternative to phpMyAdmin
> >
> > > if you install mysql on a windoze machine then you can administer ANY >
> >
> > mysql database going through the socket.
> >
> > Okay, for a development this may be fine, but I still fail to see how a
> > tool that runs on your own computer (no matter if it's a Windows tool, or
> > a Linux tool) can help you administer databases which are not on the same
> > computer (unless the mysql database on the providers server can be
> > contacted from any machine and not just from "localhost").
> >






You probably mean SSH tunnel, which is quite feasable--  Hank Marquardt
posted this earlier to the list:

--------------- BEGIN QUOTE ---------------

Works just fine ... as does postgres --

ssh -N -2 -f -C -c blowfish -L3306:yourdatabase.server.here:3306
[EMAIL PROTECTED]

or the other usual tricks work too ... like going through a firewall
(fyi ... clear text on the *other* side of the firewall):

ssh -N -2 -f -C -c blowfish -L3306:db_behind_thefirewall:3306
[EMAIL PROTECTED]

The only oddity is that you will have to use the local host *address*
127.0.0.1 to connect from the mysql client as it normally looks for a
local socket if you use 'localhost', so your connection will be:

mysql -h 127.0.0.1

for postgres examples, change the port numbers (3306) to 5432

--------------- END QUOTE ---------------

-----Original Message-----
From: Evan Nemerson [mailto:[EMAIL PROTECTED]] 
Sent: Saturday, July 14, 2001 6:02 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Alternative to phpMyAdmin


What if you were to open an SSL tunnel to the DB host, then connect
through 
that???

> like you said... as long as the database provider accepts connections 
> from outside, you can administer it from anywhere.
>
> if the provider doesn't accept incoming connections, no amount of 
> tools and software will work for you.
>
> > -----Original Message-----
> > From: Alexander Skwar [mailto:[EMAIL PROTECTED]]On Behalf Of
> > Subject: RE: [PHP] Alternative to phpMyAdmin
> >
> > > if you install mysql on a windoze machine then you can administer 
> > > ANY >
> >
> > mysql database going through the socket.
> >
> > Okay, for a development this may be fine, but I still fail to see 
> > how a tool that runs on your own computer (no matter if it's a 
> > Windows tool, or a Linux tool) can help you administer databases 
> > which are not on the same computer (unless the mysql database on the

> > providers server can be contacted from any machine and not just from

> > "localhost").
> >


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED] To
contact the list administrators, e-mail: [EMAIL PROTECTED]





I need to send form input to a secure CC payment processing form using the
POST method. Before the fields are sent, I need to insert them into a
database, and I prefer that the user not have to press a second submit.

I have been trying to use cURL to do this, but instead of sending the user
to the page, it stays at the sending page and does not seem to send the
variables. Here is the code I am using:

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL,"$ccPaymentURL");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "$formDataString");
curl_exec ($ch);

curl_close ($ch);

Does anyone have ideas about why this is not working?

Thanks

Glenn Shope
[EMAIL PROTECTED]
Twin Cities Music Network
3010 Hennepin Ave. S. #109
Minneapolis, MN 55408
612-362-5995
http://www.tcmusic.net 





Ok.  I've been in this industry for 32 years.  I've loved O/S2, hated windoz
and been intrigued with *nix.  So, I have a successful web site and server
under windoz/php/mysql and I decide to venture into RedHat Linux because I
have heard some great things about it.

I get 7.0 and install it, virgin.  Apache and PHP work, but I was never able
to get MySQL working, except from a command line.  So, after abut 17 hours
of frustration, I get 7.1 .  Apache is the only thing that works.  I was
able to get PHP working when I did an install from scratch (tarball).  But,
it seems as if the RPM should work.  I still could not get MySQL working
working.  It consistently gives an error 2002 / socket problem.

Right now I have a virgin Apache and PHP4 and MySwl install from the RPM
(7.1) and php will not work.  As far as I can tell, I have modified my
httpd.config in all the right places.  Please, could someone who has a
working install from the 7.1 RPM package, please post their httpd.conf lines
that pertain to getting php to work?  Also, if their is a library that I
need to move around, please advise that too.

Thanks.  The MySQL problem would be a nice caveat if someone knows how to
fix that too :)

Regards,

--
Gaylen
[EMAIL PROTECTED]







Hi James,

I don't want someone overseas. 
I DID ask for someone in Melbourne.
Thanks anyway.

Justin French




James Tan wrote:
> 
> hi,
> 
> I'm interested in the position,
> would it be ok if I were in the position to do it from distance??
> 
> I'm currently living in malaysia...
> I could do php with mysql.
> I could setup apache , mysql and php with source on the unix environment as
> well...
> php have been my major for about several months ago..
> I've developed a payroll system with php.
> 
> hope to hear from you soon,
> 
> thank you
> 
> regards,
> 
> James
> 
> Justin French wrote:
> 
> > Hi all,
> >
> > I'm currently putting in a tender together for a large web project,
> > using PHP and MySQL, but I believe my skills may not quite be upto
> > scratch (or at least my development speed / quality of code), so I'm
> > considering finding a partner for the project.
> >
> > They have a realistic budget, realistic development time-frame, and
> > there are enough "components" to the project to serve as an excellent
> > "trophy" to show off our/your capabilities.
> >
> > I'm only interested in Melbourne (Australia) based PHP/MySQL developers,
> > capable of writing efficient, clean code for applications such as:
> >
> > o  detailed content management
> > o  intricate membership management
> > o  e-commerce (URL session based, not client side/cookies)
> > o  statistics / tracking gathering and analisys
> >
> > The developer must be able to show thier ability with real world
> > examples, and the ability to write portable / reuseable code rather than
> > one-off applications is a must.
> >
> > Understanding of the balance between browsers / design / information /
> > code would be an added bonus.
> >
> > Essentially I'm looking for a freelancer / contractor available to work
> > weekdays (even from home a lot of the time), and whilst this is a
> > one-off project, I'm keen to find a long term business partner to persue
> > similar projects full time.
> >
> > Terms / hours will be decent and negotiable for the right person.
> >
> > PLEASE no time wasters.  Send BRIEF resume / details to [EMAIL PROTECTED]
> >
> > Justin French
> > Creative Director
> > Indent.com.au
> > [EMAIL PROTECTED]
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]




hi,

I wanna print out all files in a directory. But i wanna exclude ".", "..",
"head.jpg", and all files that start with tn_

Here is my script, but it didn't work. Please help me to solve this problem.
Thank You.

---------my script-----
while ($file_name = readdir($dir2))

if (($file_name!="." && $file_name!=".." && $file_name!="head.jpg" &&
$file_name!=ereg(^tn_,$file_name) ))

$files[]=$file_name;
}

$numfiles = count($files);

for ($i=$g; $i<$numfiles; $i++){
echo $files[$i];
}

-----------------









Hi,
I tried to execute the following command from the web interface using a 
system call
/usr/bin/play a_wave_file.wav

I tried exec, system, passthru, and shell_exec. None of them worked, that is 
I didn't hear any sound played. Note that I'm sitting here on the server 
itself, and tried it with a web browser in the server. The command is 
executed fine when I just copy it and run it in terminal. I also made sure 
that nothing blocked the sound card, that is, the sound card was not in use.

exec, system, passthru returns the value 2, which I don't know what it means. 

Any help on this will be appreciated. Thanks in advance.

Reuben D. Budiardja




  Hi All,

  I want to enable multiple languages on one of my scripts, so
administrators or visitors can choose in what language they want to browse
the site. I have seen a few ways to do it, like with switch, define or
querying databases.

  But, considering performance, what is the best way to make a script with
multiple languages?

  Thanks for any ideas.


--

  Julio Nobrega.

You're asking me will my love grow, I don't know.







The best way to do it definitely is:

make several files with an array like:

file: lang.eng.inc:

        $dict = Array();
        $dict['name'] = 'Name';
        $dict['button']['red'] = 'Red Button';


file: lang.ita.inc:

        $dict = Array();
        $dict['name'] = 'il nome';
        $dict['button']['red'] = 'il bottone rosso';


file: lang.spa.inc:

        $dict = Array();
        $dict['name'] = 'nombre';
        $dict['button']['red'] = 'er botone roso';


file: lang.rus.inc:

        $dict = Array();
        $dict['name'] = 'Imya';
        $dict['button']['red'] = 'Krassnaya knopka';


file: lang.jap.inc:

        $dict = Array();
        $dict['name'] = 'Onamae';
        $dict['button']['red'] = 'Aka no battonu';



and so on... and so on...



then, in your scripts before any output (no, not a rule, just otherwise
makes few sense)...

1. ... include a config file where the language is set.
oh well, you can use any way you wish, cookies, sessions, get variables,
whatever, as long as you can set a language of preference to the script.

2. include "lang.$lang.inc";

3. In case you need something within a function or class just define
variable $dict as global.


Hare we go.
This is the less resource consuming way, all you need is to set the language
prefence correctly and work on keeping track of it.


any code?
Hmm, you could try to look into applications like phpmyadmin or Jinnie...
but the difference here is, most of these doing a little mistake - they
create a bunch of new variables for every phrase. Better do it with an
array.




Sincerely,

 Maxim Maletsky
 Founder, Chief Developer

 PHPBeginner.com (Where PHP Begins)
 [EMAIL PROTECTED]
 www.phpbeginner.com









-----Original Message-----
From: Inércia Sensorial [mailto:[EMAIL PROTECTED]]
Sent: Sunday, July 15, 2001 12:04 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Multiple languages


  Hi All,

  I want to enable multiple languages on one of my scripts, so
administrators or visitors can choose in what language they want to browse
the site. I have seen a few ways to do it, like with switch, define or
querying databases.

  But, considering performance, what is the best way to make a script with
multiple languages?

  Thanks for any ideas.


--

  Julio Nobrega.

You're asking me will my love grow, I don't know.



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]






oh,

i didn't realise how php is as flexible as vb :)

yeah.. ops, missed out the owner->test1 does not exist :)

thanx for tips :)

[EMAIL PROTECTED] wrote:

> Hi u007!
> On Sun, 15 Jul 2001, u007 wrote:
>
> > hie..
> > it's simply u did not declare ur class variable...
> >
> well, actually you don't have to declare them, you can add members as you go
> (as opposed to C++ for example)
>
> > class ctest
> > {
> > var $owner;
> >
> >     function ctest(&$owner)
> >     {
> >         $this->owner = $owner;
> >     }
> >
> >     function foo()
> >     {
> >         echo "test!<br>";
> >     }
> > }
> >
> > hope it works :)
> > regards,
> >
> > James
> >
> > Andrew Kirilenko wrote:
> >
> > > Hello!
> > >
> > > I have following problem:
> > >
> > > <?
> > > $container = new ccontainer();
> > > $container->init();
> > > $container->test1->foo();
> > > $container->test2->foo();
> > > $container->test2->owner->test1->foo();
> > > $container->test1->owner->test2->foo();
> > >
> > > class ccontainer
> > > {
> > >     function ccontainer()
> > >     {
> > >     }
> > >
> > >     function init()
> > >     {
> > >         $this->test1 = new ctest(&$this);
> > >         $this->test2 = new ctest(&$this);
> > >     }
> > > }
> > >
> > > class ctest
> > > {
> > >     function ctest(&$owner)
> > >     {
> > >         $this->owner = $owner;
> > >     }
> > >
> > >     function foo()
> > >     {
> > >         echo "test!<br>";
> > >     }
> > > }
> > > ?>
> > >
> > > Output of this script is:
> > > --->
> > > test!
> > > test!
> > > test!
> > > Fatal error: Call to a member function on a non-object in c:\www\a.php on
> > > line 8
> > > <---
> > >
> > > How to solve this problem???
> > >
> > > Best regards,
> > > Andrew Kirilenko,
> > > Senior Programmer / System Administrator,
> > > Internet Service.
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> -- teodor





G'day folks,

We've got a web-application ready to install and everything looks okay except
that the client has chosen Hosting4all as their web-hoster.  They
(Hosting4all) don't have a version of PHP linked with cURL and we need to
process credit card information.  Again, the client has chosen a payment
processor and, as expected, secure-HTTP is required.

All fair enough - the payment script has been written and works on our
servers.  Of course, it'll fail dismally on Hosting4All's servers.

My question is...

        Is anybody on this list hosting an e-commerce site with Hosting4All?
        Or, has anybody had any experience with the "Miva Engine" which
        Hosting4All provide "free of charge" (i.e. as part of the
        subscription fee)?

Any help would be much appreciated.  Thanks in advance.

Ciao.

-- 
-------------------------------------------------------+---------------------
Daniel Baldoni BAppSc, PGradDipCompSci                 |  Technical Director
require 'std/disclaimer.pl'                            |  LcdS Pty. Ltd.
-------------------------------------------------------+  856B Canning Hwy
Phone/FAX:  +61-8-9364-8171                            |  Applecross
Mobile:     041-888-9794                               |  WA 6153
URL:        http://www.lcds.com.au/                    |  Australia
-------------------------------------------------------+---------------------
"Any time there's something so ridiculous that no rational systems programmer
 would even consider trying it, they send for me."; paraphrased from "King Of
 The Murgos" by David Eddings.  (I'm not good, just crazy)




I'm new to Apache (and PHP) and was unable to find anything approaching an
answer to this problem in the Apache documentation. In fact, I'm not even
sure if I'm having a problem with Apache or with PHP. I am trying to use
sessions to track users on my site and write information to a file. I'm not
requiring them to login or anything - all I really want to know is which
users are visiting different pages on my site so I can judge the
effectiveness of my design. Anyway the problem is - I'm using the following
script:

<?
session_start();
session_register("origin");
session_register("ip_address");
session_register("browser");
session_register("$id");
$id = session_id();
$origin = "$HTTP_REFERER";
$ip_address = "$REMOTE_ADDR";
$browser = "$HTTP_USER_AGENT";
$sessn_root = "/***/sessn-log"; //substituted asteriks for actual path here
if(!file_exists("$sessn_root/$id.txt")):
        $sessn_data = "$id\n $ip_address\n $browser\n $origin\n";
else:
        $sessn_data = "$origin\n";
endif;
$fp = fopen("$sessn_root/$id.txt", "a");
fputs($fp, $sessn_data);
fclose($fp);
$includes = "***/includes"; //substituted asteriks for actual path here
$page = "$includes/index.inc";
include("$includes/template.html.php");
?>

and i get the following error:

Warning:
fopen("/home/tgmalone/sessn-log/0bbaf33ab1c1f9d714e2244459979ec7.txt","a") -
Permission denied in /home/tgmalone/public_html/index.php on line 17

The problem is obvious, but I've been searching, searching and wracking my
inadequate brain for a solution and can't find one - can anyone help me find
a solution/workaround?

Thanks,
Tom Malone





Hi,

I have a client who wishes to publish some catalogues to CD Rom.  Of
course they can't be placed onto a CD using PHP code (because it would
require the CD user to have PHP installed!!), but PHP/MySQL is
definately the best way to build the content, since the same data is
being used for online content as well.

So I guess my question is, what;s the best way to creat a static site
from dynamic content.  If it was a small site, i'd just access every
page, view the source, copy it, and save to file, but the catalogues may
get up over 1000 pages!!

It also occurs to me that this would be helpfull in building dynamic
sites monthly, but publishing a static site to the web, which would have
better luck with search engines, and maybe even with server load / caching.


I could make a script which builds / wrote HTML files to disc, no
problem, but if the pages already exist dynamically, I thought there
might be a way to write the HTML source (same as sent to the browser) to
a HTML file....


Thanks

Justin French


Reply via email to