Re: [PHP] reading last -n lines array is emty

2003-03-06 Thread 1LT John W. Holmes
> Holy crap looks like I was wrong!  I just tested it and sure enough '|'
does
> return an error.. how do you like that.  So use split("\|", $file[$i]).

For a regular expression "|" means OR. You could use explode("|",$file[$i])
for the sam effect. Benchmark split() vs. explode() and see which is
faster...

---John Holmes...


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



Re: [PHP] Uploading file problem

2003-03-06 Thread 1LT John W. Holmes
> Well, I have a statement that says:
> 
> if ([EMAIL PROTECTED]($photo, $long_path . "speakers/" . $photo_name)) {
> echo an error
> }else{
> proceed with renaming the file
> }
> 
> The error that is echoed after the copy is the one that pops up.  So, it
> could be some other problem, but I'm not sure what to look for.

Take out the @ sign so you can see what the PHP error message is. 

---John Holmes...

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



Re: [PHP] Need help with ?> vs. php?>

2003-03-05 Thread 1LT John W. Holmes
> I've installed the Apache v2.0.44 with PHP4.3.1., under Windows.
> 
> My pages starting and ending with "" don't work anymore. I would
> have to change them to "".

php?> is not valid. It's  or 
 
> Do you know if there is a way for keeping "http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] preg_match fails to fill $matches

2003-03-05 Thread 1LT John W. Holmes
> >What's your actual code? How are you looking for the match in $matches?
> >If something was matched, then it'll be there.
>
> The full cod in the loop is.
>
>   $cnt = 0;
>   while(!feof($fp))
>   {
> // Get body
> $line_in = fgets($fp,4096);
> $cnt++;
> // looking for the other end of the marker found above
> if (substr($line_in,2,strlen($line_in)-5) != $marker )
> {
>   $body= $body . $line_in;
>   $hit[]   = preg_match ($ts, $line_in,$matches);
>   $line[]  = $line_in;
>   $char= substr($line_in,0,1);
>   $quote[] = preg_match ($qs, $char);
> }
> if (strpos($line_in, $marker) > 0 ) {
>   break;
> }
>   }
>
> Later on in the code after the loop I do
>
> echo "printing array matches ";
> print_r ($matches);echo "";

$matches is going to be over-written after every time through the loop! It
doesn't add it all up.

Add in a

$var[] = $matches;

or something inside of your loop to keep track of them all, then
print_r($var) to see what it contains.

---John Holmes...


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



Re: [PHP] TO Bryan LipscyRe: [PHP] i got a problem

2003-03-05 Thread 1LT John W. Holmes
"He" probably needs register_globals turned ON in your php.ini file.

---John Holmes...

- Original Message -
From: "Luis A" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, March 04, 2003 11:49 PM
Subject: [PHP] TO Bryan LipscyRe: [PHP] i got a problem


HE show me this
INSERT INTO agenda (nombre, direccion, telefono, email, pais, comentario)
VALUES ('','','','','','')¡THANKS! WE HAVE RECEIVED YOUR DATA.


i think he does not asimilate the $ on the variable VALUES (' $DATA,' )
- Original Message -
From: "Bryan Lipscy" <[EMAIL PROTECTED]>
To: "'Luis A'" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Wednesday, March 05, 2003 12:27 PM
Subject: RE: [PHP] i got a problem


> Try
>
> echo $sql;
>
> To check your sql before execution.
>
>



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


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



Re: [PHP] Re: php forgetting variables very easily

2003-03-05 Thread 1LT John W. Holmes
> Thanks, John- that works brilliantly.
> Just wandering how I can include a file in a different
> directory so that it still remembers variables.
>
> for example what if I want to include the file
> www.example.com/two/example.php in the file:
> www.example.com/one/example.php
> ?
> would include('/two/example.php') work?

Stop thinking of include files as www.example.com/file.php.

You're including a file that's within the same file system as the original
file, so you just need to provide a correct path.

If you have

/home/example/www/one/example.php

and you want to include

/home/example/www/two/example.php

into it, then you can do two things:

include("../two/example.php")

which will go from the one/ directory, go up one, into the two directory,
and then access the example.php file. This is called a relative path, since
it is relative to the one/example.php file.

or, you can do

include("/home/example/www/two/example.php");

This is an absolute path.

Use whichever you understand. One thing you may come accross that you need
to understand is that all includes, if you're using relative paths, are
relative to the original file. so if one/example.php includes
two/example.php and then two/example.php tries to include another file using
a relative path, it's going to start relative to the one/ directory, no the
two/ directory. You don't have this problem/issue with absolute paths.

---John Holmes...


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



Re: [PHP] preg_match fails to fill $matches

2003-03-05 Thread 1LT John W. Holmes
> $ts = '/(' . $trigger_string .')/is';
> echo "trigger_string is $ts ";
> $matches = array();
> $hit = array();
>
> In the loop
>
> $hit[] = preg_match ($ts, $line_in,$matches);
>
> Now the $hit array fills up correctly, if the trigger string is on the
> line just read in, putting 1 or 0 in $hits. But the string that
> triggered the match is not put in $matches. The manual says it should
> be.

What's your actual code? How are you looking for the match in $matches? If
something was matched, then it'll be there.

---John Holmes...


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



Re: [PHP] i got a problem

2003-03-05 Thread 1LT John W. Holmes
Try

$result = mysql_query($sql) or die(mysql_error());

to see what the problem is.

---John Holmes...

- Original Message -
From: "Luis A" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, March 04, 2003 9:29 PM
Subject: [PHP] i got a problem


hi every one here

o got one problem here on the php

take a look at this





Nombre   :
Teléfono:
E-Mail:
Pais :
Comentario: escriba aqui su
el comentario que desee añadir












aparently php create the table on the mysql server (he make the connect to
the mysql server) , but he does insert the data from form on the mysql
database

any subjestion??

i realy if ani one of yours please can help me





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



Re: [PHP] Getting error REG_EMPTY

2003-03-05 Thread 1LT John W. Holmes
> Way does this give me this error

It's a warning, not an error.

> Warning: REG_EMPTY: in emailusers.php on line 52
>
>
> $lines = file("data/members.txt");
> foreach($lines as $line){
> list ($logged_email,$logged_title,$logged_first_name,$logged_last_name) =
split("|", $line);
> if ($logged_email==$email) {print "This email has already been
registered.";
> exit;}
> }
>
>
> this is what is in the members.txt file
>
> [EMAIL PROTECTED]|Mr.|Richard|Kurth|1046828998|03/04/2003

You have 6 parts in your .txt file if you use | as the delimiter. In your
list() call, though, you only give 4 variables. This leaves two parts that
won't be assigned to a variable and it causes PHP to issue a warning.

---John Holmes...


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



Re: [PHP] Re: php forgetting variables very easily

2003-03-05 Thread 1LT John W. Holmes
> I am still having problems with variables not being
> remembered by included files.  I've tried using the
> global command and it still doesn't work.  I've cut
> down my two pages to contain the main stuff so you can
> see what's happening.  Basically main.php includes the
> file new.php and I want the variable '$name' to be
> remembered in it.  The other included files aren't
> important to the problem I'm having.
>
> main.php
> ===
>
>  global $name;
> $name = 'home';
> ?>
> 
> Tite
>  href="stylesheet.css"/>
> 
> 
>  
> include("http://www.vocalwebsites.com/neilhowlett/new.php";)

Use include("new.php"), not the full URL. The way you're doing it now, your
making a brand new request for the _result_ of a .php page. There is no
relation to this page and new.php when you request it in this manner. If you
just do include('new.php'), then it takes the _php_ code (the whole file)
from new.php and inserts it into this file and runs it. So then your
variables will still work.

also, take away the "global $name" calls, they don't do anything.

>   ?>
> 
>  include("http://www.vocalwebsites.com/footer.php";);

Same thing here... You're getting the parsed _result_ of footer.php, not the
code.

---John Holmes...


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



Re: [PHP] inserting date() into MySQL

2003-03-04 Thread 1LT John W. Holmes
> If I am going to use date('U') to insert an epoch timestamp into a 
> mysql table, what is the appropriate field type to use?

Integer.

---John Holmes...

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



Re: [PHP] strange problem

2003-03-04 Thread 1LT John W. Holmes
Look for anything outside of the  or  tags in the rest of your
table. That's generally what causes things like this.

---John Holmes...

- Original Message -
From: "Denis L. Menezes" <[EMAIL PROTECTED]>
To: "PHP general list" <[EMAIL PROTECTED]>
Sent: Tuesday, March 04, 2003 10:40 AM
Subject: [PHP] strange problem


Hello friends,

Following is the part html output of my page got from View-source in IE.

The problem is that I gate a big blank gap on the output page from the top
until about 10 lines height and only then the table is displayed. As you see
I have no  tags here. Can someone tell me why I get blank space?

Quote :



Untitled Document





  

  The Whatson database has found the following 15 students
:
  
  
 
 
 
 
 
 
  
  



Unquote

Thanks
Denis


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



Re: [PHP] ICQ # validation

2003-03-03 Thread 1LT John W. Holmes
Use single quotes around your pattern.

if(ereg('^[0-9]{7,9}$',...

With the double quotes, PHP is probably seeing the $ and looking for a
variable, even though it's at the end of the string.

---John Holmes...

- Original Message -
From: "Liam Gibbs" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, March 03, 2003 2:00 PM
Subject: [PHP] ICQ # validation


Maybe I'm off my rocker, but I don't see how this can't work. I'm trying to
validate an ICQ number, and assuming a valid one is between 7 and 9 numbers.
My line of code is this:

if(ereg("^[0-9]{7,9}$", $_REQUEST["icqnumber"])) {
print("a-okay!");
} else {
print("error msg");
}

I've submitted the ICQ # 2264532680, but it validates. Any ideas?


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



Re: [PHP] Keeping existing data in textarea's

2003-03-03 Thread 1LT John W. Holmes
> Hi, I have a  developed a simple Helpdesk for our small company. When
users
> log calls they get an alert message warning them that they must fill in
all
> the fields if they have missed a field. At the moment if they happen to
> forget a field, they receive the alert message, but then have to start all
> over again. How do I keep the existing data in the textareas from
> dissapearing after the alert message?

Well, when they submit the form, whatever they typed is going to be in
$_POST['name_of_textarea'], right? (or $_GET...)

To put that value back into a textarea, do something like this:



I'll assume you use the same form for entering if there is an error. the
first time this form is displayed, $_POST['whatever'] will not be set, so
the  will be blank. After it's submitted, then the value will be
filled back in.

---John Holmes...


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



Re: [PHP] changing colors on buttons

2003-03-03 Thread 1LT John W. Holmes
> is there a way you can change the text color on buttons as well as the
> background color for a button? i have a button that looks like:
>  onclick="window.location='edit.php';"
> onkeypress="window.location='edit.php'">
> so is there a way to change text color and background color for that? or
is
> it better to use  and do it that way...
> my client wants light blue buttons with dark blue text on them but we need
> "real buttons" if you really want to call them that..not images that act
> like buttons...

Yes, it's possible. Search google for CSS, this has nothing to do with PHP.

---John Holmes...


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



Re: [PHP] PHP on IIS session problems

2003-03-03 Thread 1LT John W. Holmes
You need to restart IIS.

c:\> net stop iisadmin

c:\> net start w3svc

or use the control panel.

---John Holmes...

- Original Message -
From: "Victor Stan" <[EMAIL PROTECTED]>
To: "1LT John W. Holmes" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Monday, March 03, 2003 12:54 PM
Subject: RE: [PHP] PHP on IIS session problems


> Ok, thanks guys for your help, I sort of figured that's the problem, but I
> didn't want to touch the ini settings without being sure, and getting some
> advice from people that know. Thanks again, great help.
>
> I made the changes, now how do I restart php? So the changes are used?
>
> - Vic
>
> -Original Message-
> From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]
> Sent: Monday, March 03, 2003 10:23 AM
> To: Victor Stan; [EMAIL PROTECTED]
> Subject: Re: [PHP] PHP on IIS session problems
>
> > I get these errors from a simple "session_start();" script.
> >
> > Warning: session_start() [function.session-start]:
> > open(/tmp\sess_f4aa3ef3c537bb6327d5e7b991e91be7, O_RDWR) failed: No such
> > file or directory (2) in c:\inetpub\wwwroot\picoblog\admin.php on line 2
>
> Do you have a /tmp folder on your computer? Probably not, so that's why
PHP
> is throwing a warning, because it can't write to a directory that doesn't
> exist.
>
> > Warning: session_start() [function.session-start]: Cannot send session
> > cookie - headers already sent by (output started at
> > c:\inetpub\wwwroot\picoblog\admin.php:2) in
> > c:\inetpub\wwwroot\picoblog\admin.php on line 2
> >
> > Warning: session_start() [function.session-start]: Cannot send session
> cache
> > limiter - headers already sent (output started at
> > c:\inetpub\wwwroot\picoblog\admin.php:2) in
> > c:\inetpub\wwwroot\picoblog\admin.php on line 2
>
> These are just by-products of the first error.
>
> Set your session.save_path setting in php.ini to a folder that IIS can
write
> to.
>
> ---John Holmes...
>


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



Re: [PHP] PHP & Oracle

2003-03-03 Thread 1LT John W. Holmes
> i have one big Oracle database, 20GB. Is it better to comunicate
> directly to Oracle with PHP, or to export data to MySQL. How secure is
> PHP & Oracle, can they communicate well?

Why would you send it to MySQL? Just get PHP and Oracle talking and go with
that.

---John Holmes...


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



Re: [PHP] Automatic Table Creation

2003-03-03 Thread 1LT John W. Holmes
The easiest way would be nested tables. Your three "columns" would each have
a nested table within them where you loop through 1/3 of the results. Some
simple math functions and the result of mysql_num_results() should tell you
how many to loop through in each table.


  

  

aaab
  


  
bbba

  


  
ccca
cccb
  

  


---John Holmes...

- Original Message -
From: "Awlad Hussain" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, March 03, 2003 9:58 AM
Subject: [PHP] Automatic Table Creation


I have a mysql table containing about 100 record, alphabetically ordered.

How would i display them in browser in a 3 columns, doesn't matter how long
the rows is as the number of records will grow in the database table.

the records should be in alphabetically order, for example:

aaa bbbaccca
aab cccb
aac bbbc
aad bbbdcccd

any idea anyone?

awlad
___

Sheridan Phoenix Company
The Business Centre  Kimpton Road  Luton  Bedfordshire  LU2 0LB

Email:  [EMAIL PROTECTED]
Phone:  01582 522 330
Fax:01582 522 328
___

This electronic transmission is strictly confidential and intended
solely for the addressee.  If you are not the intended addressee, you
must not disclose, copy or take any action in reliance of this
transmission.  If you have received this transmission in error it would
be helpful if you could notify The Sheridan Phoenix Company Ltd as soon
as possible.

Any views expressed in this message are those of the individual sender,
except where the sender specifically states them to be the views of The
Sheridan Phoenix Company Ltd.





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



Re: [PHP] File array mailing list pharse error

2003-03-03 Thread 1LT John W. Holmes
> I worked on it so long now I have to come back to you
> it gives me an Parse error:
> Parse error: parse error, expecting `'('' in  members_read_send.php on
line
> 5
>
> Iam so sorry to bug u so much but can u help me finish here please?
>
>  $lines = file(data/default2.users);
> for each ($lines as $line)

foreach() is all one word...

> {
> list ($User, $UserN, $Pass, $Date, $Realf, $RealL, $Email, $Street,
> $City, $State, $Postal, $Country, $Phone, $Webaddress, $ex1, $ex2, $ex3,
> $ex4, $ex53, $ex7 ) = explode("|", $buffer);
>
> $myname = "browseabit";
> $myemail = "[EMAIL PROTECTED]";
> $myreplyemail = "[EMAIL PROTECTED]";
> $contactname = "$Realf";
> $contactemail = "$Email";
>
> $message = " message here ";
> $subject = "Subject here";
> $headers .= "MIME-Version: 1.0\r\n";

and change this to

$headers = "MIME-Version: 1.0\r\n";

> $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
> $headers .= "From: ".$myname." <".$myemail.">\r\n";
> $headers .= "To: ".$contactname." <".$contactemail.">\r\n";
> $headers .= "Reply-To: ".$myname." <$myreplyemail>\r\n";
> $headers .= "X-Priority: 1\r\n";
> $headers .= "X-MSMail-Priority: High\r\n";
> $headers .= "X-Mailer: browseabit";
>
> mail($contactemail, $subject, $message, $headers);
>
> echo "Memmber  $Realf
> $RealL from $City $State $Country is been notified...  ";
> }
>
> ?>

---John Holmes...


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



Re: [PHP] PHP on IIS session problems

2003-03-03 Thread 1LT John W. Holmes
> I get these errors from a simple "session_start();" script.
>
> Warning: session_start() [function.session-start]:
> open(/tmp\sess_f4aa3ef3c537bb6327d5e7b991e91be7, O_RDWR) failed: No such
> file or directory (2) in c:\inetpub\wwwroot\picoblog\admin.php on line 2

Do you have a /tmp folder on your computer? Probably not, so that's why PHP
is throwing a warning, because it can't write to a directory that doesn't
exist.

> Warning: session_start() [function.session-start]: Cannot send session
> cookie - headers already sent by (output started at
> c:\inetpub\wwwroot\picoblog\admin.php:2) in
> c:\inetpub\wwwroot\picoblog\admin.php on line 2
>
> Warning: session_start() [function.session-start]: Cannot send session
cache
> limiter - headers already sent (output started at
> c:\inetpub\wwwroot\picoblog\admin.php:2) in
> c:\inetpub\wwwroot\picoblog\admin.php on line 2

These are just by-products of the first error.

Set your session.save_path setting in php.ini to a folder that IIS can write
to.

---John Holmes...


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



Re: [PHP] Any function that gives the coordinates of the cursor?

2003-02-28 Thread 1LT John W. Holmes
> Are there any functions in PHP which can give us the coordinates of the
cursor when we click the mouse?
> Thanks for the replys.

If you use an image as your submit for your form, you can.



When that image is clicked on, you'll have

$_POST['image_x'] and $_POST['image_y'] as the coordinates where it was
clicked.

---John Holmes...


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



Re: [PHP] Little help please

2003-02-27 Thread 1LT John W. Holmes
> I'm looking for a webbased interface that will allow me to managae mysql
> databases. However, phpmyadmin has been ruled out due to the fact it
> requires the username and password to be stored in the config file

No it doesn't.

> and that it doesn't have any security to protect the average joe from
> stumbling across it.

Ummm... yes it does. Read the installation directions a little more
carefully.

> So can anyone point me in the direction of a utility that requires a login
> that checks of the users database then throws that information into the
> config for the mysql management?

How about PHPMyAdmin? You can configure it so that it checks the mysql.user
table.

---John Holmes...


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



Re: [PHP] Reading files

2003-02-27 Thread 1LT John W. Holmes
>while (!feof ($handle)) ;

Take that semi-colon away. You're running this loop continously. 

---John Holmes...

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



Re: [PHP] File upload problem - permission denied

2003-02-27 Thread 1LT John W. Holmes
Make sure whatever user the _web server_ is running as has access to write
to that directory.

With IIS, this is the IUSR_ account.

> $AppImageDir = Web/Images";

You've got a error in that line, also, hopefully it's just a typo, though.

---John Holmes...

- Original Message -
From: "Niklas Lampén" <[EMAIL PROTECTED]>
To: "Php-General" <[EMAIL PROTECTED]>
Sent: Thursday, February 27, 2003 9:07 AM
Subject: RE: [PHP] File upload problem - permission denied


On linux you can do it in shell with chmod command. Do 'chmod 766 direcory'.
You can find out more about chmod-command at
http://www.die.net/doc/linux/man/man1/chmod.1.html.


Niklas


-Original Message-
From: Frans Bakker [mailto:[EMAIL PROTECTED]
Sent: 27. helmikuuta 2003 16:03
To: [EMAIL PROTECTED]
Subject: Re: [PHP] File upload problem - permission denied


All right then. ¿Where do I set that permission for PHP? On my local Windows
machine it is usually in IIS. However the whole ..\inetpub\wwwroot\..
directory already has read and write permissions. Apart from PHP I use Cold
Fusion. With Cold Fusion I don't have any permission problems...

"Niklas lampén" <[EMAIL PROTECTED]> escribió en el mensaje
news:[EMAIL PROTECTED]
Seems that php does not have write access to that directory. Set it right
and it should work.


Niklas


P.S. Tip: It's much quicker to create plain html without echo. Just do it
like , not like "; ?> :)


-Original Message-
From: Frans Bakker [mailto:[EMAIL PROTECTED]
Sent: 27. helmikuuta 2003 15:43
To: [EMAIL PROTECTED]
Subject: [PHP] File upload problem - permission denied


Hello everybody,

I am relatively new to PHP and for quite some days I am trying to get a file
upload system going through a standard html form. To test it I use an html
page called Test2.php with a form in it with
enctype=\"multipart/form-data\". Here is the source code:





Web site - pages form



"; ?>




It is a standard straight forward image upload situation. You see that the
form directs to itself (action=\"Test2.php\") and on top of the page a
simple instruction to see if the file uploads correctly. As far as I can
see, this is correct code. Note that the any \\ are to escape "" and further
\\ (necesary in echo "" statements).

However, when I execute the page, I get the following error messages:

Warning: Unable to create '/Web/Images/cartel_feria1.jpg': Permission denied
in /Web/Test2.php on line 6

Warning: Unable to move '/tmp/php0jHeNE' to '/Web/Images/cartel_feria1.jpg'
in /Web/Test2.php on line 6

It seems to say that I don't have permission to execute a file upload on
that page. As you can see by the directory specifications this script runs
on a Linux. However, I also tried the same script on a Windows machine, with
the corresponding directory specifications of course, and with the same
result: permission denied.

What is wrong here, where do I set what type of permissions in order to get
the file upload to work? By the way, in the php.ini FileUpload is set at
yes.

Kind regards,
FRANS BAKKER




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


###
This message has been scanned by F-Secure Anti-Virus for Internet Mail. For
more information, connect to http://www.F-Secure.com/



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

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail. For
more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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


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



Re: [PHP] classes and functions in include files

2003-02-27 Thread 1LT John W. Holmes
> just a fast question here.. and the lotic probably isnt to bright on my
part
> and i think i know the answer to this question too but just to make
sure...
> if you can include variables in an include file and use them outside that
> file (in the file that includes that file that is) then can you do the
same
> with classes and functions

Yes. Most people put their common functions and classes into a single file
that's included() on every other page.

---John Holmes...


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



Re: [PHP] Escape Characters

2003-02-27 Thread 1LT John W. Holmes
> I'm running a script that reads the contents of images and stores them
> in a MySQL database.  The problem I'm running into is that my server is
> seeing "\" as escape characters and stripping them out.  I assume this
> has something to do with "Magic Quotes" or something of that nature but
> I'm not exactly sure which variable I'm playing with.  For the time
> being I'm replacing any "\" with "\\" so it only escapes one of them,
> but I'm sure this is not the correct solution.  If anyone has any idea
> what I'm doing wrong any info would be greatly appreciated.  I
> apologize if this has already been discussed but I could not find it in
> the archive.  Maybe I was searching for the wrong thing?  Please help.

That's the correct solution. You can use addslashes() to do it for you.
magic_quotes_gpc will do this automatically to data submitted through a
form.

---John Holmes...


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



Re: [PHP] Deleting a page after viewing it

2003-02-26 Thread 1LT John W. Holmes
> I have a confirmation of "membership" page a user would arrive at after 
> clicking on a URL in an email. After they click on a link in this page I 
> want to delete the page itself so it will only exist for this one use. 
> The URL in the page does go to another "Welcome" page which is on 
> another server. Do I need to include something in the second page that 
> will do the deleting, or can I delete it from within the script for the 
> first page that deletes as of the click on the URL. Haven't written any 
> code yet for this, but I'm thinking "unlink."

This works:

echo "Thanks.. I'm deleting this page";
unlink(basename($_SERVER['PHP_SELF']));

Have fun!

---John Holmes...

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



Re: [PHP] date, "first of next month"?

2003-02-26 Thread 1LT John W. Holmes
> Does anyone know a way to do this easily? I have a script that pretty much
> says "this is due on the first of next month" but I would like it to
> actually use the correct date.

You would think strtotime("first of next month") would work, but it doesn't.
This does:

$t = mktime(0,0,0,date('m')+1,1,date('Y'));

Gives you timestamp of first day, next month. Format accordingly with
date().

---John Holmes...


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



Re: [PHP] Too many connections - MySQL

2003-02-26 Thread 1LT John W. Holmes
There is a setting in MySQL for the max_connections. You just need to
increase this. If you're using persistent connections, do some research on
them and make sure you really need to be using them. They will eat up your
connections and cause you to have this error more quickly.

---John Holmes...

- Original Message -
From: "Stephen Craton" <[EMAIL PROTECTED]>
To: "PHP List" <[EMAIL PROTECTED]>
Sent: Wednesday, February 26, 2003 12:23 PM
Subject: [PHP] Too many connections - MySQL


On this site, www.roempire.com, which we host, they are having problems with
too many connections. I think that someone messed with the GRANT option. How
can we reverse this and allow unlimited connections per site? Or is this a
problem with the script?

Thanks,
Stephen Craton
http://www.melchior.us



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



Re: [PHP] niklasRe: [PHP] mysql trouble

2003-02-26 Thread 1LT John W. Holmes
> On Thursday 27 February 2003 00:08, 1LT John W. Holmes wrote:
> > Dude... honestly, lay off the coffee and learn to type.
> 
> Shouldn't that be cigars?

I guess so. He can send the cigars to me!! :)

John


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



Re: [PHP] niklasRe: [PHP] mysql trouble

2003-02-26 Thread 1LT John W. Holmes
Dude... honestly, lay off the coffee and learn to type.

---John Holmes...

- Original Message -
From: "Luis A" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, February 26, 2003 9:24 AM
Subject: Re: [PHP] niklasRe: [PHP] mysql trouble


oh   IN GONNA TRY NOW

thanks

i scream againg if present truble >)

- Original Message -
From: "Niklas Lampén" <[EMAIL PROTECTED]>
To: "Php-General" <[EMAIL PROTECTED]>
Sent: Wednesday, February 26, 2003 9:13 AM
Subject: RE: [PHP] to holmes Re: [PHP] mysql trouble


> No, he doesn't mean that.
>
> You are doing:
> $String = "text " + "more text";
> while you should be doing:
> $String = "text " . "more text";
>
>
> Niklas
>
> -Original Message-
> From: Luis A [mailto:[EMAIL PROTECTED]
> Sent: 26. helmikuuta 2003 16:09
> To: [EMAIL PROTECTED]
> Subject: [PHP] to holmes Re: [PHP] mysql trouble
>
>
> you mean  i do not need to put the pus on the end of the function
>
> (+)   i dont need to put there that?
>
>
> - Original Message -
> From: "John W. Holmes" <[EMAIL PROTECTED]>
> To: "'Richard Whitney'" <[EMAIL PROTECTED]>; "'Luis A'"
> <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Tuesday, February 25, 2003 8:21 PM
> Subject: RE: [PHP] mysql trouble
>
>
> > > ###  > > ### // process form
> > > ### $link = mysql_connect("localhost", "root");
> > > you need to have the password as the third argument
> > > $link = mysql_connect("localhost", "root", "password");
> > >
> > > Also, why is it in a variable?
> > > Just make it:
> > > mysql_connect("localhost", "root", "password");
> >
> > Sometime there are users that do not have a password. Every parameter
> > to
> > mysql_connect() is optional, by the way.
> >
> > Also, you want to assign the result of mysql_connect() to a variable
> > so you can tell the connections apart. If you only have one connection
> > per script, then it's not a big deal. But, if you connect to several
> > databases, then you need that result to tell them apart when you do
> > queries later so PHP knows what connection to send your query through.
> >
> > > ### mysql_select_db("mydb",$db);
> > > ### $sql = "INSERT INTO agenda (nombre, direccion, telefono, email)
> > > "
> > +
> >
> > Problem is the plus (+) sign at the end of this line.
> >
> > ---John W. Holmes...
> >
> > PHP Architect - A monthly magazine for PHP Professionals. Get your
> > copy today. http://www.phparch.com/
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> ###
> This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For
> more information, connect to http://www.F-Secure.com/
>
> ###
> This message has been scanned by F-Secure Anti-Virus for Internet Mail.
> For more information, connect to http://www.F-Secure.com/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


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


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



Re: [PHP] Out of Range

2003-02-25 Thread 1LT John W. Holmes
Probably means that only one row was returned from your query, so 2 is out
of range.

---John Holmes...

- Original Message -
From: "Todd Barr" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, February 25, 2003 5:11 PM
Subject: [PHP] Out of Range


here is my code

$Query = "SELECT Last_Login and Current_Login from Security where
PM_ID=$_SESSION[ID]";
$Getdates = odbc_do($link, $Query);
while(odbc_fetch_row($Getdates))
 {
$Last=odbc_result($Getdates, 1);
$Now=odbc_result($Getdates, 2);


Now I get an error that tells me that #2 is out of the range

Any suggestions


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



Re: [PHP] simple problem about authentication

2003-02-25 Thread 1LT John W. Holmes
> I'm trying to set up a password section on my website. But I don't want
> a window popping up asking for a username and password. I'd rather like
> to have a form that submits the data. I did that and it works fine, but
> the browser seems to not save the username and password, because if i
> click on any link, it returns an "unauthorized message"... any ideas?
> thnx,

Show some code... the possibilities are endless for what you're doing wrong.

---John Holmes...


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



Re: [PHP] Empty Query

2003-02-25 Thread 1LT John W. Holmes
>From what I can tell, if $img is an empty string, and $file_dir is not a
directory, $sql will not be assigned a value. This could be what's causing
your error when you try to run an empty query.

---John Holmes...

- Original Message -
From: "Richard Whitney" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, February 25, 2003 3:25 PM
Subject: [PHP] Empty Query


> ### I have this:
> ###
> ### [serial]
> ### [model]
> ### [yr_blt]
> ### [km]
> ### [price]
> ### [hours]
> ### [details]
> ### [location]
> ### double[style]
>
> All of the 1 are the variables being passed, the word is hardcoded for
clarity
>
>
> What I get half the time:   Couldn't insert dataQuery was empty
> ###
> ### The variables are obviously being passed
> ###
> ### Here's my insert query:
> ###
> ### if($img == ""){$sql = "INSERT INTO vehicles ( `id` ,`serial`,
`model` ,
> ### `yr_blt` , `km` , `price` , `hours` , `details` , `location` , `img`,
> ### `tstamp`,
> ### `style`)
> ### VALUES ('', '$serial',
> '$model', '$yr_blt', '$km', '$price',
> ### '$hours',
> ### '$details', '$location', '0', '$tstamp', '$style');";
> ### }
> ### else
> ### {
> ###
> ###
>
$file_dir="/services/webpages/o/f/offroad-imports.com/public/uploads/mogs/$s
erial";
> ### if (!is_dir($file_dir)){
> ### umask(000);
> ### mkdir($file_dir,0777);
> ### }
> ### else{
> ### umask(000);
> ###
> ### $path = $file_dir . "/1.jpg";
> ### move_uploaded_file($img, $path)or die('Could not upload
photo');
> ### $sql = "INSERT INTO vehicles ( `id` ,`serial`,  `model` ,
`yr_blt` ,
> `km`
> ### ,
> ### `price` , `hours` , `details` , `location` , `img`, `tstamp`, `style`)
> ### VALUES ('', '$serial',
> '$model', '$yr_blt', '$km', '$price',
> ### '$hours',
> ### '$details', '$location', '1', '$tstamp', '$style');";
> ### }
> ###
> ### }
>
> Any thoughts? Enlightenment?
>
> Thanks
>
> --
> Richard Whitney   *
> Transcend Development
> Producing the next phase of your internet presence.
> [EMAIL PROTECTED]   *
> http://xend.net*
> 602-971-2791
>   * *   *
> *  *  *__**
>  _/  \___  *
>  *  /   *\**
>   */ * *  \
> **/\_ |\
>  /   \_  /  \
> /  \/\
>/  \
>   /\
>  /  \
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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



Re: [PHP] Javascript

2003-02-25 Thread 1LT John W. Holmes
Nothing to do with PHP at all but,

Pretty sure you have to tack on the URL variables within the window.open()
function. When you specify the name of the file to open, try putting the
variable there.

---John Holmes...

- Original Message -
From: "Todd Barr" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, February 25, 2003 7:10 PM
Subject: [PHP] Javascript


I have tried this 3 different ways and none of them worked...

I am trying to get javascript to generate a popup, with a variable passed
along in the url.

echo"";

this doesn't work, neither does stopping PHP and then restarting...

Blah, any advice on how to embed javascript?


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



Re: [PHP] Output Numerical Month as String?

2003-02-25 Thread 1LT John W. Holmes
> http://www.zend.com/manual/function.date.php
> --- CF High <[EMAIL PROTECTED]> wrote:
> > Hey all.
> >
> > Easy question here (can't find the answer in php
> > manual)
> >
> > In Cold Fusion I'm able to format a given numerical
> > month value, say the
> > third month, as #MonthAsString(3)# and it returns
> > "March"
> >
> > What's the equivalent in PHP?
> >
> > Thanks for any ideas..

I know you can use date() and mktime(), but wouldn't it be easier to just
make an array?

$MonthAsString = array (1=>'January',2=>'February',3=>'March',...);

and then just echo $MonthAsString[3] when you need it?

---John Holmes...


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



Re: [PHP] line number

2003-02-25 Thread 1LT John W. Holmes
The constant __LINE__ works well.

---John Holmes...

- Original Message - 
From: "Chandler, Jacob R" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, February 25, 2003 2:21 PM
Subject: [PHP] line number


What function can I use to find out the current line number?


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



Re: [PHP] general question ?

2003-02-24 Thread 1LT John W. Holmes
> http://kemu.ath.cx/intranet/login.phps
> when I press submit everything is OK it works like I want it to work but 
> I'm not happy with the result I see in my url window
> I see this
> http://localhost/intranet/login.php?user=kemu&passwd=test&submit=login
> I don't like it that you can know the passwd
> is there a way to just make this login.php and not with all the vars I 
> send with it

Learn HTML. Search Google for the different METHODs your form can have. 



---John Holmes...

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



Re: [PHP] Keep cariage returns

2003-02-24 Thread 1LT John W. Holmes
> Is it possible to maintain the carriage returns in a
> database insert.  When I input data from a textfield
> with returns into the database, it is lost on a
> subsequent select and print.

They're still there, they don't disappear for no reason. HTML does not
understand newlines, though, only  elements. Look into the nl2br()
function.

---John Holmes...


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



Re: [PHP] PHP_SELF syntax

2003-02-24 Thread 1LT John W. Holmes
> What you might try is removing the single-quotes from around PHP_SELF.
>
> Before: $_SERVER['PHP_SELF']
> After:  $_SERVER[PHP_SELF]
>
> Another note: as far as I can tell you do not need the braces ({}) to
> enclose a variable within a double-quoted string. I may be wrong, but
> nothing I've read advocates doing this, and I've never had a problem
> with my code when I've written it this way.

Just so there's no confusion, with double quoted strings, you can do it one
of two ways.

echo "The value is {$_SERVER['PHP_SELF']}";
or
echo "The value is $_SERVER[PHP_SELF]";

Neither is any more right than the other. You can always end the string and
concatinate the variable, too...

echo "The value is " . $_SERVER['PHP_SELF'];

In that case, you should always use quotes around the key, single or double,
doesn't matter much.

---John Holmes...

> > [snip]
> >
> >>Could someone tell me why this code prompts a parse error. I have tried
it
> >>several different way. The statement is called from within a function:
> >>
> >>print " >>action=\"$_SERVER['PHP_SELF']\">\n";
> >
> > [snip]
> >
> > When using array elements within a string you must enclose it in curly
> > brackets, like this:
> >
> > print " > action=\"{$_SERVER['PHP_SELF']}\">\n";
> >
> > HTH,
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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



Re: [PHP] What is wrong with this?

2003-02-24 Thread 1LT John W. Holmes
> > Put some quotes around the tag value for just in case the $aviao has a
space
> > in it:
> >  $drop_down_list .=
"$aviao";
>
> what about if $aviao contains a double quote?
> what's the proper way to handle that case?
> or, in other words, what's the most general way to solve this problem?

Use double quotes around the value (like suggested) and run htmlentities()
on it before hand.

---John Holmes...


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



Re: [PHP] Received: (from www@localhost) ???

2003-02-24 Thread 1LT John W. Holmes
> I am using sendmail and php and it works great...
>
> However, It always says this in the header of the email
>
> Received: (from [EMAIL PROTECTED])
>
>
> Is there a way I can change this to something less generic, more specific
to
> my server?

Read the manual page on the mail() function along with the contributed
notes. It will explain how you can use a parameter to mail() to set
different headers in your email, including the From: header.

www.php.net/mail

---John Holmes...


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



Re: [PHP] Creating my own super global variables

2003-02-24 Thread 1LT John W. Holmes
> Is there any way I can creat my very own super global variables?

You can assign values directly to $_POST, $_COOKIE, etc arrays and reference
them wherever you want later. It's just for the duration of the script,
though.

---John Holmes...


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



Re: [PHP] Multiple Data Requests

2003-02-24 Thread 1LT John W. Holmes
> Hi guys,
>
> Wonder if you can help me with this.
>
> I have a "recording_global" table which has "recording_global_id" in and
> "dj_global_id".
>
> I want to be able to sort the "recording_global" table alphabetically by
> dj name which I need to find from the "dj_global_id" table referencing
> it from the ID in the "recording_global" table and enter it into a
> script.
>
> I have been banging my brain all afternoon but am no nearer to the
> solution. Below is the code I got upto before I realised I was stuck.
>
> $sql = "SELECT * FROM recording_global ORDER BY recording_global_name
> WHERE recording_global_name LIKE a%";
>
> Any help hugely appreciated! Ian.

I think you want:

SELECT r.* FROM recording_global r, dj_global d WHERE
  r.dj_global_id = d.dj_global_id AND r.recording_global_name LIKE 'a%'
  ORDER BY d.dj_global_name

or something like that. You're query is completely wrong since it has the
ORDER BY clause before the WHERE clause.

Read the manual or do some searching on JOINs, as that's what you're going
to need to solve this problem, if I understand it correctly.

---John Holmes...


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



[PHP] Re: [PHP-DB] Checkboxes to gather rows to delete

2003-02-24 Thread 1LT John W. Holmes
> It is wrong to use that way of doing it John, cause this will delete ALL
> lines that where printed with a checkbox
> And also, if you are using a old version of PHP with register globals OFF,
> the _POST array will not be available

You are mistaken. $_POST['checkboxes'] will only contain those IDs for which
the boxes were checked. If you do not check a checkbox, it's value is not
sent at all. Try it please.

To create the checkboxes, you'd do something like this:

$result = mysql_query("select rowID from table");
while($row = mysql_fetch_row($result))
{ echo '"; }

Now, $_POST['checkboxes'] will be an array of rowID values for _only_ the
boxes that were checked (or $HTTP_POST_VARS['checkboxes'] or even just
$checkboxes, depending on your version and register_globals setting).

Then, use implode() to join them all in a string and add them to your DELETE
query.

---John Holmes...

> "1lt John W. Holmes" <[EMAIL PROTECTED]> a écrit dans le message de
> news: [EMAIL PROTECTED]
> > > I have a mysql database with a table using one column as a primary
key.
> > > (rowID). On a php page I use a query to  list all of the rows of the
> table
> > > and have a checkbox beside each  row that should be used to check if
you
> > > would like to delete this row. Can someone give me an example using
post
> > > to pull the boxes that need to be deleted.
> >
> > Easy one.. :)
> >
> > Make sure your checkboxes have the rowID as their value, then you can
> simply
> > do this:
> >
> > $query = "DELETE FROM table WHERE rowID IN (" .
> > implode(',',$_POST['checkboxes']) . ")";
> >
> > and run that query.
> >
> > You'll end up with something that looks like this:
> >
> > DELETE FROM table WHERE rowID IN (1,2,3,4,5)
> >
> > where the numbers will come from only the checkboxes that you selected.
> >
> > ---John Holmes...
> >
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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



Re: [PHP] dynamic list box

2003-02-24 Thread 1LT John W. Holmes
> I have an sql statement that pulls data into a dynamic list box, the
problem
> is, I have this list box twice on my form, since the query returns a lot
of
> rows, I do not want to have the query executed twice but I populate my
list
> box using the while loop so when it is time for the second list box, the
> query is already at end of file.  I tried to get my result then just copy
> that to another array but that doesn't seem to work, any one have any
ideas?

mysql_data_seek() or put it into an array and loop through it twice.

---John Holmes...


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



Re: [PHP] Cannot find php.ini

2003-02-21 Thread 1LT John W. Holmes
> I've taken over a redhat server with apache/php4.1.  I need to enable
> register_argc_argv but I can't find the php.ini file (I've searched the
> entire system).
>
> Would creating a new php.ini file with only register_argc_argv line work?
> Where's the default location for php.ini?

Load up a page with phpinfo() in it. In the first block, it'll tell you the
location of php.ini that the installation is using. If it's only a
directory, then that's where it expects to find php.ini, but it's not there.
If it's a full path including php.ini, then that's where it is.

If there's still no file present, then you can go to
http://cvs.php.net/co.php/php4/php.ini-dist to get the latest copy from CVS.

---John Holmes...


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




Re: [PHP] What do these errors mean?

2003-02-21 Thread 1LT John W. Holmes
> I was looking through php.ini and noticed that show_error was set to Off.
I
> turned it On, and now I see these errors on one of my pages:
> Notice: Use of undefined constant option - assumed 'option' in
> /usr/local/apache/htdocs/tyler/encodeDecode.php on line 37
>
> Notice: Undefined index: option in
> /usr/local/apache/htdocs/tyler/encodeDecode.php on line 37
>
> Here's line 37-42:
> if ($_GET[option] == "") {
>  print "Add Credit Card";
>  print "
>  Credit Card Number:  name=cc>
>  ";
> }
>
> What's wrong with that?

Where you have $_GET[option], PHP is assuming that _option_ is a constant,
since strings have quotes around them (array indexes are strings). Since
there is no constant with that name, though, PHP will then assume that you
meant to use a string.

The second "warning" is caused because there is no index in the _GET array
named "option", so it's an "undefined index"

You should be using this:

if(isset($_GET['option']))
{ //code... }

---John Holmes...


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




Re: [PHP] function to discover if value is already in array

2003-02-21 Thread 1LT John W. Holmes
> Here is an example array:
>
>
> array(
>  array("1","2"),
>  array("2","3"),
>  array("3","1")
> )
>
> now suppose I get some form inputs with the value 1 and 1. I am trying to
> find a way to figure out if the first coloumn is already in the table and
> if so just add the second coloumn to the first. I have tried various
> combinations of foreaches, in_array and array_search.
>
> Has anyone had a similar problem and found a soloution?

If you can have:

$array = array(array('1','2','3'),array('2','3','1'));

You can use this:

$key = array_search($search_for,$array[0]);
if($key !== FALSE)
{ $array[1][$key] += $add_value; }

Otherwise, with the way you have your array now, you have to search
$array[0][0], $array[1][0], $array[2][0], etc, with a loop.

---John Holmes...


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




Re: [PHP] session expiration

2003-02-21 Thread 1LT John W. Holmes
> I'm using sessions for authentication in a content management system and
> experiencing rare but occasional problems with the session apparently
> expiring unexpectedly. I've checked the manual and I've reviewed the
session
> configuration on the commericial host I'm using. I don't see anything
wrong,
> but there are some settings that I don't understand:
>
> session.gc_maxlifetime 1440 -- Garbage collection after 24 minutes? Does
> this mean that the session id and session variables will be cleared after
24
> minutes of inactivity? (Surely not; that doesn't make sense.) And cleared
> from where, the directory specified in session.save_path?

Yes and Yes. After 1440 seconds of not being accessed, they are deleted the
next time the garbage collection routine is ran.

> session.save_path /tmp -- The session id and session variables are stored
in
> this directory, and it's more secure to specify a different directory. Is
it
> more stable to specify a different directory? Is it more stable to use a
> database?

Depends on what else your server is doing and how much traffic you get. If
you get a lot of traffic, there are going to be a lot of session files
sitting in this directory. Keeping it separate from /tmp will just reduce
the number of files in the directory.

A database adds to much overhead and is only needed in special cases, IMO.

> session.cache_expire 180 -- The cache expires after 3 hours? If
> session.cache_limiter is set to nocache, is session.cache_expire relevant?

Not sure on that one, but it seems logical.

> Basically, I want users to be able to stay logged in to the content
> management system indefinitely, but my tests show that after about 2 hours
> of inactivity, the session expires. (Going to a different page causes the
> session variable that identifies the user to be checked with
> session_is_registered(), and access is denied if the variable isn't
> registered.) Some users have reported this happening after about 30
minutes.

Garbage collection isn't exact. It's triggered (by default) on 1% of the
hits to your site. So if two are triggered close together, then someone can
be logged out rather quickly at 30 minutes. If there is a long pause where
the probability just doesn't trigger the garbage collection, then it may
take longer.

> I'm on LInux, PHP 4.1.2, session.cookie_lifetime setting is 0,
> session.use_cookies setting is On, session.use_trans_sid setting is 1, and
> other configurations as mentioned above. Why are sessions expiring?
Comments
> and directions to more information are appreciated.

Sessions are lost when the file is cleaned up by garbage collection or when
the user closes the browser (by default). So, if you wanted to use the
existing session handling routines, you could set the cookie lifetime to a
large value so the cookie isn't deleted and set the gc_maxlifetime to a
large value, also. You could possibly turn the gc_probability to zero, go
garbage collection is never triggered.

Another option would be to use session_save_path() within your application
to save the session files to a separate directory that's writable by the web
server. Since this directory is different from session.save_path specified
in php.ini, garbage collection will never occur, so the files will not be
deleted.

You can also define your own session handler to do what you want.

Why not just use a cookie to "remember me" though, instead of keeping the
sessions persistant? You're going to end up with a file on your computer for
_every_ person that visits the site and the file will not go away. Seems
like it'd be better to just use a cookie and load their data if it's not
already present, like on their first visit.

---John Holmes...


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




Re: [PHP] Php Oracle & Word object

2003-02-21 Thread 1LT John W. Holmes
SELECT it out, send Word headers with header() and echo your data.

---John Holmes...

- Original Message - 
From: "M.ALPER KARASAHIN" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 21, 2003 8:53 AM
Subject: [PHP] Php Oracle & Word object


Hi,
i want to display a blob column, that contain a word object. 

My database is Oracle Ver 8.1.7.
Php version is 4.2.3

How can i do this?

Thanks for your help.

Alper.


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




Re: Re[2]: [PHP] small ads system

2003-02-21 Thread 1LT John W. Holmes
> Thank you for answer, but I need application for personal small ads.
>
> I am looking for application which need to show categorized
> personal small ads and needto allow on-line adding of
> personal small ads (for everyone) and and
> need to have some mechanism for ads administration.
>
>
> I do not need application for banners management.

Ah.. sorry. You mean something like a classifieds system? I misunderstood
you. Best bet is to search hotscripts.com (already suggested) or
sourceforge.net. Something is out there already written.

---John Holmes...


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




Re: [PHP] small ads system

2003-02-21 Thread 1LT John W. Holmes
> I need web application (PHP/MySQL) for small ads
> (personal ads, that is advertisements to buy and
> sell cars, houses etc).

http://www.phpwizard.net/projects/phpAds/

---John Holmes...

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




Re: [PHP] list "a", list "b" ...etc

2003-02-21 Thread 1LT John W. Holmes
> how can i sort names by first letter, like, show only names starting 
> with a, then b, c .. etc

Where is the data? In an array? database? file?

If it's a database, then you can just do

SELECT * FROM table WHERE column LIKE 'a%'
or
SELECT * FROM table WHERE LEFT(column,1) = 'a'

---John Holmes...

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




Re: [PHP] List folder contents with links?

2003-02-20 Thread 1LT John W. Holmes
> Is it possible to display the contents of a given folder, list them , and
> make them links?

Yes.

---John Holmes...

PS: www.php.net/readdir

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




Re: [PHP] Splitting Article Into Multiple Pages

2003-02-20 Thread 1LT John W. Holmes
If you use the  method, you could use:

$part = explode("",$text);

to break apart the essay. Then echo $part[0] for page 1, $part[1] for page
2, etc...

I'm sure there are other ways.

---John Holmes...

- Original Message -
From: "Alan McCoy" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, February 20, 2003 10:11 AM
Subject: [PHP] Splitting Article Into Multiple Pages


Greetings!

I have a MySQL database of essays that contain some pretty long articles.
I'm using PHP and instead of throwing all the text up on one mile-long page,
I'd like to be able to automagically break up the article among multiple
pages.

I had thought about using multiple text areas for breaking up the story when
it is published, but fear it may be a bit cumbersome for the writers. They
might be able to handle putting in a tag (like ) to signify page
breaks in the text if it's possible that PHP could spot the tags and split
it into separate pages accordingly.

Any thoughts on this (or where to find sample code to get me started) would
be greatly appreciated!

Thanks!

Alan


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


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




Re: [PHP] Display strings with single quotes

2003-02-20 Thread 1LT John W. Holmes
> Thursday, February 20, 2003, 9:34:03 PM, you wrote:
> Rec> Hi all,
>
> Rec> Have simple but annoying issue, I want to display a string
within an
> Rec> input field. This string contains ' & so when it's being display the,
> Rec> anything after the ' is being left out. Here is the code I'm using:
>
> Rec> $string = str_replace("'", "''", $string);
> Rec> $string = stripslashes($string);
> Rec> echo "";
>
> Rec> Thanks
> Rec> Dave
>
>
> You could also try
>
> echo '';
> which would be more politically correct :)

Good point. You'll still run into problems if $string has double quotes
within it, though. So the original suggestion of using htmlentities() still
applies.

---John Holmes...


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




Re: [PHP] Test

2003-02-20 Thread 1LT John W. Holmes
> This is a test message.  I sent a real message last night and apparently 
> it didn't make it to the server.

So this is not a real message? Do I exist?

---John Holmes...

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




Re: [PHP] define("DOC_HOME_PATH", "what goes here")

2003-02-20 Thread 1LT John W. Holmes
> define ("DOC_HOME_PATH", "http://localhost/killerspin/web/store/";);
> define ("IMG_HOME_PATH", "http://localhost/killerspin/web/images/";);
> define ("CTL_HOME_PATH", "http://localhost/killerspin/web/control/";);
> 
> Click Here
>  
>
> doesn't work.

It should. The above code produces this when I try it:

http://localhost/killerspin/web/images/stuff/image.jpg";>
http://localhost/killerspin/web/store/stuff/index.jsp";>Click
Here
http://localhost/killerspin/web/control/stuff/process_order.php";>

Isn't that what you want? Look at the HTML source of your page that's being
generated...

---John Holmes...


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




Re: [PHP] Encrypted URL links?

2003-02-20 Thread 1LT John W. Holmes
> I have a site that sells software and wants to have downloadable
purchases.
>
> Is there a way to encrypt a URL that will still work when clicked on, BUT
> not show the customer where the file actually resides? Is it also possible
> to have it expire after a given amount of time?

Sure, just have a PHP script handle the downloads. Store the files you want
to protect outside of your web root, that way no one can ever get to them
directly.

Now, construct a PHP script that's going to control the download. It can
check to make sure the user is logged in if necessary among other things.
You can construct a URL such as the following

www.yourdomain.com/download.php?file_id=XX&code=YY

where XX would identify what file they are trying to download. the "code"
could be used to relate to a database or separate file that you can check to
see if X minutes have passed or not, so you know whether this link is
expired or not. If everything checks out fine, you just use a couple
header() calls to set the appropriate headers for the type of file you are
offering for download and then use readfile() to send the data. The end
result to the user will be a download box if everything validates.

---John Holmes...


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




Re: [PHP] Display strings with single quotes

2003-02-20 Thread 1LT John W. Holmes
> On Thursday 20 February 2003 20:26, Ernest E Vogelsinger wrote:
> > At 13:16 20.02.2003, Tom Rogers said:
> > [snip]
> >
> > >Rec> Have simple but annoying issue, I want to display a string
> > >within an
> > >Rec> input field. This string contains ' & so when it's being display
the,
> > >Rec> anything after the ' is being left out. Here is the code I'm
using:
> > >
> > >Rec> $string = str_replace("'", "''", $string);
> > >Rec> $string = stripslashes($string);
> > >Rec> echo " > > '$string'>";
> > >
> > >
> > >Pass the string through htmlentities(); before you echo it.
> >
> > [snip]
> >
> > htmlentities won't work with single quotes, use addslashes:

Addslashes will have no effect. HTML does not recognize the \ character as
an escape character. That's a PHP concept.

> Actually just (only) htmlentities() will do. See manual for options
regarding
> whether to encode single-quotes and double-quotes.
>
> > "";

But, you're right that this won't work. htmlentities() by itself will leave
single quotes alone. What you want to use is

htmlentities($string,ENT_QUOTES);

which will convert single and double quotes to entities.

---John Holmes...


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




Re: [PHP] Strings and regular expression?

2003-02-07 Thread 1LT John W. Holmes
> > > $a1="1,8,98,244,9,243,2,6,36,3,111,";
> > >
> > > $a2="8,98,244,9,243,2,1,6,36,3,111,";
> > >
> > > How can I exactly match "1," in both strings using one regular
expression?
> > > (first "1" is the first element and second time in a random position)?
> >
> > if(preg_match('/(^|,)1(,|$)/',$str))
> > { echo "one is found"; }
>
> if(strstr($string, '1,') == 'FALSE){
>   echo 'No match found';
>   }else{
>   echo 'Found a match';
>   }
>
> No need for costly regex

Very true, I agree. For your solution, though, wouldn't it correctly match a
string such as '2,3,11,12' even though there is no entry that's just one?

I assumed that one could be the last value in the string also, though, and
hence the regular expression.

If the 1 can be the last number in the string, then you could also use
something like your solution (looking for ',1,') and include an OR that
checks for the last two characters being ',1' OR the first two characters
being '1,'

Check if that or the regex is faster.

---John Holmes...


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




Re: [PHP] Multi-User phpMyAdmin

2003-02-07 Thread 1LT John W. Holmes
IIRC, when you use the 'cookie' or 'http' method of authentication, it'll
validate everything against the actual mysql.user database and only let them
access what they have permissions to. In other words, you set up your users
and permissions in MySQL. When they log into PHPMyAdmin, they're actually
logging into MySQL and they get the permissions you set for them.

---John Holmes...

- Original Message -
From: "Stephen" <[EMAIL PROTECTED]>
To: "PHP List" <[EMAIL PROTECTED]>
Sent: Friday, February 07, 2003 3:31 PM
Subject: [PHP] Multi-User phpMyAdmin


Can anyone tell me a tutorial on how to setup a multi-user phpmyadmin
installation? I would like to just have one central copy, then have other
users able to access their corresponding database in phpMyAdmin. How can I
do this?

Thanks,
Stephen Craton
http://www.melchior.us

"What's the point in appearance if your true love, doesn't care about
it?" -- http://www.melchior.us






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


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




Re: [PHP] is_numeric fails and don't know why

2003-02-07 Thread 1LT John W. Holmes
Well, since is_numeric('.101972E+00') works on it's own, there must be
something else coming with it from the file that makes it fail. Try to
trim() each number before you test it. Maybe that'll help.

---John Holmes...

- Original Message -
From: "fmendezpalma" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 07, 2003 7:29 AM
Subject: [PHP] is_numeric fails and don't know why


Hi,

I'm trying to read a file that contains a group of numbers, each of them in
one line of the file. I need to verify that the file is valid, so i read
line by line and test if the line is numeric:

...

$line = fgets ($FileDesc);
$line = trim ($line);
if (!is_numeric ($line))
   return 0;

...

It doesn't work for the first and last line of the file. Last line is a \r,
so perhaps it's normal, but I don't understand why it fails with first line.

Example:

.101972E+00 (first line)
-.122713E+01
.784379E-01
-.135826E+01
-.217017E+01

... first line is not considered as a number. Rest of lines are considered
as numbers. Where is the problem? Thanks for your help.
_
Horas ilimitadas para leer y enviar correos con Tarifa Plana Wanadoo
¡¡ desde las 3 de la tarde!!
Compruébalo en http://www.wanadoo.es/acceso-internet


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


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




Re: [PHP] 3 tier web development

2003-02-07 Thread 1LT John W. Holmes
>> //Class to handle ALL operations an ANY database

You may want to change that... it only does 2 operations and it only does
them for two databases...

---John Holmes...

- Original Message -
From: "Daniel Masson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 07, 2003 11:28 AM
Subject: RE: [PHP] 3 tier web development


About the database sigue .. i dont use ADOD or PEAR .. I use this:


//Class to handle ALL operations an ANY database
Class data_base (
//Predetermined value of attributes, you can safely override
this when //do many instances of this class
$dbtype = "mssql";
$duser = "user";
$dbname = "name";
$dbpass = "x";


function connect() {
if ($this->dbtype == "mssql") {
retrun function_to_connect_to_mssql($this->user,
 );
}
elseif ($this->dbtype == "mysql") {
retrun function_to_connect_to_mysql($this->user,
 );
}
}

function query() {
if ($this->dbtype == "mssql") {
retrun
function_to_query_mssql($this->connection,  );
}
elseif ($this->dbtype == "mysql") {
retrun
function_to_query_mysql($this->connection,  );
}
}



);




Daniel E Massón.
Ingeniero de desarrollo
[EMAIL PROTECTED]

Imagine S.A.
Su Aliado Efectivo en Internet
www.imagine.com.co
(57 1)2182064 - (57 1)6163218
Bogotá - Colombia

- Soluciones web para Internet e Intranet
- Soluciones para redes
- Licenciamiento de Software
- Asesoría y Soporte Técnico



-Mensaje original-
De: Hardik Doshi [mailto:[EMAIL PROTECTED]]
Enviado el: viernes, 07 de febrero de 2003 10:50
Para: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Asunto: RE: [PHP] 3 tier web development

Hi Daniel,

Thanks for your comments.

What is the difference between PHP nuke and Smarty
engine?

Can we use PEAR or ADODB as database abstraction
layer? Which one is the best on everyone's experience?

thanks

Hardik

--- Daniel Masson <[EMAIL PROTECTED]> wrote:
> Hardik:
>
> Maybe this can help:
>
> Im currently using PHP using MCV (Model Control
> View) Methology, Model
> is about libraries and classes like the business
> rules of your
> application,
> Control has to do with the como control sentences
> you must use like IF,
> WHILE,FOREACH, ... , and View is the look and file
> of the app , HTML,
> IMAGES, ...
>
> Have a look on smarty http://smarty.php.net , and
> there you can learn
> how to use HTML and PHP
>
> And about the databse tier .. I use a class named
> data_base .. with
> attributes like:
>
> -dbtype
> -dbhost
> -dbuser
> -dbpassword
>
> and the instances of the class can handle many
> databases .. and
> guarantee the portability ..
>
> I hope this helps.
>
>
> Regards.
> Daniel.
>
>
> -Mensaje original-
> De: Hardik Doshi [mailto:[EMAIL PROTECTED]]
> Enviado el: viernes, 07 de febrero de 2003 10:24
> Para: [EMAIL PROTECTED]
> Asunto: [PHP] 3 tier web development
>
> Hi Everyone,
>
> I am curious to know how one can develop 3-tier web
> based applications using PHP, MySQL. Here Database
> should be changed in future using database
> abstraction
> layer. Can anybody tell me in detail that how can i
> build 3 tier flexible web application?
>
> More questions on this thread:
>
> 1. How one can seperate HTML and PHP (or any other
> programming code).  Is there anything in PHP so i
> can
> seperate Interface layer and programming logic
> layer?
>
> 2. I know that we can use Database abstraction layer
> so in future it is really easy to change database as
> per need. Can any one tell me which database
> abstraction layer is the best for future
> applications.
>
> 3. There is lots of talk about CMS today. Does
> anyone
> know about PHP based CMS (PHP-Nuke?? i dont know)?
>
> Currently i am making 2 tier systems (HTML+PHP,
> Database) I want to switch my applications to 3 tier
> (HTML, php and database). Please give me enough
> guidance.
>
> thanks
>
> Hardik
>
> __
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up
> now.
> http://mailplus.yahoo.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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

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


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


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




Re: [PHP] Strings and regular expression?

2003-02-07 Thread 1LT John W. Holmes
> $a1="1,8,98,244,9,243,2,6,36,3,111,";
>
> $a2="8,98,244,9,243,2,1,6,36,3,111,";
>
> How can I exactly match "1," in both strings using one regular expression?
> (first "1" is the first element and second time in a random position)?

if(preg_match('/(^|,)1(,|$)/',$str))
{ echo "one is found"; }

---John Holmes...


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




Re: [PHP] Dynamic input fields in Form

2003-02-07 Thread 1LT John W. Holmes
> Thanks for the answer; but there is nobody who can show me an example in
> code???

You mean do the work for you? Do you want the PHP or Javascript solution?
Only one can be posted on this list...

The PHP one is simple. Assuming $_POST['num'] is the number from your drop
down...

for($x=0;$x<$_POST['num'];$x++)
{ echo ''; }

That's it.

---John Holmes...

> > > I have a form where the user selects for example; how many cars
> > > you have:  4. Then it most dynamicly create 4 input fields
> > [...]
> >
> > Using only PHP, you'll have to make this a two-step process where page 1
> > collects the number of cars and posts to page 2, which generates the
form
> > accordingly.
> >
> > If is has to be done on the same page, you'll need to call a Javascript
> > function every time the number of cars changes. That function will have
to
> > add or remove s from the form depending on the number  of cars
> > entered, and of course the whole page will break completely for anyone
> > without Javascript.
> >
> > I'd make it a two-step process myself, it's considerably more robust and
> > offers considerably less room for problems (what happens if I claim I
have
> > five cars, fill out their details, and then change it to three cars?
which
> > details do you get rid of?)
> >
> > Cheers
> > Jon
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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




Re: [PHP] Avoiding several windows with the same session

2003-02-07 Thread 1LT John W. Holmes
> If you are using cookies the new window will pick it up. Have the original
> page change a variable to say that it has loaded then when the new window
> loads have it check that variable first.

How do you tell a "new window" from a "new request" though? You can't. The
cookies are all there, the session is still there. Two requests from two
windows will look the same as two requests from a single window to a web
server. It shouldn't matter to your application.

---John Holmes...


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




Re: [PHP] Avoiding several windows with the same session

2003-02-07 Thread 1LT John W. Holmes
> > I place
> >
> > session_start();
> > if (!session_is_registered('somevar'))
> > {
> > header('location: login.php');
> > exit();
> > }
> >
> > at the top of all my pages to prevent people to view pages before they
log
> > in. However, once thay have logged in succesfully, they can ctrl-U in IE
> to
> > open a new window. This new window 'inherits' the session id and hence
it
> > does not redirects to the login page. Is there any way to avoid this
> > situation so that people cannot have several windows with the same
session
> > open?

No. It shouldn't matter, as that's a client side issue. Who cares how many
windows they have open.

---John Holmes...


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




Re: [PHP] PhpBB2 Error

2003-02-07 Thread 1LT John W. Holmes
> I have been runing PHP BB2 successfully on my site for a couple of
> months . Recently I got this error.
>
> phpBB : Critical Error
>
> Could not connect to the database
>
>
> Can someone tell what this means..??

It means phpBB cannot connect to the database.

---John Holmes...

PS: You'll want to check your login and password, make sure the database is
running, etc...all of the stuff that should be obvious when you get an error
like this.


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




Re: Re: [PHP] empty variables from a form

2003-02-05 Thread 1LT John W. Holmes
> empty doesnt work either... it still comes up as though something is in
them
> and excludes either nothing at all or includes everything...even the empty
> vars..any reason for that ?

Because you're jacking something up in your logic or code... show us how
your trying to solve this perplexing dilemma (show us your code).

---John Holmes...


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




Re: [PHP] empty variables from a form

2003-02-05 Thread 1LT John W. Holmes

> > > how would you test for an empty (unused) variable from a form..
> > > i have a phone number split into 3 different vairiables and want to
test
> > to
> > > see if they were used in the form before displaying either the phone
> > number
> > > itself or just leaving it out of the display... what code would be
good
> to
> > > test it with.. the variables are $ac2 $ext2 and $num2
> >
> > Use the isset() function:
> >
> > if(isset($ac2)) and
> > if(isset($ext2)) and
> > if(isset($num2)) { do something }
> > else { do something else }

That's not a good idea if your trying to check for an empty variable. An
empty text box, when submitted, will still be set and pass isset(). You
should use empty() is that's really what you're looking for.

---John Holmes...


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




Re: [PHP] empty variables from a form

2003-02-05 Thread 1LT John W. Holmes
> how would you test for an empty (unused) variable from a form..
> i have a phone number split into 3 different vairiables and want to test
to
> see if they were used in the form before displaying either the phone
number
> itself or just leaving it out of the display... what code would be good to
> test it with.. the variables are $ac2 $ext2 and $num2

umm i don't know maybe empty() ?

www.php.net/empty

---John Holmes...


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




Re: [PHP] Sessions and Cookies

2003-02-05 Thread 1LT John W. Holmes
> I'm trying to use cookies in PHP4 (.whatever the latest release is).  I
want
> to use them for validation (ensuring a user has logged in) but all I can
find
> is setcookie, which seems only to create the cookie.  In trying to use PHP
> sessions, I end up with odd errors.
>
> When I try to use sessions I get the error message the header has already
been
> sent.  I've pasted them below (I was getting different errors before I
moved
> the code before the < html > tag).
>
> Warning: Cannot send session cookie - headers already sent by (output
started
> at /home/allan/public_html/sestest2.php:10) in
> /home/allan/public_html/verifysession.php on line 6
>
> Warning: Cannot send session cache limiter - headers already sent (output
> started at /home/allan/public_html/sestest2.php:10) in
> /home/allan/public_html/verifysession.php on line 6

session_start() must be before . Solve those problems first because
sessions are going to be a better solution than a cookie.

> My Questions:
> If I create a cookie with set_cookie how do I read it/check it?

Whatever you name the cookie, say 'MyCookie', on the following pages from
where you set it, you'll have a $_COOKIE['MyCookie'] variable with it's
value. Use that variable just like you would any other.

> How do I use sessions if they can't be sent in the code?

They must be started before output. You can use the values within your code
and set/change values within your code.

> What use are sessions if I can only mess with them in one place?  What if
I
> need to do some processing first to decide what to do with them?

No problem, see above.

---John Holmes...


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




Re: [PHP] In Need of a PHP freelancer...

2003-02-04 Thread 1LT John W. Holmes
-Original Message-
>>Greetings... I am in need of a freelancer to write an additional 
>>function to our company's extranet. Before I go and post a 
>>request to this list, I would like to know if there is 
>>a more appropriate place to post such a request, and still 
>>get quality folks who know their stuff.

This is probably the best place, assuming you need a PHP function.. :)

I'd be interested, also, if you want to send more details offlist.

---John Holmes...



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




Re: [PHP] Access GAH

2003-02-04 Thread 1LT John W. Holmes
It probably depends on how you're creating your SQL statement...

---John  Holmes...

- Original Message -
From: "Todd Barr" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, February 04, 2003 2:56 PM
Subject: [PHP] Access GAH


Hello folks,

I was wondering if anyone had anyluck with empty fields in Access.

Basically, I have an update page, and sometimes items are left blank on
purpose.

but when I click to update, it gives me an error, as some fields are left
blank.

Is this an access thing, or can I code around it.  The internet has been
little help today.




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




Re: [PHP] Is my syntax wrong?

2003-02-04 Thread 1LT John W. Holmes
>Something is still not right. Now I'm getting unexpected
>T_CONSTANT_ENCAPSED_STRING when using:
>
>$inc_current_ad = WrapMySQLDatabaseResults("macasap", "update ads where
>ad_id = ".$current_ad->Value("ad_id")." set
>rotate=".$current_ad->Value("rotate")+1."",
>"block=0","inc_current_ad");

The problem is your addition, you need another set of paranthesis around the
whole operation.

This will produce your same error:

$test = "the value is " . $c+1 . " dollars";

whereas this won't:

$test = "the value is " . ($c+1) . " dollars";

---John Holmes...


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




Re: [PHP] Is there a way to retrieve an entire source code from a php file?

2003-02-04 Thread 1LT John W. Holmes
No, you can only get the output of the PHP script, not it's source code.

---John Holmes...

- Original Message -
From: "The New Source" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, February 04, 2003 11:57 AM
Subject: [PHP] Is there a way to retrieve an entire source code from a php
file?


What I want to know is if it is possible to retrieve a source code from a
url, with a php file.

Something like this:

There is a php file that retrieve the source code from the url www.url.com
and this source is treated and you get content from this file and show it on
the response page.

Is this possible? Can anyone show me the right direction?

Rodrigo.


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




Re: [PHP] Is my syntax wrong?

2003-02-04 Thread 1LT John W. Holmes
>The following code is giving me a "parse error, unexpected T_STRING."
>
>$inc_current_ad = WrapMySQLDatabaseResults("macasap", "update ads where
>ad_id = '.$current_ad->Value("ad_id").' set
>rotate='.$current_ad->Value("rotate")+1.'",
>"block=0","inc_current_ad");
>
>It's supposed to increment the value ad_id in the ads table. The
>current_ad action works fine and correctly retrieves the right record.
>I suspect I have a problem with my quotes?

Yep. If you want to break out of your string to include you're variables,
then use double quotes.

$string = "insert my " . $variable . " here";

not...

$string = "insert my ' . $variable . ' here";

The error is being caused because of the double quote in Value("ad_id") is
being seen as the end of the string.

---John Holmes...


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




Re: [PHP] Getting key of value added to array with []?

2003-02-04 Thread 1LT John W. Holmes
> Is there any way to get the key of an element added to an array with []?
>  I need to use this for a reference to it.  The only idea I can think of
> is to foreach through the array and use the last key looped through, but
> that seems very dirty.

If elements are only being added with [], then you should be able to keep a
count as  you go.

Easy way would be to add it like this:

$array[$x++] = $your_value;

Then you'll have ($x-1) as the element just added, if you need it.

---John Holmes...


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




Re: [PHP] dealing with accents in your databases (or to entity or not to entity...)

2003-02-03 Thread 1LT John W. Holmes
> This hasn't come up too much yet in one of the databases on my site, but
as
> I get closer to starting a big project, I thought I'd get an idea of how
the
> rest of you handle this.
>
> How do you handle accented words and other problematic symbols on your
> database-driven sites? If you need to store one, do you store it as the
> actual character and display it with htmlentities, or do you store it as
the
> html entity? In other words, do most of you store "Law & Order" in your
> database or "Law & Order"? "Renée" or "Renée"
>
> What are the pros and cons of storing them in the database in either
format?

One other thing to mention... searching. If you search your database, make
sure you make the search string match the encoding of your database. So if
you store the data encoded, then the search string has to be encoded, too.
Seems obvious, but I could imagine it tripping someone up for a while until
they figured it out.

---John Holmes...


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




Re: [PHP] dealing with accents in your databases (or to entity or not to entity...)

2003-02-03 Thread 1LT John W. Holmes
> --- "Ian M. Evans" <[EMAIL PROTECTED]> wrote:
> > How do you handle accented words and other problematic
> > symbols on your database-driven sites? If you need to
> > store one, do you store it as the actual character and
> > display it with htmlentities, or do you store it as the
> > html entity?
>
> Most people seem to prefer storing the data in its raw form
> and translating it when you want to view it in HTML. This
> can be very helpful if you are going to do something else
> with the data (other than displaying it in a browser) or if
> your formatting requirements are subject to change.
>
> However, it is ultimately up to you. If data is typically
> viewed a few hundred times per single insert, it might be
> worth the performance gain for you to format the data
> before storing it. This way, when you get the data for
> display, you don't have to perform any string functions.
>
> So, I guess you could say (this is a gross generalization,
> but fairly accurate):
>
> Store data formatted => greater performance
> Store data raw => greater flexibility
>
> Hope that helps.

I agree. And 4.3 has a html_entity_decode() function that you can use to
reverse your encode. So, store it in the format that it's going to be viewed
in the most, then decode/encode for the exceptions.

---John Holmes...


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




Re: [PHP] Need to check whether a param exists!

2003-02-03 Thread 1LT John W. Holmes
if(isset($_REQUEST['page']))
{ $pagename = $_REQUEST['page']; }
else
{ $pagename = 'home'; }

Should work... If not, let us know. Make sure your case match, too.
?page=hello and ?Page=hello are two different variables.

---John Holmes...

- Original Message -
From: "Brian Dunning" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, February 03, 2003 11:54 AM
Subject: [PHP] Need to check whether a param exists!


Hi,

All I'm trying to do is check for the presence of a query string, but
everything I try gives me an Undefined Index error. I want to set a
variable $pagename to whatever was passed as the ?page= value, and if
it wasn't passed, set it to some default value.

http://www.mysite.com/index.php?page=hello



I also tried is_null, tried if($_REQUEST) by itself, also tried all of
these with $_GET, $_POST, $_GLOBAL, but they all give me Undefined
Index error on that If line.

- Brian


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


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




Re: [PHP] escaping quotes in mail() message

2003-02-03 Thread 1LT John W. Holmes
> I'm having a problem escaping double quotes in email messages sent with
> mail(). The message is built as a string and assigned to a variable and
the
> variable name is passed to the mail function.
>
> The double quotes appear correctly in a simple test like this:
> $message = "This message uses 'single' and \"double\" quotes.";
> mail($sendto, $subject, $message, $headers);
>
> But if $message is built in another part of the script and passed as a
> hidden input of a form, the email arrives with the message truncated at
the
> first double quote encountered. If I do a str_replace() on $message to
> escape double quotes, the email shows the escaping backslash but is still
> truncated at the double quote!
>
> I've got magic_quotes on, but I think I'm keeping up with stripslashes
> because single quotes are showing up correctly.
>
> Can anyone please advise?

You can't escape double quotes in HTML... it doesn't understand.

So, you're ending up with a hidden element like this:



HTML will cut it off at the first " because it doesn't recognize the escape
character.

The way around this is to use htmlentities() or htmlspecialchars() on your
string before you insert it into the value attribute of your form element.
It will come out decoded on the the other side, so you don't have to worry
about that.

Hope that helps.

---John Holmes...


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




Re: [PHP] Html forms

2003-02-03 Thread 1LT John W. Holmes
> Parse error: parse error in C:\apache\htdocs\tsadbatest.php on line 148
> Its the line after the html ends

Almost always means you forgot a closing brace somewhere. Count up your {
and } and make sure they match.

---John Holmes...


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




Re: [PHP] Html forms

2003-02-03 Thread 1LT John W. Holmes
What is the error message you get?

---John Holmes...

- Original Message - 
From: "Todd Barr" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, February 03, 2003 9:59 AM
Subject: [PHP] Html forms


I am having difficulty putting results into an form

Once the query runs, I have this for my output

print "";

This results in an HTML error 

being apache finds an error AFTER the  tag

Any ideas?


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




Re: [PHP] How to compare 2 strings

2003-02-03 Thread 1LT John W. Holmes
> How to compare 2 strings in PHP
> I hawe 2 array where I have only string values some values in both arrays
> are same but if command don't send me a good result.
> e.g
>
> foreach ($array1 as $a1) {
>   foreach($array2 as $a2){
>if ($a1 == $a2) echo "good";   //never system send me a good result
>  else echo "bad;
>   }
> }

Well, that means your strings are never equal, plain and simple. Remember
the comparison will be case sensitive. You should be using strcmp() and it's
family to compare strings, anyhow.

---John Holmes...


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




Re: [PHP] Delete Related Table

2003-02-03 Thread 1LT John W. Holmes
> i need delete two related table from mysql database,
> but i am found and error..
> this following my sql language :
>
> DELETE FROM X INNER JOIN Y ON X.ID = Y.ID WHERE Y.No = 144;
>
> i found an error in INNER JOIN syntax..
> but i have successfully displaying 2 Related table in SELECT syntax..
> my question..
> any other way two delete two related table like above??..,
> sorry if i ask out of topic..
> need help... :)

What database are you using? It probably doesn't support that type of query.

---John Holmes...


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




Re: [PHP] mktime with Feb or Jan ..

2003-02-03 Thread 1LT John W. Holmes
> I parse the apache logfile and get a date format like this
> [03/Feb/2003:09:22:50 +0100]
> OK i split it with preg_match and the result is
>
> Array
> (
> [0] => 03
> [1] => Feb
> [2] => 2003
> [3] => 09
> [4] => 22
> [5] => 50
> )
>
> Now I'd like to convert it in a timestamp
> with mktime but the problem is Feb ($t[1])
>
> $lasttime = mktime($t[3], $t[4], $t[5], $t[1], $t[0], $t[2]);
>
> Is it possible to convert Feb in 02,

If strtotime() doesn't work on the whole thing, then the easy way to get
'Feb' to 2 is to just create an array.

$month = array('Jan' => 1, 'Feb' => 2, 'Mar' => 3 ... etc.

Then, just use:

$lasttime = mktime($t[3], $t[4], $t[5], $month[$t[1]], $t[0], $t[2]);

---John Holmes...


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




Re: [PHP] Followup on form problems

2003-01-31 Thread 1LT John W. Holmes
> Well, after much debugging, turns out it was the "isset" command that was
> causing all the problems.  By simply removing that, everything started
> working properly.
>
> Thanks to everyone for their input!

It will also work if you replace all of your code with , but is that a solution, either?

---John  Holmes...


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




Re: [PHP] Followup on form problems

2003-01-31 Thread 1LT John W. Holmes
> Well, after much debugging, turns out it was the "isset" command that was
> causing all the problems.  By simply removing that, everything started
> working properly.
> 
> Thanks to everyone for their input!

IT COMPILES! Ship it!

---John Holmes...

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




Re: [PHP] Question

2003-01-31 Thread 1LT John W. Holmes
[snip]
> I understand most of what is going on here except for this line:
>
> printf ("%s\n", htmlspecialchars ($row[$i]));
>
> Can someone explain to me what the %s is?

www.php.net/sprintf

sprintf() and printf() have the same type of syntax and all of the %s, etc,
are explained on the sprintf() page given above.

---John Holmes...


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




Re: [PHP] Unable to upload multiple files

2003-01-31 Thread 1LT John W. Holmes
> 

You're saying you're only uploading 10K total... for all of the files. If
the browser is respecting this, and you're trying to upload more than 10K,
then it could not upload anything and you get your error.

If it was a PHP issue, it seems like you'd get an error or warning from PHP,
not from the web server (which is where "document contains no data" would
come from, I assume?)

---John Holmes...


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




Re: [PHP] Unable to upload multiple files

2003-01-31 Thread 1LT John W. Holmes
> >>Ok now I am able to send the request. I set the post_max_size into 50M
> >>and now when the request is sent the whole apache goes down giving: "The
> >>document containd no data" everytime I send a request. I tried also 10M
> >>but same happens. What the h**l is this?
> >
> >
> > Do you have this line in your form?
> >
> > 
> >
> > and is it set to a value greater than the size of all the files you're
> > trying to upload? Some browers actually pay attention to this.
> >
> > ---John Holmes...
> >
>
> No, I don't have that line.

Try it then...

---John  Holmes...


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




Re: [PHP] Unable to upload multiple files

2003-01-31 Thread 1LT John W. Holmes
> Ok now I am able to send the request. I set the post_max_size into 50M
> and now when the request is sent the whole apache goes down giving: "The
> document containd no data" everytime I send a request. I tried also 10M
> but same happens. What the h**l is this?

Do you have this line in your form?



and is it set to a value greater than the size of all the files you're
trying to upload? Some browers actually pay attention to this.

---John Holmes...


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




Re: [PHP] PHP & Apache

2003-01-30 Thread 1LT John W. Holmes
> Maby you could help me on why I get this message when using variables:
> Undefined variable: UN1 in c:\inetpub\wwwroot\sdd\pages\redirection.php
> on line 15

Because you have an undefined variable. You have a variable that has not
been assigned a value. Assign it a default value or use isset() in your
tests and this will go away.

> I have PWS being used, PHP 4.3.0 & Apache 2.0.34. OS is Windows 2k
> If you could help that would be great because I need it for testing
> scripts for my HSC Course.

Or look at error_reporting()

www.php.net/error_reporting

---John Holmes...


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




Re: [PHP] Using custom "button" form element instead of standard "submit"?

2003-01-30 Thread 1LT John W. Holmes
> At 13:37 30.01.2003, Durwood Gafford spoke out and said:
> [snip]
> >
> >
> >
> >
> >
> >your php form handler can now simply do:
> >
> >print "The user selected button $sample\n")

If that's what you want, then just make each button a normal  link
and pass an variable to the next page in the link (like someone has already
suggested). You'd get the same end result.






print "The user selected button $sample\n";

---John Holmes...


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




Re: [PHP] chat rooms

2003-01-29 Thread 1LT John W. Holmes
> Does anyone have any suggestions for a good small FREe chat room to add to
a
> family site?  A friend here at work is hosting a site from home and is
> looking to add a chat room.  Some of his site is php so if it is  php
based,
> that would be great.  We even talked today about creating our own.

Just Google for "PHP chat"

There are some good ones out there already.

---John Holmes...


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




Re: [PHP] Multiple Emails

2003-01-29 Thread 1LT John W. Holmes
> are all your email duplicated?  if people are replying to a message you
sent
> you are probably getting one copy from them and one from the list.

No, it's not that. I'm talking about just regular questions that are send
only to the list. Hours later I will receive another copy of the message for
some reason. Maybe it's my ISP.

---John Holmes...


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




[PHP] Multiple Emails

2003-01-29 Thread 1LT John W. Holmes
Is anyone else getting multiple emails from this list? I'm about to jump on
people for asking the same question 3 or 4 times, but maybe it's just me
getting copies of the same message.

---John Holmes...


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




  1   2   3   4   5   6   >