[PHP] spaces in directory names

2005-12-18 Thread matt VanDeWalle

hello,
I have encountered this on several cds and well when i went to a friend's 
ftp site in windows, using linux and php(i think its a linux mainly 
question) but i have run accross files and directory names like this:

they appear like  this in linux,   path\ of\ the\ windows\ file.txt
i am trying to read a directory from a cd made in windows with a 3-word or 
longer directory name like the one shown above, but how do i deal with a 
oddly named directory like that in linux/php?
I know spaces don't work when changing directories so would i have to 
escape the space or what?

matt
simple question again

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



[PHP] asked too soon, nevermind

2005-12-18 Thread matt VanDeWalle
I just figured out my own answer to the previous post so i guess just 
ignore the question :p

i'll learn to try things first one of these days lol
matt

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



[PHP] duplicate filenames but different .extention

2005-12-18 Thread matt VanDeWalle

hello again
I am trying to figure out how i can read the list of files in a directory 
using the opendir() and readdir() functions.  Normally this goes fine but 
within the loop, what i am wanting to do is echo the filename if it is a 
jpg file, but if its a .gif, just continue.

I have several files i wish to seperate based on the basename of the file.
i read the basename help file and know how to use it even to exclude the 
.3letterextention.  I am however wanting to skip if it happens to be a 
.gif, is there some sort of way to i guess, do the basename function in 
reverse, e.g if it comes across xx.gif it would skip it but not skip 
over the xxx.jpg files?
that is my latest problem, it skips everything when i have a line like 
this in my loop


if($file = basename('.gif',$file))
continue;
else go on with code

this not only skips over .gif files, but everything is ignored
any ideas?
matt

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



Re: [PHP] simple-ish question but something i never knew

2005-12-10 Thread matt VanDeWalle

hello again,
I tried the meta tag stuff and well where i had it it didn't redirect or 
refresh, it just litterally echo'd the meta stuff so maybe i read the 
manual page wrong but it either does that, or presents me with a blank 
page and i know the pages i have it go to aren't blank :p so i guess i'm 
doing the meta tag slightly wrong or not in the right place but i guess 
actually if the form passed the variable i could go ahead and just 
substitute the url=http://whatever.com/page/to/load.php.etc, to having 
the url equal to the variable being passed..yes i'm a moron at times :p 
and its not my usual time to be up but maybe that has something to do with 
it anyway i will do some reading when my mind is switched on lol

matt


On Sat, 10 Dec 2005, Robert Cummings wrote:


On Sat, 2005-12-10 at 03:01, Aaron Koning wrote:

My experience was with the Location keyword, it might work better with the
Redirect keyword in the header function. I stopped using header and Location
after a few problems and meta has never failed for me. MHO.


What kind of problems did you have? I've never experience a problem with
the location header, but would be interested to know of any gotchas that
I've just been fortunate enough to miss over the years.

Cheers,
Rob.
--
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



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



Re: [PHP] simple-ish question but something i never knew

2005-12-10 Thread matt VanDeWalle
well i learned once again, or maybe it is a new commandment for me: thou 
shalt not code after midnight lol because the blank page after the 
refresh was a really stupid blunder on my part.  it seems like I was 
trying to use $type as a variable  but it was refreshing/redirecting to 
the same page..oops! it never even crossed my mind last night that type 
could possibly be a keyword in html..i use it all the time for forms but i 
never gave it a thought..after i went to bed for the night, i finally 
thought oh duh!! you probably cant use that so i guess it was doing what 
i told it, not what i wanted though :p

matt


On Sat, 10 Dec 2005, Robert Cummings wrote:


On Sat, 2005-12-10 at 02:55, Michael Hulse wrote:

On Dec 9, 2005, at 11:35 PM, Aaron Koning wrote:

Its been my experience that meta tags work better.


header(Refresh: 0; URL=https://www.theNewUrl/forward.html;);


I didn't know you could do that *lol*. Either way, I think the example I
gave is better. Why stop at an intermediate page? The location header is
immediate.

Cheers,
Rob.
--
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



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



[PHP] quickly discovered why refresh isn't nice

2005-12-10 Thread matt VanDeWalle


hello,
I just found out why one reason for a meta refresh is a bad idea, it does 
exactly that, it refreshes the page every 3 or 2 or 0 seconds which 
basically is constant..so maybe the header idea is better in this case.


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



[PHP] simple-ish question but something i never knew

2005-12-09 Thread matt VanDeWalle
I am wanting to forward a user on a signup or similar page (based on a few 
of their answers) and so far i have it split into  basically a two-step 
process where i have on the first part, an option list with 4 choices, 
they hit continue or some such labled link, and then having passed all the 
session variables and making the decision in the next script it would 
forward them to the right page automatically, do I have to use meta tags 
to do this  or is there  some simple way e.g, 
url=http://rightpage.php?SID; of course without the 's except for in the 
actual url
I could have probably done this switch on the fly like some pages do but 
I was told that requires java and i don't have or want to use java lol

matt
if possible i want to keep my webpages java free

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



[PHP] forking off in php

2005-11-21 Thread matt VanDeWalle

hello,
I have what may seem like a small problem but its not obvious to me.
I have a script that I forked and that part works fine, it forks, tells me 
the pid like I wanted, and keeps running.  Well, the problem that was not 
apparent to me until about 3 days ago when I was wondering why the 
script(my php chat server) was crashing at seeminly random times.  I 
finally  figured out that when I logged out of my shell in linux, the 
talker would go down as well.  Obviously I don't want that but what do I 
need to add to the line when i start the script

thanks
matt
ps If it helps, I am  running php 4.3.10 on slackware

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



Re: [PHP] forking off in php

2005-11-21 Thread matt VanDeWalle

ah ok thanks, am reading it now

On Mon, 21 Nov 2005, Marcus Bointon wrote:


On 21 Nov 2005, at 17:39, matt VanDeWalle wrote:


I have what may seem like a small problem but its not obvious to me.
I have a script that I forked and that part works fine, it forks, tells me 
the pid like I wanted, and keeps running.  Well, the problem that was not 
apparent to me until about 3 days ago when I was wondering why the 
script(my php chat server) was crashing at seeminly random times.  I 
finally  figured out that when I logged out of my shell in linux, the 
talker would go down as well.  Obviously I don't want that but what do I 
need to add to the line when i start the script


Example1 on the php docs page is what you need:

http://www.php.net/manual/en/ref.pcntl.php

The important thing is the call to posix_setsid(), which detaches your forked 
process from your terminal process. Works great for me - I've had PHP daemons 
running for over 9 months without a break.


Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[EMAIL PROTECTED] | http://www.synchromedia.co.uk

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



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



[PHP] forking problem and logging off - solved

2005-11-21 Thread matt VanDeWalle
I have fixed my prier problem of my script crashing down whenever i logged 
out of the shell, I got a bright idea, (one of the few it seems i'm having 
lately :p )
I found out that there is a nohup command ..i guess i knew there was but 
i had forgotten that until today.  I put this in a script now to run my 
chat now with nohup, something like this

/* my script to start server */
#!/usr/bin/bash
nohup ./server.php 

of course i have to be in the right directory to do this but it works and 
finally, i can log off of my account without the server going down yay!

matt

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



[PHP] new to sessions, but learning

2005-11-20 Thread matt VanDeWalle

hello,
I am writing basically what is hopefully going to turn out eventually to 
be a penpal website.  There are millions out there i know but some are 
to slow and only load half the page whenever it feels like it + 
has a bazillion ads and well, other things..so I decided to write my own.
What I am wanting to know, is it possible to do the signup thing in two 
parts using sessions.  I basically have the signup info first, then so the 
user doesn't have to come back later, they can fill out their profile 
right then and there, on the next page.  I'm thinking about saving the 
signup info and then when the user clicks continue, it would have their 
info.  I know session vars work between two pages but will sessions work 
across 3 and 4 pages or not?

thanks
matt

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



Re: [PHP] wanting to get host name instead of ip

2005-11-10 Thread matt VanDeWalle

yes, you assume right, I really did mean socket_getpeername()
its about midnight here and my brain shuts down at about 10:30  :p
thanks for the reply
matt


On Thu, 10 Nov 2005, Curt Zirzow wrote:


On Thu, Nov 10, 2005 at 11:35:06PM -0600, matt VanDeWalle wrote:

hello,
I was wondering, is there a way to get a connection's name(host's name
instead of just ip),
i am  using the cli version of php and am now using  the function
getpeername() but for example, i would like to be able to have it  say
something like connection: localhost  instead of connection:
127.0.0.1
is this possible with the command line interface?


I assume you really mean socket_getpeername().

You just have to do a reverse lookup using gethostbyaddr(), pending
your host and named settings you will get back either localhost or
the hostname you have (hopefully it is localhost), if it can't be
resolved it will be the IP.

if it is the IP instead of a localhost/hostname you'll have to fix
your systems configuration.

Curt.
--

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



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



[PHP] comment more than a question

2005-11-08 Thread matt VanDeWalle
I don't really have a question, I just have noticed in working with php 
for about a year off and on, so you could probably say i'm a bit new 
still, what an error says it is, or what line it is on, is hardly ever the 
case, e.g, several different times until i figured out what this meant, i 
would get the unexpected $ on line two lines past the end of the script 
error, I've figured out that actually means you are missing a closing } or 
a few
also tonight, I was working on a script, I figured this out about an hour 
later but i was getting an error about unexpected '\' ascii 92 in 
line#, something to that effect; I infact  did not have a stray \, but 
the script i was calling in this particular function apparently didn't sit 
well with the code, so, i just read the code into the function instead of 
include'ing the script and everything is happy again
so I guess just letting new or somewhat new, users know not to take the 
php's errors for what they say always, sometimes it works that way, not 
much, or, in my experience anyway


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



[PHP] small windows odd problem

2005-11-03 Thread matt VanDeWalle

hello all,
I have just installed php-4.4.0 on my windows xp system and added the 
directory to the path c:/php-4.4.0-Win32 but I am having problems with the 
cli version of php.  I can get into the program but after i type a bit of 
code, I try the following keys to get output but it never parses it.  I 
have tried ctrl-z and ctrl-m and ctrl-d but none of these will execute a 
darn thing.  The bit of code I tried is as follows

?
echo hello world;
?
but like i said, nothing is output when i hit ctrl-m, ctrl-z, or ctrl-d
on linux i am using php 4.3.10 and the command line works perfectly

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



[PHP] possibly buffer problem, including a bit of code this time

2005-10-04 Thread matt VanDeWalle

oops, sorry about the lack of any code with my last problem message.
I am still having the same buffer problem where after asking for a 
password, it doesn't stop and wait, just falling through to the next 
prompt.  here is basically what the new_user function looks like.  I am 
using php 4.3.10 on slackware 10.1

/* the new user function */
function new_user($sock, $username)
{
global $cdata;
/* shorthand of socket_write is now  send_single */
send_single($sock, please type the username you would like to go by );
$username = socket_read($sock, 1024, PHP_NORMAL_READ);
/* i had to change to PHP_NORMAL_READ or else windows users couldnt get on 
with more than 1 char */

$username = trim($username);
/* now comes the problem as far as i'm seeing it program execution-wise */
send_single($sock, please choose a password);
$pwd = socket_read($sock, 1024, PHP_NORMAL_READ);
$passwd = trim($pwd);
send_single($sock, email address to send your signup info);
$email = socket_read($sock, 1024, PHP_NORMAL_READ);
$email = trim($email);
/* do rest of function like fill array and write userfile etc */
..
}
ok: as far as i can tell, it asks for the password, skips that, and goes 
right onto the prompt that asks for the email address (totally skips that 
as well), and proceeds to fill the array and write the file and then log 
the user on, so of course half of the array variables seem to be blank and 
the file doesn't contain the password or email)

obviously I'm doing something wrong but what?
matt
ps, hope that is enough of the code to tell

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



[PHP] buffer problem having a mind of its own

2005-10-02 Thread matt VanDeWalle

hello again
I was writing and rewriting my user function for my  chat server trying to 
crush this bug but its beyond me whats going on.  basically I have it so 
if a new user comes on, we know that if they type new at the prompt so 
it goes to the newuser function, asks for a username, accepts that 
alright, but when I ask for a password(echoed or not), even if i ask for 
anything else, just the second input of the function, it skips right 
threw that, prompts for it but apparently the buffer still has a \n in it 
so it is assuming that is the password and going right onto the 3rd signup 
prompt, i could stick with the default password being a random number and 
avoiding this whole problem, but i actually don't, the buffer is still 
full of whatever, and would ask the 3rd prompt but just drop right threw,


I turned on  implicit_flush in php.ini, just as a second measure, I call 
ob_implicit_flush() after reading from the socket each time, but the '\n' 
or whatever mysterious character, still seems to be there, also, I know 
too because before i started working on redoing the logon function, i 
would log on and i would automatically have a character sent but i didn't 
type anything so something is really screwy or am I just not clearing the 
buffers the right way?
oh yes, as you may have assumed from what I wrote, or may not have, after 
the password or otherwise 2nd prompt, things work as expected with the 
other prompts,

if this helps, I am using php 4.3.10  in command line interface

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



[PHP] would this be a buffer problem or something else

2005-10-01 Thread matt VanDeWalle

hello all,
I have noticed on this server/talk/chat I am trying to write, that when i 
or another user logs on, right away, it will go to the if statement in my 
chat handling function, that says something to the affect of /* something 
entered but not a . */

if(($words[0] != '.' )  count($words) == 1)
{
socket_write($sock, $user said $words[0]);
}
/* end of if */

and when i log on, it will automatically hit that last if statement like 
there is something still in the buffer and it seems to be a blank space or 
maybe its a new line or something, but I have ob_implicit_flush(); called 
before any of the code but shouldnt that take care of all buffers, or just 
the output buffer?

if so, how do I make sure the input buffer is emptied every time
i think this is the reason I am having a problem with new variables not 
being filled with anything, the code doesn't even wait, it apparently is 
some big code problem on my part or i just need to somehow clear the input 
buffer, which i assume is just stdin,
do i need something like flush($sock); or did i just hit the nail on the 
head with that question

matt

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



[PHP] problem half-solved, however have another

2005-10-01 Thread matt VanDeWalle

hello again
I have been battling this mysterious char thats showing up in the buffer 
when i first log onto my chat, or else try to add new things to the logon 
function, I am getting the code not to fall through to the next prompt 
however, using $varname = socket_recv($sock, $read, 1024, 0)
this won't put anything but a number in that variable, say for example the 
passwd was 'test'(just for the sake of testing for now), the password 
would end up being not  test, but maybe the number 5 I'm assuming its 
returning the number of digits but this is totally not what I expected, 
and the manual for socket_recv is um, well for a lack of better wording, 
its not there on the website anymore, all except the format of it, no 
descriptions or anything, should i be using something else instead of 
socket_recv()?


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



[PHP] array simple question

2005-09-13 Thread matt VanDeWalle

hello,
I have a simple question, not really a problem this time.
I know that the function print_r() will print an array but if that array 
has sub-arrays it prints everything and if you don't use more command or a 
pipe of some kind that could be useless in some cases, but I am just 
wondering, for an array that has several arrays in it, is there a way to 
print the array names that are contained in the main array but not the 
contents of each?

thanks
matt

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



[PHP] array question: fixed

2005-09-13 Thread matt VanDeWalle
hey, thanks for jogging my memory about the array_keys ; that was exactly 
what i wanted,
now I don't have to run the program through the more program now, and i 
got all the names of the arrays in the big array without having half of 
the info scrolling off the screen.

thanks
matt

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



[PHP] turning off echoing of chars

2005-09-12 Thread matt VanDeWalle

hello,
I am wanting to turn of screen echo for a login function or changing a 
password or similar things.  I got the function to almost work, however it 
turns off the screen echo but it asks for the password, won't give you a 
chance to fill it in, and skips right on to the next prompt(and has the 
non-echoing for that stuff.  incase this isn't clear which i assume alot 
of things which I guess i shouldnt ok, what i am doing:

*/ code snippit here */
socket_write($sock, enter a username);
$name = socket_read($sock, 1024, PHP_NORMAL_READ);
/* all good to this point */
socket_write($sock, enter a password);
socket_write($sock, sprintf(%c%c%c,255,251,1));
$pwd = socket_read($sock, 1024, PHP_NORMAL_READ);
/* will skip right on by to the next prompt and fill in $pwd with some of 
those non-alphanumeric chars */


and the next prompt is where the no-screen-echo finally works like it 
should

I must be doing something incorrectly but, what?
thanks
matt

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



[PHP] ran into a seemingly odd problem

2005-09-10 Thread matt VanDeWalle

Hello all.
I am new to this list but not to new to php although maybe the problem I 
am having will prove otherwise
ok, I am writing a server(or trying to), Basically I am attempting to 
write a  chat type server in php.  I cant seem to get it to realize that I 
have typed more than one word, so execute the code within the if 
statement.  basic function is below, well what I am attempting to do 
anyway, I have the  str_word_count() defined as $word_count and $words for 
the array of words that str_word_count($variable, 1) creates

ok, little piece of code is below

function commands($sock, $data)
{
$word_count = str_word_count($data);
$words = str_word_count($data, 1);
/* here is where the problems come in I think */
if(($word_count == 2)  ($data == '.quit'))
{
echo you quit with a message of $data\n;
}
else
{
echo quitting without saying anything...\n;
}
}

it seems like the code fragment above does absolutely nothing e.g 
$word_count reverts to being empty once the if statement is hit.  if I put 
something in the function, but outside of the if statement like

echo word_count was $word_count\n;
that works fine and returns an integer like it should
am I the only one who finds this little thing odd or am I missing 
something that it is so simple it already sticks out to others as a big 
glaring error?

any ideas?
matt

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



[PHP] seemingly odd problem

2005-09-10 Thread matt VanDeWalle

I should have added in my previous message, what my test input was so :
ok, i login, this is what I typed to test the little piece of code i 
previously wrote...

/* my input */
.quit goodbye
/*
just a note, I know that '.quit' by itself is only one word, i guess I 
just assumed people would know what I would test this with but maybe not.

anyway, above is my test input

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



[PHP] thanks for the help

2005-09-10 Thread matt VanDeWalle

hello,
I just wanted to say thank you to the person who basically rewrote the 
function i seemed to have problems with and it actually now works.

thanks again
matt

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