[PHP] $_SESSION only takes 1 character?

2002-10-01 Thread Tim Stoop

Hi there,

I've got some strange behaviour here (at least, I can't explain it). I'm 
running PHP 4.2.3 on a Mandrake 9.0 machine. I'm using sessions in my 
little app and want to use the $_SESSION-variable to keep track of all my 
variabeles.

Well, when I tell it
$_SESSION[something-intelligent] = $myName;
echo($_SESSION[something-intelligent]);

I get Tim on my screen. But when I do:

$nr = 12;
$_SESSION[things][$nr][intelligent] = $myName;
echo $_SESSION[things][$nr][intelligent];

I don't get any output at all! Can anyone shed any light on this? Thanks in 
advance!!

-- 
Kind regards,
Tim

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




[PHP] Re: $_SESSION strange behaviour? (was: $_SESSION only takes 1 character?)

2002-10-01 Thread Tim Stoop

Hmm... subject wasn't what I wanted it to be :) Sorry about that.

-- 
Kind regards,
Tim

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




[PHP] [Session-objects] Call to a member function on a non-object

2002-08-16 Thread Tim Stoop

Hi people,

As I understand it, object are unserialized into their former Class, if 
that Class is in memory. That's right, right?

Well, consider the following code:

include_once(../config.inc.php);
include_once($WORKDIR.obj/foto.obj.php);
if($type == 1)
{
$foto = new Foto();
}
if(isset($_SESSION['foto']))
{
$foto = unserialize($_SESSION['foto']);
}
$foto-makeInputFoto($type);
$_SESSION['foto']=serialize($foto);

It's for a page that can edit or add a foto in(to) the database. If I run 
it like this, with ?type=1 in the URL, it works the first time, but after a 
reload of the exact same page, I get a 'Call to a member function on a 
non-object' in the line '$foto-makeInputFoto($type);'. Why is that? It's 
already a Foto-object, because I unserialized it, isn't it?

I also tried:
if($type == 1  !isset($_SESSION['foto']))
{
$foto = new Foto();
}
elseif(isset($_SESSION['foto']))
{
$foto = unserialize($_SESSION['foto']);
}
With exactly the same effect. Any idea on how I can solve this? Tia!

-- 
Kind regards,
Tim

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




[PHP] [Class] Behaviour global variables

2002-08-14 Thread Tim Stoop

Hi there,

I'm forgetting something, but I can't seem to get to it... Consider the 
following Class.

class Test
{
var $a;
var $b;

function Test()
{
$this-a = 2;
$this-b = 5;
}

function Show()
{
global $a, $b;

echo(a: .$a);
echo(a: .$this-a);
echo(b: .$b);
echo(b: .$this-b);
}
}

After proper initialisation, calling the function Show() gives:

a:
a: 2
b:
b: 5

What am I forgetting here? Tia for answers!

-- 
Kind regards,
Tim

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




[PHP] [Class] global again, not working?

2002-08-14 Thread Tim Stoop

Hi people,

Again, a problem with global. Maybe you can shed a light on this one...

Consider this part of a class (with [...] I marks things I left out, which 
aren't important for the problem, FAFAIK):

class FotoView
{
[...]
var $fotos;
var $cats;
var $start;
var $limiet;
[...]

/**
 * Constructor
 */
function FotoView($start,$cats=NULL,$admin=FALSE)
{
$this-limiet = $this-getLimit();

[...]

$this-start = $start;

[...]

echo(1:.$this-start. .$this-limiet);

$this-fotos = $this-findFotos();
}

function getLimit()
{
global $WORKDIR;
include_once($WORKDIR.obj/dbconnection.obj.php);

$db = new DBConnection();
$result = $db-query(SELECT lijst_x, lijst_y FROM config);
$data = mysql_fetch_row($result);
return ($data[0]*$data[1]);
}

[...]

function findFotos()
{
global $start, $cats, $limiet, $urlfotoview, $WORKDIR;

echo(2:.$this-start. .$this-limiet);

echo(3:.$start. .$limiet);
[...]

Okay, $WORKDIR is set in the page that calls this class, it works (checked 
it). You can see three echo's in there. The result from those are:
1: 0 20
2: 0 20
3: 0

Can anyone explain to me why in findFotos() the defining of $limiet doesn't 
work correctly? Why isn't a reference made to $this-limiet? I'm really at 
a lost, here... Any help is appreciated!

-- 
Kind regards,
Tim

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




[PHP] Re: PHP AND JAVA

2002-08-14 Thread Tim Stoop

Alexandra Aguiar wrote:

 may i use php with JAVA (note. not JAVASCRIPT , but JAVA APPLETS) !?!

Depends on what you want to achieve. As long as the final embed is 
correct (i.e. the one that is sent to the client, after php-parsing), no 
problem at all.

-- 
Kind regards,
Tim

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




[PHP] Re: mysql statement (still a semi newbie)

2002-08-14 Thread Tim Stoop

Alexander Ross wrote:

 That first column is an auto_incrementing column so i don't want any data
 INSERT INTO cast VALUES(DEFAULT, 'Rick', 'Blaine', 'Humphrey', 'Bogart',
 'male');

I think you need to use NULL instead of DEFAULT... I'm not 100% sure. Just 
try it :)

-- 
Kind regards,
Tim

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




[PHP] Re: Simple Mail

2002-08-14 Thread Tim Stoop

Dave Leather wrote:

 Something is VERY weird with trying to send mail.  I am running Apache for
 windows and trying to send mail... using a line such as

I think you need a local SMTP-server, or at least your SMTP-server 
configured in PHP (don't know exactly what you need to change in php.ini 
for that, but I know for sure it's a part of the output from phpinfo()).

 Connect to where  And yes, line 236 is my mail line...

Connect to a SMTP-server, so it can send the mail :)

-- 
Kind regards,
Tim

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




[PHP] Maximum in SQL query?

2002-08-12 Thread Tim Stoop

Hi people,

It seems that MySQL only accepts queries that are 470 characters or smaller 
when I use PHP. Is this a known thing? Can I change it somehow? I printed 
the query:

Query: REPLACE INTO foto (ID, titel, fotograaf, origineel_formaat_x, 
origineel_formaat_y, datum_invoering, datum_wijziging, plaats_opname, 
datum_opname, file_thumb, file_large, url_thumb, url_large, thumb_hoogte, 
thumb_breedte, large_hoogte, large_breedte, fine_art_print, 
digitaal_formaat) VALUES (0001, Eva, Jasper, 1024, 768, now(), 
now(), Brunssum, , / var/www/html/foto/0/0/0/0/0001.thumb.jpg, 
/var/www/html/foto/0/0/0/0/0001.jpg, /foto/0/0/0/0/0001.thumb.jpg, / 
foto/0/0/0/0/0001.jpg, 200, 150, 500, 375, FALSE, Array)

Database error: You have an error in your SQL syntax near ' 
/var/www/html/foto/0/0/0/0/0001.thumb.jpg, /var/www/html/ 
foto/0/0/0/0/0001.j' at line 1

-- 
Kind regards,
Tim

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




RE: [PHP] Maximum in SQL query?

2002-08-12 Thread Tim Stoop

Hi Jay,

Jay Blanchard wrote:

 I believe the error is a space prior to 'var'
 
 Brunssum, , / var/
 
 try
 
 Brunssum, , /var/

Nope, that wasn't the error, but the error was in there... it's the , , 
in there :) An empty value... Thanks for the quick reply!

-- 
Kind regards,
Tim

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




[PHP] Moving a file with 'rename'?

2002-07-04 Thread Tim Stoop

Hi people,

I want to move a file from one location to another. I expect I can only do 
this with 'rename', because there's no 'move'-command (at least nog in the 
manual). Following situation:

original file: /var/www/html/webfotos/tmp/thumb_phpibmGBF.jpg
with /var/www/html/webfotos being a symlink to /home/cvd/sanbox/webfotos
new location: /var/www/html/foto/0/0/0/0/.thumb.jpg

syntax: rename($old_location, $new_location);

Error: Warning: Rename failed (Invalid cross-device link) in 
/home/cvd/sandbox/webfotos/admin/save.php on line 95

When I 'su' to 'apache' (the user under which the httpd is running), I can 
do the following without any error:

mv /var/www/html/webfotos/tmp/thumb_phpibmGBF.jpg 
/var/www/html/foto/0/0/0/0/.thumb.jpg

Any ideas on why I get the error and how I can solve it? Tia!

-- 
Kind regards,
Tim

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




Re: [PHP] Moving a file with 'rename'?

2002-07-04 Thread Tim Stoop

Marek Kilimajer wrote:

 rename can move the file only on the same partition, it is realy just
 _rename_, not full _move_

So there is no full-features move in PHP?

-- 
Kind regards,
Tim

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




Re: [PHP] Moving a file with 'rename'?

2002-07-04 Thread Tim Stoop

Latex Master wrote:

 Hello Tim,
 Tim why don't you try shell_exec ?

As a last resort, I might, but I'd rather do it in PHP... Code-portability, 
y'know :)

-- 
Kind regards,
Tim

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




[PHP] [Session] SID automatically add on all pages?

2002-06-30 Thread Tim Stoop

Hi people,

Just a question, I'm building components for a customer who wants some 
interactivity within his site, but still wants to build the site himself. 
One thing that would be interesting would be Session management. Now, if I 
just tell him to make all his own pages with .php ext instead of .html, 
would did be enough if --enable-trans-sid is used (and php.ini is correctly 
configured)? It seems to work here, but I want to know if I forgot 
something important...

-- 
Kind regards,
Tim

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




Re: [PHP] [Session] SID automatically add on all pages?

2002-06-30 Thread Tim Stoop

Hi Justin,

Thx for the reply

Justin French wrote:

 using functions like session_start() and the registering of session
 variables ($_SESSION['something'] = foo;) will establish/maintain a
 session.

Yes, I understand. Sessions need to be started. But once they have started, 
do I need to re-affirm the session on every page, or will it hold for a few 
pages, until the session-variables will be used again ...

 simply converting your files to .php and compiling with enable-trans-sid
 will not give you sessions.

... when I do this?

-- 
Kind regards,
Tim

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




Re: [PHP] [Session] SID automatically add on all pages?

2002-06-30 Thread Tim Stoop

Hi Justin,

Thx again for the answer.

Justin French wrote:

 Well, you really need to check out a decent article/tutorial on sessions,

Nah, I think I explain my question a little wierd and that's why you don't 
understand me... I've worked with sessions lots of times (although mostly 
in Java Servlets). Or something must be really crooked with my knowledge of 
standard sessions...

 because it's a lot more in depth than can possible be explained here.  But
 as a bare minimum, each page would need to call session_start() BEFORE the
 HTML tag or any other content is sent to the browser.

Ah yes, I forgot about that... I need to resume the session, of course. 
Would session.auto_start set to 1 work without these session_start()'s? The 
thing is, I need as less as possible of a hassle to have the sessions 
work... Read on for an explanation.

 You'd also need to register variables to the session (otherwise what's the
 point?)
 
 What is the session to be used for?

Well... For a shopping-cart actually :)

But not the standard kind. I'm building a set of components that a 
webdesigner can use easily, without actually understanding how the code 
works. The webdesigner (my customer) wants to build a site where his 
customers can browse to some products and put them in their shopping-cart 
with simple code. Something like:

HTML
HEAD
  bla bla..
/HEAD
BODY
H1Buy this product!/H1
Pbla bla/P
?php 
  include(functions.php);
  makeBuyButton(black shoes, size 34);
?
/BODY
/HTML

I do the work with the variables and all, he only needs to make sure 
everything looks fine. I used to do this with Cookies, but they're evil :) 
Besides, a session-solution a much prettier :) I want to know if the 
session is maintained if he makes use of the components and has all his 
files extend on .php, when I have --enable-trans-sid on and (as noted in 
this mail) session.auto_start.

I think this would work? I made a test-site locally, but I need to know the 
exact options that make this work, so I can inform the provider what to 
change (very helpful chaps over there, just don't know sh*t about PHP).

-- 
Kind regards,
Tim

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




RE: [PHP] [Session] SID automatically add on all pages?

2002-06-30 Thread Tim Stoop

Thanks for the help guys. The one-line include is definitly a very good 
idea, which I'll use.

Templating is very interesting, although, only if it works exactly as you 
say, with HTML-like tags. I looked at Smart, patTemplate en some others, 
but they all use {} or [] style tags. In that case, I prefer de php. If 
anyone knows of a template-engine that can recognise the difference between 
a custom-tag with  and a HTML-tag, I'd appreciate the URL :)

For now, I'm going to make this work.

-- 
Kind regards,
Tim

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