[PHP] Catching all errors and redirecting

2005-08-18 Thread Thomas Hochstetter
Hi again,

Is it possible to catch all parser errors (notices), and as that happens
redirecting to a 'sorry-page-not-available-at-this-moment' page, whilst
storing the error (or notice) message somewhere else (e.g. emailing it to
the developer).

thanks

Thomas

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Array of objects

2005-05-06 Thread Thomas Hochstetter













 
  
  
  Hi there,
  I
  need help with arrays. What I want to do is to have an array of the following
  structure:
  $mod=array(
  name=new NameObject());
  Then
  later in the page I want to go $Site = $mod[$_GET[module]] (or something
  like that) to instantiate a new object.
  The
  problem is, if done the way above it will try to instantiate the object right
  there and then in the array (defeating the purpose), if I put it in quotes and
  try to use something like:
  (object)eval($mod[$_GET[module]])
  it does not instantiate the object. Is there a way to do this?
  Thanks
  Thomas
  
  
  
 
 
  
  
  SPIRAL EYE
  STUDIOS 
P.O. Box 37907,
  Faerie Glen, 0043
  
  Tel: +27 12 362 3486
  Fax: +27 12 362 3493 
Mobile: +27 83
  258 2669 
  Email: [EMAIL PROTECTED] 
  Web: www.spiraleye.co.za
  
  
 













RE: [PHP] Array of objects

2005-05-06 Thread Thomas Hochstetter
Thanks, will do ;-) (as of this mail)

-Original Message-
From: Jochem Maas [mailto:[EMAIL PROTECTED] 
Sent: 06 May 2005 03:08 PM
To: Thomas Hochstetter
Cc: [php] PHP General List
Subject: Re: [PHP] Array of objects

Thomas Hochstetter wrote:
 Hi Jochem,
 
 Thanks for that. The eval story was just a desperate attempt ... anyway, I
 know references a bit from my c++ times. I am not sure how that will help
in
 this case though. Maybe you want to share with me your thoughts on that.

well compare:

$a = new Test; // $a is the new object
$b = new Test;  // $b is a copy of the new object
$c = $b;   // $c refers to the same object
$d = $b;// $d is a seperate copy of $b

by default in php4 every time you assign an object (new or otherwise) to
a variable you are making a COPY, the same goes for when you pass an object
to a function.

There is shedloads of info around that explains the how  why of references
in detail, just google around a bit.

I have no idea about c++ (the C++ book beside the bed is only half-read and
hardly understood ;-) so whether your understanding of references in c++ is
a
help or hinderance I can guess at :-)

 
 Just for completion's sake:
 
 I want to have an array in a config file that holds all possible modules
 that can be loaded. The module name comes from the url string and if the
 string is not in that array I display a default page (so no tinkering can
go
 on).
 The reason for doing what you helped me doing now is only a cosmetic
reason.
 Instead of having to declare another block with if and else if statements
to
 instantiate the objects as in:
 
 if( $Site == null ) {
   if  ( $module==browse )   { $Site = new
 Browse(); }
   else if ( $module==details )  { $Site = new Details();} 
 }
 
 I thought it would be cool to be able to instantiate the object when I
check
 the array (on finding the right entry).

I might have written that as a function e.g.

function getModule( $modName )
{
if (in_array($modName, $modules)) {
$modClass = $modules[ $modName ];
return new $modClass();
}

return new DefaultModule();
}

or possible a switch statement, which would be a more concise way of
writing a big if/else block

switch ($_GET['module']) {
case 'browse':
$Site = new Browse();
break;
case 'details':
$Site = new Details();
break;
default:
$Site = new DefaultModule();
break;
}

... or a combination of the two (examples above).

btw, there is nothing implicitly wrong with the boring old if/else block...
it just maybe doesn't have the coolness factor, regardless eval() really
doesn't
sound like the way to go here at all. which ever way you do it, the most
important
thing is to layout you code _neatly_ (don't be afraid of using a bit of
space :-)
and comment as much as possible so that maintainance of the code is as easy
as
possible.

Good Luck! :-)

PS - please reply to list as well - somebody might be interested (and learn
something).

 
 Thanks again.
 
 Cheers
 
 Thomas
 
 -Original Message-
 From: Jochem Maas [mailto:[EMAIL PROTECTED] 
 Sent: 06 May 2005 01:17 PM
 To: Thomas Hochstetter
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] Array of objects
 
 Thomas Hochstetter wrote:
 
Spiraleye.Studios

  Hi there,

I need help with arrays. What I want to do is to have an array of the 
following structure:

$mod=array( 'name'=new NameObject());
 
 ^ -- looks like your single quotes got mangled in my email
 client.
 
 class Test { function Test($str = '') { echo $str; } }
 
 $_GET['module'] = 'testmod';
 $mod = array( 'testmod' = 'Test' );
 
 if (isset($mod[$_GET['module']])  class_exists($c =
 $mod[$_GET['module']])) {
  $Site = new $c;
  // $Site = new $c('Testing');
 } else {
  die ('Can't create module object');
 }
 
 
 ... and if that doesn't give you the knowledge/inspiration/lighbulb-moment
 to fix whatever it is your trying to do then please mail the list again
 and explain what _and_ why you are trying to do whatever it is you're
trying
 to
 do (this helps people to understand thereby having a better chance of
 offering some helpful advice!)
 
 
Then later in the page I want to go $Site = $mod[$_GET['module']] (or 
something like that) to instantiate a new object.

The problem is, if done the way above it will try to instantiate the 
object right there and then in the array (defeating the purpose), if I 
put it in quotes and try to use something like:

(object)eval($mod[$_GET['module']]) it does not instantiate the object. 
 
 
 well assuming no syntax error occurs (eval will return false is such a
case)
 then I bet it actually does, only your eval statement isn't assigning the
 new object to anything!... besides which you are casting the return
 value of eval to an object which is pointless for 2 reasons:
 
 1

[PHP] php5 and mysql 4.1 - Authentication

2004-11-02 Thread Thomas Hochstetter
Hi there,
 
I am sure there has been a discussion about this previously, I couldn't find
much through google though . anyway. I know I must use mysqli, and that is
also not the problem. The problem is with things like phpmyadmin and bxcms.
I am not going through all the code to fix the mysql connections. Is there
no way I can tell MySQL4.1.6 to accept http authentication? This seems to be
the overall problem, because it foes not even find the right access password
once a connection is establishes (using the OLD_PASSWORD() function).
 
Thomas


[PHP] Callback functions inside classes - how to?

2004-10-08 Thread Thomas Hochstetter
Hi again,
 
I have always been wondering how this is done properly:
 
Here is an example:
 
[snip]
 class A {
   function name( $a, $b, $c) {
  $tmp = array();
  $tmp[a] = $a;
  .
 array_push( $GLOBALS['XMLStack'], $tmp );
  }
 
  function parse() {
.. some definitions .
$parser-set_handler( root/page/title, name );
   . some more stuff here .
  }
}
[/snip]
 
What I want is to have the callback function name as it is in the above
example. But, obviously, the above code won't work. So, how do I tell the
set_handler function that it must use the name function from the class?
Using:
A::name or $this-name (if instantiated) . how do these callback
function calls work, because the same issue is with the xml handler
functions in php4 (have not as yet been to v5).
 
Also, how can I get the data from the callback function out without using
$GLOBALS? I cannot just return an array, can I?
 
Any ideas.
 
Thanks so  long.
 
Thomas


[PHP] HTML in Download data?

2004-09-24 Thread Thomas Hochstetter
Hi there,
 
I am (again) trying to download a file from off the server and force it to
use the download dialog box. I have been trying pclzip.lib for compression
and used my own headers  (as depicted below). This version did zip nicely
and the files were intact in the tmp folder. But once I used the headers it
mixed the html code into the resulting zip file. I know I must not mix the
my html and the zip data . but why is this happening?
Then I have used PEAR's HTTP_DOWNLOAD. The result: the exact same problem.
HTML is mixed with the data coming from the headers.
 
We have used ob_start() ( with gzip handlers), which I have taken out now,
but the problem is still the same. So that cannot be the problem? Why on
earth does it mix the html with the data? I do not include any html files.
 
Below are the two variations. The function 'PackAndSend' is called before
any output has taken place.
 
[1]
// The headers //
header(Content-type: application/octet-stream);
header(Content-Disposition: attachment; filename=$name );
header(Expires: 0);
header(Cache-Control: must-revalidate, post-check=0,pre-check=0);
header(Pragma: public);
 
// The zipping //
$mime = mime_content_type(files/papers/$_GET[file]);
$filePath = realpath( tmp/zips/. substr( md5( $_GET[file] ), 0, 5 )
..zip );
 
$zip = new PclZip( $filePath );
$zip-create( files/papers/$_GET[file], [ICT2005] Review Resources/Paper
ID [$_GET[file]], files/papers/$_GET[file] );
 
// reading the resulting zip file //
@readfile( files/papers/$_GET[file] );
// destroying the copy //
unlink( $filePath );
 
[2]
require_once( 'HTTP/Download.php' );

$dl = new HTTP_Download();
$dl-setFile('files/papers/'.$_GET['file']);
$dl-setContentDisposition(HTTP_DOWNLOAD_ATTACHMENT, $_GET['file']);
$dl-setContentType('application/x-gzip');
$dl-send();
 
Also, if I use the headers (as above in [1]) with a normal file, it has got
the neck of working fine on my machine (XP Pro, IE6, Apache 1.3, PHP4.3.2)
but not on the server (Debian, IE6, Apache 1.3, PHP4.02).
 
Any suggestions?
 
Thomas


[PHP] Is ob_gzhandler interfering with dynamic zipping???

2004-09-07 Thread Thomas Hochstetter
Hi there,
 
Still sitting on this problem of not being able to dynamically zip a bunch
of files together, to output them as a Save Dialog box for downloading. I am
using the rather old pclzip classes for the zipping part (still wrestle with
the server admin to get Archive_xxx stuff from PEAR installed - hate Debian
servers!).
 
Now I came across a discussion in which someone said that [code] ob_start(
ob_gzhandler);[/code] should not be used when one things of dynamically
outputting stuff via header() to the browser.
 
Anyone has got a story on that? Or even better, an idea how to get this show
going even with [same-code]ob_start( ob_gzhandler);[/same-code] enabled.
 
Help is appreciated!
 
Thomas
 
P.S. Sorry Marek, last time is was a bit slow to respond. ;-)


[PHP] Getting $_POST variables back

2004-09-03 Thread Thomas Hochstetter
Hi there,
 
I am not sure if that is a common request, so I will post it here without
checking the archives . ;-)
 
I have a page which has its details from the $_POST array (ID, etc). On it
there is a small link about people, this is done via href link in html. This
link takes you to another page displaying info about people. What I want is
to get back to the previous page without having to hit F5 again  (The
session is up). Obviously I cannot use js's history.back(-1) because the
previous page needs the $_POST stuff.
 
The interesting thing is now, if I do use history.back then after hitting F5
I get to the previous screen again (with my old $_POST) variables.
 
NOW:
The question arises: where does the browser store this info, and can I get
it back from there on the page that got called via the href html? I would
like to avoid some rather unnecessary server side selects to retrieve the
previous page.
 
Thanks
Thomas


[PHP] Creating a zip and pumping it through the headers - ERROR

2004-08-31 Thread Thomas Hochstetter
Hi again,
 
After a clever question follows a dumb one: :-(
 
I am trying to pack a few resources from off the server, zip them together
(at this stage still storing in a tmp folder and afterwards deleting it
again) and make the freshly created zip file available to the user via a
'Save File' prompt. Now I have searched the archives a bit and have read the
suggestions in the extended chm version of the manual TWICE, but still, I
don't seem to be able to get rid of this one stupid problem:
 
The zip gets created fine, but when I readfile() it and pump it through the
headers it adds the whole html (which the server sent to the browser - not
the php code) and so corrupts the zip file. I have read about suggestions to
these issues, implemented these suggestion and still sit with it.
 
I am using Apache 1.3.20, PHP 4.3.2 and mySQL on a Windows stove. The
browsers I have tested this on was IE6 and Opera 7 . both acted the same
way. This got me thinking that: maybe I am doing something wrong . ;-)
 
So here is the method I am using to pack and send the stuff .
 
[code]
function PackAndSend( )
{
include_once( realpath(classes/pclzip.lib.php) );

$filePath = realpath( tmp/zips/. substr( md5( $_GET[file] ),
0, 5 ) ..zip );

$zip = new PclZip( $filePath );
$zip-create( realpath(files/papers/$_GET[file]),
Resources/Docs ID [$_GET[file]], files/papers/ );

$fz = filesize( $filePath );
$mime_type = application/zip;

header('Pragma: public'); // IE specific
header('Cache-Control: private');
header('Cache-Control: no-cache, must-revalidate');
header('Accept-Ranges: bytes');
header('Content-Length: ' . $fz);
header('Content-Type: $mime_type');
header('Content-Disposition: attachment;
filename=Resources.zip');

@readfile( $filePath );
unlink( $filePath );
$GLOBALS['COPE_LOG']-devLog();
}
[/code]
 
The headers sequence I have tried with many others . all did not do anything
different.]
 
Help would be appreciated.
 
Thomas


[PHP] CMS, Seperation of concerns - the Cocoon style

2004-08-31 Thread Thomas Hochstetter
Hi there,
 
I was thinking about this a lot today and was wondering if there are any
people here on this list that have experimented with this:
 
I hope you know what Cocoon does. If I can just sum up what I am concerned
about:
 
*   Separation of concerns (i.e. Design, Content and Logic are
COMPLETELY separate entities)
*   Pipelining xml to create out of one content file many other,
semantically different files (like xhtml, pdf, wml .)
*   To use such a system as a generic template system, say for
Conferences
 
What is was now wondering about is, what would be the best practice here. I
have read a little up on the use of PHP in combination with Cocoon 2, and it
looks like that there are a few ways of doing this. 
 
Question: the reason why I went the PHP and not the XSP way was because of
the huge complexity and slowness of Cocoon (jsp, xsp, servlets) compared to
PHP. So now the combination of the two still does not sound feasible, or
does it not matter much? The fact still remains that xml transformations
nibble CPU time. Then there is also Java involved. :-/
 
A second option would be to write my own PHP 5 driven XML
transformers/template engine (I would not dare to say that I could do so!).
I know that PHP 5 has got a hugely improved XML and DOM interface. And one
could possibly combine this with PEAR classes and Smarty (or something
similar).
 
Then there are things like . err, forgot the name, but there is an open
source project out there that emulates what Cocoon does (separation of
concerns and pipelining), by using only PHP.
 
I am quite keen on getting some sort of backbone going where I can create,
manipulate pdf's and even stuff like Word files and rtfs. I am still
mesmerized by the whole XML idea. Some people talk about it having failed
the web . hmmm, not sure of that. Maybe it's just not been tried enough?
 
So, any inputs on that? I would not mind going the java route, just prefer
rapid development over: asant - asant deploy - asant undeploy - asant clean
.. And so on .
 
Thanks,
 
Thomas
 


[PHP] Weired session problem

2004-02-06 Thread Thomas Hochstetter
Hi guys,

Has anybody come across the same problem:

i am using the $_SESSION array to retrieve info of users. At times, however,
it just retrieves the wrong info, i.e. info from another user. how is that?

thanks in advance
Thomas

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Weired session problem

2004-02-06 Thread Thomas Hochstetter
Hey,

I am having users sign in on a index.php which directs them to the members
page (same: index.php). There i have links that open small windows via js.
These have session_start() in them to continue the same session variable.
Then there i would have something like: 

[snip]
$tusr = $_SESSION['fn'] .   . $_SESSION['ln'];

or 

sendReceived( $_POST['title'], $_POST['tusr'], $_SESSION['email'] );

[/snip]

So it is supposed to get the right info from the current sesssion with which
one logged in.

Thomas

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] 2 questions

2003-08-23 Thread Thomas Hochstetter
Hi guys.

I have two questions for you today:

1. Weired login problem
I am developinig a site for a conference where i have a login page for
members. This page is called index.php and includes different types of modules,
according to the type of user logged on. The problem is now following:
i have a login function hidden in a class, this function registers a bunch
of variables. After the user has submited the details, index.php (which calls
the session_start()) calls the login function. Then i check whether a session
variable is present ($_SESSION['name']). If yes, we include the members
area, otherwise we include the login table again. Now: on my test server
(XP/Apache/php4.3.2) all is well. However, on the real server (Linux/Apache/php4.0.x)
it just includes the login table anyway, even if the login was successful. I
then have to click on the menu link again to include the member script.
Why is that?

2. Save a large amount of text to a file
On the same page i have some type of cms going. The admin users can change
txt files which relate to text on some of the general pages. I have now found
that it is only transmits a certain amount of text via GET to the function
that writs to the files. Is there a restriction on passing text via url? If yes
(which will be the case), how could i do this otherwise?

Thanks so long...

Thomas
P.S: this list still rocks

-- 
COMPUTERBILD 15/03: Premium-e-mail-Dienste im Test
--
1. GMX TopMail - Platz 1 und Testsieger!
2. GMX ProMail - Platz 2 und Preis-Qualitätssieger!
3. Arcor - 4. web.de - 5. T-Online - 6. freenet.de - 7. daybyday - 8. e-Post


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] 2 questions

2003-08-23 Thread Thomas Hochstetter
The register globals is on with the live server, and off at home (my version
is 4.3.2, the other is 4.1.2). does that matter?
Thanks for the other tip, shall try that ...

Thomas

- Original Message -
From: Thomas Hochstetter [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, August 23, 2003 5:33 PM
Subject: [PHP] 2 questions


 Hi guys.

 I have two questions for you today:

 1. Weired login problem
 I am developinig a site for a conference where i have a login page for
 members. This page is called index.php and includes different types of
modules,
 according to the type of user logged on. The problem is now following:
 i have a login function hidden in a class, this function registers a bunch
 of variables. After the user has submited the details, index.php (which
calls
 the session_start()) calls the login function. Then i check whether a
session
 variable is present ($_SESSION['name']). If yes, we include the members
 area, otherwise we include the login table again. Now: on my test server
 (XP/Apache/php4.3.2) all is well. However, on the real server
(Linux/Apache/php4.0.x)
 it just includes the login table anyway, even if the login was successful.
I
 then have to click on the menu link again to include the member script.
 Why is that?

Check your register_globals setting in both ur test server and real server
and let me know.


 2. Save a large amount of text to a file
 On the same page i have some type of cms going. The admin users can change
 txt files which relate to text on some of the general pages. I have now
found
 that it is only transmits a certain amount of text via GET to the function
 that writs to the files. Is there a restriction on passing text via url?
If yes
 (which will be the case), how could i do this otherwise?

Use POST instead of GET method... POST method allows u to even extend the
size of data being posted.

Hope this helps...


 Thanks so long...

 Thomas
 P.S: this list still rocks

 --
 COMPUTERBILD 15/03: Premium-e-mail-Dienste im Test
 --
 1. GMX TopMail - Platz 1 und Testsieger!
 2. GMX ProMail - Platz 2 und Preis-Qualitätssieger!
 3. Arcor - 4. web.de - 5. T-Online - 6. freenet.de - 7. daybyday - 8.
e-Post


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
COMPUTERBILD 15/03: Premium-e-mail-Dienste im Test
--
1. GMX TopMail - Platz 1 und Testsieger!
2. GMX ProMail - Platz 2 und Preis-Qualitätssieger!
3. Arcor - 4. web.de - 5. T-Online - 6. freenet.de - 7. daybyday - 8. e-Post

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] HTTP transactions with PHP?

2003-08-21 Thread Thomas Hochstetter
[snip]
- PHP sends request headers (with POST data) to $url
- $url sends response back to calling script
- PHP works with the response
[/snip]

Look at fsockopen, with which you can send POST headers, or just fopen. You
sit this in a try/ catch sort of script and you should be able to get stuff
back to process.

Am not so sure whether that is what you are looking for ... i have used this
to send a request to a sms gateway, and received a reply. Works well.

Thomas

-- 
COMPUTERBILD 15/03: Premium-e-mail-Dienste im Test
--
1. GMX TopMail - Platz 1 und Testsieger!
2. GMX ProMail - Platz 2 und Preis-Qualitätssieger!
3. Arcor - 4. web.de - 5. T-Online - 6. freenet.de - 7. daybyday - 8. e-Post


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] File upload and deletion

2003-08-21 Thread Thomas Hochstetter
[snip]
- PHP sends request headers (with POST data) to $url
- $url sends response back to calling script
- PHP works with the response
[/snip]

Look at fsockopen, with which you can send POST headers, or just fopen. You
sit this in a try/ catch sort of script and you should be able to get stuff
back to process.

Am not so sure whether that is what you are looking for ... i have used this
to send a request to a sms gateway, and received a reply. Works well.

Thomas

-- 
COMPUTERBILD 15/03: Premium-e-mail-Dienste im Test
--
1. GMX TopMail - Platz 1 und Testsieger!
2. GMX ProMail - Platz 2 und Preis-Qualitätssieger!
3. Arcor - 4. web.de - 5. T-Online - 6. freenet.de - 7. daybyday - 8. e-Post


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] logging data to xml

2003-08-15 Thread Thomas Hochstetter
Hi there.

I have been trying to log some data to an xml file. Whta my problem is now
is that the /root tag needs to be either replaced (overwritten) or i need to
get the data in before EOF-1. I have spend some time on the manual, but
could not find out hoe exactly i should get the last row and then move one up
again to log the stuff to the file.

Well ... this is my idea anyway. If anyone can suggest to me (point me) to
another solution i will certainly investigate this.

NB: i am not looking for some code, just let me know where i can find the
right answers.

Thomas

-- 
COMPUTERBILD 15/03: Premium-e-mail-Dienste im Test
--
1. GMX TopMail - Platz 1 und Testsieger!
2. GMX ProMail - Platz 2 und Preis-Qualitätssieger!
3. Arcor - 4. web.de - 5. T-Online - 6. freenet.de - 7. daybyday - 8. e-Post


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] OPINIONS wanted - xml-DOM-xsl + php

2003-08-14 Thread Thomas Hochstetter
Hey guys.

There is question that has been bothering me for a while now ... and i
wonder whether there are any takes/ insights on that.

I would really like to integrate xml, DOM and XSL more in my projects. What
has kept me from doing this, so far, is just that the live servers often did
not make the dom and xsl functions available (i.e did not include the libxml
etc with php).
I guess many server admins just don't bother about that and because it is
not part of the standard php install (unlike xml functionality) it remains
unsupported.
Are there plans to make the xml-DOM-xsl combination standard in future
releases of php (version 5)? The .dlls are there.
In terms of creating generic and flexible systems it would make sense to
make these part of the standard setup, just because it is possible to move the
system now to any server without having to bother the poor Admins.

I must appologize if i have not spend too much time online to find out
myself now ... don't have the luxuary of going online for long (still a student -
no money and torterously slow connections). I hope that someone can enlighten
me, otherwise, it will spark a discussion about that (i hope that this is
also aprt of a list - don't want to rekindle any more discussions about the
(mis)use of this exellent mailing list.

Thanks.

Thomas

-- 
COMPUTERBILD 15/03: Premium-e-mail-Dienste im Test
--
1. GMX TopMail - Platz 1 und Testsieger!
2. GMX ProMail - Platz 2 und Preis-Qualitätssieger!
3. Arcor - 4. web.de - 5. T-Online - 6. freenet.de - 7. daybyday - 8. e-Post


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] /n not working

2003-07-26 Thread Thomas Hochstetter
Hi there.

I got a question from someone why the following (from the manual) will not
bring the desired output:

?php

/* if I open the following txt file and in explorer*/


$text = The quick brown fox jumped over the lazy dog.;
$newtext = wordwrap($text, 20);

echo $newtext\n;



/*my output is the following

The quick brown fox jumped over the lazy dog.

*/


/*this should however have the following output according to the php manual

The quick brown fox
jumped over the
lazy dog.

*/
?

Is this a php.ini setting?

Thomas


-- 
+++ GMX - Mail, Messaging  more  http://www.gmx.net +++

Jetzt ein- oder umsteigen und USB-Speicheruhr als Prämie sichern!


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] cms design xml-php ?

2003-07-25 Thread Thomas Hochstetter
Hi there.

Is there any php book that discusses general design issues for cms's and
webservices in php?
Also, what is your take on xml? Is it worthwhile waiting for v5 to be
released before buying a xml-php book?

thanks
Thomas

-- 
+++ GMX - Mail, Messaging  more  http://www.gmx.net +++

Jetzt ein- oder umsteigen und USB-Speicheruhr als Prämie sichern!


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] php5 + php4 on same server

2003-07-25 Thread Thomas Hochstetter
Hi guys.

Sorry, i know that was discussed earlier this month ... i just looked for
the posting again in the archives ... i could only find the question post ...
but there was an answer.

So, how do you setup the server again to have php4 run on the :80 port and
php5 on :8080 (apache server). Does it collide?

Thanks
Thomas

-- 
+++ GMX - Mail, Messaging  more  http://www.gmx.net +++

Jetzt ein- oder umsteigen und USB-Speicheruhr als Prämie sichern!


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Preserving session vars over multiple windows

2003-07-20 Thread Thomas Hochstetter
Hi there.

How can i preserve var's of session 's' over more than one window without
loosing them?

Thomas

-- 
+++ GMX - Mail, Messaging  more  http://www.gmx.net +++

Jetzt ein- oder umsteigen und USB-Speicheruhr als Prämie sichern!


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] session across satelite windows

2003-07-15 Thread Thomas Hochstetter
Hi again.

 

I am having a problem with session variables spanning over different
windows.

What I am doing is to supply links in an admin interface that open satellite
windows, opened via JS. The window scripts check for a variable to be
present ($_SESSION[]). I am doing this so that the scripts cannot be called without
being successfully logged in.

The problem is this:

Opening the first window is fine, but when closed (with window.close()) and
tried to reopen, the $_SESSION variable test works out to be false. Why?

 

I am passing the session number through to the windows (as a variable called
$sesi). I checked the session folder, and it seems that the session is not
destroyed. All scripts call session_start(). What is happening? I know that
the manual says that we have to send the session number to the next pages.

Does it have anything to do with JS (I doubt).

 

Help is appreciated.

 

Below you find the calling snipps:

 

[snip]

 

#

## Check for valid session variable

# 

session_start();

require(../../scripts/generic/major.class.php);

$gsql = new sql;

if ($_SESSION['uid'])

{

…

 

#

## open the window with js

#
… onclick=openwin('update','?php echo $tid;?','?echo
session_id();?','?php echo $uid;?','430','480','cwin','no','no') /

function openwin(type,id,sess,uid,h,w,win,loc,scrl){
 
window.open(xtemp/+type+.php?sesi=+sess+id=+id+uid=+uid+,win,height=+h+,width=+w+,left=0,top=0,alwaysRaised=yes,directories=no,dependent=yes,location=+loc+,status=no,titlebar=no,resizable=no,menubar=no,scrollbars=+scrl+);

}

 

 

Thomas

-- 
+++ GMX - Mail, Messaging  more  http://www.gmx.net +++

Jetzt ein- oder umsteigen und USB-Speicheruhr als Prämie sichern!


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] how to :: multi select

2003-07-05 Thread Thomas Hochstetter
Thanks guys.
I will have a look at the array[] convention. Meanwhile I did my own
thing by naming them all different and parsing the $QUERY_STRING for
them. It is a mess!
So thanks again!

Cheers
Thomas


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] how to :: multi select

2003-07-04 Thread Thomas Hochstetter
Hi guys,
 
This might just be off the topic, but here it goes anyway:
 
How can one multi select check boxes and pass them through in php,
without getting mixed up with variables (email multi select style).
 
Thomas


[PHP] a generic getsql() function

2003-06-25 Thread Thomas Hochstetter
Hi guys,
 
I wrote a generic getsql() function for my project's class. However, I
only manage to retrieve a single row. What it should really do is:
Read all rows into the array (with multiple results).
The code is below:
 
function getsql($sql,$conn,$dbase,$arr)
{
if($conn)
{
mysql_select_db($dbase,$conn);
$result = mysql_query($sql,$conn);

while ($arr = mysql_fetch_assoc($result))
{
return $arr;
// Something has to happen here!!!
}
}
else
{
$arr[Error] = No connection;
return $arr;
}   
}
 
Thanks.
 
Thomas


[PHP] reference a function in a class from array_walk()

2003-06-21 Thread Thomas Hochstetter
Hi guys.
I want to call this generic echo function within a class, but have
trouble referencing the output function with $this- .
Any suggestions? Maybe there is a better solution to this?
 
This is within a class:
 
[snip]
# generic WALK functions
function walkit($array)
{
array_walk($array,$this-output); //not
working
}

function output($item,$key)
{
echo $key. $itembr /\n;
}
 
thomas


[PHP] mysql_errno codes

2003-06-16 Thread Thomas Hochstetter
Hi.

[3rd try] ... where can i get mysql_error codes from? The ones that
mysql_errno returns.

Thanks
Thomas

-- 
+++ GMX - Mail, Messaging  more  http://www.gmx.net +++
Bitte lächeln! Fotogalerie online mit GMX ohne eigene Homepage!


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] mysql_errno codes

2003-06-16 Thread Thomas Hochstetter
Thanks guys ... always a pleasure.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] mysql error messages

2003-06-16 Thread Thomas Hochstetter
Hi.
 
I have parsed the txt file and put it on my site . it's kinda ugly and
messy, but maybe it helps someone.
 
http://www.thomash.co.za/docs/errmsg.php
 
T


[PHP] referer counter

2003-06-12 Thread Thomas Hochstetter
Hi guys,
 
I am writing a counter that checks where the hit comes from, and if it
comes from the same site, it will not count .
I have a question related to performance:
In the script (as yet) I have to open the txt file twice at this stage,
because I first need to read from it and then write to it. The problem
is that the a+ and w+ property of fopen set the file 0 before I can read
from it. So here is the real question:
Is it possible to do this with only one read? Does it matter performance
wise?
 
The script functions are below:
 
function ref($url)
{
$nc = 0;
$cfile = inc/log/logcount.txt;
$valid = preg_match(/dcv/, $url);
$fp = fopen($cfile,r);
$pc = fgets($fp,1024);

if($valid){
echo $pc;
} else {
$this-incr($pc,$fp,$nc);
fclose($fp);
$this-write($nc,$cfile);
echo $nc;
}
}

function incr($pc,$fp,$nc)
{
if($pc != ) 
$nc = intval($pc)+1;
else 
fputs($fp,1);
return $nc;
}

function write($nc,$cfile)
{
$fp = fopen($cfile,w);
$done = fputs($fp,$nc);
if($done == 0)
exit;
fclose($fp);

}
//END of counter functions
}
Additionally, why do I have to pass the nc variable to function incr()
as reference? It did not work just do return $nc.
 
Thomas


[PHP] fastest parsing first!

2003-06-11 Thread Thomas Hochstetter
Hi,

I have a question concerning the parsing of scripts. The question is what
will be parsed the quickest: much inline php (dirty) code, or let the code
generate the html on the fly?
I frequently use css ALOT! Does that make any difference to php (apart from
making the file quite messy)?

Any other thoughts?

:x
t

-- 
+++ GMX - Mail, Messaging  more  http://www.gmx.net +++
Bitte lächeln! Fotogalerie online mit GMX ohne eigene Homepage!


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] fastest parsing first!

2003-06-11 Thread Thomas Hochstetter

It really depends, mostly it is external ... to accommodate small
variations I have some style attributes around.

T

-Original Message-
From: Jay Blanchard [mailto:[EMAIL PROTECTED] 
Sent: 11 June 2003 06:30 PM
To: Thomas Hochstetter; [EMAIL PROTECTED]
Subject: RE: [PHP] fastest parsing first!

[snip]
I have a question concerning the parsing of scripts. The question is
what will be parsed the quickest: much inline php (dirty) code, or let
the code generate the html on the fly? I frequently use css ALOT! Does
that make any difference to php (apart from making the file quite
messy)?
[/snip]

Are you using inline CSS A LOT or an included stylesheet a lot?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Rather unrelated

2003-06-09 Thread Thomas Hochstetter
Hi guys,
sorry that i am asking this rather non-php question here. I know how anoying
it is to get these unrelated mails ... it might just have to do with the
apache ... or whatever:
[problem]
if i declare in an external stylesheet the scrollbar-track-color to be
whatever, it does not show. even if i put it inline into the actual page. However,
if i get a page doing this from the net, it displays. It doesn't if i use
the apache server on my machine. Anyone had a similiar problem?

thanks
thom

-- 
+++ GMX - Mail, Messaging  more  http://www.gmx.net +++
Bitte lächeln! Fotogalerie online mit GMX ohne eigene Homepage!


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php