Re: [PHP] sessions

2001-04-18 Thread Plutarck

Rather than bothering with SID whos existance is uncertain, use the variable
$PHPSESSID. It's set whenever you use session_start, to my knowledge.

The simplest method, and the only one I am aware of, of accessing session
variables globally is by explicitly declaring them global in your function.
It's also the best way to do it, as it may take extra typing when declaring
your function, but it makes it alot more readable and bug-free.


--
Plutarck
Should be working on something...
...but forgot what it was.


""Ben"" <[EMAIL PROTECTED]> wrote in message
9bjn4n$41c$[EMAIL PROTECTED]">news:9bjn4n$41c$[EMAIL PROTECTED]...
> i'm trying to use sessions with my project, but it seems that registered
> variables in a session aren't global by default.
> It doesn't even seem like the session is global, because if I reference
the
> sessionid (which only shows up if cookies are disabled)
> by using , it shows up within a function, if I reference it
from
> within the function.
>
> if anyone can help me make my variables (such as $user, and $active)
> globally registered with the session, I would be very grateful.
> maybe its the cookie not being global, that would explain why the
sessionid
> shows up only from within a function (but not in the global scope)
>
> thanks
> ben
> [EMAIL PROTECTED]
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] What is cookies

2001-04-18 Thread Plutarck

RTFM (ReadTheFineManual ;)

http://us.php.net/manual/en/function.setcookie.php

As listed in the manual for an explanation on cookies:

http://www.netscape.com/newsref/std/cookie_spec.html



--
Plutarck
Should be working on something...
...but forgot what it was.


"Bertrand TACHAGO" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Can anyone tell me what is cookiesand how i can use it
>
> Thank
>
> TACHAGO
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] Variable variable

2001-04-18 Thread Plutarck

Your problem has little to do with the things mentioned.

First of all, you are refering to a variable variable incorrectly. You must
use brackets, like this:

${$id}

If ID has the value "Blue", then the above is the same as:

$Blue

So in your examble if you had the checkbox with the value "on", and you want
to see if it was checked, use this:

if (${$id} == "on")
{
echo 'on';
} else
{
echo 'off';
}

But that's an overly complicated way of doing it if you know the "name" of
the checkbox. If the name of the checkbox is "id", then use this piece of
code to access it if it was submitted via POST or GET (which works even if
register_globals is turned off):

$f = 'HTTP_' . $HTTP_ENV_VARS["REQUEST_METHOD"] . '_VARS';

if (${$f}["id"] == "on")
{
echo 'The checkbox with the name "id" has the value "on"';
} else
{
echo "The checkbox with the name "id" was not selected";
}


But if register globals was on, all you have to use is:

if ($id == "on")
{
echo 'The checkbox with the name "id" has the value "on"';
} else
{
echo "The checkbox with the name "id" was not selected";
}


Tell me if that doesn't answer your questions.


--
Plutarck
Should be working on something...
...but forgot what it was.


""Jacky"" <[EMAIL PROTECTED]> wrote in message
011001c0c839$ebfb9b40$[EMAIL PROTECTED]">news:011001c0c839$ebfb9b40$[EMAIL PROTECTED]...
Hi all
I have a form with check box and name of those checkboxes is usuing variable
lke this,




and when I submit the form to page foo.php4, at that page, I use Variable
variable to call the value of the check box to see if it checked like this

$quey = "select id from table";
$result = .. ( assumeing it is done and i got value for $id for all
records from table)

if ($$id =="on"){
echo "on";
}else{
echo "off";
}

It always returns echo "off", why is that?
cheers
Jack
[EMAIL PROTECTED]
"There is nothing more rewarding than reaching the goal you set for
yourself"




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




Re: [PHP] Is there such an array like $array[][]?

2001-04-17 Thread Plutarck

Woh, I had no idea PHP supported more than 2 dimensions...lol, was that a
recent addition?

I could _sware_ I originally read it on either zend.com or in the manual
that 2 dimensional arrays are all that are supported...then again, this is
why I don't gamble :)


Live and learn, lol. Guess I should of actually _tried_ it and not have just
taken their word for it.


--
Plutarck
Should be working on something...
...but forgot what it was.


"CC Zona" <[EMAIL PROTECTED]> wrote in message
9bi3ac$9n9$[EMAIL PROTECTED]">news:9bi3ac$9n9$[EMAIL PROTECTED]...
> In article <9bhrri$sn9$[EMAIL PROTECTED]>,
>  [EMAIL PROTECTED] ("Plutarck") wrote:
>
> > Just another option, but feel free to use multi-dimensional arrays. Just
be
> > aware that PHP supports only two dimensions (so $array[][][] will not
work),
> > and if you try and get fancy with sort() and count() you are going to
give
> > yourself a migraine.
>
> Odd.  3+ dimensions works fine for me.  I pass two dimensional arrays in
> forms all the time, then reference them from $HTTP_*_VARS which adds
> another dimension.  No problem there.  It's true sort() and count() are
> sorting or counting the elements of the first dimension, but PHP does
> provide other functions which allow for effective handling of more
> dimensions (ex. array_multisort()).
>
> --
> CC
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] Site Sessions: Online/Offline - help?

2001-04-17 Thread Plutarck

The best way I know of is to use mt_rand. Check the manual for examples, but
this is usually a good way to seed it:

mt_srand ((double) microtime() * 100);


If you look at the size of a normal session ID, it's pretty easy to make a
unique sessid.

There are 32 chars in a typical sessid. The chances of someone getting the
same ID as someone else, all things being equal and even though it's
case-insensitive, is approximately 1 in
6.3340286662973277706162286946812e+49...actually, my windows calculator
doesn't go that high.

It's 32 to the 36th power, anyway. That's insanely huge.

But in reality, you don't really need to worry about getting two 32
character long IDs that are the same.


Note: one way to auto-logout someone is to use something like a on_unload
javascript procedure, but don't bother. Not worth the hassle and it's isn't
fool-proof.


--
Plutarck
Should be working on something...
...but forgot what it was.


""Richard"" <[EMAIL PROTECTED]> wrote in message
9bi64f$goj$[EMAIL PROTECTED]">news:9bi64f$goj$[EMAIL PROTECTED]...
> Greetings.
>
> Thanks for your help! That about people not using logout buttons is really
> true! But what can one expect? However, how can I create a unique session
> ID? I don't use Databases, at least not MYSQL.
>
> - Richard
>
> ""Plutarck"" <[EMAIL PROTECTED]> wrote in message
> 9bhsa8$vq8$[EMAIL PROTECTED]">news:9bhsa8$vq8$[EMAIL PROTECTED]...
> > Simplest way to do it IMHO.
> >
> > When a user logs in (starts their session) register their username into
> the
> > session (that session is "bound" to them now).
> >
> > On every page when a user does anything, update your database with the
> > current time as a "last_activity" entry for that user.
> >
> > When showing who is currently logged in, get all the entries out and
check
> > their dates. If the last activity is older than a certain amount of
> > acceptable time (how long it takes them to be considered "logged out".
> note:
> > people rarely use a logout button), then consider that user as not being
> > logged in.
> >
> > Delete the entry so your "who's online" function doesn't hugely slow
down
> > the page, and you should be good to go.
> >
> >
> > The only problem is that you have to do an update every time someone
> visits
> > a page, which increases your server load. But to avoid any noticable
slow
> > down you could just use a register_shutdown_function.
> >
> > I think that should handle your problem...
> >
> >
> > --
> > Plutarck
> > Should be working on something...
> > ...but forgot what it was.
> >
> >
> > ""Richard"" <[EMAIL PROTECTED]> wrote in message
> > 9bfv6n$pds$[EMAIL PROTECTED]">news:9bfv6n$pds$[EMAIL PROTECTED]...
> > > Greetings.
> > >
> > > Some of you are familiar with my latest project, a smaller
> community.
> > I
> > > have implemented almost everything I need, and I wish to thank those
of
> > you
> > > who helped me with "which mail is new" and so forth. However, this
> problem
> > > is quite worse I suppose, but I hope some of you has done something
like
> > > this before:
> > >
> > > Sessions.
> > >
> > > I wish to keep track of every visitor. Not a counter or anything, but
> more
> > > of when a person signs in, the users nickname will be bound to this
> > session
> > > ID which will keep track of the person is online or offline. I have
> solved
> > > it like so:
> > >
> > > Whenever a person loggs in, I add it's name to a online.dat file.
> When
> > > the user signs of, I remove the nickname thus the login time from the
> > file.
> > >
> > > PROBLEMS?? First one: User must click on "logout" to remove itself.
> > Second:
> > > It does not always remove itself.
> > >
> > > Therefore, I ask: How can I create a new session for every visitor (so
I
> > > know how many are online at the time), bind this ID to its nickname
(so
> > one
> > > row in a file would be: NICKNAME|SESSION_ID|DATE), and how can I make
> sure
> > > that whenever the browser is closed or whatever, or after a certain
time
> > of
> > > inactivity (3 minutes), the user is removed from the file.
> > >
> > > All help is greatly appriciated and your name will be on the credits
> list
> > > too.
> > >
> > > - Richard
&

Re: [PHP] Finding Duplicate Numbers?

2001-04-17 Thread Plutarck

Hm...it's not fast, but it should work.

Do a select statement to take out just the phone numbers, then do something
like:

while ($row = mysql_fetch_row($result))
{
$array[] = $row[0];
}

$amount = array_count_values($array);

$imax = sizeof($amount);
for ($i = 0; $i < $imax; $i++)
{
if ($amount[$i] > 1)
{
$copys[] = $amount[$i];
}
}


It ain't pretty, but $copys will be an array filled with the phone numbers
that were entered more than once, so you can do whatever you want with it
other than that.


--
Plutarck
Should be working on something...
...but forgot what it was.


""Devin Atencio"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> I have a SQL Table that has over 1,000 records and I was wanting
> to write a script that would find duplicate phone numbers and
> then list the duplicate phone numbers. I have been trying to
> think on how to do this but I can't think of a way. Can someone
> please help me on some code I could write to do this?
>
> Thanks in advance.
>
>/'^'\
>   ( o o )
> --oOOO--(_)--OOOo
> Devin Atencio
> ArosNet Systems Administration .oooO
> EMail: [EMAIL PROTECTED]   (   )   Oooo.
> \ ((   )-
>  \_)) /
>(_/
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] Site Sessions: Online/Offline - help?

2001-04-17 Thread Plutarck

Simplest way to do it IMHO.

When a user logs in (starts their session) register their username into the
session (that session is "bound" to them now).

On every page when a user does anything, update your database with the
current time as a "last_activity" entry for that user.

When showing who is currently logged in, get all the entries out and check
their dates. If the last activity is older than a certain amount of
acceptable time (how long it takes them to be considered "logged out". note:
people rarely use a logout button), then consider that user as not being
logged in.

Delete the entry so your "who's online" function doesn't hugely slow down
the page, and you should be good to go.


The only problem is that you have to do an update every time someone visits
a page, which increases your server load. But to avoid any noticable slow
down you could just use a register_shutdown_function.

I think that should handle your problem...


--
Plutarck
Should be working on something...
...but forgot what it was.


""Richard"" <[EMAIL PROTECTED]> wrote in message
9bfv6n$pds$[EMAIL PROTECTED]">news:9bfv6n$pds$[EMAIL PROTECTED]...
> Greetings.
>
> Some of you are familiar with my latest project, a smaller community.
I
> have implemented almost everything I need, and I wish to thank those of
you
> who helped me with "which mail is new" and so forth. However, this problem
> is quite worse I suppose, but I hope some of you has done something like
> this before:
>
> Sessions.
>
> I wish to keep track of every visitor. Not a counter or anything, but more
> of when a person signs in, the users nickname will be bound to this
session
> ID which will keep track of the person is online or offline. I have solved
> it like so:
>
> Whenever a person loggs in, I add it's name to a online.dat file. When
> the user signs of, I remove the nickname thus the login time from the
file.
>
> PROBLEMS?? First one: User must click on "logout" to remove itself.
Second:
> It does not always remove itself.
>
> Therefore, I ask: How can I create a new session for every visitor (so I
> know how many are online at the time), bind this ID to its nickname (so
one
> row in a file would be: NICKNAME|SESSION_ID|DATE), and how can I make sure
> that whenever the browser is closed or whatever, or after a certain time
of
> inactivity (3 minutes), the user is removed from the file.
>
> All help is greatly appriciated and your name will be on the credits list
> too.
>
> - Richard
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] Is there such an array like $array[][]?

2001-04-17 Thread Plutarck

PHP can be a tad screwy with how it handles multi-dimensional arrays, but
yes PHP handles them. No real speed problems with them either.

But you may just want to use an associative array like:

$loc = array("y" => $y, "x" => $x);

Then just use $loc["y"] and $loc["x"].

Just another option, but feel free to use multi-dimensional arrays. Just be
aware that PHP supports only two dimensions (so $array[][][] will not work),
and if you try and get fancy with sort() and count() you are going to give
yourself a migraine.


--
Plutarck
Should be working on something...
...but forgot what it was.


"Jack Dempsey" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> yes, that's a multi-dimensional array, which is fine in php (and
> everything else i can think of =P)...
>
> -jack
>
> Scott Fletcher wrote:
> >
> > Hi!  I am wondering if there is such a php array that can take care of
the x
> > and y axis data.  I figure that using this array type, $axis[$x][$y]
would
> > do the trick.  Would it work?  If not, then education me on what would
work!
> > Thanks!
> >
> > Scott
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] get_class()

2001-04-17 Thread Plutarck

"This function returns the name of the class of which the object obj is an
instance."

The name of the class is "myClass", therefore the behavior is as it should
be.

"thisInstance" is an object, not a class. If you are trying to do something
imparticular you'll have to be more specific.

As for getting the name "thisInstance", I'm not really sure why you'd need
to, so I can't think of a work-around.

Since "thisInstance" is the name of the object, you need some object related
function. I've never had to do it, so I have no clue how, but maybe someone
else will know :)


--
Plutarck
Should be working on something...
...but forgot what it was.


""Boget, Chris"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Given the following code:
>
> -
>
> class myClass {
>   function myClass() {
> $classVar = get_class( $this );
>
>   }
> }
>
> $thisInstance = new myClass();
>
> -
>
> What value should $classVar contain?
>
> "myClass"
>
> or
>
> "thisInstance"
>
> ?
> The documentation leads me to believe that it is the
> latter value, but in practice it contains the former.
> If it is supposed to have the latter value, is there any
> way I can get the fomer?  Any way that I can get the
> name "thisInstance"?
>
> Chris
>



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




Re: [PHP] OT - cyber squatting?

2001-04-17 Thread Plutarck

I assume you mean registering a web address of a company, just to keep them
from registering it or to try and make them pay you for it?

Check NetworkSolutions "domain name dispute" policies.

InterNIC has a pretty good policy, actually. If someone registers a name
with is copyrighted, trademarked, or is clearly only valuable because it is
familiar to a registered trademark of copyright, they are in violation and
the domain name can be taken away from them and awared to the rightful owner
via arbitration.

To avoid having a domain name taken away they must prove either that they
have made a good-faith effort to build a destinctive trademark of brand
which does not impede upon a pre-existing copyright, and that the name was
not registered for the sole purpose of keeping someone from rightfully
registering it.


Is that what you meant?


--
Plutarck
Should be working on something...
...but forgot what it was.


"Kurth Bemis" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> this is totally OT - however I don't where else to ask.
>
> i need information on cyber squatting. as in what laws there are against
> it, etc.i believe that there was a law passed making cyber squatting
> illegal...but i can't find it at the library of congressany help?
>
> ~kurth
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] Javascript mailing list

2001-04-17 Thread Plutarck

I know of only the one on marc.aimsgroup.com. They list quite a few mailing
lists of all types.

But I still don't know any newsgroups :(


--
Plutarck
Should be working on something...
...but forgot what it was.


""Boget, Chris"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> A bit OT, yes, but I don't want to ask an
> inappropriate question here (not that this
> isn't an inappropriate question :p).
> Can someone recommend a good Javascript
> mailing list?
>
> Chris
>



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




Re: [PHP] RE: A slightly amusing, though mostly dangerous, endless loop

2001-04-17 Thread Plutarck

It's automatically enabled, and I don't think it's available for disabling.
I recall hearing something about a feature being added to PHP to help
prevent infinate loops, and it apparently works with print_r.

It should probably be listed more prominately and in any place where
$GLOBALS is mentioned.

The first time I saw it I was thinking, "Geeze, this page sure is taking a
long time to load...and why are so many variables available on this site..."


--
Plutarck
Should be working on something...
...but forgot what it was.


""Greig, Euan"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Is the anti-recursion feature you mention automatically activated or do
you need to configure it to take effect?
>
> This error with print_r is documented in the manual, but would still be
(have been) an easy trap to fall into!
>
> -Original Message-
> From: Plutarck [mailto:[EMAIL PROTECTED]]
> Sent: 14 April 2001 12:59
> To: [EMAIL PROTECTED]
> Subject: A slightly amusing, though mostly dangerous, endless loop
>
>
> This is a bug which was apparently fixed in v 4.0.4pl1 at least, but it
> still present in 4.0.3
>
> I just found it kind of amusing and it makes a nice warning.
>
> Consider this:
>
> print_r($GLOBALS);
>
>
> That's it. It prints all the variables available, however part of it is an
> array called GLOBALS. Which then prints all available variables, including
> an array called GLOBALS...
>
> And it will continue until you hit the Stop button or until the script
times
> out. But if you have ignore.user.abort on, it will continue till it times
> out. If you've screwed with your scripts timeout settings...
>
> ...so be wary of that, and ensure you don't try and print out the
variables
> available in GLOBALS in older versions of PHP. It was fixed with the
> anti-recursion feature, which automatically breaks endless loops.
>
>
>
> --
> Plutarck
> Should be working on something...
> ...but forgot what it was.
>
>
>
>
>
>
> **
> Any opinions expressed in this email are those of the individual and
> not necessarily the Company. This email and any files transmitted with
> it, including replies and forwarded copies (which may contain alterations)
> subsequently transmitted from the Company, are confidential and solely for
> the use of the intended recipient. If you are not the intended recipient
> or the person responsible for delivering to the intended recipient, be
> advised that you have received this email in error and that any use is
> strictly prohibited.
>
> **
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] HTML and slashes.

2001-04-17 Thread Plutarck

Check magic_quotes_runtime in your ini. If it's on, turn it off.

Use the htmlspecialchars() family of functions. They will "hide" HTML in
that the browser will not attempt to parse. so "" will be displayed as
"", and not make all the text turn to bold.


--
Plutarck
Should be working on something...
...but forgot what it was.


""Dddogbruce (@home.com)"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > there is NO way of hiding the html from the user.
> > the browser can't output otherwise. You can only
> > try to make it difficult to get the source.
>
> I want to hide the HTML from the browser.  If someone adds some malicious
> code, or even  I don't want it to underline.
>
> > Where does the " 's " problem come in? More detail plz.
> > Is it a part of a text? Then try htmlspecialchars() or
> > htmlentities().
>
> Say I right "Hiya, my name's Owen" on the submission part of the form.
It'll
> show up as "Hiya, my name\'s Owen" on the output (which is a .txt file.)
>
> HTH,
> Owen
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] Dynamic Pages and Google ???

2001-04-17 Thread Plutarck

Getting listed in search engines really is important. But in the vein of
what you were talking about, people shouldn't really "worry" about it.

Note: Getting listed in directories like Yahoo is way more important than
having any search engine list you. You always receive a far more targeted
user with places like Yahoo, because they really do want to see what you
have to say.


Back on topic, the only search engines worth bothering with can handle
dynamic pages just fine. There is _no_ difference in a static html page and
a dynmically created one.

However, be _very_ careful with sessions. Sessions can force a query string
onto the end of every page on your first page, causing the spider to be
unable to visit any other page in your site!

Also be extremely careful about the use of  and browser sniffing.
So many sites do something classically stupid so that when someone sees
their site in a search engine, the description is "Your browser does not
support frames. Your browser must support frames to view this site."...I
just want to slap the webmaster every time I see that.


In short, on your index page (which is what you want bookmarked the most) do
not have links with query strings in them, do not use redirects, do not use
frames (period. if you want to use them everywhere else on the site that's
ok, but don't do it on the main page!), do not use session_start(), and do
not complain if the user has disabled javascript- if you want your site to
be well listed in search engines.

With all that taken into effect, I can see why the person you were talking
to disliked dynamic sites. But if the webmaster knows the rules of the
search engines, dynamic sites work just perfectly.


--
Plutarck
Should be working on something...
...but forgot what it was.


"Michael Kimsal" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
>
> Jon Shoberg wrote:
>
> > So I was having a conversation with a manager/educator in the IT
Industry :)
> >
> > In a discussion concerning search engines he stated how he dislikes
dynamic
> > web pages (PHP/ASP/JSP/CFM) because search engine spiders 'choke' on
dynamic
> > content or gives those pages a lower ranking.  I can't see this as being
> > true. I epically can't see the search spider "choking" on dynamic pages
> > returning well-formed/valid HTML.
> >
> > Any thoughts?
>
> Each spider is different, and they've changed over time.  Often they don't
> index a page that has a ? in it - they definitely won't be able to follow
> form input tags and such - the possibilities for input are limitless.
>
> Some can follow
> blah.com/index.php?alh=fff
>
> and links of that nature.  If you've got redirects in there,tho, they'll
often
> choke on those.
>
> Apache has an advantage over IIS because you can normally
> pass in parameters in the $PATH_INFO area -
> http://www.blah.com/index.php/blag/222/dsfsd/dlkjsdf
> calls the index.php with /blag/222/dsfsd/dlkjsdf as parameters you can
grab in
> your
> script.  IIS doesn't allow for this.  :(  (not natively anyway)
>
> Some search engines wouldn't FOLLOW a ? in a link,
> but will accept one as a 'submitted page' to index if you submit it
manually.
>
> Again, all of this information is necessarily vague.  What works one year
> doesn't work the next.
>
> This was all info and experienced gleaned while building keywordcount.com
a few
> years
> ago - the whole landscape has changed, and getting 'indexed' by search
engines
> is nice,
> but imo can be a big waste of time and money given that there are many
factors
> beyond your control entirely.  SEOs will bash me upside the head for that
one,
> but it's been my experiences over the past couple years.  :)
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] RFC: Storing User Info

2001-04-17 Thread Plutarck

As others suggested, use md5 or one of the mhash functions. You can't
retrieve the password, but you shouldn't need to anyway.

When someone looses their password, get rid of their old one and mail them
their randomly created new one. Then just allow them to change it to
whatever they want.

Make sure to tell them to use a valid email address or require a
confirmation, otherwise when people loose their password they can never get
it back.

People tend to email you when they loose their password, so be sure to make
it clear that "once it's gone, it's really gone, and you just have to pick a
new one".


I try to avoid emailing a user with their password with exception to when
they loose it. Then again, there isn't really much of an alternative...


--
Plutarck
Should be working on something...
...but forgot what it was.


""Ashley M. Kirchner"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> I'm looking for comments on this one.  I'm developing a site that
> will have user logins on it.  What's the best way to do this?  What to
> store, and how?
>
> - Are people more inclined to use a username when they need to log
>   in to something, or would asking for an email (as the userID) be
>   better?
>
> - How about storing passwords?  All of this info will be stored in
>   an MySQL DB.  How do admins generally do this type of stuff?
>   Encrypt the password stored in the DB, and decrypt it on the fly
>   to compare?  Store it in plain text?  Or store it encrypted,
>   and when the user logs in, encrypt that passwd (from the form)
>   and compare the strings?  (not sure if the latter would work)
>
> - What about sending people passwords through email?  Like when
>   someone signs up the first time, they supply a passwd.  How do
>   people feel about sending that login information to the user in
>   plain text via email?  Or do you?
>
> - What about when the user forgets their login?  Just fetch the
>   info from DB and mail it out to the (registered) email address?
>   Or, generate a new, generic one, mail that one out, and tell the
>   user to login and change it again?
>
> Suggestions please.
>
> AMK4
>
> --
> W |
>   |  I haven't lost my mind; it's backed up on tape somewhere.
>   |
>   ~
>   Ashley M. Kirchner <mailto:[EMAIL PROTECTED]>   .   303.442.6410 x130
>   SysAdmin / Websmith   . 800.441.3873 x130
>   Photo Craft Laboratories, Inc. .eFax 248.671.0909
>   http://www.pcraft.com  . 3550 Arapahoe Ave #6
>   .. .  .  . .   Boulder, CO 80303, USA
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] Job in Whistler, BC

2001-04-17 Thread Plutarck

It should be noted that programming facilities are entirely outdoor. But
they do provide those little hand-held vacuums to suck the snow out from
between your keyboard keys.










Nah, I'm just kidding. But it is in Canada, so you will be forced to type
"a\'boot" hundreds of times a day ;)

(a little poke at our canadian friends. Which I am perfectly willing to do,
because I'm waaay down here on the gulf of mexico, and they'd have to
come through Georgia, Alabama, or Mississippi to come down and disagree with
me. God isn't willing to go through Georgia, Alabama, or Mississippi, so I
think I'm safe ;)


--
Plutarck
Should be working on something...
...but forgot what it was.


"Mark Maggelet" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
On Mon, 16 Apr 2001 20:00:27 -0700, Dddogbruce \(@home.com\)
([EMAIL PROTECTED]) wrote:
>Whistler's cool!

Yeah, and a php job at a ski resort?! Hmm, that's way too good to be
true.


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




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




Re: [PHP] Populating HTML List boxes From DB

2001-04-17 Thread Plutarck

I had that same problem.

Use the "distinct" keyword in your SQL query.


--
Plutarck
Should be working on something...
...but forgot what it was.


""Peter Houchin"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> One thing I've come across and forgot to mention is
>
> say in my db i have multiple values that are the same as well as different
values... how can i restrict it to showing each value just once?
>
> -Original Message-
> From: Alexander Skwar [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, April 17, 2001 10:17 AM
> To: Peter Houchin
> Cc: Php-General@Lists. Php. Net
> Subject: Re: [PHP] Populating HTML List boxes From DB
>
>
> So sprach Peter Houchin am Tue, Apr 17, 2001 at 10:08:36AM +1000:
> > 1: is there a way to populate a list box from a db?
>
> Sure.
>
> >
> > 2: if some one could point me in the right direction, with out actually
giving a example, as to how to go about it as i've
> >got no idea
>
> Uhm, no example?  I'll try.  ... failed *G*
>
>$query = "SELECT ListboxText, ListboxValue FROM Table";
>   $rs = mysql_select( $query );
>   while( $row = mysql_fetch_object( $rs ) ){
> echo '';
> echo htmlentities( $row->ListboxText );
>   }
> ?>
>
> Alexander Skwar
> --
> How to quote: http://learn.to/quote (german) http://quote.6x.to (english)
> Homepage: http://www.digitalprojects.com   |   http://www.iso-top.de
>iso-top.de - Die günstige Art an Linux Distributionen zu kommen
> Uptime: 2 hours 3 minutes
>



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




Re: [PHP] cgi vs. module

2001-04-17 Thread Plutarck

The only reason I am aware of to use PHP as a CGI is on Windows. Both apache
and the php module for windows apache is considered "beta quality", so most
people don't want to install beta software on their production machine.

But just on my local system I've never had a problem with PHP as CGI. I
honestly thought I had PHP as a module until I re-read my phpinfo, lol. And
I assumed that NuSphere would install it as a module...;)


--
Plutarck
Should be working on something...
...but forgot what it was.


"Franklin Hays" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> RE: PHP as a CGI or Module
>
> This has been discussed some but I am interested to see if one is more
> popular then the other.  My experience has been most people run PHP as a
> apache module but is there a specific benefit to run it as a cgi
> program?  What about very large servers such as web hosts?  I am currently
> wrestling with some issues (apaches global variables) that aren't working
> with php -cgi and wonder if this is a common occurance with php-cgi or
> just a misconfiguration on the hosts end.  Does one version serve the
> pages faster or provide less overhead on the server?
>
> I have read a few FAQ's on this but interested to see what is happening in
> the real world.  Is one form more popular then the other?
>
> //frank
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] Returning part of a string, ereg..

2001-04-17 Thread Plutarck

This:

ereg("([0-9]{1})-([0-9])-", $f, $regs);

What that means is "Capture a single occurance of 0-9, then a hyphen, then
capture a single occurance of 0-9 if it is imediately folowing by a hyphen."

Try this instead:

([0-9]{1})-([0-9]+)-

The "+" means "one or more". So "[0-9]+" is the same as "[0-9]{1,}". For
instance, "{x,y}" matches at least x amount of characters, but no more than
y amount of characters. Leave y off to match "x or more of the mentioned
characters". But don't forget that comma.


Regex is incredibly hard until you learn it. Then it doesn't seem hard
anymore :)


--
Plutarck
Should be working on something...
...but forgot what it was.


""Chad Day"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I'm horrible at regex's, maybe someone can help me out.
>
> What I'm trying to do is parse a string in the format:
number-number-number
> (ex.  1-23123-312039128)
>
> I need to pull that second number, regardless of length
>
> This code returns nothing:
>
> $part = ereg("([0-9]{1})-([0-9])-", $f, $regs);
>
> but
>
> $part = ereg("([0-9]{1})-([0-9]{1,10})-", $f, $regs);
>
> will return the number, but I don't want to take a chance and limit it to
10
> characters.  I thought the first bit of code would work.. any ideas what
is
> wrong?
>
> Thanks,
> Chad
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] Dynamic built web pages administration

2001-04-17 Thread Plutarck

If you are storing the content in a database, your job is a ton easier.

Just add an edit link on the page you want people to be able to edit. It
will link over to an edit page with the value of the current page sent in
the URL via get.

Get the content from the database pointed to by the url, and stick it in a
variable.

On the edit page have a text area. Set the "value" to the content the person
can edit.

When someone clicks submit, just take the content they submit and stuff it
into the database using UPDATE.

Of course you will need to do safety features like stripslashes() or the
special character functions before storing the data, just to be safe. You
will also want to have the option only available for registered users, and
you probably want to limit it to users you know won't be malicious.

There are many little tricks like using a little piece of javascript to
execute a file on the hard drive that shouldn't be executed, malicious
ActiveX controls, java applets, etc, that you don't want users writing to
the page.

But for administration used by only trusted people, it's actually pretty
simple to put together. For use by people who aren't trusted...


--
Plutarck
Should be working on something...
...but forgot what it was.


""Romulo Roberto Pereira"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hello,
>
> I was wondering if anybody have developed something related to dynamic web
> pages building and administration. I need to store the content of the site
> in the database and later as the user navigate, mount the content using
> templates. This part is easy, since PHP is very powerfull in this area. My
> problem would be to let the user modify the actual page content... how?
any
> ideas?
>
> TIA,
>
> Rom
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] Is this kind of code safe?

2001-04-17 Thread Plutarck

Don't use that on such small outputs, simply for the reason that it's really
hard to read and follow. It also screws up Syntax highlighting.

However, it works just like you would hope it would. When you call an ending
tag, PHP just outputs whatever is there without parsing it. But it doesn't
forget what it was doing, and will pick up right where it left off once you
call an opening tag.

But it can be pretty useful so you don't have to use here-doc printing, or
escape a bunch of things inside of a string.


--
Plutarck
Should be working on something...
...but forgot what it was.


""Greig, Euan"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Thanks for that Jason (and so quick!). I agree it's ugly, but I can see it
being useful occasionally.
>
> Euan
>
> -Original Message-
> From: Jason Murray [mailto:[EMAIL PROTECTED]]
> Sent: 17 April 2001 12:38
> To: 'Greig, Euan'; [EMAIL PROTECTED]
> Subject: RE: [PHP] Is this kind of code safe?
>
>
> >  > $test="b";
> > if ($test=="a"):
> > ?>
> >value is a
> >  > else:
> > ?>
> >value is not a
> >  > endif;
> > ?>
> >
> > It seems to work, ie it outputs different text depending on
> > the value of $test. But is it safe, can I rely on this
> > behaviour?
>
> Yes can rely on it, but I just think it's somewhat ugly. If I'm combing
> through a file looking for outputs, stepping through multiple ?> and  tags is very annoying.
>
> Jason
>
>
> **
> Any opinions expressed in this email are those of the individual and
> not necessarily the Company. This email and any files transmitted with
> it, including replies and forwarded copies (which may contain alterations)
> subsequently transmitted from the Company, are confidential and solely for
> the use of the intended recipient. If you are not the intended recipient
> or the person responsible for delivering to the intended recipient, be
> advised that you have received this email in error and that any use is
> strictly prohibited.
>
> **
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] php equivalent for `command`

2001-04-17 Thread Plutarck

The backtick operator " ` " is used like an exec() or passthru() function.

But I know what you mean. For instance, try running this in a script:

$n = 1;

echo "The number is: $n++";
echo "The number is: $n++";
echo "The number is: $n++";

PHP will not increment a variable inside of a string. However, now try this:

$n = 1;

echo "The number is: " . $n++ . "";
echo "The number is: " . $n++ . "";
echo "The number is: " . $n++ . "";

But now try this:

$n = 1;

echo "The number is: " . ++$n . "";
echo "The number is: " . ++$n . "";
echo "The number is: " . ++$n . "";


To do what you are wanting to do, just use the post-increment or
pre-increment operators, just like in Perl. Just be aware that PHP will not
do any mathematical functions on variables which are inside of a string.


--
Plutarck
Should be working on something...
...but forgot what it was.


""Greig, Euan"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Is there a php equivalent for the use of ` (I think) in Unix/Perl? So for
example echo "`$x++`" would first evaluate $x++ and then print the resulting
value.
>
> Euan Greig
> Technical Consultant
> BRANN DATA
> [EMAIL PROTECTED]
> 01285 645997
>
>
>
>
>
> **
> Any opinions expressed in this email are those of the individual and
> not necessarily the Company. This email and any files transmitted with
> it, including replies and forwarded copies (which may contain alterations)
> subsequently transmitted from the Company, are confidential and solely for
> the use of the intended recipient. If you are not the intended recipient
> or the person responsible for delivering to the intended recipient, be
> advised that you have received this email in error and that any use is
> strictly prohibited.
>
> **
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] Persistent connection & many scripts ?

2001-04-17 Thread Plutarck

Ideally you could use pconnect, then save the connection ID into a session.
Then just try and use the connection like that.

That _should_ work. But you may just want to use pconnect and not bother
with the rest...that might be just as good as what you are trying to do.


--
Plutarck
Should be working on something...
...but forgot what it was.


""Picard, Cyril"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi all
> I use PHP to query a PostgreSQL database.
> Today I know how to query the database with a PHP script, but I have to
> establish a connection to the database in each script.
>
> Is there a way to get the following :
> connect.php : a script where the user enters its login and password, and
> connect to the DB by the submit button (submit button which action url is
> query.php).
> query.php : a script that performs a query using the connection from
> connect.php
>
> I know that I could send the login/password to the query.php to establish
> the connection ; but it is not what I would like (sometimes - often - the
> connection time is bigger than the query time itself !)
> Thanks for your help !
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] Reauthenticate

2001-04-17 Thread Plutarck

When using sessions, which you might want to do, PHP automatically sends
header's that tell the user's browser not to bookmark the page.

The reason they can click the back button and see the page is because their
browser is caching the page. If they press the Refresh key they won't be
able to see the page, as long as you check for their cookie on that page
anyway.


So it's not fool proof (nothing is), but use header to send the Pragma:
No-cache setting.

Note: You can't _force_ the browser not to cache the page. You can only
_request_ that it not be cached.


--
Plutarck
Should be working on something...
...but forgot what it was.


""Marcelo Pereira"" <[EMAIL PROTECTED]> wrote in message
006701c0c742$4b843b60$0b01a8c0@hmmg">news:006701c0c742$4b843b60$0b01a8c0@hmmg...
> Hi All,
>
> I'm in trouble to authenticate each user (using a database).
> When the user sucesfully login on your area the php script send a cookie,
> and every php script reads this cookie. So when the user log ou the php
> script expires the cookie and then the user cannot bookmark the page and
> turn back.. but, if the user clicks the 'logout' button, I expire the
> cookie e show the main screen, but, by other side, if the user click at
> 'back button' then he can see the page... I would like to:
>
> - Each page look for the cookie, even if the back button is pressed.
> - If the cookie isn't there, then a 'expires page' is showed
>
> Which is the better way to do it ???
>
> Thanks in advance,
>
> Marcelo Pereira
> Programmer
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] baffled :<:

2001-04-17 Thread Plutarck

In the loop, try using print_r($myarray) in the loop to see if the data is
in there at all.

Other than that, switch the while loop to:

while ($myrow = mysql_fetch_assoc($result)) {


That should fix it...


--
Plutarck
Should be working on something...
...but forgot what it was.


""Peter Houchin"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> can any one see a problem with this loop?
>
>$db = include"connect.inc";
> $foo = "SELECT * FROM 6pci WHERE card='$card' ORDER BY card";
>
>  $result = mysql_query($foo,$db);
>
>
> while ( ($myrow = mysql_fetch_array($result) ) ) {
>
> $id = $myrow["id"];
> $card = $myrow["card"];
> $serial = $myrow["serial"];
> $avail = $myrow["avail"];
> $pn = $myrow["pn"];
> $cat = $myrow["cat"];
> $box = $myrow["box"];
> $quote = $myrow["quote"];
> }
> ?>
>
> if i call say just $card it only displays the one record (the last one),
the minute i try to call $myrow["card"]; i get nothing at all... any idea's?
>
> I have script identical to this that works perfectly .. only difference is
this one has different names for the values
>
> Peter Houchin
> [EMAIL PROTECTED]
> =
>  _  __   /\
> /_/_/_\/  |_/  \
>/_/_/___  __  __   __  / \
>\_/_/_\  /_/ /_/ /_/  /_/  \   _ /
>  ___\_\_\/ /_/_/_/ /_//\/_/\_/ \/\_/
>  \_//_/_/ /_/_/_/ /_/ \/_/v
>     
> /_/_/_/_/  /_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
>/_/_ _/_/ __  __   __  /_/   __ __
>   /_/_/_/_/ /_/_/_/ /_/  /_/ /_/ /_/\_\/_//_/_/_/
>  /_/  \_\  /_/ _/  /_//\/_/ /_/ /_/__\_\  /_/___ _\_\_\
> /_/\_\/_/_/_/ /_/ \/_/ /_/ /_/\_\/_/_/_//_/_/_/
> =
> Telephone : (03) 9329 1455  Facsimile : (03) 9329 6755
> * We rent the dot in .COM!  **
>



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




Re: [PHP] var question

2001-04-16 Thread Plutarck

Note: Yes, I meant string instrument. Any references to YoYo Ma will be
dealt with swiftly and severly.


--
Plutarck
Should be working on something...
...but forgot what it was.


""Plutarck"" <[EMAIL PROTECTED]> wrote in message
9bfp5e$169$[EMAIL PROTECTED]">news:9bfp5e$169$[EMAIL PROTECTED]...
> Add an "=" on the end of your url. Viola.
>
>
> --
> Plutarck
> Should be working on something...
> ...but forgot what it was.
>
>
> ""Jeroen Geusebroek"" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Hi Guys,
> >
> > I have a question about the way PHP handles var/strings.
> >
> > Let's say i have this URL: http://foo.bar.com/?login.
> > And in my script i have this code:
> >
> > if($login) { echo "blab"; } or
> > if(isset($login)) { echo "blab"; }
> >
> > It always returns FALSE. I think that is because the string
> > is empty. Shouldn't PHP, even if a var is empty, put it in
> > his var-list?
> >
> > Is there another way to do what i want?
> >
> > Thanks,
> >
> > Jeroen Geusebroek
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] How do i include ASP script into PHP...??!

2001-04-16 Thread Plutarck

Doesn't work.

ASP scripts require an ASP interpreter. If you stick it in a PHP file, PHP
will try to interpret the ASP code. PHP can't do that.



--
Plutarck
Should be working on something...
...but forgot what it was.


""Joe Truong"" <[EMAIL PROTECTED]> wrote in message
9bfd8q$gum$[EMAIL PROTECTED]">news:9bfd8q$gum$[EMAIL PROTECTED]...
> How can i include ASP scripts into PHP files or is it posible?
> thanxz
> -Joe
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] var question

2001-04-16 Thread Plutarck

Add an "=" on the end of your url. Viola.


--
Plutarck
Should be working on something...
...but forgot what it was.


""Jeroen Geusebroek"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi Guys,
>
> I have a question about the way PHP handles var/strings.
>
> Let's say i have this URL: http://foo.bar.com/?login.
> And in my script i have this code:
>
> if($login) { echo "blab"; } or
> if(isset($login)) { echo "blab"; }
>
> It always returns FALSE. I think that is because the string
> is empty. Shouldn't PHP, even if a var is empty, put it in
> his var-list?
>
> Is there another way to do what i want?
>
> Thanks,
>
> Jeroen Geusebroek
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] is it safe to stripslashes() on all form variables?

2001-04-16 Thread Plutarck

As long as you don't need to ever store a forward slash :)

Beyond that, nope. stripslash() away.


--
Plutarck
Should be working on something...
...but forgot what it was.


""Noah Spitzer-Williams"" <[EMAIL PROTECTED]> wrote in message
9bf7ec$m1m$[EMAIL PROTECTED]">news:9bf7ec$m1m$[EMAIL PROTECTED]...
> would there be any problems caused if i used the stripslashes() function
on
> all posted variables from a form to eliminate sql query errors?
>
>  - Noah
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] Variables not getting passed when I post info

2001-04-16 Thread Plutarck

Check your settings for track_vars and register_globals and ensure they are
both enabled.

Furthermore, check for the existance of $HTTP_GET_VARS["title"]. If it isn't
there either and both of your ini settings are set correctly, then you can
basically ignore this advice because you are having a different problem
entirely.


--
Plutarck
Should be working on something...
...but forgot what it was.


"Brandon Orther" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hello,
>
> I made a GD script that made an image with the name of whatever page I was
> in in my web site.  I would post info to it like this:
> http://www.domain.com/jpeg-out.php?title=FrontPage  what ever I put for
> title it would make the image.  After reinstalling php4 on my win2000 box
> with apache it doesn't seem to get the $title variable.  Does anyone know
> what might be going wrong?
>
> Thanks,
> Brandon
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] global env variables not working in php-cgi

2001-04-16 Thread Plutarck

> The GLOBALS array contains an a array called GLOBALS, which contains
> GLOBALS, endlessly. It will never ever end ;) It's fixed in 4.0.2.

That was a typo. What I mean to say is that it's fixed in 4.0._4_, not _2_.


--
Plutarck
Should be working on something...
...but forgot what it was.


""Plutarck"" <[EMAIL PROTECTED]> wrote in message
9bf39j$j2c$[EMAIL PROTECTED]">news:9bf39j$j2c$[EMAIL PROTECTED]...
> Btw, the reason you got all the output is why I said to hit the browser
Stop
> button. Technically it will run forever.
>
> The GLOBALS array contains an a array called GLOBALS, which contains
> GLOBALS, endlessly. It will never ever end ;) It's fixed in 4.0.2.
>
> get_defined_vars isn't available till 4.0.4, so that's why you got the
> error.
>
>
> But from looking at your output, there is definately something screwy with
> their setup.
>
> In phpinfo, what are the settings for track_vars (if listed) and
> global_vars?
>
>
> "Franklin Hays" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> >
> > Hello.
> >
> > The version is php-4.02 built on Sep 22, 2000.
> >
> > |What version of PHP? I ask because a few test functions aren't
available
> on
> > |older versions of PHP4.
> > |
> > |Try this piece of code:
> > |
> > |$arr = get_defined_vars();
> > |
> > |print_r($arr);
> >
> > This gave me an error on get_defined_var() so I tried
> > print_r($GLOBALS) and got a ton of output of the form:
> >
> > Array ( [PHP_SELF] => /test.php [HTTP_GET_VARS] => Array ( )
> > [HTTP_COOKIE_VARS] => Array ( ) [HTTP_SERVER_VARS] => Array ( [PHP_SELF]
> > => /test.php ) [GLOBALS] => Array ( [PHP_SELF] => /test.php
> > [HTTP_GET_VARS] => Array ( ) [HTTP_COOKIE_VARS] => Array ( )
> > [HTTP_SERVER_VARS] => Array ( [PHP_SELF] => | /test.php ) [GLOBALS] =>
> > Array ( [PHP_SELF] => /test.php [HTTP_GET_VARS] => Array ( )
> > [HTTP_COOKIE_VARS] => Array ( ) [HTTP_SERVER_VARS] => Array (|(if that
> > doesn't work, try print_r($GLOBALS), but be sure to hit the Stop
> > [PHP_SELF] => /test.php ) [GLOBALS] => Array ( [PHP_SELF] => /test.php
> > [HTTP_GET_VARS] => Array ( ) [HTTP_COOKIE_VARS] => Array ( )
> > [HTTP_SERVER_VARS]|button on your browser, because it will print off an
> > infinite list) | => Array ( [PHP_SELF] => /test.php ) [GLOBALS] => Array
(
> > [PHP_SELF] => /test.php [HTTP_GET_VARS] => Array ( ) [HTTP_COOKIE_VARS]
=>
> > Array ( )|Now, look at the results. In the main listing, does it list
any
> > of the ENV [HTTP_SERVER_VARS] => Array ( [PHP_SELF] => /test.php )
> > [GLOBALS] => Array ( [PHP_SELF] => /test.php [HTTP_GET_VARS] => Array
( )
> > [HTTP_COOKIE_VARS]|variables you are trying to access? | => Array ( )
> > [HTTP_SERVER_VARS] => Array ( [PHP_SELF] => /test.php ) [GLOBALS] =>
Array
> > ( [PHP_SELF] => /test.php [HTTP_GET_VARS] => Array ( )|If not, page down
a
> > bit and look in the HTTP_SERVER_VARS array. Are the ENV
[HTTP_COOKIE_VARS]
> > => Array ( ) [HTTP_SERVER_VARS] => Array ( [PHP_SELF] => /test.php )
> > [GLOBALS] => Array ( [PHP_SELF] => /test.php [HTTP_GET_VARS]|variables
in
> > there? | => Array ( ) [HTTP_COOKIE_VARS] => Array ( ) [HTTP_SERVER_VARS]
> > => Array ( [PHP_SELF] => /test.php ) [GLOBALS] => Array ( [PHP_SELF] =>
> > /test.php|My guess is that they probably are. Check phpinfo() again and
> > see what |register_globals is On. That may be your problem...
> > [HTTP_GET_VARS] => Array ( ) [HTTP_COOKIE_VARS] => Array ( )
> > [HTTP_SERVER_VARS] => Array ( [PHP_SELF] => /test.php ) [GLOBALS] =>
Array
> > ( [PHP_SELF]| => /test.php [HTTP_GET_VARS] => Array ( )
[HTTP_COOKIE_VARS]
> > => Array ( ) [HTTP_SERVER_VARS] => Array ( [PHP_SELF] => /test.php )
> > [GLOBALS] => Array (|If none of the variables you seek are in
> > HTTP_SERVER_VARS, then something is [PHP_SELF] => /test.php
> > [HTTP_GET_VARS] => Array ( ) [HTTP_COOKIE_VARS] => Array ( )
> > [HTTP_SERVER_VARS] => Array ( [PHP_SELF] => /test.php ) [GLOBALS]|wrong
> > with the installation of PHP itself. | | => Array ( [PHP_SELF] =>
> > /test.php [HTTP_GET_VARS] => Array ( ) [HTTP_COOKIE_VARS] => Array ( )
> > [HTTP_SERVER_VARS] => Array ( [PHP_SELF] => /test.php )| |-- [GLOBALS]
=>
> > Array ( [PHP_SELF] => /test.php [HTTP_GET_VARS] => Array ( )
> > [HTTP_COOKIE_VARS] => Array ( ) [HTTP_SER

Re: [PHP] Want a Good Book for Ref on PHP

2001-04-16 Thread Plutarck

Woh, that book looks excellant.

I think I may order it, actually.

It is absolutely _hell_ to find a good advanced programming or internet
technology book.

If the book doesn't expect you to be a moron (how many morons are interested
in the implementation of TCP/IP, anyway?), it expects you to be a complete
wizard (which basically means the book is a 400 page reference manual).

It's hard to find a book on computers that is for an
advanced-but-not-perfect user.

*orders*

I'll give me review to the list once I get it :)


--
Plutarck
Should be working on something...
...but forgot what it was.


"Ulf Wendel" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
>
> Christian Reiniger schrieb:
> >
> > On Monday 16 April 2001 08:23, you wrote:
> > > Personally, I never even bought a PHP book. I learned from the web
> > > only...hehe.
> >
> > Same here.
> > Well, actually I *did* buy a book - "Core PHP programming". I started
> > reading it, saw that it basically only covers (a) introductory
> > programming in general (what is a 'while' loop?) and (b) a PHP3 function
> > reference (copied from the online manual), and I immediately went back
to
> > the web resources.
> >
> > That doesn't mean you shouldn't buy any book - the cookbook for example
> > certainly is very useful both as starter (giving examples) and later on
> > (giving more complex examples :).
>
> Hmm, although Sterlings book is cool, german readers can save the money
> an check the german FAQ on http://www.koehntopp.de/php. It covers most
> of Sterlings book except the PHP core hacking. The advanced book I like
> best is "Web application development with PHP 4.0" written by
> Till&Tobel. Don't expect a PHP only book, the authors did very well not
> to copy the online reference or the usual tutorials. Till&Tobel wrote a
> book for those that have a solid basic programming knowledge but lack
> some more advanced skills like API design or certain web development
> strategies (CVS, staging server, development process, ...).
>
> Ulf
>
> --
> Neu: PEAR Menu 3 - Navigationsstrukturen dynamisch dargestellt
> http://www.ulf-wendel.de/projekte/menu/tutorial.php |
> http://www.phpdoc.de
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] global env variables not working in php-cgi

2001-04-16 Thread Plutarck

Btw, the reason you got all the output is why I said to hit the browser Stop
button. Technically it will run forever.

The GLOBALS array contains an a array called GLOBALS, which contains
GLOBALS, endlessly. It will never ever end ;) It's fixed in 4.0.2.

get_defined_vars isn't available till 4.0.4, so that's why you got the
error.


But from looking at your output, there is definately something screwy with
their setup.

In phpinfo, what are the settings for track_vars (if listed) and
global_vars?


"Franklin Hays" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> Hello.
>
> The version is php-4.02 built on Sep 22, 2000.
>
> |What version of PHP? I ask because a few test functions aren't available
on
> |older versions of PHP4.
> |
> |Try this piece of code:
> |
> |$arr = get_defined_vars();
> |
> |print_r($arr);
>
> This gave me an error on get_defined_var() so I tried
> print_r($GLOBALS) and got a ton of output of the form:
>
> Array ( [PHP_SELF] => /test.php [HTTP_GET_VARS] => Array ( )
> [HTTP_COOKIE_VARS] => Array ( ) [HTTP_SERVER_VARS] => Array ( [PHP_SELF]
> => /test.php ) [GLOBALS] => Array ( [PHP_SELF] => /test.php
> [HTTP_GET_VARS] => Array ( ) [HTTP_COOKIE_VARS] => Array ( )
> [HTTP_SERVER_VARS] => Array ( [PHP_SELF] => | /test.php ) [GLOBALS] =>
> Array ( [PHP_SELF] => /test.php [HTTP_GET_VARS] => Array ( )
> [HTTP_COOKIE_VARS] => Array ( ) [HTTP_SERVER_VARS] => Array (|(if that
> doesn't work, try print_r($GLOBALS), but be sure to hit the Stop
> [PHP_SELF] => /test.php ) [GLOBALS] => Array ( [PHP_SELF] => /test.php
> [HTTP_GET_VARS] => Array ( ) [HTTP_COOKIE_VARS] => Array ( )
> [HTTP_SERVER_VARS]|button on your browser, because it will print off an
> infinite list) | => Array ( [PHP_SELF] => /test.php ) [GLOBALS] => Array (
> [PHP_SELF] => /test.php [HTTP_GET_VARS] => Array ( ) [HTTP_COOKIE_VARS] =>
> Array ( )|Now, look at the results. In the main listing, does it list any
> of the ENV [HTTP_SERVER_VARS] => Array ( [PHP_SELF] => /test.php )
> [GLOBALS] => Array ( [PHP_SELF] => /test.php [HTTP_GET_VARS] => Array ( )
> [HTTP_COOKIE_VARS]|variables you are trying to access? | => Array ( )
> [HTTP_SERVER_VARS] => Array ( [PHP_SELF] => /test.php ) [GLOBALS] => Array
> ( [PHP_SELF] => /test.php [HTTP_GET_VARS] => Array ( )|If not, page down a
> bit and look in the HTTP_SERVER_VARS array. Are the ENV [HTTP_COOKIE_VARS]
> => Array ( ) [HTTP_SERVER_VARS] => Array ( [PHP_SELF] => /test.php )
> [GLOBALS] => Array ( [PHP_SELF] => /test.php [HTTP_GET_VARS]|variables in
> there? | => Array ( ) [HTTP_COOKIE_VARS] => Array ( ) [HTTP_SERVER_VARS]
> => Array ( [PHP_SELF] => /test.php ) [GLOBALS] => Array ( [PHP_SELF] =>
> /test.php|My guess is that they probably are. Check phpinfo() again and
> see what |register_globals is On. That may be your problem...
> [HTTP_GET_VARS] => Array ( ) [HTTP_COOKIE_VARS] => Array ( )
> [HTTP_SERVER_VARS] => Array ( [PHP_SELF] => /test.php ) [GLOBALS] => Array
> ( [PHP_SELF]| => /test.php [HTTP_GET_VARS] => Array ( ) [HTTP_COOKIE_VARS]
> => Array ( ) [HTTP_SERVER_VARS] => Array ( [PHP_SELF] => /test.php )
> [GLOBALS] => Array (|If none of the variables you seek are in
> HTTP_SERVER_VARS, then something is [PHP_SELF] => /test.php
> [HTTP_GET_VARS] => Array ( ) [HTTP_COOKIE_VARS] => Array ( )
> [HTTP_SERVER_VARS] => Array ( [PHP_SELF] => /test.php ) [GLOBALS]|wrong
> with the installation of PHP itself. | | => Array ( [PHP_SELF] =>
> /test.php [HTTP_GET_VARS] => Array ( ) [HTTP_COOKIE_VARS] => Array ( )
> [HTTP_SERVER_VARS] => Array ( [PHP_SELF] => /test.php )| |-- [GLOBALS] =>
> Array ( [PHP_SELF] => /test.php [HTTP_GET_VARS] => Array ( )
> [HTTP_COOKIE_VARS] => Array ( ) [HTTP_SERVER_VARS] => Array ( [PHP_SELF]
> =>|Plutarck |Should be working on something... /test.php ) [GLOBALS] =>
> Array ( [PHP_SELF] => /test.php [HTTP_GET_VARS] => Array ( )
> [HTTP_COOKIE_VARS] => Array ( ) [HTTP_SERVER_VARS] => Array (|...but
> forgot what it was. | [PHP_SELF] => /test.php ) [GLOBALS] => Array (
> [PHP_SELF] => /test.php [HTTP_GET_VARS] => Array ( ) [HTTP_COOKIE_VARS] =>
> Array ( ) [HTTP_SERVER_VARS]| | => Array ( [PHP_SELF] => /test.php )
> [GLOBALS] => Array ( [PHP_SELF] => /test.php [HTTP_GET_VARS] => Array ( )
> [HTTP_SERVER_VARS] => Array ( [PHP_SELF] => /test.php ) [GLOBALS] => Array
> ( [PHP_SELF] => /test.php [HTTP_GET_VARS] => Array ( )
> [HTTP_COOKIE_VARS]|> => Array ( ) [HTTP_SERVER_VARS] =>

Re: [PHP] Protecting JavaScripts from being Donwloaded

2001-04-16 Thread Plutarck

If you mean Javascript that is in your HTML code, it is both practically and
theoretically impossible to do so. HTML source is wide-open to anyone who
wants to look at it, and there is little/nothing you can "really" do about
it. Some sites try and hide their HTML source, but it servers only to annoy
the crap out of users. If I right-click a page and don't get the right-click
menu I expect, I tend to become highly irritated.

JavaScript is a "scripting language", which was designed for the exact
purpose of being easily read by humans.

Now, if you are speaking of a JavaApplet or client-side java bean, that's a
little different. But in reality you can't really stop people from
downloading those to their hard-drive either.

There are methods to keep people from easily decompiling them, but I'm
betting you aren't talking about Java stuff anyway :)


--
Plutarck
Should be working on something...
...but forgot what it was.


""Steve Haemelinck"" <[EMAIL PROTECTED]> wrote in message
01c0c663$59401dd0$0200a8c0@shaemeli">news:01c0c663$59401dd0$0200a8c0@shaemeli...
> Hi all is it possible to protect your javascripts from being downloaded by
> visitors ?
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] global env variables not working in php-cgi

2001-04-16 Thread Plutarck

What version of PHP? I ask because a few test functions aren't available on
older versions of PHP4.

Try this piece of code:

$arr = get_defined_vars();

print_r($arr);

(if that doesn't work, try print_r($GLOBALS), but be sure to hit the Stop
button on your browser, because it will print off an infinite list)

Now, look at the results. In the main listing, does it list any of the ENV
variables you are trying to access?

If not, page down a bit and look in the HTTP_SERVER_VARS array. Are the ENV
variables in there?

My guess is that they probably are. Check phpinfo() again and see what
register_globals is On. That may be your problem...

If none of the variables you seek are in HTTP_SERVER_VARS, then something is
wrong with the installation of PHP itself.



--
Plutarck
Should be working on something...
...but forgot what it was.



"Franklin Hays" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> I am migrating a site to a new host (westhost.com) and having some
> issues.  PHP was compiled as a cgi instead of a module which is what I
> have always used.  This wasn't really an issue until I realized a lot of
> my scripts that depended on apaches environment variables ($REQUEST_URI,
> $HTTP_USER_AGENT, etc.) weren't working.  I can write a PERL cgi script
> and get them from the command line, they also appear in phpinfo(), yet I
> simply can't obtain them from any of my php scripts.  Maybe the cgi issue
> isn't even related but up to this point it is the only culprit I can
> find.  After spending three days going through the docs at apache,
> phpbuilder, and php.net I have not ran across anything which offers a
> solution.  Thus, I am not looking in the right place or this is a unique
> problem.  Can anyone out there help, or provide some
> directions/suggestions?  And yes, they are running Apache (note above, I
> can obtain the variables but just not through my php scripts).  Do I need
> to make an addition to my .htaccess file of some sort?
>
> I need these variables for my site to work properly ( css generation,
> hashing URL strings, etc.) so any/all help is greatly appreciated.
>
> If you need more information please let me know and I will get back to you
> as soon as possible.  At this point I can't obtain ANY of the env
> variables (SERVER_PORT, REMOTE_ADDR, REQUEST_URI, HTTP_USER_AGENT, etc.).
>
> Thanks,
> //frank
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] General WebServer Question?

2001-04-16 Thread Plutarck

The first thing you need is benchmarking software. Try an internet search
for "webserver performance benchmark". I did it on altavista and got some
good leads.

For instance this one sounds excellant:

http://www.softwareqatest.com/qatweb1.html

It's description is "Listing of 190 web test tools and management tools -
link checking, html validation, load testing, security testing, java
testing, publishing...". Never underestimate the power of the search engine
:)

For the second part, you want a weblog analyzer. I reccommend Analog:

http://www.statslab.cam.ac.uk/~sret1/analog/

It has listing for popularity of particular files, directories, etc. Good
stuff. Insanely fast.


--
Plutarck
Should be working on something...
...but forgot what it was.


""Jason Caldwell"" <[EMAIL PROTECTED]> wrote in message
9be700$b2d$[EMAIL PROTECTED]">news:9be700$b2d$[EMAIL PROTECTED]...
> Can anyone recommend (or is there) a utility / app that I can use to hit
my
> webserver (say from another computer outside my subnet) -- any number of
> times to get an idea of performance - based on my bandwidth and hardware?
>
> In other words -- I'd like to do some hard core testing of my website and
> see how much my pipe and servers (simultaneously) can handle... I would
like
> to get page return times, etc...
>
> Also -- is there a good add on to IIS or Apache that I can use to monitor
> not only how much traffic is hitting my site, but which pages, and from
> where the users are coming (ie. which websites they came from)?
>
> Thanks.
> Jason
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] fwrite not writing

2001-04-16 Thread Plutarck

Ahhh, I see what's going on now. I had more time to read over the code, so
now I see what you are trying to do.

I'm not sure why it suddenly stopped working, but let's see if you actually
need it to work.

First of all, I take it that you have content which you want to write into a
file. Correct?

If so, why does it matter if the file you want to write it to has data
anyway? If you are just going to add data into it, isn't it ok that it is a
zerolength file?

Or is the problem that the file is _not_ actually zerolength, but PHP says
it's zerolength anyway?

Just try removing the !filesize() part, and then try executing the function.

But maybe I just don't understand what you are trying to write and why.
Could you be a little more specific what data is being saved in the file,
and what is in the file already?


--
Plutarck
Should be working on something...
...but forgot what it was.


"CC Zona" <[EMAIL PROTECTED]> wrote in message
9bebi3$133$[EMAIL PROTECTED]">news:9bebi3$133$[EMAIL PROTECTED]...
> > > This function suddenly stopped working, and I just can't seem to
figure
> > out
> > > why.  The only change made recently is that now the value of $force at
> > > calltime is sometimes true instead of being undefined or null.
> > >
> > > build_file("file_content","/path/to/file.inc","w",TRUE);
> > >
> > > function build_file($func_name,$filepath,$mode="w",$force=FALSE)
> > >{
> > >if($force or !file_exists($filepath) or !filesize($filepath))
//echo
> > > filesize($filepath) shows '0'
> > >   {
> > >   $content=$func_name(); //echo $content shows it's all there
> > >$fp=fopen($filepath,$mode);
> > >fwrite($fp,$content);
> > >rewind($fp); #temp test
> > >   $read_back=fread($fp,10); #temp test
> > >   echo "file content:\n $read_back"; #temp test, displays
> > nothing
> > >  fclose($fp);
> > >   }
> > >}
> > >
> > > I've tried putting echoes and "or die('Error on __LINE__')" on every
line,
> > > checked all the variable values, and found no answers from that.
> > > Everything shows exactly as it should be except that the content that
> > > echoes out so nicely *doesn't ever get written to the file*.  The
function
> > > runs to the end without error and the file's modification date is even
> > > updated.  But the file remains empty. I'm probably missing something
> > > ridiculously obvious, but would someone please be kind enough to point
out
> > > what it is?  Thank you!!
>
> > What is this:
> >
> > !filesize($filepath)
>
> If filesize is zero (which it is ), then do the rest (which it
> does--except the content it fetches never makes it into the file it writes
> to.  How that can be, I dunno, but that apparently is what it's doing...)
>
> > Add this above your if loop:
> >
> > $filesize = filesize($filepath);
> > echo $filesize;
>
> Already tried echoing that and all the other values.  Filesize is 0.
>
> > That might be causing your loop not to execute...if not, I'm not sure
what's
> > wrong.
>
> I don't get it.  It should work.  It did work.  Suddenly it's not.
>
> --
> CC
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] Want a Good Book for Ref on PHP

2001-04-15 Thread Plutarck

Personally, I never even bought a PHP book. I learned from the web
only...hehe.

First, go to zend.com and check out their tutorial and article sections.
Then check out their links section, which just so happens to have links to
17 books, 10 of which are non-english.

Check out phpbuilder.com, devshed.com, and phpbeginner.com. weberdev is also
a good one.


First of course, read the PHP manual. I basically learned everything I
needed to from those sites. The rest comes from just hacking out code.

PHP changed alot during the books writing process, so it's really rather
impossible to get a totally updated book. For instance if you started
writing a book now on PHP v4.0.5, PHP would be nearing version 5 before it
ever hit a bookshelf.


--
Plutarck
Should be working on something...
...but forgot what it was.


"Manisha" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi all,
>
> I am just entering into PHP world. First what I did is, I signed for PHP
> mailing list.
>
> I want to buy a good PHP book for my initial start and may be later on as
a
> reference. I know there are lot in the market. Can anybody suggest a good
> book among them ?
>
> manisha
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] fwrite not writing

2001-04-15 Thread Plutarck

What is this:

!filesize($filepath)

Add this above your if loop:

$filesize = filesize($filepath);
echo $filesize;


That might be causing your loop not to execute...if not, I'm not sure what's
wrong.


--
Plutarck
Should be working on something...
...but forgot what it was.


"CC Zona" <[EMAIL PROTECTED]> wrote in message
9bdv8u$2la$[EMAIL PROTECTED]">news:9bdv8u$2la$[EMAIL PROTECTED]...
> This function suddenly stopped working, and I just can't seem to figure
out
> why.  The only change made recently is that now the value of $force at
> calltime is sometimes true instead of being undefined or null.
>
> build_file("file_content","/path/to/file.inc","w",TRUE);
>
> function build_file($func_name,$filepath,$mode="w",$force=FALSE)
>{
>if($force or !file_exists($filepath) or !filesize($filepath)) //echo
> filesize($filepath) shows '0'
>   {
>   $content=$func_name(); //echo $content shows it's all there
>$fp=fopen($filepath,$mode);
>fwrite($fp,$content);
>rewind($fp); #temp test
>   $read_back=fread($fp,10); #temp test
>   echo "file content:\n $read_back"; #temp test, displays
nothing
>  fclose($fp);
>   }
>}
>
> I've tried putting echoes and "or die('Error on __LINE__')" on every line,
> checked all the variable values, and found no answers from that.
> Everything shows exactly as it should be except that the content that
> echoes out so nicely *doesn't ever get written to the file*.  The function
> runs to the end without error and the file's modification date is even
> updated.  But the file remains empty. I'm probably missing something
> ridiculously obvious, but would someone please be kind enough to point out
> what it is?  Thank you!!
>
> --
> CC
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] SQL Query syntax error... Help?

2001-04-15 Thread Plutarck

In the future, to make things easier on yourself, when you get a query
syntax error add an "echo $sql;" line right before your query.

Almost every time I have a query problem, that solves it.


--
Plutarck
Should be working on something...
...but forgot what it was.


""Scott VanCaster"" <[EMAIL PROTECTED]> wrote in message
9bd394$ikn$[EMAIL PROTECTED]">news:9bd394$ikn$[EMAIL PROTECTED]...
> I've only been trying to learn this stuff for a few days and thought I was
> on a roll, but now have run into a problem I don't get at all.  In my
script
> I have the following sql query and am receiving the following error when
it
> executes "You have an error in your SQL syntax near '' at line 1."
>
> Any idea what my problem is?  I removed the WHERE id=$id and it works, but
> updates every record of course :(
>
> I'm lost here.  Thanks for any help.
>
> $sql ="UPDATE members SET ".
>   "name='$name', ".
>   "email='$email', ".
>   "icq='$icq', ".
>   "password='$password', ".
>   "loginid='$loginid', ".
>   "countryid='$countryid', ".
>   "gtlogin='$gtlogin', ".
>   "gtpass='$gtpass', ".
>   "swirvelogin='$swirvelogin', ".
>   "swirvepass='$swirvepass' ".
>   "WHERE id=$id" ;
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] Mailbox and PHP

2001-04-15 Thread Plutarck

Check out PHPost: http://webgadgets.com/

It doesn't use IMAP, so you can probably learn quite a bit how POP3 mail can
be handled.

One of these days I'm going to actually figure it out myself...


--
Plutarck
Should be working on something...
...but forgot what it was.


""Richard"" <[EMAIL PROTECTED]> wrote in message
9bc03m$3ad$[EMAIL PROTECTED]">news:9bc03m$3ad$[EMAIL PROTECTED]...
> Greetings.
>
> I have no problem writing an email client in PHP, which sends emails
and
> such things. One thing only, can I check someones POP3, such as mine,
> through PHP? If so, what should be needed to complete it..? The server I
am
> using is running Linux FreeBSd (I think..) with the options for the user
to
> change quite alot..
>
> - Richard
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] converting DATETIME to a readable date.

2001-04-15 Thread Plutarck

The I "now" get a date from MySQL (hehe) is to use UNIX_TIMESTAMP then feed
it over to date.

That way if I want to change the way the date is displayed, I don't have to
touch my query syntax. And I personally find it easier to use PHP's date()
function rather than MySQL's.


--
Plutarck
Should be working on something...
...but forgot what it was.


"Chris Adams" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> On 14 Apr 2001 17:31:02 -0700, DRN <[EMAIL PROTECTED]> wrote:
> >$date = $row["date"];
> >
> >$new_date = date("l, j M Y, G:i:s", strtotime($date));
> >~~
> >
> >but I cannot get this to work :(, I get an "unexpected error in
> >date()"
>
> At a guess strtotime() is choking on the format MySQL used to return the
date,
> which would lead date() to fail as well.
>
> The best way of handling this is to eliminate the need for your program to
> worry about the day formats. Modify your mysql query so that instead of
"SELECT
> date" you have something like "SELECT UNIX_TIMESTAMP(date) AS date". Then
you
> can simply use date($row["date"]) directly. Alternately, you could use
MySQL's
> date formatting function to return the desired format directly. In either
case,
> you'll save a great deal of trouble by avoiding the need for PHP and MySQL
to
> be parsing each other's human-readable date formats.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] Sorry :(

2001-04-15 Thread Plutarck

Remember: There are no stupid questions. Only stupid people.


...*couldn't resist*

;)


--
Plutarck
Should be working on something...
...but forgot what it was.


""Chris Anderson"" <[EMAIL PROTECTED]> wrote in message
002b01c0c528$7ea85a60$0d1012d1@null">news:002b01c0c528$7ea85a60$0d1012d1@null...
> Well thanks everyone, don't feel like I'm "leeching" from the community
> anymore. Now when it comes to me and napster, thats another story
> - Original Message -
> From: "Brian Clark" <[EMAIL PROTECTED]>
> To: "PHP is not a drug." <[EMAIL PROTECTED]>
> Sent: Saturday, April 14, 2001 7:47 PM
> Subject: Re: [PHP] Sorry :(
>
>
> > Hi Chris,
> >
> > @ 3:51:02 PM on 4/14/2001, Chris Anderson wrote:
> >
> > > I realized that'll that I don't do much to help this community. I
> > > rarely reply to people's questions. Mainly because I have 56.6 and
> > > when I get mail people answered already. I also ask alot of
> > > questions. Just saying thanks for putting up with me. Chris, The 17
> > > yr Old Php Coder
> >
> > As far as I'm concerned, you don't have a thing to be sorry about.
> >
> > There isn't a thing wrong with asking questions here. In fact, if you
> > have a good book and this list to get help from, you're far more
> > likely to become successful with PHP.
> >
> > -Brian
> > --
> >  PGP is spoken here: 0xE4D0C7C8
> >  Please, DO NOT carbon copy me on list replies.
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] next release?

2001-04-14 Thread Plutarck

Nope, it 4.0.5 hasn' been released yet.

However at one point I believe there was a 4.0.6dev source code on CVS,
before the Midgaard extension required another round of release candidates.
So I think that's where the mentions came from.

And I'm sure some people are planning their features to be in 4.0.6. Then
again, there are probably people who claim their features will be in PHP5 ;)



--
Plutarck
Should be working on something...
...but forgot what it was.


"Michael Kimsal" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I'm seeing references to functions that 'are' in 4.0.6, but I wasn't
> even
> aware that 4.0.5 was released yet.  I've seen references to RCs for
> 4.0.5,
> but nothing's on the php.net page.  Did I miss something?
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] What's XML's Purpose??

2001-04-14 Thread Plutarck

I agree with most of your points actually. That's why I said I thought the
love would "fade off a bit".

For some things I agree that XML really is quite excellant.

But what I meant about people not being good with "new" on Java and XML, is
that when people (including myself) get a new toy they try and do everything
with it. People get a VCR, and now they want it to program itself and set
it's own clock. Thus came for horrible implementation of "VCR+".

Java was originally made to work in little widgets like blenders and
microwaves. Then it made sense to work on computers too...it's still a very
good idea. But then people instantly tried to do everything with it, and
complained loudly when they couldn't. So Sun bowed to their wishes and
started forcing Java to do things it wasn't yet ready to do.

And now Java applets are quite secure for the user, but the ease with which
they can be decompiled is gastly.

And with XML it's the same way, for now. They want it to do _everything_.
Now when you mix XML with a little javascript and a server-side language
like PHP or *cough* ASP (or any of the others), it really is a pretty nifty
widget.


But here is my problem. For instance with Java, people tend to get really
excited about doing something that they could of done with C/C++. But in
reality, it's a feature only a mother (or programmer, as the case may be),
could love.

So my whole POV is when you want to open a can, use a can opener. So please
put the VCR back under the TV.


--
Plutarck
Should be working on something...
...but forgot what it was.

"Michael Kimsal" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
>
> Plutarck wrote:
>
> > I use to be really enthusiastically pro-XML just as I was getting into
PHP,
> > but now I've basically taken a "XML shmexXML" approach. I get the
initial
> > attraction, but I would think the love would fade off a bit.
> >
> > The key that so many people seem to forget is the best way to do HTML is
> > with, *gasp*, HTML!
> >
> > If you just want a webpage, XML is using a canon to kill a fly. It's
like
> > creating classes and objects in PHP for sending text emails.
> >
>
> Agreed, but if you have a set of data that you'd like to be able to
> "fairly easily" convert into multiple presentation systems (HTML, PDF
> and WAP spring to mind), then taking a more structured data and
> abstraction approach can pay off quite handsomely on larger projects.
>
>
> >
> > Sure you can do it...but why?
> >
>
> Because what you need to do might change some in the future.  Yes,
> use mail() all you want, but when you start needing to send attachments,
> already you need a class of some sort.   - Aha - I see you qualified and
said
> 'text' attachments.  OK...
>
>
> >
> > XML is new. Common society doesn't do well with new. They always manage
to
> > screw it up somehow.
> >
>
> Depends on what you mean by 'screw it up'.  The notion of a commercial
> internet, to me, seems to have been adopted QUITE quickly - even my
> parents have coped quite well with this 'new' stuff, and they STILL
> can't set their VCR clocks.
>
> >
> > XML started as an extensible markup language...that's it. That's all it
was
> > supposed to do! Now people are using it to query databases, and concoct
> > entire search engines, and they are trying to use it to control access
to
> > restricted data, etc etc.
> >
>
> I don't know what you're talking about here.  I've not heard of anyone
using
> XML to 'control access' to 'restricted data'.  The XML itself IS the data.
>
>
> >
> > It's the same thing that happened with Java. People just aren't good
with
> > "new".
> >
>
> Don't lump Java in with other 'new' technology wholesale.  Sun has made,
> imo, a HUGE number of mistakes pushing Java out, so the
> less-than-stellar adoption of Java has as much or more to do with Sun
themselves
>
> rather than people's ability to adopt to 'new' things.  Again, imo.
>
>
> >
> > XML is nice, and for some things it's even great. But it's not the death
of
> > plain old HTML, just like ISDN didn't kill POTS (remember when ISDN was
"the
> > future of telecom"?).
> >
> > I fear that there are too many cooks in the kitchen on XML, all with a
> > seasoning all their own that they are dead set on adding to the broth.
> >
> > But for me, I say let people play with their Java and XML and new
fangled
> > w

Re: [PHP] PHP without a webserver

2001-04-14 Thread Plutarck

Btw, thanks for all your answers to far ;)

> I have no idea. What language? Using system() in C and Perl, I'm
> sure you could concoct something. Why would you want to do that?


A move recently being made by game programmers has been to move an
increasing amount of work into a scripting engine. My idea is to jump ahead
of the slow move, so that the program is far more abstracted.

The program, written in C/C++ (or Java, or any language really), is
basically turned into a dumb bot. It's a mindless intermediary. The outer
layer is the Display Engine, which could be a Quake Engine or an MFC style
GUI, which takes all of it's commands from the intermediary layer.

The final layer is the scripting engine. In the script if a move_elevator()
function is called, the script interpreter bundles up some commands and
passes it over to the intermediary layer. The intermediary looks at the
display engine, figures out what commands must be called to fufill the
wishes of the script, and passes over the commands.

This would allow the vast majority of the real "content" of a game or
application to be written in a scripting language, much like web apps are
now. The script would run just as well on Linux as it would on windows.

The intermediary understands the universally written script, and figures out
how to actually do what the script asks it to. So an entire application
could be written to run using OpenGL, DirectX, and a selection of different
engines. So you could switch from using a Quake engine to a Midtown Madness
engine for maximum effectiveness, only by tweaking the intermediary level.
Since there are only so many ways to "rotate camera", code could be reused
to the point that the intermediary level comes packaged with all it needs to
know. And thus the sheer amount of people who have the ability to run such
applications skyrockets.


The creators of the Dark Forces star wars game (correct name?) created a
specific programming language for doing things like moving elevators,
dialog, etc. Now adays everyone has their own script.

Asheron's Call has their own little internal quest scripting, and Ever Quest
made their own, Doom has one, Daggerfall has some, et al. But why go to the
trouble of making a whole stinking language, reinventing the wheel, when
thousands of people have spent years to develop a versitile and extensible
scripting engine in PHP?


Anyway, that's my idea. I'd just be happy to outsource some of my C++ work
to PHP. If I use MFC, goodbye platform independence. If I don't use it, it's
a huge pain in the butt to do heavy string manipulation. So I figure, why
not just have PHP do it, since I already know the language?



--
Plutarck
Should be working on something...
...but forgot what it was.



"Brian Clark" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi Plutarck,
>
> @ 2:40:28 PM on 4/14/2001, Plutarck wrote:
>
> > Ahh, so it's the location of the script that get's passed.
>
> Yes:
>
> % cat test.php
> 
> while(list($i,$arg) = each($argv))
> {
>   print "$i: $arg\n";
> }
>
> ?>
>
> % php -q test.php a b c d e f g
> 0: test.php
> 1: a
> 2: b
> 3: c
> 4: d
> 5: e
> 6: f
> 7: g
> %
>
> > Now, if the script was coming from a program, is there a way to hand the
> > file directly to PHP, or will a temporary file have to be used?
>
> I have no idea. What language? Using system() in C and Perl, I'm
> sure you could concoct something. Why would you want to do that?
>
> > So if a user filled in a form and clicked a button in the program, the
> > program would toy with the form a little, then send the form to PHP. Is
that
> > possible using the CGI executible?
>
> I have no idea what you're talking about here, but if you're wanting
> to build some type of GUI based application you might as well either
> use PHP-GTK (http://gtk.php.net) or just use a HTML, PHP and a web
> server.
>
> -Brian
> --
>  PGP is spoken here: 0xE4D0C7C8
>  Please, DO NOT carbon copy me on list replies.
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] What's XML's Purpose??

2001-04-14 Thread Plutarck

I use to be really enthusiastically pro-XML just as I was getting into PHP,
but now I've basically taken a "XML shmexXML" approach. I get the initial
attraction, but I would think the love would fade off a bit.

The key that so many people seem to forget is the best way to do HTML is
with, *gasp*, HTML!

If you just want a webpage, XML is using a canon to kill a fly. It's like
creating classes and objects in PHP for sending text emails.

Sure you can do it...but why?

XML is new. Common society doesn't do well with new. They always manage to
screw it up somehow.

XML started as an extensible markup language...that's it. That's all it was
supposed to do! Now people are using it to query databases, and concoct
entire search engines, and they are trying to use it to control access to
restricted data, etc etc.

It's the same thing that happened with Java. People just aren't good with
"new".


XML is nice, and for some things it's even great. But it's not the death of
plain old HTML, just like ISDN didn't kill POTS (remember when ISDN was "the
future of telecom"?).

I fear that there are too many cooks in the kitchen on XML, all with a
seasoning all their own that they are dead set on adding to the broth.


But for me, I say let people play with their Java and XML and new fangled
widgets. I'll take my PHP and plain-old HTML, and I'll create twice as much
material with just as high a quality, and I won't need to spend an extra
minute learning a bleeding-edge technology.

Life's too short to spend it learning how to live it. Translation: Better to
program than to learn yet _another_ language.


--
Plutarck
Should be working on something...
...but forgot what it was.


""Chris Anderson"" <[EMAIL PROTECTED]> wrote in message
002001c0c506$c70d7f00$0d1012d1@null">news:002001c0c506$c70d7f00$0d1012d1@null...
> thanks that helped
> I stll think it sounds like its more geared for the MS crowd
> - Original Message -
> From: "Brian Clark" <[EMAIL PROTECTED]>
> To: "PHP is not a drug." <[EMAIL PROTECTED]>
> Sent: Saturday, April 14, 2001 3:29 PM
> Subject: Re: [PHP] What's XML's Purpose??
>
>
> > Hi Chris,
> >
> > @ 12:01:45 AM on 4/14/2001, Chris Anderson wrote:
> >
> > > Am I missing something here?
> >
> > This has been discussed many times. There was an extremely long thread
> > last year about XML, but I can't find it in the archives.
> >
> > Here's a good start:
> >
> > http://marc.theaimsgroup.com/?l=php-general&m=97969195010857&w=2
> >
> > Use the 'next in thread' link to follow the thread.
> >
> > -Brian
> > --
> >  PGP is spoken here: 0xE4D0C7C8
> >  Please, DO NOT carbon copy me on list replies.
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] PHP without a webserver

2001-04-14 Thread Plutarck

Ahh, so it's the location of the script that get's passed.

Now, if the script was coming from a program, is there a way to hand the
file directly to PHP, or will a temporary file have to be used?

So if a user filled in a form and clicked a button in the program, the
program would toy with the form a little, then send the form to PHP. Is that
possible using the CGI executible?


--
Plutarck
Should be working on something...
...but forgot what it was.


"Brian Clark" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi Plutarck,
>
> @ 2:11:35 PM on 4/14/2001, Plutarck wrote:
>
> > Ah, even better. However, how would the script be passed to PHP? As
> > a command line argument?
>
> Install the CGI executable of PHP in c:\php
>
> In your autoexec.bat:
>
> SET PATH=c:\php;%PATH%
>
> Reboot.
>
> From the command line:
>
> php -q script.php
>
> And read about $argc and $argv. If you're familiar with C, those
> shouldn't be a problem.
>
> -Brian
> --
>  PGP is spoken here: 0xE4D0C7C8
>  Please, DO NOT carbon copy me on list replies.
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] Supplied argument is not a valid MS SQL-Link resource

2001-04-14 Thread Plutarck

http://us.php.net/manual/en/function.mssql-select-db.php

*_select_db does not return a connection id, it returns true or false.

Just change your script like this:

$Conn=mssql_connect('192.168.1.20','username','password');
mssql_select_db('My_Database',$Conn);
$QueryString="select id, name from my_table";
$Test=mssql_query($QueryString, $Conn);


That should work just fine.


--
Plutarck
Should be working on something...
...but forgot what it was.




""davek"" <[EMAIL PROTECTED]> wrote in message
9ba2po$jnb$[EMAIL PROTECTED]">news:9ba2po$jnb$[EMAIL PROTECTED]...
> Does anybody know how to fix this error?  "Supplied argument is not a
valid
> MS SQL-Link resource"  I am running:
>
> NT4
> MSSQL7.0
> IIS4
> PHP 4.0.4pl1
>
> I've been running php3 for some time now without any problems but want to
> upgrade to 4.  This error seems to be occuring at the mssql_query()
> function.
>
> $Conn=mssql_connect('192.168.1.20','username','password');
> $ThisConnect=mssql_select_db('My_Database',$Conn);
> $QueryString="select id, name from my_table";
> $Test=mssql_query($QueryString, $ThisConnect);
>
> Please help! Thanks.
> Dave
>
>
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] PHP without a webserver

2001-04-14 Thread Plutarck

Ah, even better. However, how would the script be passed to PHP? As a
command line argument?


--
Plutarck
Should be working on something...
...but forgot what it was.


"Jeroen Wesbeek" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> well actually you could compile php4
> on it's own so you get a php executable which
> you can use as an interpreter for php4 scripts...
> no webserver needed
>
>
> dowebwedo
> Jeroen Wesbeek
> .programming
> Nieuwekade 213 | 3511 RW Utrecht
> The Netherlands
> p 030 2380544 | f 020 8632045
>
>
> [roses are red, violets are blue,
>  I am schizophrenic and so am I ]
>
>
> -Original Message-
> From: Brian Clark [mailto:[EMAIL PROTECTED]]
> Sent: zaterdag 14 april 2001 19:53
> To: PHP is not a drug.
> Subject: Re: [PHP] PHP without a webserver
>
>
> Hi Plutarck,
>
> @ 11:37:09 AM on 4/14/2001, Plutarck wrote:
>
> > I've heard much about how PHP is far more than just a language for
> > web programming, and I agree. I agree enough that I would like to
> > actually try it. I'd like to use PHP scripting in a C/C++ program
> > that doesn't need a webserver as an intermediary.
>
> It doesn't. You don't have to have a web server installed in order to
> use PHP.
>
> -Brian
> --
>  PGP is spoken here: 0xE4D0C7C8
>  Please do not carbon copy me on list replies.
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




[PHP] PHP without a webserver

2001-04-14 Thread Plutarck

I've heard much about how PHP is far more than just a language for web
programming, and I agree. I agree enough that I would like to actually try
it. I'd like to use PHP scripting in a C/C++ program that doesn't need a
webserver as an intermediary. I basically want to use PHP in a
standalone/TCP-IP program rather than having to build a whole "IMF-esk"
hairball myself.


Are there any articles or documentation which focuses, or at least would
give me useful information, on how such a task would be accomplished? I'm
looking at the API documentation itself which will be helpful, but is there
anything a little more "pointed" than that?

I'd love to see PHP grow an arm of offline scripting. It would just be
_perfect_ for compiling high-level developer-friendly scripts into a format
usable for 3D real-time environment manipulation, for instance.



--
Plutarck
Should be working on something...
...but forgot what it was.





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




Re: [PHP] Selected Radio Buttons

2001-04-14 Thread Plutarck

I'm not sure I understand. In the first loop you are seing if
$article_active equals y. And no where in the code do you set
$article_active to anything else.

Why would you think $article_active would be anything but "y" or "n"?


--
Plutarck
Should be working on something...
...but forgot what it was.


"Jordan Elver" <[EMAIL PROTECTED]> wrote in message
01041415474000.10298@localhost">news:01041415474000.10298@localhost...
> Hi,
> I think I'm being stupid. Why won't this code work. The $article_active
> variable is showing y when I echo it?
>
>
> if($article_active == 'y') {
> echo"Yes";
> } else {
> echo"Yes";
> }
>
> if($article_active == 'n') {
> echo"No";
> } else {
> echo"No";
> }
>
>
> Thanks,
>
> Jord
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] help on something simple?

2001-04-14 Thread Plutarck

What function are you calling on $result when it returns the error?

Try doing this, all in one place:

$db = mysql_connect("localhost", "username");
mysql_select_db("subsurface_net", $db);

$result = mysql_query("SELECT * FROM customer_genre", $db);

echo mysql_num_rows($result);


When you use a SELECT query the function "mysql_affected_rows" is not valid.
When using an UPDATE, INSERT, or DELETE query, "mysql_num_rows" is invalid.

That may be your problem, because the code you paste in seems not to have
anything wrong with it.


--
Plutarck
Should be working on something...
...but forgot what it was.


""Andrew Durk"" <[EMAIL PROTECTED]> wrote in message
9b9n47$7ej$[EMAIL PROTECTED]">news:9b9n47$7ej$[EMAIL PROTECTED]...
> I can get connected to my host's MySQL database w/o error, but I cannot
seem
> to do anything after that.
>
> I do:
> $db = mysql_connect("localhost", "username");
> mysql_select_db("subsurface_net",$db);
>
> No problem, but if I do this:
> $result = mysql_query("SELECT * FROM customer_genre",$db);
>
> I eventually get:
> Warning: 0 is not a MySQL result index in /test.phtml on line 35
>
> And customer_genre _is_ a table in my database...
>
> Help, anyone!?
> --
> Andrew Durk
> [EMAIL PROTECTED]
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] Explain recordset

2001-04-14 Thread Plutarck

$result holds a "resource id". When you do anything like mysql_fetch_row it
sends a request to the database. All results, until you "fetch" them, are
kept in MySQL.

If you want to store the results away from the DB you will need to do
something like:

while ($array[] = mysql_fetch_row($result));

That will store all the results into $array...hopefully.


--
Plutarck
Should be working on something...
...but forgot what it was.



"Mike P" <[EMAIL PROTECTED]> wrote in message
9b9lvb$u57$[EMAIL PROTECTED]">news:9b9lvb$u57$[EMAIL PROTECTED]...
> I'm trying to figure out the way recordsets are handled with php and
> mysql.After I issue a query to the Db with $result = mysql_query ($query)
> is the recordset contained in $result or is this just a pointer.I want a
> persistant recordset on the client computer that can be manipulated
without
> going to the server.Is this possable.fetchrow seems to go to the server
> each time or am i wrong?
> Thanks
> Mike P
> [EMAIL PROTECTED]
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] counter reseting help!

2001-04-14 Thread Plutarck

How are you saving the current counter amount?

For instance if it's in a database, add a date field.

Check to see if the date is more than 24 hours old before displaying the
current counter. If it is then update the database and make the counter
number 0. If it's not older than 24 hours, just do your counter as normal.


--
Plutarck
Should be working on something...
...but forgot what it was.


""McShen"" <[EMAIL PROTECTED]> wrote in message
9b9mg0$26o$[EMAIL PROTECTED]">news:9b9mg0$26o$[EMAIL PROTECTED]...
> hi
>
> I am writing a small counter for my site. But i am not sure how to reset
the
> counter every 24h. How should i do it? any suggestions would be much
> appreaciated!
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] Sessions?

2001-04-14 Thread Plutarck

Ahh. I reread your post and now I see what you were originally asking.


Yes, sessions are the best way to handle it then. The variables "live" by
sending a specially augmented header to the client. The header sort of
"sticks" to the client so that their session ID is automatically sent in
their requests for new pages. It's basically a cookie that isn't stored on
the persons hard drive.

There are instances where a person's browser is, for lack of a better word,
"teflon coated" so that the header/cookie just doesn't "stick" to them.
That's when PHP appends the "PHPSESSID=[long string of characters]" to all
of your links.

So the short answer to your question is "Yes, it's the best way to handle
it".

But it must be noted that when someone submits a variable through the URL it
will _not_ change the value of any session variables. You must do that
explicitly in your code.


--
Plutarck
Should be working on something...
...but forgot what it was.


""Ashley M. Kirchner"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Plutarck wrote:
>
> > The way I do it is to stick all those global variables into an include
file,
> > which I usually named something like global.php.
>
>   Um no.  These aren't static variables.  They change from page to
> page.  For example, page one
>
>   $foo=0, $bar=3, $baz='Closed'
>
> They follow a particular link that changes them to,
>
>   $foo=1, $bar=3, $baz='Open'
>
> They follow yet another link, and this time only $bar changes,
>
>   $foo=1, $bar=2, $baz='Open'
>
>   Right now, the way I've always done that was to include it in the
> URL: next_page.php?foo=0$bar=3&baz='Closed' - they follow a link, and
> those variables get tacked again.  If it's a form, I pass hidden input
> tags.
>
>   But, there's got to be a better, transparent way of doing this.  No?
>
> AMK4
>
> --
> H | Hi, I'm currently out of my mind.  Please leave a message.  BP!
>   |
>   ~
>   Ashley M. Kirchner <mailto:[EMAIL PROTECTED]>   .   303.442.6410 x130
>   Director of Internet Operations / SysAdmin. 800.441.3873 x130
>   Photo Craft Laboratories, Inc. .eFax 248.671.0909
>   http://www.pcraft.com  .3550 Arapahoe Ave, #6
>   .. .  .  . .Boulder, CO 80303, U.S.A.
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] sorting multi-dimensional arrays

2001-04-14 Thread Plutarck

The easiest way is probably to just use a for loop.

For instance (no pun intended...well, maybe just a little one):

$imax = sizeof($joke);

for ($i = 0; $i < $imax; $i++)
{
if (sizeof($joke[$i]) > 1)
{
sort($joke[$i]);
}
}


That will handle the sorting of any two-dimensional array. It won't effect
the first dimension however, so if you want to sort that you will need to do
it first.


--
Plutarck
Should be working on something...
...but forgot what it was.



<[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I have a question about sorting multidimensional arrays. Here is my
problem:
>
> I have an 2-d array:
> $joke[1][rating]=10;
> $joke[2][rating]=20;
> $joke[3][rating]=15;
> 
>
> I would like to sort the jokes into an array based on the rating from
highest
> to lowest. The end result would be something like this:
> Joke 2 : 20 points
> Joke 3: 15 points
> Joke 1: 10 points
>
> How do I accomplish this?
>
> I have tried fooling around with sort(), arsort(), and array_multisort(),
but
> I just can't get it. Thank you very much for your time.
>
> Shane
>



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




Re: [PHP] CLASSES AND OBJECTS..

2001-04-14 Thread Plutarck

Nope, I'm afraid not.

Currently PHP will support single level inheritance only. So A can extend B,
but C cannot extend B. You will need to create a class of B to extend it
with C.

I suppose PHP may one day support it, but I am guessing that the Zend API
can't currently handle it. I think it will need to be retooled.


Sounds like a nice thing to shoot for for PHP5, perhaps?


--
Plutarck
Should be working on something...
...but forgot what it was.


""alberto"" <[EMAIL PROTECTED]> wrote in message
9b9eu7$s6n$[EMAIL PROTECTED]">news:9b9eu7$s6n$[EMAIL PROTECTED]...
> Anyone know if one day PHP will support multiple inheritance?
> I think it's very important...
>
> For example, will PHP support this code:
>
> class A extends B,  extends C   {
> 
> }
>
> where B and C are classes?
>
> Thanks!
> Alberto
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




[PHP] A slightly amusing, though mostly dangerous, endless loop

2001-04-14 Thread Plutarck

This is a bug which was apparently fixed in v 4.0.4pl1 at least, but it
still present in 4.0.3

I just found it kind of amusing and it makes a nice warning.

Consider this:

print_r($GLOBALS);


That's it. It prints all the variables available, however part of it is an
array called GLOBALS. Which then prints all available variables, including
an array called GLOBALS...

And it will continue until you hit the Stop button or until the script times
out. But if you have ignore.user.abort on, it will continue till it times
out. If you've screwed with your scripts timeout settings...

...so be wary of that, and ensure you don't try and print out the variables
available in GLOBALS in older versions of PHP. It was fixed with the
anti-recursion feature, which automatically breaks endless loops.



--
Plutarck
Should be working on something...
...but forgot what it was.





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




Re: [PHP] PHP & MySQL Search Results

2001-04-14 Thread Plutarck

In a MySQL query you can use the LIMIT keyword, like in phpmyadmin.

Use limit 0,10 to get the first ten results in a query.

Then do the query again but use 10,10 for the limit.

The first number is the "offset", and the second one is the maximum results
to return.

That's the way most people do "pages".


--
Plutarck
Should be working on something...
...but forgot what it was.


""Jason Caldwell"" <[EMAIL PROTECTED]> wrote in message
9b8rgd$oot$[EMAIL PROTECTED]">news:9b8rgd$oot$[EMAIL PROTECTED]...
> Does anyone know (or have) of a good example of how to create search
results
> like a Yahoo or MSN search?
>
> for example:
>
> Say I do a search for "cars" and there are 10,000 records in my table that
> match "car"... I would like to show the results in blocks of (say) 25 at a
> time, therefore I will need a "Next Results", "Previous Results", "Total
> Records found that match my query", and perhaps, between the "Previous
> Results" and "Next Results" a set of numbers like so;
>
> 
>
> The numbers being "jump to" links, etc.
>
> Thanks.
> Jason
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] Reading a file and changing tag values

2001-04-13 Thread Plutarck

All you need is a regular expression, provided by ereg function or preg
functions.

You'd have the regex look for 

Then just adjust the result as you want it to appear.


You'll need to either search around for code that already does this, or be
willing to learn regular expressions (which you should do anyway).

Otherwise it will seem impossible.


--
Plutarck
Should be working on something...
...but forgot what it was.


""Brett"" <[EMAIL PROTECTED]> wrote in message
012701c0c4a2$cbc7f840$LocalHost@Default">news:012701c0c4a2$cbc7f840$LocalHost@Default...
> I have been able to find out how to read a file and replace certain
matches,
> but I want to be able to take a web page stored in a string and change the
>  tags and add www.mysite.com?page=   before the actual link value
so
> the new url would read www.mysite.com?page=original_url.  Can I do this
and
> if so will someone give me an idea how?   Thanks.
>
> Brett
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] Sessions?

2001-04-13 Thread Plutarck

The way I do it is to stick all those global variables into an include file,
which I usually named something like global.php.

Just do that and require() the file at the top of all your scripts which
need it. Keep things like page color, text color, font, etc in the global
file.

If you ever need to change the color before you use them, just alter the
colors at the top of your scripts after the require(), but before you "do"
anything with them (such as echo them to the browser).


Once you have the site working like that, it's easy to add per-user
customization. So in the future you just check to see if a session variable
is set, and if it is you replace the global variable value with the session
variable value.


--
Plutarck
Should be working on something...
...but forgot what it was.


""Ashley M. Kirchner"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> I'm used to building pages that contain links that have variables
> passed on the URL  (somepage.php?var1=1&var2=2...) and I'm now looking
> into building a site that will have quite a bit of these that will have
> to 'live' from page to page, occasionally getting reset, or changed by
> new page.  I'm told sessions are the way to go (specially since this
> will have several users using the site).
>
> And consequently, now I'm lost.  Sessions..okay..how does the
> variable 'live' from one to the other?  What do I have to do different
> when setting variables that will be used globally across the site (and
> reset/changed from time to time)?  I don't need to STORE any of these
> (say for a future log-in), however if it's easy (easier?) to do it that
> way, that's fine as well.  I may eventually start making the site
> customizable on a per user basis.  But for right now, I need a startup
> primer first.
>
> AMK4
>
> --
> W |
>   |  I haven't lost my mind; it's backed up on tape somewhere.
>   |
>   ~
>   Ashley M. Kirchner <mailto:[EMAIL PROTECTED]>   .   303.442.6410 x130
>   SysAdmin / Websmith   . 800.441.3873 x130
>   Photo Craft Laboratories, Inc. .eFax 248.671.0909
>   http://www.pcraft.com  . 3550 Arapahoe Ave #6
>   .. .  .  . .   Boulder, CO 80303, USA
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] Do any of you provide hosting?

2001-04-12 Thread Plutarck

http://cihosts.com/ has always made me drool...you might only be one of
90,000, but they are very very customer-centric.

They'll do anything to make you happy it would seem, but if you get a
dedicated server...you are basically like a little god to them, lol. 24/7
unlimited tech support, as long as they don't have to actually do anything
with your setup. They'll tell you what to do to, say, correctly configure
sendmail, but if they have to do it for you it costs money (obviously).

Still, their ecommerce plan has the most space I've ever seen for such a low
price. 700 megs for 25$ a month *drool*

Plus they charge for bandwidth, which is only believable because they are
the largest DNR/ASP/ISP around. Or at least they are an "industry
leader"...*still drooling over the dedicated servers*


Anyway, for cheaper service I've talked to www.elitehosts.com tech support
and they are quite nice. They also allow unlimited subdomains, email
accounts, and ftp accounts, but their bandwidth and storage space is low.

For $14 you get 50mb and 3gigs of transfer.

If you are looking to pay under $18, there are plenty of good choices, but
for over that I'd go with cihosts. The space they provide is just
monstrous...but I don't know about subdomains.

I couldn't find a mention on subdomains :(

They provide 50 ftp accounts and 10 telnet on the smallest ecommerce
plan...bah, but zero mentions of subdomains. You could always ask :)


--
Plutarck
Should be working on something...
...but forgot what it was.


""Chris Anderson"" <[EMAIL PROTECTED]> wrote in message
000201c0c373$a1d01d40$b01012d1@null">news:000201c0c373$a1d01d40$b01012d1@null...
I currently am using Thehostpros.com for my hosting, but I can't say its
been a pleasant experience. I had to have them install PHP because they are
more ASP oriented. So that cost me more. Then I wanted MySQL and they have
spent 3 months saying they'll install that. Basicly here's what I need:
Someone who can host my domain (I own the domain already)
Can provide MySQL and PHP. Both up-to-date.
Can give around 60 meg of space (ballpark, less should be fine)
Also a way to set up subdomains without needing to go through the admin
(some hosts can do his). But this isn't necessary.
Can anyone help with that?





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




[PHP] Problem solved, thanks!

2001-04-12 Thread Plutarck

"distinct" and "order by" are all I need.

Thanks to John Keith and John Perkins for their quick answers!


--
Plutarck
Should be working on something...
...but forgot what it was.


""Plutarck"" <[EMAIL PROTECTED]> wrote in message
9b6229$48j$[EMAIL PROTECTED]">news:9b6229$48j$[EMAIL PROTECTED]...
> I need to query a MySQL database with something like: "select guild from
> table_name"
>
> I'm going to take "guild" and eventually make a drop-down box with the
> information, but that I can handle.
>
> The thing is, I want to have only one entry for each guild, and I want
them
> to be in alphabetical order.
>
> My current idea is to read all the results into an array with a while
loop,
> then use array_unique on it, then run sort on that.
>
> Is this really the best way to do it, or am I missing a simpler solution?
>
>
>
> --
> Plutarck
> Should be working on something...
> ...but forgot what it was.
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] crap! look at the mess that i made!

2001-04-12 Thread Plutarck

lmao

No problem. And my problem is solved :)

Thanks to you and John Keith for your quick help. Greatly reduces the amount
of work I need to do in multiple instances!


--
Plutarck
Should be working on something...
...but forgot what it was.


""Jason N. Perkins"" <[EMAIL PROTECTED]> wrote in message
9b64n1$ha4$[EMAIL PROTECTED]">news:9b64n1$ha4$[EMAIL PROTECTED]...
> sorry about all the posts...i was getting a message that an error had
> occured and my message wouldn't be posted. like a dumbass i took it at
face
> value...
>
> --
>
> :: jason n. perkins
> :: email -> jason[at]somebodydial911.com
> :: url -> www.somebodydial911.com
> :: "for a vegetarian rents, you're a (obscene gerund, expletive) evil
shot."
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




[PHP] Getting one of each result from MySQL

2001-04-12 Thread Plutarck

I need to query a MySQL database with something like: "select guild from
table_name"

I'm going to take "guild" and eventually make a drop-down box with the
information, but that I can handle.

The thing is, I want to have only one entry for each guild, and I want them
to be in alphabetical order.

My current idea is to read all the results into an array with a while loop,
then use array_unique on it, then run sort on that.

Is this really the best way to do it, or am I missing a simpler solution?



--
Plutarck
Should be working on something...
...but forgot what it was.



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




Re: [PHP] no reponse -- Need FTP help

2001-04-12 Thread Plutarck

You don't have to make the user wait for confirmation.

What you could do if you wanted to be sure to tell the user if the
connection failed or not, is to have him give his email addy for
confirmation. When the file move is done, make a call to mail().

Once you've gotten the file from the user, display a confirmation that the
file was recieved and will now be perminately stored.

Stick your file move code, ftp or whatever, into a function. Then use
http://us.php.net/manual/en/function.register-shutdown-function.php to call
the function.

If the function does it's job properly, have it mail the user with success.
Otherwise you probably want to have it send the error to yourself, or email
the user that the file didn't work.


Only do this all once you are reasonably certain that there are no bugs in
the code. Otherwise if there is an error, you'll never know it!


--
Plutarck
Should be working on something...
...but forgot what it was.


"David Minor" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> hmm, good idea, but the only access I have to the remote machine is ftp.
> Can't put a script on it.  I am getting the feeling that I actually have
to
> move the file(s) from the user's machine to my server and then transfer
them
> to the FTP site?  I was hoping there would be a way to transfer directly
> from the user to the remote FTP site.  But now that I think about it, I
> guess probably not.  so the trick would be to let the form upload them to
> /tmp and then move them to the remote site.  Takes twice as long. :(  I'm
> talking about 10-15 MB at a time while the user waits for confirmation.
> That's a long wait (even moving it once).  Any ideas?
>
> dm
>
> Plutarck wrote:
> >
> > Or you could just put a PHP script on the target server that will take
the
> > input via GET and store the data for you. So you don't even have to use
FTP.
> >
> >
> > --
> > Plutarck
> > Should be working on something...
> > ...but forgot what it was.
> >
> >
> > "Lindsay Adams" <[EMAIL PROTECTED]> wrote in message
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> >> sure.
> >>
> >> keep track of the files on the server drive, then open a connection
using
> >> fopen() and fputs the contents of each file.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] removing slashes from template file

2001-04-12 Thread Plutarck

http://us.php.net/manual/en/function.set-magic-quotes-runtime.php


Someone should make the manual search a little better...it couldn't find a
search for "magic" ;(


--
Plutarck
Should be working on something...
...but forgot what it was.


"Franklin Hays" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> Chris,
>
> This is correct.  The provider has the following:
>
> magic_quotes_gpc ON ON
> magic_quotes_runtime ON ON
> magic_quotes_sybase OFF OFF
>
> and I have:
>
> magic_quotes_gpcON  ON
> magic_quotes_runtimeOFF OFF
> magic_quotes_sybase OFF OFF
>
> Is there anyway I can turn this off locally?  Such as in .htaccess or
> within the script itself?
>
> Thanks for the feedback!
>
> //frank
>
> |
> |Check your magic quotes settings on both systems using phpinfo(). I bet
> |magic_quotes_runtime is set on in your provider's settings but not your
> |development system's php.ini.
> |
> |--
> |PHP General Mailing List (http://www.php.net/)
> |To unsubscribe, e-mail: [EMAIL PROTECTED]
> |For additional commands, e-mail: [EMAIL PROTECTED]
> |To contact the list administrators, e-mail: [EMAIL PROTECTED]
> |
> |
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] no reponse -- Need FTP help

2001-04-12 Thread Plutarck

Or you could just put a PHP script on the target server that will take the
input via GET and store the data for you. So you don't even have to use FTP.


--
Plutarck
Should be working on something...
...but forgot what it was.


"Lindsay Adams" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> sure.
>
> keep track of the files on the server drive, then open a connection using
> fopen() and fputs the contents of each file.
>
> On 4/12/01 3:13 PM, "David Minor" <[EMAIL PROTECTED]> wrote:
>
> > Well, I didn't get a response from my previous post, so I'm trying
again.  I
> > need to collect a group of files in a form and ftp them to a different
> > server than the script is located on.  Can this be done? how?
> >
> > Thank you,
> > David Minor
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] is_null

2001-04-12 Thread Plutarck

It doesn't tell you if a variable is actually null, but unless you
specifically need to know if it is actually "NULL", just testing for truth
is usually enough.

For most uses it works fine, but if you really need to know wether or not
it's null, take one of the other suggestions.


For instance, if you need to see if someone submitted something to the
$username variable, use:

if ($username)
{
// stuff
}


--
Plutarck
Should be working on something...
...but forgot what it was.


"Jennifer" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I wanted to use is_null, but it isn't available in my version
> (4.0B2)
>
> What would be an equivalent?  I'm fairly new to PHP.
>
> I was using isset, but sometimes it is set to Null.
>
> Null values are unacceptable, but zero is a perfectly acceptable
> value for what I want.
>
> Jennifer
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] What variable are being sent to my script?

2001-04-12 Thread Plutarck

Even better, there is a whole PHP function just for that.

I use the following code in scripts where I need to debug the available
variables and their values:

// Print all available variables.
$arr = get_defined_vars();

print_r($arr);


I love print_r ;)


--
Plutarck
Should be working on something...
...but forgot what it was.


""Ashley M. Kirchner"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Brandon Orther wrote:
>
> > I there a way for me to find out what variables are being sent to
script?
> > Example:
> > http://www.myscript.com/myscript.php?var1=asdf&var2=asdf
> >
> > that above would be $var1 and $var2
>
> Stick  at the end of your script, and go through it so
you
> can see all the nifty variables that PHP sets for you when you pass
arguments
> to it.  Good way to learn too.
>
> AMK4
>
> --
> W |
>   |  I haven't lost my mind; it's backed up on tape somewhere.
>   |
>   ~
>   Ashley M. Kirchner <mailto:[EMAIL PROTECTED]>   .   303.442.6410 x130
>   SysAdmin / Websmith   . 800.441.3873 x130
>   Photo Craft Laboratories, Inc. .eFax 248.671.0909
>   http://www.pcraft.com  . 3550 Arapahoe Ave #6
>   .. .  .  . .   Boulder, CO 80303, USA
>
>



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




Re: [PHP] Problem?

2001-04-12 Thread Plutarck

Nothing keeping you from doing it, but it can occasionally be a pain to have
everything on just one page without using includes.

I like to take all my function declarations and stick them in another file
(if it's database related I stick it in the database file, or authorization
related goes in the auth file, etc). Then you just include them at the top
of pages where you'll need them.

It really speeds up your scripts because code that won't be used right then
isn't evaluated at all.

But if you want to, say, have a 500 page test script on one page, you could
probably best do it by using includes.

Makes it more readable and faster too, if you aren't going to spit out the
whole thing at once.


--
Plutarck
Should be working on something...
...but forgot what it was.


"Wee Chua" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi all,
> I have a question that can I do my dynamic web application in one page
> without any other hyperlink page if I have all the classes needed to run
the
> dynamic web application? Are there any Pros and Cons for running
application
> on one page? The application is mainly used for ERP. Thank you.
>
> Calvin Chua
> Systems Analyst
> InterClean Equipment, Inc.
> 734-975-2967
> www.InterClean.com
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] Newbie MySQL Table Work

2001-04-12 Thread Plutarck

Use the mysql_query as mentioned. You need the CREATE TABLE syntax.

For all your basic SQL syntax ponderings, I found a great site:

http://sqlcourse.com

Helped me out tremendously.

For the create table:

http://sqlcourse.com/create.html


--
Plutarck
Should be working on something...
...but forgot what it was.


""Chris Anderson"" <[EMAIL PROTECTED]> wrote in message
000301c0c373$a3522960$b01012d1@null">news:000301c0c373$a3522960$b01012d1@null...
Alright I finally got around to installing MySQL on my cpu, and I
sucessfully created a database. Now I have a ryyy dumb question.
In the manual I see no functions for creating tables in a database through
code. Maybe I'm just missing the function. Can someone help me?




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




Re: [PHP] Easy News Script

2001-04-12 Thread Plutarck

It's easy once you get the hang of it.

I use:

// Format of MySQL DATETIME timestamp.
$time = date("Y-m-d H:i:s");

$time is ready for insertion into MySQL. To get the time out though you'll
need to use the unix timestamp function in mysql.

That's a bit tougher to get the hang of :)


--
Plutarck
Should be working on something...
...but forgot what it was.


""Zeus"" <[EMAIL PROTECTED]> wrote in message
004e01c0c3b0$5dc7a7c0$1cd218d2@zeus">news:004e01c0c3b0$5dc7a7c0$1cd218d2@zeus...
> True but hehe I can't seem to do it witht he datetime thing.
>
> I'm not sure how am I going to insert the date and time into the mySQL
> database.
>
> - Original Message -
> From: Chris Anderson <[EMAIL PROTECTED]>
> To: Zeus <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Friday, 13 April, 2001 1:27 AM
> Subject: Re: [PHP] Easy News Script
>
>
> > I prefer to write my own
> > - Original Message -
> > From: "Zeus" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Thursday, April 12, 2001 10:11 AM
> > Subject: [PHP] Easy News Script
> >
> >
> > I'm sure many of you heard of newsphp ? (the newspro-clone).
> >
> > Somehow I felt attached to it except that it doesn't use databases for
its
> > file storing.
> >
> > Does anyone know a good similar script (easy to setup) that uses mySQL?
> >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] Newsgroups like this one?

2001-04-12 Thread Plutarck

lol, no problem :)

I might use the mail list anyway...by making a new Message Rule in outlook
express I can stuff the messages over into their own folder.

Then I just list the account last so my important messages get checked
first, and viola.


Someone really should create a listing of techie newsgroups ;)


--
Plutarck
Should be working on something...
...but forgot what it was.


""Alvin Tan"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> yes you're right - i seem to have misread plutarck's mail. apologies ;)
>
> @lvin
>
> -Original Message-
> From: John R.Marshall [mailto:[EMAIL PROTECTED]]
> Sent: Friday, April 13, 2001 4:04 AM
> To: [EMAIL PROTECTED]
> Subject: RE: [PHP] Newsgroups like this one?
>
>
> On 11 Apr 2001 21:07:01 -0700 Alvin Tan said...
>
> > Hi Plutarck,
> >
> > The 'mailing list' at MySQL _is_ very much like this one and is also
very
> > active. Send mail to [EMAIL PROTECTED] to subscribe.
>
> Except that it is a *mailing* list not a *newsgroups* format (like
> news.php.net) which was what the Plutark was asking about. ;-)
>
> Personally I don't know how anyone can stand getting this many posts
> cluttering up their mail reader. I'll stick with Gravity thank you very
> much. :-)
>
> And sorry I don't know about any mySQL newsgroups..
>
> --
> John R. Marshall
> JRM Studios.com - http://www.jrmstudios.com
> The Hotrodding Network - http://www.hotrodding.net
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] HTTP_POST_VARS

2001-04-12 Thread Plutarck

Try doing a print_r in the place where you are trying to print data.

So you can see if a second dimension slipped in there, or if there is some
other problem.

I know that the post/get vars are always associative arrays, but I assume
refering to them by their numeric keys should work...don't see why it
wouldn't.


--
Plutarck
Should be working on something...
...but forgot what it was.


""Mat Marlow"" <[EMAIL PROTECTED]> wrote in message
9b4f3s$3uo$[EMAIL PROTECTED]">news:9b4f3s$3uo$[EMAIL PROTECTED]...
> Hi all,
> I'm having trouble retrieving data from $HTTP_POST_VARS. Whenever I try to
> print something from it using print($HTTP_POST_VARS[0]); it just prints
> "Array". And I know it works because I've done it once and can't do it
> again!
> Am I missing something glaringly obvious?
>
> Thanks for the help,
>
> Mat
> PS. track_vars is ON!
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] Editors ... calling them, or PHP-based one? (doh!)

2001-04-12 Thread Plutarck

Well after looking at the file I just downloaded...the specification of RTF
is 164 pages long.

Good lord...*chokes an all the information*


Ever considered just forcing the people to learn HTML instead? *smile*


--
Plutarck
Should be working on something...
...but forgot what it was.


""Plutarck"" <[EMAIL PROTECTED]> wrote in message
9b4e3u$eoj$[EMAIL PROTECTED]">news:9b4e3u$eoj$[EMAIL PROTECTED]...
> Jackpot! Cha-ching!
>
> That site triggered my memory!
>
> I remember downloading a program from some obscure site which was suppose
to
> be able to view a huge amount of files which are most often used in games.
I
> wanted to see the art :)
>
> Anyhoo, it reminded me of another site which is linked on that website,
> which is:
>
> http://www.wotsit.org/
>
> *dances*
>
> For the RTF:
>
> http://www.wotsit.org/search.asp?page=3&s=text
>
> Oooo I'm soo happy...toys toys toys! So many wonderful bits and bytes to
> play with now...
>
>
> --
> Plutarck
> Should be working on something...
> ...but forgot what it was.
>
>
>
>
> "Dezider Góra" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Thinking about this, about a week ago, there was a discussion about
> parsing word
> > document. Just to dig the text from doc. It sounds interesting, and
since
> I have
> > in my crazy mind an idea, that I'd create a database of all documents
that
> were
> > ever created in our company and put them in to the database, I'd also
need
> to
> > know what's in those docs. So I followed the given link and it seems to
be
> > pretty easy. Just install a program and pass it a document and it will
> parse the
> > text. The link is:
> > http://wvware.sourceforge.net/
> > Check out the site, may be you could find something similiar for rtf
> documents,
> > 'cause I think its format is much easier to "crack".
> >
> > hth
> > Dezider.
> >
> > Plutarck wrote:
> >
> > > Ick...I'd say it's a good idea, but it's going to be a bi...tter fight
> with
> > > technology.
> > >
> > > First, you have to have some application do the loading/unloading. PHP
> can't
> > > do that, of course.
> > >
> > > But, you could use some form of java...but you'd have to get fancy. Or
> you
> > > could just use file upload in a form, which is easier.
> > >
> > > If you do that, you need only parse out the file.
> > >
> > > The best way to do that is pick a text format that does what you want
it
> to
> > > do, and is universal across platforms. You don't even need to worry
> about
> > > the editor they use, as long as it's saved in the proper format.
> > >
> > > I reccomend you use either a word document, or perhaps Rich Text
Format
> is
> > > best (rtf).
> > >
> > > Then you just have to figure out how text is saved in that format, and
> > > viola. You just use PHP to go from there...
> > >
> > > I'm sure it's easier said than done, and I have absolutely no clue
> how
> > > the content of rtf files is different from txt (but I'd love to
know!),
> but
> > > I can see it being very possible if you pick only a few standard file
> > > formats, and use the file upload features.
> > >
> > > It's actually a very good idea. I'm surprised no one has done
it...which
> > > should probably worry you ;)
> > >
> > > --
> > > Plutarck
> > > Should be working on something...
> > > but forgot what it was.
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] Editors ... calling them, or PHP-based one?

2001-04-12 Thread Plutarck

Jackpot! Cha-ching!

That site triggered my memory!

I remember downloading a program from some obscure site which was suppose to
be able to view a huge amount of files which are most often used in games. I
wanted to see the art :)

Anyhoo, it reminded me of another site which is linked on that website,
which is:

http://www.wotsit.org/

*dances*

For the RTF:

http://www.wotsit.org/search.asp?page=3&s=text

Oooo I'm soo happy...toys toys toys! So many wonderful bits and bytes to
play with now...


--
Plutarck
Should be working on something...
...but forgot what it was.




"Dezider Góra" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Thinking about this, about a week ago, there was a discussion about
parsing word
> document. Just to dig the text from doc. It sounds interesting, and since
I have
> in my crazy mind an idea, that I'd create a database of all documents that
were
> ever created in our company and put them in to the database, I'd also need
to
> know what's in those docs. So I followed the given link and it seems to be
> pretty easy. Just install a program and pass it a document and it will
parse the
> text. The link is:
> http://wvware.sourceforge.net/
> Check out the site, may be you could find something similiar for rtf
documents,
> 'cause I think its format is much easier to "crack".
>
> hth
> Dezider.
>
> Plutarck wrote:
>
> > Ick...I'd say it's a good idea, but it's going to be a bi...tter fight
with
> > technology.
> >
> > First, you have to have some application do the loading/unloading. PHP
can't
> > do that, of course.
> >
> > But, you could use some form of java...but you'd have to get fancy. Or
you
> > could just use file upload in a form, which is easier.
> >
> > If you do that, you need only parse out the file.
> >
> > The best way to do that is pick a text format that does what you want it
to
> > do, and is universal across platforms. You don't even need to worry
about
> > the editor they use, as long as it's saved in the proper format.
> >
> > I reccomend you use either a word document, or perhaps Rich Text Format
is
> > best (rtf).
> >
> > Then you just have to figure out how text is saved in that format, and
> > viola. You just use PHP to go from there...
> >
> > I'm sure it's easier said than done, and I have absolutely no clue
how
> > the content of rtf files is different from txt (but I'd love to know!),
but
> > I can see it being very possible if you pick only a few standard file
> > formats, and use the file upload features.
> >
> > It's actually a very good idea. I'm surprised no one has done it...which
> > should probably worry you ;)
> >
> > --
> > Plutarck
> > Should be working on something...
> > but forgot what it was.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] sending mail.. PLEASE HELP!

2001-04-12 Thread Plutarck

You need to alter your php.ini file in the mail section to point the proper
path to sendmail, and you need some form of sendmail there for PHP to point
to in the first place!

So there's no just calling mail() without setting stuff up.


--
Plutarck
Should be working on something...
...but forgot what it was.


""Jude Sanglitan"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> If I was to send mail could I possibly send it using mail() function or I
> need to setup some things to make it work properly? Everytime I run my PHP
> script, it always gives me an Error: Failed to Connect to
> c:\inetpub\wwwroot\ and it was pointing to my mail() function.
>
> I just followed what the book says and I guess there is a part of it that
I
> missed or whatever. Could someone help me? Thanks!!!
>
>
> Jithy
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] www.php.net - gateway timeout?

2001-04-12 Thread Plutarck

> Dearly hope it's not 4.0.5-dev that's the prob! Been wanting to try it,
> which is why I can't use uk.php.net!

LOL! That's exactly what I was thinking...hehe.

Maybe the people in charge just got back from apachecon, and figured out
what was wrong? Or maybe just getting back from apachecon was what was
wrong? ;)


--
Plutarck
Should be working on something...
...but forgot what it was.




""maatt"" <[EMAIL PROTECTED]> wrote in message
9b4cbu$hdt$[EMAIL PROTECTED]">news:9b4cbu$hdt$[EMAIL PROTECTED]...
> > 208.247.106.187, running Apache/1.3.12 (Unix) DAV/0.9.18-dev
> PHP/4.0.5-dev.
>
> Dearly hope it's not 4.0.5-dev that's the prob! Been wanting to try it,
> which is why I can't use uk.php.net!
>
> > The site loads fine now, but last time I did it it was all being
rejected
> on
> > that hop. The server was refusing packets.
>
> Yup, fine for me too.
>
> Matt
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] www.php.net - gateway timeout?

2001-04-12 Thread Plutarck

I ran a few tracers and it seems that the server php.net is on is the
problem.

My packets are fine all the way along till final hop 13, which seems to be
located in Rochester NY, on the network of Choice One Communications, IP
208.247.106.187, running Apache/1.3.12 (Unix) DAV/0.9.18-dev PHP/4.0.5-dev.

The site loads fine now, but last time I did it it was all being rejected on
that hop. The server was refusing packets.


Maybe they are having problems with their server lately? It's been really
sporatic, so I switched my links to use us.php.net...annoying ;(


--
Plutarck
Should be working on something...
...but forgot what it was.



""maatt"" <[EMAIL PROTECTED]> wrote in message
9b4ahg$q9v$[EMAIL PROTECTED]">news:9b4ahg$q9v$[EMAIL PROTECTED]...
> Anyone else having probs getting through? Or is it just me? Been trying
> since the wee hours (GMT).
>
> --
> Matt Kynaston
> remove the green eggs before replying
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] php-lib questions

2001-04-12 Thread Plutarck

That sounds like a problem with the way you handle sessions.

What happens is your program tries to start a session, but the page isn't
sent if a session isn't started. It still shouldn't reply with a 404
though...search your script for header and see if you send any.

Once someone has the session, then the page will load correctly.

Muck through your php code and see if there are any conditions or loops
which require a session to be running.


Still, that shouldn't happen and it's probably one of those bugs that you
can't figure out why they happen, or what causes them, but after tinkering
around suddenly everything works.


One thing to try, if it's available, is use the ob_* functions as a
debugger. Stick an obstart at the begining and a ob_end_flush at the end,
and see if the problem disappears magically.

Odd what sometimes fixes things...


--
Plutarck
Should be working on something...
...but forgot what it was.


""Mark"" <[EMAIL PROTECTED]> wrote in message
9b4ar1$t6i$[EMAIL PROTECTED]">news:9b4ar1$t6i$[EMAIL PROTECTED]...
> I have a php script which is like a modified shopping cart.
>
> It starts with a search that calls a perl script ( I know, but it's the
only
> way I can include certain proprietary functionality I need).  This returns
a
> results set of documents that can be either downloaded or requested
> depending on permissions.
>
> If you click to request a document a php script request.php is called it
is
> sort of like a cart script, and uses phplib sessions and db_oci8.
>
> The strange problem I am having is this:
>
> If it is the first time you have reqeusted this script since last opening
> your browser, you will get a 404, if you hit back/forward or refresh the
> script works fine as if nothing ever happened.  You will not get this
error
> again as long as you do not close and reopen your browser.  Any ideas?
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] Editors ... calling them, or PHP-based one?

2001-04-12 Thread Plutarck

Ick...I'd say it's a good idea, but it's going to be a bi...tter fight with
technology.

First, you have to have some application do the loading/unloading. PHP can't
do that, of course.

But, you could use some form of java...but you'd have to get fancy. Or you
could just use file upload in a form, which is easier.

If you do that, you need only parse out the file.

The best way to do that is pick a text format that does what you want it to
do, and is universal across platforms. You don't even need to worry about
the editor they use, as long as it's saved in the proper format.

I reccomend you use either a word document, or perhaps Rich Text Format is
best (rtf).

Then you just have to figure out how text is saved in that format, and
viola. You just use PHP to go from there...

...I'm sure it's easier said than done, and I have absolutely no clue how
the content of rtf files is different from txt (but I'd love to know!), but
I can see it being very possible if you pick only a few standard file
formats, and use the file upload features.


It's actually a very good idea. I'm surprised no one has done it...which
should probably worry you ;)


--
Plutarck
Should be working on something...
...but forgot what it was.



"The Hermit Hacker" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> Sorry for vague subject, only so many things you can put in there ...
>
> I'm looking for someone way, in PHP4, to take a "form/template" for a
> letter on the server side, pass it to the client, let them edit it
> (including markup tags like bold and underline) and then pass it back to
> the server ...
>
> It has to be relatively transparent to the end user ... I don't want to
> have to teach them to put  tags around where they want bold ...
>
> I'm not particular on editor ... right now, if I have to force the client
> to install StarOffice for commonality across platforms, I'll do that and
> expand from that ... but some way of 'click here, download doc to
> computer, open up file with , save back to server
> (if possible)' ...
>
> Ideas?
>
> thanks ...
>
> Marc G. Fournier   ICQ#7615664   IRC Nick:
Scrappy
> Systems Administrator @ hub.org
> primary: [EMAIL PROTECTED]   secondary:
scrappy@{freebsd|postgresql}.org
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] search highlighting

2001-04-12 Thread Plutarck

You'll probably want to use preg_replace.

For instance:

$string = "/(PHP)/i";

$target = "Please highlight PhP for me.";

echo $target, '';

$target = preg_replace($string, "\\1", $target);

echo $target, '';


\\1 is whatever was found in the first parentheses(sp).


--
Plutarck
Should be working on something...
...but forgot what it was.


""Matt Williams"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi
>
> I'm implementing a simple keyword search.
> I want the results to be displayed with the keywords highlighted.
> I am currently using this to highlight the keywords
>
> str_replace($string,"$string",$field);
>
> If I search for php, it will find PHP, PhP etc... but using the above only
> php will will be highlighted, not PHP.
> I've tried eregi_replace but I could only get that to change the case and
> highlight that ie. PHP would become php.
>
> Can anyone point me in the direction of how to highlight the string
> regardless of case but keep the case for the match.
>
> TIA
>
> M@
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] $8 PHP hosting from Jeffrey Greer

2001-04-12 Thread Plutarck

Anyone wonder if he was kidding?

The part about adding mod_ssl to apache just reaks of concept comedy to me.

Then again, I see a joke in every phrase...


--
Plutarck
Should be working on something...
...but forgot what it was.


""Greig, Euan"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> Isn't it time to give this poor guy a rest?!?
>
> -Original Message-
> From: Ashley M. Kirchner [mailto:[EMAIL PROTECTED]]
> Sent: 11 April 2001 15:21
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] $8 PHP hosting from Jeffrey Greer
>
>
> Jeffrey Greer wrote:
>
> > Is 1/2 per
> > year too much down time?
>
> 
> Half a year downtime?  Yes, I would have a BIG problem with that.
> 
>
> AMK4
>
> --
> W |
>   |  I haven't lost my mind; it's backed up on tape somewhere.
>   |
>   ~
>   Ashley M. Kirchner <mailto:[EMAIL PROTECTED]>   .   303.442.6410 x130
>   SysAdmin / Websmith   . 800.441.3873 x130
>   Photo Craft Laboratories, Inc. .eFax 248.671.0909
>   http://www.pcraft.com  . 3550 Arapahoe Ave #6
>   .. .  .  . .   Boulder, CO 80303, USA
>
>
>
>
> **
> Any opinions expressed in this email are those of the individual and
> not necessarily the Company. This email and any files transmitted with
> it, including replies and forwarded copies (which may contain alterations)
> subsequently transmitted from the Company, are confidential and solely for
> the use of the intended recipient. If you are not the intended recipient
> or the person responsible for delivering to the intended recipient, be
> advised that you have received this email in error and that any use is
> strictly prohibited.
>
> **
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] Updating a value in a session

2001-04-12 Thread Plutarck

What happens is when you use session_start(), all variables in the session
become initialized to the values they have previously been given.

So when you call session_start the second time, a variable named $value is
created with the value it was given earlier.

The problem is, it over-writes the variable $value which was submitted in
the form.

The way to get around this is to rename your form to "form_value". Then
right after you register value in your session, insert this:

$value = $form_value;

It should work without error.


--
Plutarck
Should be working on something...
...but forgot what it was.



""Tobias Talltorp"" <[EMAIL PROTECTED]> wrote in message
9b431b$fau$[EMAIL PROTECTED]">news:9b431b$fau$[EMAIL PROTECTED]...
> On my first page I have a form that posts a value to page2 where it gets
> registered in a session. Works like a charm...
> When I try to do this again, but send another value, the session doesn´t
> update the new value.
> Why?
>
> PAGE 1 --->
> 
>
> 
> 
>
> 
>
>
> PAGE 2 --->
>  session_start();
> session_register("value");
> ?>
>
> Thanks,
> // Tobias
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] Case-Sensitivity with PHP and MySQL

2001-04-11 Thread Plutarck

I had a similar question about case-sensitivity, and I was told that MySQL
is automatically case-insensitive! But it depends on your version of MySQL.

Go to the mysql manual and look at chapter 20.16 "Case sensitivity in
searches".

In the newest versions of MySQL, all searches are case-insensitive by
default. To make them case-sensitive however, is a royal pain in the arse.


--
Plutarck
Should be working on something...
...but forgot what it was.


"midget2000x" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> I am writing a PHP script that operates on a MySQL database that uses the
> e-mail address as the primary key.  If the e-mail doesn't exist in the
database
> (when a form is submitted), I want to insert a new record.  If it does, I
want
> to update the existing record.
>
> How can I make the query that checks if the e-mail exists
case-insensitive?  I
> want to avoid users creating another record if they type in their e-mail
in a
> different case.
>
> Thanks!
>
> rory
>
>  ---
> providing the finest in midget technology
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




[PHP] Newsgroups like this one?

2001-04-11 Thread Plutarck

I was looking at marc.theaimsgroup.com listing of message archives (which is
how I finally found the address to this newsgroup in the firstplace) to find
the MySQL group, however I noticed that the one at mysql.com is just a
"mailing list". (I prefer to preserve my inbox for personal messages and
spam that slips by my filters ;)

Are there any good listings of topic-grouped "newsgroups" (like this one)
for MySQL, javascript, C, etc?

I'd like a newsgroup to ask my non-PHP questions where people expect non-PHP
questions :)

Thanks in advance!


--
Plutarck
Should be working on something...
...but forgot what it was.



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




[PHP] TIP: Making ALL your scripts work with register.globals turned off

2001-04-11 Thread Plutarck

I've been working on a way to strip invalid characters from user input with
little or no need to rip the hair out of my head, and I learned some
interesting things in the process.

For one thing, hair really is stuck in there good, man.

But the important thing is how to increase your global namespace, make
debugging and refining user-input easier, make your scripts more readable
(arguably), and maybe even make your scripts a little more secure in the
process.

And all it requires is one single little line being present in either an
included file, or at the top of your script.

*basks in the beauty of the variable variable*

And that line is (actually it's two lines, but one is a comment to make
things easier on people who read your code):

// To refer to variables submitted via GET or POST use: ${$f}["
$f = 'HTTP_' . $HTTP_SERVER_VARS["REQUEST_METHOD"] . '_VARS';

Now, if someone submits a form with the field "email", you refer to it in
your code as:

${$f}["email"]

It works if it was submitted via POST or GET, so you never have to worry
about needing one feature or the other. And if you do want to lock it in to
POST only, you just do:

$f = 'HTTP_POST_VARS';

...right at the top of the script where you want to lock it in. It
effectively reduces having to type $HTTP_POST_VARS to ${$f} (hard to type at
first, I know).


And now you can instantly know what variable is suppose to be user
submitted, and what isn't. And you can now safely turn off register.globals
in your .ini file, or run your script in a place where register.globals is
off (track_vars must be enabled, but I don't know anyone who actually turns
it off, and it's always enabled in version 4.0.3+).


The reason for not just using $email to refer to the "email" field is
something I recently found out.

If you change the value of $HTTP_POST_VARS["email"], it will not change the
value of $email! Doh! So my great big script which flawlessly strips all
invalid characters from POST, COOKIE, and GET global variables did squat.


I've fallen in love with variable variables, I admit it. Oh how I love them
so...

...anyway, I just thought some of you might benefit from my discovery of
variable variables using REQUEST_METHOD, since I've never actually seen it
used in any scripts (I actually got the idea from "Decae", a programmer at
Evernight...I have no idea when he figured it out). So I hope it helps some
of you out.

Enjoy!


--
Plutarck
Should be working on something...
...but forgot what it was.



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




Re: [PHP] popup window

2001-04-11 Thread Plutarck

> I know how to do popups with Javascript, but what I want is
> to use purely PHP.  Is there a way to spawn a browser window
> from a server-side action?

I'm afraid you'll have you use Javascript. The only way to make a new window
is to use window.open, or to have someone click a link with the target of
_blank.

So with window.open and window.close, I think you can accomplish all you'd
like to.

But if someone turns off java, none of it will work. So you'll probably want
to allow some other way of logging in. I know many places (game sites are
especially guilty of this) that require javascript just to login, even
though nothing in the site even uses javascript!

I really do hate that.


--
Plutarck
Should be working on something...
...but forgot what it was.


""Dan Harrington"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hello,
>
> Does anyone have ideas about this kind of scenario?
>
> 1)  Load a php page, based on whether a user is currently
> authenticated either:
> a) if not authenticated: pop up a new browser window
> or
> b) if already authenticated, proceed
>
> 2)  Based on the login id of the individual that either
> failed to login or succeeded, you either:
>
> a) close the little popup window and
> load a user information page from a database
> on the original page.
> or
>
> b) close the little popup window and
> load an error message up on the original page.
>
> The average gray generic "enter user name and password"  in
> IE or Netscape isn't good enough because the login page
> needs to have multiple options that are dynamically generated
> as well (login.php would be the contents of a popup)
>
> I know how to do popups with Javascript, but what I want is
> to use purely PHP.  Is there a way to spawn a browser window
> from a server-side action?
>
> Thanks
> Dan
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] No new topic using reply please.

2001-04-11 Thread Plutarck

Better than the people who make a new thred by hitting Forward ;)


--
Plutarck
Should be working on something...
...but forgot what it was.


""Chris Lee"" <[EMAIL PROTECTED]> wrote in message
9b1rbb$mr3$[EMAIL PROTECTED]">news:9b1rbb$mr3$[EMAIL PROTECTED]...
Accually, Ive noticed in Outlook Express

Ctrl - N = new message
Ctrl - R = relpy to user directly, does not get posted to newsgroup/mailling
list
Ctrl - G = relpy directly to newsgroup, in turn gets posted to the mailing
list

On another note, good post, I see alot of people posting 'new' threads by
hitting relpy, hehe.

--

 Chris Lee
 [EMAIL PROTECTED]



""Yasuo Ohgaki"" <[EMAIL PROTECTED]> wrote in message
news:9b1k02$f6h$[EMAIL PROTECTED]...
Hello all,

I think most of users knows about news://news.php.net and list archives, if
you
use your mail client's reply button, it becomes part of a thread. (It does
not
start new thread)

Therefore, do not post new topic using reply button.

Regards,
--
Yasuo Ohgaki




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



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




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




Re: [PHP] timer in PHP

2001-04-11 Thread Plutarck

I'm guessing it's either for a Quiz script or an Auction script.

If you want to make it easy on yourself, use a database to store the
starting time (when the timer "starts") and what time the test/auction
should end. When someome makes a submission, get the time stored in the
database and see if the person's submission is within the timelimit (check
if the current time is less than the finish time).

If the current time is within 2 minutes of the ending time, then take the
ending time, add 5 minutes to it, and then store it.

If you try to do this all in a sort of real-time, you're only making it hard
on yourself and it's more or less impossible to do (without killing yourself
in resources, anyway).

Doing it with a database, once you get it working in the first place, may
even be considered trivial. You may be pleasantly surprised...unless you
can't use a database :)


--
Plutarck
Should be working on something...
...but forgot what it was.


""george"" <[EMAIL PROTECTED]> wrote in message
9b1p05$t6c$[EMAIL PROTECTED]">news:9b1p05$t6c$[EMAIL PROTECTED]...
> I need to have a time running and after a certain time it will not allow
> you to submit anything else,  on top of that if someone makes an entry
with
> less than 2 minutes to go the time must be extended by 5 minutes.
>  I really am at a loss how to do this.
>  Can it be done.
>
> TIA
>
> George
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] foreach vs. while(list() = each())

2001-04-11 Thread Plutarck

I believe foreach also works on a copy basis, not a pointer or reference. So
if you try and alter the array you are foreach'ing it won't work as
expected.

For instance this:

$array = array("var1", "var2", "var3");

foreach ($array as $val)
{
 if ($val == "var2")
 {
  $val = "changed2";

 }
}

print_r($array);

Will show you that no change to $array has occurred.

It's basically the same as list(), but it's worth noting.


Other than backwards compliance, I've never used the list/each way of doing
it. Never really had a reason too...I think it basically just comes down to
user preference.


--
Plutarck
Should be working on something...
...but forgot what it was.




"Joe Stump" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> What are the differences in these? I know with while() you have to reset()
the
> array afterwards, but foreach() you don't. Also foreach() appears to be
quite
> a bit faster.
>
> My main question is there ANY difference in how these two loop through the
> array.
>
> --Joe
>
>
>
>
/***
***\
>  *Joe Stump - PHP/SQL/HTML Developer
*
>  * http://www.care2.com - http://www.miester.org -
http://gtk.php-coder.net   *
>  * "Better to double your money on mediocrity than lose it all on a
dream."   *
>
\***
***/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] I am SO confused (help with references!) (could be a bug?)

2001-04-10 Thread Plutarck

Odd...well I still don't have a clue how to do what I wanted, but I recoded
it and now it works.

I just run HTTP_POST_VARS, HTTP_GET_VARS, and HTTP_COOKIE_VARS through a
special function that refines all the data. No errors, no bugs, no problem
:)

Thanks anway...maybe I'll figure out what's going on some day, lol.


--
Plutarck
Should be working on something...
...but forgot what it was.


""[Intent A/S] Tais M. Hansen"" <[EMAIL PROTECTED]> wrote in message
9auc2k$e5c$[EMAIL PROTECTED]">news:9auc2k$e5c$[EMAIL PROTECTED]...
> Hi,
>
> Well... I don't know if this is any help but I ran your code under
PHP/4.0b4
> and got:
>
> "Inside2 Inside2 Inside2 "
>
> Seems right to me?
>
>
> --
> --
> Intent A/S
>
> Tais M. Hansen
> Web Developer
>
> ""Plutarck"" <[EMAIL PROTECTED]> wrote in message
> 9asamr$865$[EMAIL PROTECTED]">news:9asamr$865$[EMAIL PROTECTED]...
> > If I were any more confused my head would split open. This just plain
> makes
> > no sense, and I'm wondering if it's just a bug in PHP.
> > Consider the following code:
> > ...
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] Back Button Dilemma's

2001-04-10 Thread Plutarck

If you know javascript, you might try something like history.go(20) on each
page.

It _should_ cause the user to catapult forward in their history list each
time they load the page. If they haven't used their back button, then having
javascript "push" their forward button should do nothing.

That keeps them from going back and changing a selection.

The other way is when someone submits the page, save that data so that if
the person resubmits the page not only are the changes ignored, but they are
redirected to the page they should be on.

Or ideally you can just make the whole thing in one php page. When someone
submits their info, save it and give them the next form. (the best way to do
it)

Or you could just use the good ole fashion flash applet, which breaks most
people's back buttons :) (that can be gotten around, of course, and only
happens on some peoples systems)


--
Plutarck
Should be working on something...
...but forgot what it was.


""RealGM"" <[EMAIL PROTECTED]> wrote in message
009901c0c17f$ed066300$9d14c9cb@m3g7o5">news:009901c0c17f$ed066300$9d14c9cb@m3g7o5...
Hi Guys,

I know everywhere it says that it is not possible to actually disable the
back button, and people have offered some solutions that have not worked for
me, this is why I am emailing this list.

I have a form which displays the same page with new content (controlled by a
counter) in a loop until an exit point is reached.  When the user clicks
back on the browser the counter still increments and the screen continues
like the user pressed the continue button (which is the process I want the
user to take).  The problem is the user did not make a selection and this is
where the problem lies (it takes the default, which throws the whole process
out of whack).

The question I am asking is how can I prevent the user trying to go back?
Is there any code out there which can counter this action (and not cause my
counter to increment, thus moving the user to the next screen)?  Is there
any way to detect that the back button/option has been selected and display
a "warning" type page before going back to where the user is?  The forward
counter action does not really fix my problem.

Thanks,
Michael.

Chief Information Officer,
RealGM, Inc.
http://www.realgm.com





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




Re: [PHP] huge PHP file, hardcore processing

2001-04-09 Thread Plutarck

Note: if you hit the stop button and php doesn't stop, that probably means
it's either in the middle of a query and can't stop, or more likely it means
that "ignore.user.abort" has been set to true.

Turn off ignore user abort in your php.ini, and that should solve your
problem.


As for accessing any database on any system configuration, yes PHP can do
it. You can have a DB running on a Super Nintendo accessed by PHP on a
FreeBSD box, and it should work fine. ;)

In other words it doesn't matter what platform it's running on...in a
perfect world.


--
Plutarck
Should be working on something...
...but forgot what it was.


"Christian Dechery" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I have a huge (at least I think, for a script anyway) PHP script... it is
> over 1.000 lines of code.
> And it updates (do an entire DELETE-ALL / LOAD-ALL) an SQL Server database
> (over 35MB). It runs for over an hour (sometimes 2hs)... and I divided it
> into steps... so each step is a function in the script that when is over
> calls a javascript function that reloads the script to the next step.
>
> I was wondering if this is enough to get a good 'memory-cleaning'. Or it
> would be better to have lots of files (in total, there are 27 separate
> steps). I began noticing some processing slowness after the first 35
> mins... it get's 'tired'. The script starts running and with
> ob_implicit_flush() on, the output is flushed almost at real time... but
> after 10 or 12 steps it starts to get slow and do NO FLUSHING at all...
> only showing the entire output at once after the whole step has ended.
> Should I split it into files? Is because it's running on (eek!) IIS? Maybe
> the size of the file is getting in the way?
>
> Can someone help me out?
>
> Ah... one other thing. Has anybody experienced very weird behaviours of
PHP
> with IIS? Sometimes I press 'stop' at the browser but PHP is still
running.
> I can see it eating up memory in the TaskManager. And it won't stop until
I
> kill it. And the most weird part is, as soon as I call a script (any
> script) PHP returns to the TaskManager with the same amount of memory it
> had when it was running tha massive script mentioned above. Does IIS
really
> suck, or is there something very wrong with my config?
> 
> . Christian Dechery (lemming)
> . http://www.tanamesa.com.br
> . Gaita-L Owner / Web Developer
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] Supplied argument is not a valid MySQL result resource

2001-04-09 Thread Plutarck

That means that your mysql_query probably returned an error.

It should do that only when you screw up your syntax.

echo/print out the syntax used in your query, and post it here. That is
probably the problem you are having.


--
Plutarck
Should be working on something...
...but forgot what it was.


""Nathan Roberts"" <[EMAIL PROTECTED]> wrote in message
9atdps$kgv$[EMAIL PROTECTED]">news:9atdps$kgv$[EMAIL PROTECTED]...
> I am trying to get to grips with managing data in mysql, am am currentky
> working on deleting records
>
> I have worked through a turorial - no problems, but now I am trying to
apply
> it to my own database, I am getting the error
> Warning: Supplied argument is not a valid MySQL result resource in  on
> line 14
>
> I cannot see what is causing it - if anyone can it would be much
> appreciated.
>
> thanks
>
> Nathan
>
> For clarity/brevity I have cut the page back to what i beleive to be the
> relivant part. Code for page is:-
>
> 
>
> 
>
> 
> $db = mysql_connect("localhost", "username", "pasword");
>
> mysql_select_db("catalogue",$db);
>
>
> $result = mysql_query("SELECT * FROM SECTIONS",$db);
>
> while ($myrow = mysql_fetch_array($result)) {
>
>   printf("%s %s \n", $PHP_SELF,
> $myrow["section_id"], $myrow["section_name"], $myrow["section"]);
>
>printf("(DELETE)", $PHP_SELF,
> $myrow["section_id"]);
>
> }
>
>
>   ?>
>
>
>
> 
>
> 
>
>
> SQL for the table is
>
> CREATE TABLE SECTIONS (
>section_name varchar(25) NOT NULL,
>section_id tinyint(3) unsigned DEFAULT '0' NOT NULL auto_increment,
>section char(1) NOT NULL,
>PRIMARY KEY (section_id),
>UNIQUE section (section_name, section_id, section)
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




Re: [PHP] Finer points of debugging: vardump vs. print_r

2001-04-09 Thread Plutarck

I use print_r on arrays, and var_dump on everything else.

print_r will not tell you if a variable is NULL, but var_dump will. So I
usually use both.


--
Plutarck
Should be working on something...
...but forgot what it was.


""John Lim"" <[EMAIL PROTECTED]> wrote in message
9asuq0$f1n$[EMAIL PROTECTED]">news:9asuq0$f1n$[EMAIL PROTECTED]...
> Just a question that has been besetting me for a while:
>
> which is better for debugging -- vardump( ) or print( ) ?
>
> Does anyone have a preference? Why? Is one better than the other?
> Thanks for answering this prickly question!
>
> John Lim
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




[PHP] I am SO confused (help with references!) (could be a bug?)

2001-04-09 Thread Plutarck

If I were any more confused my head would split open. This just plain makes
no sense, and I'm wondering if it's just a bug in PHP.

Consider the following code:

$arvar = array(&$var1, &$var2, &$var3);

function vartest(&$arvar)
{
 echo '', $arvar[0], $arvar[1], $arvar[2];

 $arvar[1] = 'Inside2 ';

 echo '', $arvar[1];

}

vartest($arvar);

echo '', $arvar[1];

echo '', $var2;


It outputs one blank line, then:

ArrayArrayArray
n
n
Inside2

Ok, so this is kind of weird. First, how the hell did those "n"s get in
there?

But that's not the weird part. If inside the function you use var_dump() on
$arvar[0], var_dump returns NULL. If you run it on $arvar, you get NULL.

So why did $arvar[0] get echo'ed as "Array", but it is in fact NULL?

But if it's just one great big round of null, how did it change the value of
$var2?


Honestly, this is killing me here. Here is what I want to do:

Pass $val1 and $val2 by reference into an array.

Operate on the array inside of a function.

Have the changes made to the array effect $val1 and $val2.

In C I could use an array of pointers. But how in hell do I do it in PHP?


Honestly, I'm at my wit's end here and I don't have a clue what is going
on...I'll post again with some more insanely unbelievable confusing code
results if need be.


--
Plutarck
Should be working on something...
...but forgot what it was.



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




Re: [PHP] submitting to a remote form

2001-04-07 Thread Plutarck

You can use fopen/fread to open the script remotely.

Just append the query string onto the url something like this:

www.example.com/example.php?var1=var

...and example.php will have $var1 with the value "var". That's basically
like using GET on a form.

I believe that's what you wanted to do?


--
Plutarck
Should be working on something...
...but forgot what it was.


""Joseph Bannon"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I have a remote php script on a remote server that I need to submit
> information to. Does PHP have the ability for me to submit information
> remotely?
>
> J
>
>
> Say I'm Hot! - Post Your Picture!
> http://www.sayimhot.com
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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




<    1   2   3   >