[PHP] Finding out if a table exists

2003-01-21 Thread Mako Shark
Is there a way of finding if a table exists with only
one command in MySQL? I've looked through the MySQL
functions, and the closest I've gotten to what I need
is mysql_list_tables or mysql_tablename (I'll have to
check into these a little more), but I was hopefully
looking for something that returns a boolean value,
and to be able to use it like:

if(mysql_table_exists(tablename)) {
...
}

Any ideas, short of creating my own function?

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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




[PHP] No constants being set. HUH?

2003-01-16 Thread Mako Shark
I just JUST installed PHP onto a new server (my
first--kinda scary, new foray) and my pre-defined
constants (HTTP_SERVER, SCRIPT_NAME, etc.) aren't
being set. Any ideas? What switch do I have to flick?

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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




[PHP] Error installing

2002-12-19 Thread Mako Shark
Anybody have any bright ideas?

Trying to install my own PHP on my own server. I'm
getting the error Redirection limit for this URL
exceeded. Unable to load the requested page.

I'm using Apache 2 and php 4.2.3 and haven't loaded
any extensions in PHP (yet).

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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




[PHP] URL parsing

2002-12-18 Thread Mako Shark
I've got a URL like this:

http://www.naturalist.com/~fungae/index.php

which is stored in $http_referer (as parse_url from
$HTTP_REFERER).

I'm trying to extract the username (~fungae). I've
read the docs on parse_url(), and have tried to get
$http_referer[user], but it comes up with zilch. I've
also tried to print_r $http_referer, but I only get
scheme, host, path, and query. Any ideas?

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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




[PHP] Array

2002-12-16 Thread Mako Shark
I have an array I set up like this:

$monthschedule = array(1 = Jan, 2 = Feb, 3 =
Mar, 6 = Jun);

When I try to access them, doing this:
$r = $monthschedule[6];

nothing comes up ($r is blank). Any thoughts? There
are missing elements (4,5,7-12) in $monthschedule.

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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




Re: [PHP] strstr-pls help

2002-12-11 Thread Mako Shark
Your problem is with this line:

$adam=fread($ip,filesize($adam));

Remember that $adam is not a file pointer, but text
read from a file. The file pointer is $ip, so the line
should read:

$adam=fread($ip,filesize($ip));

(and should probably be contained within an if
statement for error handling).

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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




[PHP] Thanks

2002-12-11 Thread Mako Shark
Long time in coming, but thanks to all that have
helped with my stremaing audio and $_array questions.
I've figured out my problems thanks to all your help!

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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




Re: [PHP] strstr-pls help

2002-12-11 Thread Mako Shark
but it doesnt work,

You sure? It should be that you were trying to get the
sizeof() $adam, which was thus far 0 bytes. So, of
course, it would return 0 bytes to $adam, and your
strstr() of looking for the IP address wouldn't work,
since $adam would contain nothing. Try print()ing
$adam to see what's actually coming out, then fiddling
with your block1 part.

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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




[PHP] $_FILES associative array

2002-12-06 Thread Mako Shark
I'm trying to find some documentation on the $_FILES
array, but on PHP, it's a little confusing. I read the
documentation and the comment from rep_spam@..., but
that wasn't too clear to me either.

I'm aware that when uploading a file named
$uploadedfile, the size, name, etc. get stored in
variables called $uploadedfile_size, _name,  But
when using the $_FILES array, does everything then get
stored in $_FILES[uploadedfile],
$_FILES[uploadedfile_size], etc...?

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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




[PHP] More $_ array question...

2002-12-06 Thread Mako Shark
If I want to access an array of something from a form,
is it true that I just have to use
$_POST[array[$counter]? So I can legitimately do a
count() of this array, like count($_POST[array])?

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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




[PHP] Multidimensional array

2002-11-28 Thread Mako Shark
(Thanks to all who've replied about the streaming
audio. Haven't had a chance to respond or anything
yet.)

Here is a problem I'm having similar to somethnig
someone just posted, but not quite the same. I'm not
too experienced with the intricacies and
complications of arrays, but I have a bunch of fields
like this for a magazine organizer (best way to put
it, I guess):

$issuenumber[]
$issueheadline[]
$issuewriters[]
$issuemonth[]
$issueyear[]
$issuedescription[]
among other fields.

I would like to store this all in one multidimensional
array, like
$issue-number[]
$issue-headline[]
etc.

What is the syntax? I'm bumbling around right now.
Also, if I sort() the array by number, would the rest
of the fields be properly sorted? I assume so, but
don't want to find out the hard way that it doesn't.

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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




[PHP] Multidimensional arrays (more and more...)

2002-11-28 Thread Mako Shark
Wow. This goes way beyond simply printing
multidimensional arrays. Here's some sample data:

$issue[][number] = number;
$issue[][headline] = headling;
$issue[][writers] = writers;
$issue[][list] = list;
$issue[][senttosubscribers] = 0;
$issue[][month] = 05;
$issue[][year] = 2003;
$issue[][description] = description;

What I need to do now is count(), sort() by number,
and loop through this array.

I read that PHP is screwy when counting and sorting
multidimensional arrays, but they *have* to have come
up with a method, right?

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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




[PHP] Re: Multidimensional arrays (more and more...)

2002-11-28 Thread Mako Shark
Thanks to Paul and Marek for some ksort() advice. I'll
try that out as soon as I can count() these buggers.

A little more info on my count()ing.
I have $issue[0][number] to $issue[x][number] just
like any other multidimensional array (we'll call them
m-arrays for simplicity).

If I try to count($issue), I'll get all instances of
my array (instances?) mltipled by the number of
elements (don't know if this includes NULLs or not,
don't have NULLs). If I try to count($issue[]), it'll
give me the number of elements (8), which is also not
correct. If I try to count($issue[][number]) it says
I can't pass that to the count() function (which is
logical). But it leaves me with no way of count()ing
my instances.

My problem is I need to loop through these. So I can't
just assume that the count is count($issue[]) divided
by 8, because that won't work in a for loop. I suppose
I could just iterate through my for loop in jumps of
8, but that seems really hacky and unintuitive to
whomever has to figure out my code when I'm gone.

If there's a kcount(), I'm all for it. :)

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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




Re: [PHP] Multidimensional arrays (more and more...)

2002-11-28 Thread Mako Shark
if [$number] is unique, use it as the key:

Yeah, I'd thought of that except there's no guarantee
that it will be unique.

Plus, it makes it harder to go through with a simple
loop because $number really isn't guaranteed to be
numeric (okay, so I have to change the name). Plus, it
may not even start from 0, For instance, it doesn't
have to be from 1-10, it could be from 75-85.



__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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




[PHP] Streaming audio

2002-11-27 Thread Mako Shark
Does anyone know how to do streaming audio with PHP?
No clue if this is even possible. I've checked around
a bit, looked at some script sites, but nothing seems
to give a clue. I *think* it might be possible to set
something like this up, but I'm not sure.

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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




[PHP] Ereg headache: got an Aspirin

2002-11-21 Thread Mako Shark
Finally, I found y answer to my ereg/grep question.
Thanks to all those who took a stab at it. You led me
to the answer. For all those interested in reg-parsing
comma-delimited lists, here is what I searched for:

'^INPUT TYPE = \HIDDEN\ NAME = \numbers\ VALUE =
\[0-9,\]*[\,] . $numbertosearch .
[\,][0-9,\]*$'

It was much simpler than I thought it would be. Thanks again!

__
Do you Yahoo!?
Yahoo! Mail Plus – Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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




[PHP] Order of arrays

2002-11-21 Thread Mako Shark
I don't think a simple sort() will do this. Is there a
way I can sort these following array values so that
all will be in numerical order, and then alphabetical
after that?

I need
Dirfiles/97
Dirfiles/98
Dirfiles/99
Dirfiles/100
Dirfiles/101
Dirfiles/102
Dirfiles/ABG1
Dirfiles/ABG2

in that order. They could originally be in any
seemingly random order, but when I'm done with it, I
need them in that order. Is there a way to do it? A
simple string sort() won't work since 9 comes after 1
and it'll order it like
'Dirfiles/100,101,102,97,98,99,ABG1,ABG2'. Any ideas?
For some reason, natsort() won't work.

__
Do you Yahoo!?
Yahoo! Mail Plus – Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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




[PHP] Still having ereg migranes

2002-11-20 Thread Mako Shark
Sorry to repost this, but I haven't found a solution
and it's still nagging me. Maybe some of you can come
up with something I can't. Here was my original post:

I've made myself an INPUT TYPE=HIDDEN tag that
contains in the value attribute a list of
comma-delimited numbers. I need to find if a certain
number is in these tags (and each file contains one
tag). I need an ereg statement that will let me search
these lines to see if a number exists, obviously in
the beginning or the end or the middle or if it's the
only number in the list. So, say I need #1, I need to
grep each file to find if 1 is in its INPUT
TYPE=HIDDEN list. Here's what I mean (searching for
number 1):

INPUT TYPE = HIDDEN NAME = numbers VALUE =
1,2,3,4,5   //beginning

INPUT TYPE = HIDDEN NAME = numbers VALUE =
0,1,2,3,4,5   //middle

INPUT TYPE = HIDDEN NAME = numbers VALUE =
5,4,3,2,1   //end

INPUT TYPE = HIDDEN NAME = numbers VALUE = 1 
//only

I can't grab all the tags and search for it in PHP
(there would be too many tags to parse through and I'd
rather let the OS handle that). I need to do this at
the operating system level. Does anybody yet have a
solution? I *know* it's possible, but I can't get it
and I've been working on it for days now. This is one
of those really annoying bugs that really grates on a programmer.

__
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com

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




RE: [PHP] Still having ereg migranes

2002-11-20 Thread Mako Shark
first way:
if(ereg('([^0-9]|^)'.$your_number.'([^0-9]|$)',$_REQUEST['numbers'])
) second way:
$numbers=explode(',',$_REQUEST['numbers']);
if(in_array($your_number,$numbers))

Not sure I get this but, again, I can't use $_REQUEST
or explode or in_array at this point. The entire
process needs to happen in the shell_exec() command,
because I'd much rather have that handle the whole
shebang than PHP.

__
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com

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




[PHP] Re: Ereg meadache

2002-11-18 Thread Mako Shark
this is probably not at all what you want, but i
wrote it just in case.
.
.
.
if 1 is in the string it will return either
middle, left, right or only.. if it is not it
will return false.

The problem with this is that I need to do it at the
Linux level, or else I'm not saving PHP the trouble of
searching through every file to find it.



__
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com

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




Re: [PHP] GD 1.5

2002-11-15 Thread Mako Shark
 Why do you need 1.5?

Isn't that the one with GIF support on it?

__
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com

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




[PHP] Ereg headache

2002-11-15 Thread Mako Shark
I have a real problem that I can't seem to figure out.
I need an ereg pattern to search for a certain string
(below). All this is being shelled to a Unix grep
command because I'm looking this up in very many
files.

I've made myself a INPUT TYPE=HIDDEN tag that
contains in the value attribute a list of
comma-delimited numbers. I need to find if a certain
number is in these tags (and each file contains one
tag). I need an ereg statement that will let me search
these lines to see if a number exists, obviously in
the beginning or the end or the middle or if it's the
only number in the list. Here's what I mean (searching
for number 1):

INPUT TYPE = HIDDEN NAME = numbers VALUE =
1,2,3,4,5   //beginning

INPUT TYPE = HIDDEN NAME = numbers VALUE =
0,1,2,3,4,5   //middle

INPUT TYPE = HIDDEN NAME = numbers VALUE =
5,4,3,2,1   //end

INPUT TYPE = HIDDEN NAME = numbers VALUE = 1  
 //only

This is frustrating me, because each solution I come
up with doesn't work. Here is my grep/ereg statement
so far:

$commanumberbeginning = [[0-9]+,]*; //this allows 0
or more numbers before it, and if there are any, they
must have 1 or more digits followed by a comma

$commanumberend = [,[0-9]+]*; // this allows 0 or
more numbers after it, and if there are any, they must
have a comma followed by 1 or more digits

$ereg-statement=$commanumberbeginning .
$numbertosearchfor . $commanumberbeginning;
//$numbertosearchfor will be obtained through a select
control in a form

grep 'INPUT TYPE = HIDDEN NAME = numbers VALUE =
$ereg-statement' *.html

This problem is kicking my butt. Any help?

__
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com

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




[PHP] Re: GD 1.5

2002-11-15 Thread Mako Shark
If the OP was concerned about such issues then
he/she should not be using GIF at all!

This is leading me to believe that I can't use GIFs
because of these issues. Is this true? I know now that
Unisys (Unisys?) made a fuss about some compression or
whatever, but someone told me it was still okay to use
old GDs (am I naive? maybe). Is it now considered
piracy to use GIFs at all? Does this mean I have to
switch over to JPGs, even those images that compress
better with GIFs? I just assumed we were still
permitted, what with Jasc and everybody still allowing
it in their products. Is JPEG (or PNG) the way to go?
I hesitate using PNGs since they seem to be the
least-supported out of the 'big three'.

__
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com

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




Re: [PHP] PHP extensions

2002-11-15 Thread Mako Shark
 Email extension?  Aren't you talking about Manuel
 Lemos' mimemail class?
 It's just an include file that you have in your
 directory structure.

I know some people made reference to a 'really good'
e-mail package out there that did attachments and
stuff that seemed to be the better choice considering
the alternative (the one that comes with PHP). I
wanted to check into it.

__
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com

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




[PHP] PHP extensions

2002-11-13 Thread Mako Shark
Is there a list of PHP extensions out there somewhere,
and what the function of each one is? And does anyone
have the URL of that e-mail extension everyone finds
so useful?

__
Do you Yahoo!?
U2 on LAUNCH - Exclusive greatest hits videos
http://launch.yahoo.com/u2

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




[PHP] GD 1.5

2002-11-13 Thread Mako Shark
Does anybody know where to find GD 1.5? Every link I
seem to find is dead.

__
Do you Yahoo!?
U2 on LAUNCH - Exclusive greatest hits videos
http://launch.yahoo.com/u2

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




[PHP] Wildcard search

2002-11-08 Thread Mako Shark

I've tried doing a search for this problem on the web, but haven't found anything, nor 
have I found any solution on the php.net documentation.

 

Does anyone know if it's possible to do a file search with a wildcard character? I 
need to find if there are any HTML files in a certain directory, but 
file_exists(htmls/*.html) doesn't seem to work when tested. Neither do similar 
applications of readdir(). Is there another way to do this, or do I have to do a 
readdir() and read the filename of every file until I find an HTML or until all files 
have been read.



-
Do you Yahoo!?
U2 on LAUNCH - Exclusive medley  videos from Greatest Hits CD


Re: [PHP] Wildcard search

2002-11-08 Thread Mako Shark

$a = explode (' ', shell_exec (ls $foldername/*.html));

 

Didn't know of shell_exec() until now. It works, though. Thanks!

Is there any reason why it wouldn't work? If I changed servers, say, and there were 
some ports blocked and etc. etc., is there a risk that I should know?





-
Do you Yahoo!?
U2 on LAUNCH - Exclusive medley  videos from Greatest Hits CD


Re: [PHP] Wildcard search

2002-11-08 Thread Mako Shark
Well, as a general rule, it won't work if you're not
using a UNIX o/s orif PHP has been set up with safe
mode on, or if you don't have the rightpermission to
see that folder. That's probably a non-inclusive list,
butthere should be ways around each of these problems
(depending on thedegree of control you have over the
server).

These are fine. I'm not going to use Windows for a
server. Won't the same problem in relation to
directory permissions stop me even if I just did a
simple readdir()? The only one I'm too worried about
is the safe mode thing. It works for now, though. The
next server I'm moving to will hopefully be my own, so
I'll have complete control. And, if not, all of my
shell_execs() are in a function, so I only have to
change it in one place.

But is it less troublesome to use a popen instead of
shell_exec? What are the differences, aside from that
popen remains open past one command? I'm using both
here and there in my site, and am wondering if one is
better than the other if all my shell commands are
single-line commands.



__
Do you Yahoo!?
U2 on LAUNCH - Exclusive greatest hits videos
http://launch.yahoo.com/u2
---BeginMessage---
Well, as a general rule, it won't work if you're not
using a UNIX o/s orif PHP has been set up with safe
mode on, or if you don't have the rightpermission to
see that folder. That's probably a non-inclusive list,
butthere should be ways around each of these problems
(depending on thedegree of control you have over the
server).

These are fine. I'm not going to use Windows for a
server. Won't the same problem in relation to
directory permissions stop me even if I just did a
simple readdir()? The only one I'm too worried about
is the safe mode thing. It works for now, though. The
next server I'm moving to will hopefully be my own, so
I'll have complete control. And, if not, all of my
shell_execs() are in a function, so I only have to
change it in one place.

But is it less troublesome to use a popen instead of
shell_exec? What are the differences, aside from that
popen remains open past one command? I'm using both
here and there in my site, and am wondering if one is
better than the other if all my shell commands are
single-line commands.

__
Do you Yahoo!?
U2 on LAUNCH - Exclusive greatest hits videos
http://launch.yahoo.com/u2


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


Re: [PHP] Wildcard search

2002-11-08 Thread Mako Shark

 If you're only executing one-liners and get all the
 results back you're
 better off using shell_exec(). popen() lets you open
 a pipe to a
 command--that way, you can funnel data to it as if
 you were typing from the keyboard.

That's what I'll do then: use shell_exec().

 Permissions would be a problem with readdir() as
 well.

So this really shouldn't be a deciding factor then.

Anyway, I've got it working out. I have it returning
an array of filenames if successful. If it's a
successful call, but no files exists (for instance
*.html with no HTML files), then it returns 0. If it
can't read the directory or the dir doesn't exist, it
returns NULL.

Just to make sure, I can do this:
if($files = GetFileListing(htmls\*.html)) {
.
.
.
}

and it will skip it if there either are no HTML files,
oe htmls doesn't exist, right? If I get a 0 or a NULL
return? (I figure, if I need to distinguish between
these two, I can always do a $==0 or $==NULL comparison).

__
Do you Yahoo!?
U2 on LAUNCH - Exclusive greatest hits videos
http://launch.yahoo.com/u2

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