[PHP] Re: $POST and $_SESSION

2012-03-15 Thread Michael Clark

On 3/15/2012 9:04 AM, Tedd Sperling wrote:

What's a better/shorter way to write this?

$first_name = $_SESSION['first_name'] ? $_SESSION['first_name'] : null;
$first_name = isset($_POST['first_name']) ? $_POST['first_name'] : $first_name;
$_SESSION['first_name'] = $first_name;


Better:
$first_name = null;
if (isset($_POST['first_name'])) {
$first_name = $_POST['first_name'];
$_SESSION['first_name'] = $first_name;
} elseif (isset($_SESSION['first_name'])) {
$first_name = $_SESSION['first_name']
}

Shorter:
$first_name = @$_POST['first_name'] ?: (@$_SESSION['first_name'] ?: null);
$_SESSION['first_name'] = $first_name;


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



[PHP] Error logging

2007-05-31 Thread Clark Alexander
We have the following php.ini settings:
error_reporting  =  E_ALL
display_errors = Off
display_startup_errors = Off
log_errors = On
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
track_errors = Off

on a SuSE 10.1 server and the errors are being logged to
/var/log/apache2/error_log
(although I can't seem to find a setting that is making that happen.)

parse errors ARE being logged to this file and that would be extremely
useful information for students to be able to have when trying to find
problems in their scripts. I can't just make that file readable to them.

So, I had students create a logs directory within their file area and set
the permissions so that the server can to it. I have them adding the
following to the script(s) that they wish to troubleshoot:

ini_set(log_errors, On);
ini_set(error_reporting, E_ALL);
ini_set(error_log, logs/error_log);


Parse errors are not being written to their personal log file, though. Why
not?? About the only going in there are NOTICE level entries.

Thanks.

Clark W. Alexander

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



Re: [PHP] Error logging

2007-05-31 Thread Clark Alexander
Yes, it does write to the file, but the only things going in there are
notice type entries.
Also, for further information, it is php 5.1.2 using the Suse rpm.


On 5/31/07 5:14 PM, in article [EMAIL PROTECTED], Jochem Maas
[EMAIL PROTECTED] wrote:

 Clark Alexander wrote:
 We have the following php.ini settings:
 error_reporting  =  E_ALL
 display_errors = Off
 display_startup_errors = Off
 log_errors = On
 log_errors_max_len = 1024
 ignore_repeated_errors = Off
 ignore_repeated_source = Off
 report_memleaks = On
 track_errors = Off
 
 on a SuSE 10.1 server and the errors are being logged to
 /var/log/apache2/error_log
 (although I can't seem to find a setting that is making that happen.)
 
 parse errors ARE being logged to this file and that would be extremely
 useful information for students to be able to have when trying to find
 problems in their scripts. I can't just make that file readable to them.
 
 So, I had students create a logs directory within their file area and set
 the permissions so that the server can to it. I have them adding the
 following to the script(s) that they wish to troubleshoot:
 
 ini_set(log_errors, On);
 ini_set(error_reporting, E_ALL);
 ini_set(error_log, logs/error_log);
 
 
 Parse errors are not being written to their personal log file, though. Why
 not?? About the only going in there are NOTICE level entries.
 
 does log/error_log exist?
 does the webserver have write permissions on that file?
 
 
 Thanks.
 
 Clark W. Alexander
 

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



Re: [PHP] Error logging

2007-05-31 Thread Clark Alexander
Upon review, I also discover that fatal error entries are being made as
well.


On 5/31/07 5:14 PM, in article [EMAIL PROTECTED], Jochem Maas
[EMAIL PROTECTED] wrote:

 Clark Alexander wrote:
 We have the following php.ini settings:
 error_reporting  =  E_ALL
 display_errors = Off
 display_startup_errors = Off
 log_errors = On
 log_errors_max_len = 1024
 ignore_repeated_errors = Off
 ignore_repeated_source = Off
 report_memleaks = On
 track_errors = Off
 
 on a SuSE 10.1 server and the errors are being logged to
 /var/log/apache2/error_log
 (although I can't seem to find a setting that is making that happen.)
 
 parse errors ARE being logged to this file and that would be extremely
 useful information for students to be able to have when trying to find
 problems in their scripts. I can't just make that file readable to them.
 
 So, I had students create a logs directory within their file area and set
 the permissions so that the server can to it. I have them adding the
 following to the script(s) that they wish to troubleshoot:
 
 ini_set(log_errors, On);
 ini_set(error_reporting, E_ALL);
 ini_set(error_log, logs/error_log);
 
 
 Parse errors are not being written to their personal log file, though. Why
 not?? About the only going in there are NOTICE level entries.
 
 does log/error_log exist?
 does the webserver have write permissions on that file?
 
 
 Thanks.
 
 Clark W. Alexander
 

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



[PHP] PHP Consultant / Contractor

2006-11-07 Thread Max Clark

Hi all,

I apologize in advance for a commercially orientated posting in this 
discussion list - I did not see a business focused list to use instead.


I am looking for a good reliable PHP developer that can help with some 
one off projects that I have (10-20 hours a month perhaps) - geographic 
location is not a concern (aka I am open to persons outside of the US), 
the requirement of reliable communication and timely delivery is absolute.


If you are interested in something like this please email me off list 
with your Resume/CV, any sample projects that would be good to look at, 
and of course your contact information.


Thanks,
Max

max [at] clarksys [dot] com

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



Re: [PHP] order of elements in $_POST super global

2006-06-08 Thread Ron Clark

Ben Liu wrote:

Hi Dave,

No, that is definitely a possibility. Right now I am using a foreach
loop to iterate over the $_POST array and determine if each checkbox
is checked or not, if it is checked, than a related piece of data is
written into the text file. This makes for pretty compact code. I
could as you suggest, simply check each element in the array manually
using the associative keys rather than using a loop, that way I could
do it in any order I wished, but the code gets rather long with a line
for each checkbox. I anticipate this set of checkboxes/boolean
responses may increase in the future also, so having the loop allows
for some future-proofing.

- Ben

On 6/8/06, Dave Goodchild [EMAIL PROTECTED] wrote:





On 08/06/06, Ben Liu [EMAIL PROTECTED] wrote:



You can access the values in the $_POST array in any order, so if you 
know
the checkbox names why not output them in the order you want? Or I am 
being

dumb here?





why not create an array with the keys in the order you want ( $array= 
array(value1,value2,). Then loop through the array and use the 
values as keys to the $_POST variable and perform your processing that way.


foreach ($array as $value) {
   if (isset($_POST[$value]) {
do something;
   }
}


--
Ron Clark
System Administrator
Armstrong Atlantic State University


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



Re: [PHP] 404 After Setting session.save_path to /tmp

2006-05-17 Thread Ron Clark

Mark Sargent wrote:

Chris wrote:


Big security issue - don't do it.

ps au | grep apache
root   /usr/sbin/apache
htdocs /usr/sbin/apache
htdocs /usr/sbin/apache

My apache is running as htdocs. So as root create a temp folder and 
chown it to htdocs:


mkdir /my_temp_dir
chown htdocs. /my_temp_dir


Hi All,

ok, created dir, added htdocs user/group and changed ownership of dir to 
them. Thing I'm gettin is, every time I make an adjustment to either 
php.ini or httpd.conf, and do a restart, I keep getting a 404 error for 
all pages. Which only corrects when doing a reboot of the box. This was 
happening before I just followed your last steps. Thoughts? Cheers.


Mark Sargent.



I thought you said in earlier email that your apache was running as user 
daemon. The tmp directory has to be owned by the user running apache. If 
you want to run apache as user apache group apache then you will have to 
edit httpd.conf and change the User and Group directives. Otherwise 
chown chgrp the tmp directory to the user/group that is listed in the 
httpd.conf file.

--
Ron Clark
System Administrator
Armstrong Atlantic State University
11935 Abercorn Street
Savannah, Ga 31419
Phone: 912 961 3234
Fax: 912 927 5353

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



[PHP] using curl to peform post

2005-12-04 Thread Brent Clark

Hi all

I have need to simulate the role of a web browser by submitting the following 
code.

form name=form1 action=propsearch.pl method=post
textarea rows=12 cols=70 name=msgGREENc/textarea
input type=submit value=Submit
/form

Heres my PHP code that got from the curl function.

?php

$url = www.example.com;
$page = /cgi-bin/ecco/scripts/h2h/glo/propsearch.pl;

$post_string = msg=GREE01;

$header = POST .$page. HTTP/1.0 ;
$header .= MIME-Version: 1.0 ;
$header .= Content-type: application/PTI26 ;
$header .= Content-length: .strlen($post_string). ;
$header .= Content-transfer-encoding: text ;
$header .= Request-number: 1 ;
$header .= Document-type: Request ;
$header .= Interface-Version: Test 1.4 ;
$header .= Connection: close ;
$header .= $post_string;

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 4);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $header);

$data = curl_exec($ch); if (curl_errno($ch)) {
print curl_error($ch);
} else {
curl_close($ch);
}

print $data;
?

Any assistant would gratefully be appreciated.

Kind Regards
Brent Clark

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



[PHP] Links exchange with http://php-faq.com.

2005-04-19 Thread Ann Clark

Hello,

 
  We would like to exchange links between your site http://php-faq.com and our 
new exciting casino web site.
Our site do NOT offer online gambling, it have information about different 
aspects of gambling and so it's very good and informative from our point of 
view.
We require that our link to you is reciprocated. So please add our link to your 
site and send us it location, we will reply within 72 hours.


Information about our site is next:

URL: http://www.1-all-best-online-casinos.com/about.html
Link Title: Online Casinos
Description: All Best Online Casino Games are here!
 


Best regards, Ann Clark.

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



Re[3]: [PHP] How to argue with ASP people...

2005-01-05 Thread Ron Clark




On Tue, 4 Jan 2005, Richard Davey wrote:

 Hello Ron,

 Tuesday, January 4, 2005, 5:59:31 PM, you wrote:

 RC You then do %=filen% to go back into ASP to get the value of the
 RC variable into the HTML code that you wrote. ASP is not including the file,
 RC it is only supplying a file name for SSI includes whether apache SSI or
 RC IIS SSI. The server parsing the HTML recognizes the HTML comment is
 RC sentax for server side include and includes the suppplied file name.

 Perhaps this is a better example for you:

 script1.asp
 %
   StrName = bob
 %

 script2.asp
 !--#include file=script1.asp--
 %
   Response.Write Hello   StrName
 %

 Clearer now? I understand what you're saying perfectly, but in the
 context of ASP scripts I am afraid it's wrong.

 Best regards,

 Richard Davey
 --

With this new example you are still using SSI from the web server to
include an ASP file. ASP itself is not including the file.

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



RE: Re[3]: [PHP] How to argue with ASP people...

2005-01-05 Thread Ron Clark


On Wed, 5 Jan 2005, Jay Blanchard wrote:

 [snip]
 ...stuff...
 [/snip]

 I think we can all agree that PHP and ASP can do the same things, so the
 one glaring difference is COST. An efficient Apache / PHP server can be
 set up for much less than an IIS / ASP server, even if you take the same
 'box' to do it with. Given the same 'box' you will find the Apache / PHP
 server to be much more efficient.


I totally agree and would add more secure

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



Re[2]: [PHP] How to argue with ASP people...

2005-01-04 Thread Ron Clark


On Tue, 4 Jan 2005, Richard Davey wrote:

 Hello John,

 Tuesday, January 4, 2005, 2:52:27 PM, you wrote:

 JN Standard comment in HTML, but it has another use with Apache, and I
 JN didn't find any reference to this type of syntax for ASP.

 !--#include file=whatever.asp --

 and

 !--#include virtual=whatever.asp --

 are both perfectly valid ASP syntax that will work on **IIS**

 Obviously you can do the usual stuff as in PHP, with:

 %
 filen = header.inc
 %
 !--#include file=%=filen%--

When you do % then you have broken out of ASP and are now writing HTML.
You then do %=filen% to go back into ASP to get the value of the
variable into the HTML code that you wrote. ASP is not including the file,
it is only supplying a file name for SSI includes whether apache SSI or
IIS SSI. The server parsing the HTML recognizes the HTML comment is
sentax for server side include and includes the suppplied file name.


Ron Clark
Sysadmin/Webmaster
Armstrong Atlantic State University

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



Re: [PHP] a question about the PHP manualB

2004-12-09 Thread Ron Clark


At 09:56 AM 12/9/2004, Eakin, W wrote:
Hello,
As I'm studying, and learning, PHP, I use certain resources again and
 again. A few books I've bought, some web sites, this mailing list, and
 the PHP manual. I've taken the often repeated 'RTFM' to heart, and I
 attempt to google or RTFM before considering a post to the list with a
 question, but now I have a question about the manual itself.
I've noticed that most of the replies to the questions on this list, when
they refer to a part of the manual,  point to the same few sections over
and over. Such as arrays, strings, sessions, objects, and a few others.
My question is this, when I'm reading the manual, is just that I should
be
concentrating on a few sections (and if so, which?), or should I be
giving
equal attention to all the sections, including some (I suppose) I might
never use.

I have found that when learning a new language that it is a good idea to
read the whole manual it time permits, even it there are sections that you
don't think you will ever need. Later on when programming you may need to
do something and remember that function that you never thought you would
need. It never hurts to no what's available even if you don't think you
will need it.

Ron Clark
System Administrator
Armstrong Atlantic State University

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



Re: [PHP] system command

2004-08-24 Thread ron clark
Daniel Schierbeck wrote:
Ron Clark wrote:
Capture the output in the $output variable then ob_clean to empty the 
output buffer before printing the the desired message.

ob_get_clean() is preferable:
$output = ob_get_clean(); // Gets the buffered output and cleans 
the buffer

Didn't need the contents of the buffer. All I needed was the last line 
which was contained in $output = system().

--
Ron Clark
System Administrator/Web Coordinator
Armstrong Atlantic State University
11935 Abercorn Street 
Savannah, Ga 31419
Phone: 912 961 3234
Fax: 912 927 5353

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


[PHP] system command

2004-08-23 Thread ron clark
I an trying to add virus scanning to the file upload section of our 
portal using uvscan. The virus scanning is working properly using a 
system call , but I am having problems with formatting the output. I 
need to check the return value and if it is not a 0, I want to create a 
custom message. The problem is, when using system the output of the call 
is flushed to the browser before I can write the custom message so I 
have the uvscan message and then my custom message.

This is my code.
   $uvscan_cmd = /usr/local/bin/uvscan  . 
$_FILES['file']['tmp_name'];
   $output = system($uvscan_cmd , $retval);

   if ( $retval != 0) {
   print brA virus was found in your file br$outputbr;
  exit;
   }
This results in the following sent to the browser.
/var/tmp/phpBFaaIa Found the W32/[EMAIL PROTECTED] virus !!!
A virus was found in your file.
Found the W32/[EMAIL PROTECTED] virus !!!
How can get rid of the first line and still have data $output? I tried 
adding a 2  1 to the system call and tried redirecting the output to 
/dev/null. This got rid of the first line but also resulted in $output 
not having an output.

--
Ron Clark
System Administrator/Web Coordinator
Armstrong Atlantic State University
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re:[PHP] system command

2004-08-23 Thread ron clark
John Holmes wrote:
From: ron clark [EMAIL PROTECTED]
I an trying to add virus scanning to the file upload section of our 
portal using uvscan. The virus scanning is working properly using a 
system call , but I am having problems with formatting the output. I 
need to check the return value and if it is not a 0, I want to create 
a custom message. The problem is, when using system the output of the 
call is flushed to the browser before I can write the custom message 
so I have the uvscan message and then my custom message.

You can use output_buffering to capture the output, or use a different 
method to make the call, i.e. backticks or exec(), which allow you to 
capture the output before it's displayed.

---John Holmes...

Thanks John. Was a simple fix. Turn output buffering on to prevent the 
output of the system command going to the browser. Capture the output in 
the $output variable then ob_clean to empty the output buffer before 
printing the the desired message.

--
Ron Clark
System Administrator/Web Coordinator
Armstrong Atlantic State University
11935 Abercorn Street 
Savannah, Ga 31419
Phone: 912 961 3234
Fax: 912 927 5353

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


Re: [PHP] php training tips

2004-07-07 Thread Brent Clark
Hi

Im sure there will be others out there that will completely disagree with
me, but why dont you look at Sams teach your self PHP.
The reason I suggest this is because its cheap, it has excerises in them, it
pretty much  has all the dirty for you.
I bet they (Sams) have pretty much thought in the same line and foot steps
you have been thinking in what to offer and pretty much put in what they
think is appropriate.
Also, I think it a good reputable source, amongst others of course.

But I would also like to recommend showing, teaching other resources like
PHP.net, this mailing list, and some of the other wonderful sites
(PHPClasses etc), basically teach the people to think for themselves and
where the resources are if they hit a stumbling block.

Just my 2c for the day

Kind Regards
Brent Clark


- Original Message - 
From: Jaskirat Singh [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, July 07, 2004 2:21 PM
Subject: [PHP] php training tips


 Hello,
 I am a PHP coder for the last 4 years doing mostly PHP MySQL stuff. Off
 late I have been requested by a number of programmers and students to
 teach PHP. I am wondering how different teaching is from coding and how
 to design the contents of a 1-2 week training course. I am planning to
 begin with a free of cost 1 hour per day class, but entry will be
 restricted to keep it a small bunch of seriously interested people
 only.

 Any tips are welcome.

 Jas

 -- 
 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] file locking over NFS?

2004-07-06 Thread Brent Clark
Hi there

If i am not mistaken, that is a standard part of the nfs suite.
All you need to make sure is that your export is correct, and the you are
not using the
-nolock option.
Other than that if its PHP you more interested in, look at the flock()
function.

Kind Regards
Brent Clark

-Original Message-
From: kyle [mailto:[EMAIL PROTECTED]
Sent: Monday, July 05, 2004 6:54 PM
To: [EMAIL PROTECTED]
Subject: [PHP] file locking over NFS?


Hi all,

Is there any simple, safe, and efficiency way to do file locking over NFS?

Thanks.

--
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] php functions avail ?

2004-07-02 Thread Brent Clark
Hi

I would like to know if these functions (for php 5)are already uploaded,
available on the php.net sites, in terms of research and or support.

http://zend.com/php5/whats-new.php

Kind Regards
Brent Clark

MSN: [EMAIL PROTECTED]
eMail: [EMAIL PROTECTED]
Cell: +27 82 701 7827
Work No: +27 21 683 0069
Fax No: +27 21 683 6137

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



[PHP] file locking question

2004-06-21 Thread Brent Clark
Hi all

I have this script whereby I use the php function file().
Just a quick question, do I need to implement file locking.

if so, can I just use something like
flock( file(/path/file.ext) );

Kind Regards
Brent Clark

MSN: [EMAIL PROTECTED]
eMail: [EMAIL PROTECTED]
Cell: +27 82 701 7827
Work No: +27 21 683 0069
Fax No: +27 21 683 6137

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



Re: [PHP] hi all can you read me ?

2004-06-21 Thread Daniel Clark
Can read you now().

Hi all just wanna check if you can read me

Thx

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



Re: [PHP] file locking question

2004-06-21 Thread Daniel Clark
If you're just going to read only, no.

Hi all

I have this script whereby I use the php function file().
Just a quick question, do I need to implement file locking.

if so, can I just use something like
  flock( file(/path/file.ext) );

Kind Regards
Brent Clark

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



Re: [PHP] Association Problem?

2004-06-21 Thread Daniel Clark
Good idea storing it in an array.

Sort the unique row ID and the count in the array and use asort().

 Wanted to see if anyone had any input on this.  I have a recordset that
 is returned to me in my script.  What I then would like to do is go
 through each row of the recordset and use the substr_count function to
 count the number of times a string appears in each row.  Then I'd like
 to sort  display the recordset based on how many times the string
 appeared in each row.

 Basically this is a very light search with a very quick  dirty way to
 find relevancy.  I've thought that I could just store the relevancy
 numbers in an array, but then how do I know which relevancy number goes
 with what row in the recordset?  That's the association problem I'm
 talking about.  Also, how would I then sort the recordset accordingly
 based on the relevancy array?

 I've been looking through the PHP documentation and can't quite get past
 this question.  Anyone have any ideas?  Thanks!

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



Re: [PHP] TIFF display problem...

2004-06-21 Thread Daniel Clark
Do you want...

if ( !isset($_SESSION['user_id']) )

 [snip]
   session_start();

   if ( !$_SESSION['user_id'] )
   {
   exit();
   }

 [/snip]

 Are you sure you are getting past the if ( !$_SESSION['user_id'] )
 condition?

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



RE: [PHP] TIFF display problem...

2004-06-21 Thread Daniel Clark
Do you have a temp directory setup for your session variables?

 Hi,

   that probably would work better, however, the if control isn't
 what's fouling it up.  I can omit that and leave session_start() in there,
 and its fouled up.  Session_start() is the culprit.

 -Dan Joseph

 -Original Message-
 From: Daniel Clark [mailto:[EMAIL PROTECTED]
 Sent: Monday, June 21, 2004 4:47 PM
 To: Matt Matijevich
 Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: Re: [PHP] TIFF display problem...

 Do you want...

 if ( !isset($_SESSION['user_id']) )

  [snip]
 session_start();
 
 if ( !$_SESSION['user_id'] )
 {
 exit();
 }
 
  [/snip]
 
  Are you sure you are getting past the if ( !$_SESSION['user_id'] )
  condition?

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



Re: [PHP] variable question

2004-06-20 Thread Daniel Clark
How about:

eval( '$lie' . x ) ;

is there a way to use one variable to create another?
Example
$poo=1
and i want
$lie1
OR
$poo=2
and i want
$lie2

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



Re: [PHP] umm i am confused...

2004-06-20 Thread Daniel Clark
Looks like several lines need quotes around the print statements and \ inside.

print(trtdform Method=\GET\ 
action=\module/personal/delete.php\delete/td/tr);

?php
//the function for adding new addresses
function loop_new_address($loopnum,$url,$name){
//the ${'link' . $loopnum} says put $link and add $loopnum to the end
if(isset(${'link' . $loopnum . '})){
loop_new_adderss($loopnum+1,$url,$name);
};
else{
setcookie(link . $loopnum . ,$url,time()+3600*200);
setcookie(name . $loopnum . ,$name,time()+3600*200);
print(a href=$url$name/a was added);
};
};
if(isset($_GET[new])) {
loop_new_address(1,$_GET[name],$_GET[url]);
};
print(table);
print(trtdform Method=GET
action=module/personal/delete.phpdelete/td/tr);
//write code
$writenum=1;
while(isset(${'link' . $writenum . ''}));
print(a href=${'link' . $writenum . ''}${'name' . $writenum . ''}/a);
};
include('links.htm')
?
trtdinput type=submit value=Delete Checked/form/td/tr
/table
table
trtdform METHOD=GET ACTION=module/personal/links.phpinput
type=hidden name=new value=1/tdtd/td/tr
trtdSite name/tdtdINPUT TYPE=text NAME=name VALUE=/td/tr
trtdsite url (if it is not on this site it MUST contain
http://;)/tdtdINPUT TYPE=text NAME=url VALUE=/td/tr
trtd/tdtdINPUT TYPE=SUBMIT VALUE=Continue/form/td/tr
/table

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



Re: [PHP] Mysql fetch_row()

2004-06-20 Thread Daniel Clark
Use  mysql_fetch_assoc()  for fieldnames

when I call mysql_fetch_row() I get an array, but this Array doesn't have
the fieldnames as array-keys.
I've seen several codes from others where they use something like

print $row['key'];

This doesn't work on my server. Is this because my server-software is too
old or am I using the wrong function?
PHP Version 4.3.4
mySQL version: 3.23.54

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



[PHP] html problem

2004-06-17 Thread Brent Clark
Hi all

When ever I do echo on my variable I get the following out:

Business%20Class

is there a way to strip the %20, or what ever be displaying if the future.

If someone could assist, it would be most appreciated.

Kind Regards
Brent Clark

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



Re: [PHP] Problems with arrays

2004-06-17 Thread Daniel Clark
 echo $InputString . 'BR';   // for HTML

 echo $InputString\n;  // for output to screen

Hi,

I have this array:

$array = array(element1, element2, element3, element4)

I want to list all elements of this array, so i used:

  foreach ($array as $index = $element) {
$InputString = $element;
 echo $InputString;
   }

but this code lists the elements like this: element1 element2 element3 element4

How can i list my elements like this: 
element1
element2
element3
element4


Thanks


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



Re: [PHP] Read Last Lines of a Text File

2004-06-17 Thread Daniel Clark
Try adding number of bytes to read.

   $line = fgets($fp, 4096);


 * Thus wrote Scott Miller ([EMAIL PROTECTED]):
  I have a text file (log file) that I want to be able to read the last
 30
 or
  40 lines of.  I've created the code below, but since this file is so
 large
  (currently 8 MB) it won't work.  The code works on smaller files, but
 not
  this one.  Can someone look at this below and tell me where I went
 wrong?
 
  ...
 
  $fcontents = file($filename);

 This will make your script consume lots of memory, and is very
 inefficient.

 You'd be better of using the unix tail command:

 $fp = popen(/usr/bin/tail -$limit $file, 'r');
 if (! $fp ) {
   echo 'unable to pipe command';
 }
 while (!feof($fp) ) {
   $line = fgets($fp);
   print $line;
 }

 Of course if you're simply going to output the results a simple:

   system(/usr/bin/tail -$limit $file);

 Would do the job nicely.


 Curt
 --
 First, let me assure you that this is not one of those shady pyramid
 schemes
 you've been hearing about.  No, sir.  Our model is the trapezoid!

 --

 I've changed my script to the following:

 ?php

 $file =/var/log/radius.log;

 $fp = popen(/usr/bin/tail -$limit $file, 'r');
 if (! $fp ) {
   echo 'unable to pipe command';
 }
 while (!feof($fp) ) {
   $line = fgets($fp);
   print $line;
 }
 ?

 And now get the following errors:

 Warning: Wrong parameter count for fgets() in /var/www/html/logs2.php on
 line 10

 I get this over and over and over (like it's producing the error once per
 line in the log file).

 Thanks,
 Scott

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



Re: [PHP] Just Testing

2004-06-16 Thread Kevin Clark
Um how so? 

On Wed, 16 Jun 2004 04:18:27 +, Curt Zirzow
[EMAIL PROTECTED] wrote:
 
 * Thus wrote Michael Lauzon ([EMAIL PROTECTED]):
  I am just testing, so that I can create a filter.
 
 btw, you're going about it wrong.
 
 Filters will just contribute spaming to the list.
 
 Curt
 --

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



Re: [PHP] update count

2004-06-16 Thread Daniel Clark
If your table has a primary key, or auto increment field works well and is
quick.

 What is the best way to only do an update if it going to update only one
 row?
 I want to protect my code so that it won't accidentally update more than
 one row.
 I can do a select first but there must be an easier way. :-)

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



[PHP] Array problem

2004-06-14 Thread Brent Clark
Hi all

I have this problem whereby im try to create some kind of an array of a
split off a file.

//Here I pull the file in the array $contents.

$contents = file($hotelpathprod.$hotel);

foreach($contents as $arr=$conts){
$ff[] = split(\|,$conts); //Here im trying to do a split 
on the file
}

Now this the array $ff is fine, the catch is now, it that, the first element
has a have like p101.
What I trying to do is do a substr($abc,1) and the take that value and make
that the number of the element I want.

This is what I was going with.

foreach($ff as $qaz=$wsx){
$ffile[substr($qaz[0],1)]=$qaz[0];
}

If anyone could assist, it would really be appreciated.

Kind Regards
Brent Clark

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



RE: [PHP] PHP

2004-06-14 Thread Brent Clark
hi

is this a joke

-Original Message-
From: Cheung Pui Pan [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 09, 2004 11:03 AM
To: [EMAIL PROTECTED]
Subject: [PHP] PHP


Dear Sir/Madam,

I would like to make a page on which people may add records to a table and
view them (As my web server does not support MYSQL, I may have to do it on
text files). I would also like to sort them by descending order of time. Can
you please tell me which functions are available for the following items I
want to do? If possible, can you write a sample code for me? Thank you for
your time and attention.

*Date / Time

*Name

*E-mail (Check them too please)

*Company

*Vehicle

*Route (Original)

*Route (Now on)

*Notes

Yours faithfully,

Cheung Pui Pan

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



Re: [PHP] Function Date

2004-06-14 Thread Daniel Clark
How about.

strtoupper( date(j M Y))


 I am using date(j M Y), the format date is 14 Jun 2004, but i need this
 format 14 JUN 2004. The unique difference is Jun - JUN. How can i change
 this?.
 Thank You,
 Juan

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



Re: [PHP] Erroring out?!

2004-06-14 Thread Daniel Clark
I think you need single quotes around $user.

$query = select * from quoteprefs where salesman = '$user';

 I am trying to figure out why if there is an error in my query it throws
 an error message to the screen instead of parsing the rest of my script
 to get the rest of the information.  I have error checking in my script
 and if there is no information I want it to process and do things.

 I run this:
 ?
 session_start();

 //connect to database
 include 'db.php';
 include 'salesinfo.php';

 $query = select * from quoteprefs where salesman = $user;
 $get_query_res = mysql_query($query) or die(mysql_error());


 if (mysql_num_rows($get_query_res)  1){
 //invalid id, send away
 header(script language=\javascript\parent.C.location.href =
 \show.html\;/script);
 header(script language=\javascript\parent.B.location.href =
 \custn.html\;/script);
 exit;
 } else {
 //get info
 $title = mysql_result($get_query_res,0,'item_num');
 $desc = mysql_result($get_query_res,0,'description');
 $q = mysql_result($get_query_res,0,'qty');
 $p = mysql_result($get_query_res,0,'price');
 $c = mysql_result($get_query_res,0,'comments');
 $tp = mysql_result($get_query_res,0,'Tprice');


 $display_block = html;

 }
 ?
 html
 head
 body
 centerBR
 Choose from the following options to set your preferences:
 ? echo $display_block; ?
 BR/center
 /body
 /html

 And I get:
 Unknown column 'robert' in 'where clause'

 ThANKS!!

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



Re: [PHP] Limit the number of characters in a string

2004-06-11 Thread Daniel Clark
substr( xxx, 1, 100)


Hi

Anyone know how to clip the number of characters in a string? For instance,
I have a string carrying a long piece of text, say, of 200 characters, but I
want to reduce this to just the first 100 characters.


Thanks in advance.

Russell

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



Re: [PHP] passing a function as a parameter

2004-06-11 Thread Daniel Clark
Can you use eval() ?

 I want to pass a function as a parameter and execute it in another
 function.
 A callback. :-)

 For example:

 function a() {
  echo a;
 }


 function b( $func ) {
  func();
  echo b;
 }


 The output of b( a ) will be ab.

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



Re: [PHP] testing array_search

2004-06-11 Thread Daniel Clark
What output do you get?

 I'm having a very hard time testing array_search.

 $j = array_search( $i, $errList );
 echo j= . $j;
 if (($j != false)  ($j = 0)) {

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



Re: [PHP] Re: Free news feeds

2004-06-10 Thread Ron Clark


On Thu, 10 Jun 2004, Ben Ramsey wrote:

 Tim Winters wrote:
  Thanks for the reply.  They actually don't have free feeds anymore.
  They actually say in the FAQ that they don't do that anymore.

 Bah!  They do have free feeds, still.  I can't remember how I found this
 link, but I went through an old backup of a bookmarks file to get it for
 you, and it still works.  The RSS feeds unbelievably still work, too.

 If I got to this page from their homepage without a login, then I don't
 imagine they care too much about people using them.

 There is one thing I would suggest, though: to keep traffic down to
 their feeds, set up an automated script (through cron or something) to
 download the feed(s) once a day or once every other hour.  Then, on the
 page you want to display the feed(s), just point to your locally
 downloaded copy.  This way you don't tax Moreover's servers and they
 don't get too mad about people using the feeds.

 The link:
 http://w.moreover.com/categories/category_list_rss.html

 --
 Regards,
   Ben Ramsey
   http://benramsey.com

Attached is a text file containing a list of rss and xml news feeds we
use in our portal. You have to write the code to convert the xml to plain
text.
--
Ron Clark
sysadmin/webmaster
Armstrong Atlantic State UniversityFaculty / Staff Applications|Information Retrieval|IR|
Faculty / Staff Applications|MetaApp|meta|
Faculty / Staff Applications|Utilities|utilities|
|||
CIS|CIS Cove Developer Info|cove_developers|
|||
Registrar Applications|Degree Program (Major) Process|degch|
|||
Pirates' Cove|Armstrong Announcements|Announcements|
Pirates' Cove|Pirates' Cove Information|cove_info|
Pirates' Cove|Savannah Weather|weather|
Pirates' Cove|Search Cove|search|
Pirates' Cove|Stock Ticker|stocks|
|||
Science and Tech|ABC News 
SciTech|ABC_News_SciTech|http://my.abcnews.go.com/rsspublic/scitech_rss093.xml
Science and Tech|Advogato|advogato|http://www.advogato.org/rss/articles.xml
Science and Tech|Apache 
Week|Apache_Week|http://www.apacheweek.com/issues/apacheweek-headlines.xml
Science and Tech|BBC World News Science and 
Nature|BBC_World_News_Science_and_Nature|http://news.bbc.co.uk/rss/newsonline_world_edition/science/nature/rss091.xml
Science and Tech|BBC World News 
Technology|BBC_World_News_Technology|http://news.bbc.co.uk/rss/newsonline_world_edition/technology/rss091.xml
Science and Tech|Christian Science Monitor 
Sci/Tech|csm_scitech|http://csmonitor.com/rss/scitech.rss
Science and Tech|Desktopian|desktopian|http://desktopian.org/includes/headlines.xml
Science and Tech|ExtremeTech - Core 
Tech|extremeTechCore|http://rssnewsapps.ziffdavis.com/extreme.xml
Science and Tech|Extreme Tech - 
Reviews|extremeTechReview|http://rssnewsapps.ziffdavis.com/extremetechreviews.xml
Science and Tech|Freshmeat|freshmeat|http://freshmeat.net/backend/fm.rdf
Science and Tech|GameDev|GameDev|http://www.gamedev.net/xml/
Science and Tech|Humorix|Humorix|http://i-want-a-website.com/about-linux/headlines.rdf
Science and 
Tech|IceWalkers|IceWalkers|http://www.icewalk.com/backend/netscape_channel.txt
Science and Tech|Javable|Javable|http://www.javable.com/eng/rss.shtml
Science and Tech|Linux Game 
Tome|The_Linux_Game_Tome|http://happypenguin.org/html/news.rdf
Science and Tech|Linux 
Security|Linuxsecurity|http://www.linuxsecurity.com/linuxsecurity_articles.rdf
Science and Tech|Linux Today|Linux_Today|http://linuxtoday.com/backend/my-netscape.rdf
Science and Tech|Mac News Network|macnn|http://www.macnn.com/macnn.rdf
Science and Tech|MultiAgent 
Systems|MultiAgent_Systems|http://www.multiagent.com/mynetscape.rdf
Science and Tech|Perl News|Perl_News|http://www.news.perl.org/perl-news-short.rdf
Science and Tech|PHP Net|PHP_Net|http://www.php.net/news.rss
Science and Tech|Security 
Focus|Security_Focus|http://www.securityfocus.com/topnews-rss.html
Science and Tech|Slashdot|slashdot|http://slashdot.org/slashdot.rdf
Science and Tech|SourceForge Project 
News|SourceForge_Project_News|http://sourceforge.net/export/rss_sfnews.php
Science and Tech|Squishdot|Squishdot|http://squishdot.org/rdf
Science and Tech|The 
Register|The_Register|http://www.theregister.co.uk/tonys/slashdot.rdf
Science and Tech|WebDEV - German Language Web Developer's 
Resource|WebDEV|http://webdev.khm.de/xml/scriptingNews2.xml
Science and Tech|WebReference|webreference|http://www.webreference.com/webreference.rdf
Science and Tech|Wired|wired|http://www.wired.com/news_drop/netcenter/netcenter.rdf
Science and Tech|Yahoo! News 
Science|yahoo_science|http://rss.news.yahoo.com/rss/science
Science and Tech|Yahoo! News Technology|yahoo_tech|http://rss.news.yahoo.com/rss/tech
|||
Money and Finance|ABC News 
Business|ABC_News_Business|http://my.abcnews.go.com/rsspublic/business_rss093.xml
Money and Finance|BBC World News 
Business|BBC_World_News_Business|http://news.bbc.co.uk/rss/newsonline_world_edition/business/rss091.xml
Money and Finance|BBC World News 
Economy|BBC_World_News_Economy|http://news.bbc.co.uk/rss/newsonline_world_edition

Re: [PHP] previous page

2004-06-09 Thread Daniel Clark
Then you could set a hidden form variable INPUT TYPE=hidden NAME=xxx VALUE=etc
or set a sesssion variable on the previous page.

Larry,

Thanks all makes sense, but, if I add this:
?php
echo($_SERVER['HTTP_REFERRER']);
?
I don't get anything back when the page is called?

Cab

Larry E . Ullman [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
  I have a .php page I don't want anyone being able to just open it
  unless
  they've been through a previous page that is a disclaimer http
  referrer etc
  come to mind but not exactly sure how to implement it in PHP.

 Yes, you could check the value of $_SERVER['HTTP_REFERRER'] but that's
 not perfect. Instead, you could have the previous page contain a form
 with a special hidden input. The form is submitted to the protected
 page, where you check for that hidden input's value. If that protected
 page doesn't receive $_POST data containing whatever meaningful data,
 redirect them accordingly.




Re: [PHP] count number of occurences of character in a string

2004-06-08 Thread Daniel Clark
substr_count()

http://www.php.net/manual/en/function.substr-count.php

what function can I use to count the number of occurences of a certain
character in a string?

--
Diana Castillo
Global Reservas, S.L.
C/Granvia 22 dcdo 4-dcha
28013 Madrid-Spain
Tel : 00-34-913604039
Fax : 00-34-915228673
email: [EMAIL PROTECTED]
Web : http://www.hotelkey.com
  http://www.destinia.com




Re: [PHP] PDA / Normal Browser

2004-06-08 Thread Daniel Clark
$_SERVER['HTTP_USER_AGENT'];

 [snip]
 Is it possible to use PHP to detect the type of browser accessing my
 site.
 For example if a PDA is using it I would prefer not to include large
 graphics...
 [/snip]

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



Re: [PHP] mkdir after mkdir

2004-06-06 Thread Daniel Clark
I think PHP and mkdir() is using the web servers rights.   So the web server would 
need rights to create directories.

Hello,

I have a problem with the mkdir function.
I'm trying to make a seperate folder every photoalbum. inside I want to
create another folder ('.../thumbnails/') for, you can guess, the
thumbnails.

At first it didn't work at all:

Warning: mkdir() failed (Permission denied) in
/home/virtual/site43/fst/var/www/html/beheer/albums/index.php on line 42

When I changed the rights of the folder I wanted to create the new folder in
to chmod 0777, the first MKDIR did work, but the second did not.

SAFE MODE Restriction in effect. The script whose uid is 1042 is not
allowed to access
/home/virtual/site43/fst/var/www/html/uploaded/images/albums/album_0 owned
by uid 48 in /home/virtual/site43/fst/var/www/html/beheer/albums/index.php
on line 43

this is very strange because the folders are both made in the same script.
Another strange thing is that I user mkdir($dir, 0777), but when I look at
the created folder it is 0755 and I can not change it.

That's pritty much my problem. Your help would be very much appreciated.

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



Re: [PHP] Refresh Page

2004-06-05 Thread Daniel Clark
meta http-equiv=refresh content=10; url=test.php 

Put inside the HEAD tags, this refreshed the page every 10 seconds.


I want to refresh page every 10 seconds, without clicking on Refresh 
button.
Any ideas how this can be done?

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



Re: [PHP] Re: Refresh Page

2004-06-05 Thread Daniel Clark
I've used this META tag is IF statement conditionals in the header too.   Works well 
NOT to refresh when in a edit mode.

You can use javascript timer that are much more flexible than META
HTTP-EQUIV=REFRESH because you can test for conditions, etc.


Mike Mapsnac [EMAIL PROTECTED] escribió en el mensaje
news:[EMAIL PROTECTED]
 I want to refresh page every 10 seconds, without clicking on Refresh
 button.
 Any ideas how this can be done?




Re: [PHP] DB Query

2004-06-05 Thread Daniel Clark
Run an explain plan, but my first quess would be to add indexes to c1, c2, c3, c4, c5 
fields.

I'm trying to optimize a query that in the first example is taking too long
to run.
 
This is my existing working query:
$sql = SELECT count(*) as cnt, id FROM `mYTable` WHERE c1 not in (1,16,36)
and c2 not in (1,16,36) and c3 not in (1,16,36) and c4 not in (1,16,36) and
c5 not in (1,16,36) GROUP BY id;
 
Is it possible to do something like this instead (This doesn't work of
course)
$sql = SELECT count(*) as cnt, id FROM  `myTable` WHERE (c1,c2,c3,c4,c5)
not in (1,16,36)  GROUP BY id;
 
Any other suggestions are appreciated, 
 
Thanks!
 
 


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



Re: [PHP] Prevent IE6 from blocking cookies

2004-06-05 Thread Daniel Clark
In IE you can turn ON or OFF accepting cookies, select Tools, Options, Security, 
Advanced, cookies.
But the web server can't command IE to enable cookies.


Do I a prevent Internet Explorer 6 from blocking cookies (session cookies,
etc)? Do I have to setup something in the  META HEADERS?

Thanks
Robert

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



RE: [PHP] DB Query

2004-06-05 Thread Daniel Clark
Explain can help show where the slow down is.  

http://dev.mysql.com/doc/mysql/en/EXPLAIN.html

Indexes on the c1-c5 columns should increase the speed.

Explain plan?  Due to the number of records, any indexes I added have
significantly delayed the query.

-Original Message-
From: Daniel Clark [mailto:[EMAIL PROTECTED] 
Sent: Saturday, June 05, 2004 11:41 AM
To: bskolb; [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [PHP] DB Query

Run an explain plan, but my first quess would be to add indexes to c1, c2,
c3, c4, c5 fields.

I'm trying to optimize a query that in the first example is taking too 
long to run.
 
This is my existing working query:
$sql = SELECT count(*) as cnt, id FROM `mYTable` WHERE c1 not in 
(1,16,36) and c2 not in (1,16,36) and c3 not in (1,16,36) and c4 not 
in (1,16,36) and
c5 not in (1,16,36) GROUP BY id;
 
Is it possible to do something like this instead (This doesn't work of
course)
$sql = SELECT count(*) as cnt, id FROM  `myTable` WHERE 
(c1,c2,c3,c4,c5) not in (1,16,36)  GROUP BY id;
 
Any other suggestions are appreciated,
 
Thanks!
 
 


--
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] Best way to sort?

2004-06-04 Thread Daniel Clark
Order by the 2nd column

what is the 2? in the order by statement mean?
thanks

-Original Message-
From: Raúl Castro [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 03, 2004 6:20 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Best way to sort?


The best way is:

SELECT person_name, count(*)
FROM table_name
GROUP BY person_name
ORDER BY 2 DESC




Re: [PHP] sessions

2004-06-04 Thread Daniel Clark
Did you have session_start() on this page before accessing the session variables?

Could also do:

$name = $_SESSION['first_name'] , $_SESSION['last_name'] ;

why is this not working. I am using instead of a form ($name =
$_POST[name];)
and linking to it from a users logged in page.

$FirstName = $_SESSION['first_name'];
$LastName = $_SESSION['last_name'];
$name = $FirstName , $LastName;

Mark

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





Re: [PHP] script location

2004-06-04 Thread Daniel Clark
I use of realpath()

 Does anyone know of a simple/efficient way to determine the path to a
 script on the URL?

 For instance:

 http://www.nowhere.com/test/whatever/testing.php

 All I want out of that URL is this:

 /test/whatever/

 I didn't see an element in one of the super global variables that would
 provide me this information.  Any ideas?

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



Re: [PHP] Best way to sort?

2004-06-03 Thread Daniel Clark
SELECT DISTINCT person_name, count(*)
FROM table_name
GROUP BY person_name
ORDER BY 2 DESC

 I'm not sure if this is a complex SQL query or a PHP array sorting
 thing, but what's the best way to take this data:

Tom
Greg
Brian
Tom
Brian
Tom

 And return the following results, sorted by number of records:

Tom - 3
Brian - 2
Greg - 1

 Any thoughts?

 --
 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] Asuming query without the ?

2004-06-03 Thread Daniel Clark
I think it's in the Apache config file.

 Where and how do I set this? I'm to Unix and PHP.

 Marek Kilimajer [EMAIL PROTECTED] escribió en el mensaje
 news:[EMAIL PROTECTED]
 Robert Winter wrote:
  Is it possible to configure PHP/.htAccess/etc. for assuming a query
 when
 the
  users enters a path like this:
 
  www.myserver.com/path/154-- assumes
  www.myserver.com/path/index.php?code=154
 
  The only thing I could do is avoid writing index.php but I still have
 to
  write the ?: www.myserver.com/path/?154
 
  Any idea?
  Thanks.
  Gus
 

 RewriteRule ^/path/([0-9]+)$/path/index.php?code=$1

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



Re: [PHP] Finding the sizeof a variable....

2004-06-02 Thread Daniel Clark
There is memory_get_usage()  but it returns the amount of memory allocated
to PHP.

http://us3.php.net/manual/en/function.memory-get-usage.php

 I'm wondering if there's something similar to the C sizeof operator in
 PHP?  I would like to find out how much space in memory a variable is
 actually using (and possibly adjust the max memory per script
 accordingly).

 No, sizeof() http://us3.php.net/sizeof is not what I want :-(

 Thanks!

 Matt

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



Re: [PHP] php installation verification

2004-06-02 Thread Daniel Clark
Save to your root directory as test.php (or something ending in php).

?php

phpinfo();

?

 I am new to php and was tasked with installing php v.4.3.6.  I installed
 it on redhat with apache v2.0.48.
 I read in the doc that you can create a test file called test.php with
 some php tags such as ?phpinfo()?.
 Could someone post a test.php file as an example?
 Thanks for the help.

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



RE: [PHP] php installation verification

2004-06-02 Thread Daniel Clark
Have you stopped and restarted the web server?

 OK - I tried that and what came up on the browser was the content of the
 test.php file.

 I checked in my httpd.conf file I do have the following:

 AddType application/x-httpd-php .php
 AddType application/x-http-php-source .phps

 LoadModule php4_module libexec/libphp4.so

 Any thoughts?

 thank you.

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



RE: [PHP] php installation verification

2004-06-02 Thread Daniel Clark
And you test.php file has? (note starting with ?php

?php

?

 Yes.


 Have you stopped and restarted the web server?

 OK - I tried that and what came up on the browser was the content of the
 test.php file.

 I checked in my httpd.conf file I do have the following:

 AddType application/x-httpd-php .php
 AddType application/x-http-php-source .phps

 LoadModule php4_module libexec/libphp4.so

 Any thoughts?

 thank you.

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



RE: [PHP] php installation verification

2004-06-02 Thread Daniel Clark
Running Apache?  Windows?

 I get the source display on the browser as:

 ?php
 phpinfo();
 ?

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



RE: [PHP] php installation verification

2004-06-02 Thread Daniel Clark
Seems to me there was a problem with Apache 2 and PHP (some version).

 The content of my test.php file has:

 ?php
 phpinfo();
 ?

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



[PHP] Cant right click

2004-06-01 Thread Brent Clark
Hi all 

On the link provided below, I noticed that you cant right click.
Therefore you cant get View source code
or Copy link etc (Depenind on the browser used of course)

http://www.full.xtremedl.com/6.htm

Would anyone know how to do this.
I see that you cant even right click on the pic

Weird

Kind Regards
Brent Clark

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



Re: [PHP] update mysql using radio button

2004-06-01 Thread Daniel Clark
I think you need Values for the radio buttons.

input type=radio name=club_member Value=N ?php if($row-club_member
 ='N'){echo 'CHECKED';}?


 hello all -

 i'm having a problem getting an UPDATE to work with radio buttons and
 i'm not sure where it's gone wrong. the initial values are being grabbed
 properly, but unfortunately they don't want to get updated. the regular
 text form values update just fine. would appreciate some help.

 the html:

 input type=hidden name=id value=?php echo $id ?

 club member?br
 No: input type=radio name=club_member ?php if($row-club_member
 ='N'){echo 'CHECKED';}?br
 Yes: input type=radio name=club_member ?php if($row-club_member
 == 'Y'){echo 'CHECKED';}?


 the query to update:

 $query = UPDATE outdoor SET name='$name', email='$email', zip='$zip',
 club_member='$club_member' WHERE id='$id';
 $result = mysql_query($query) or die (Error in query: $query.  .
 mysql_error());



 [trying to keep the code paste to what i think is important, let me know
 if more is needed for info.]


 thanks!
 m.

 --
 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] Strtotime() weirdness

2004-06-01 Thread Daniel Clark
http://us3.php.net/manual/en/function.strtotime.php

Note: The valid range of a timestamp is typically from Fri, 13 Dec 1901
20:45:54 GMT to Tue, 19 Jan 2038 03:14:07 GMT. (These are the dates that
correspond to the minimum and maximum values for a 32-bit signed integer.)
Additionally, not all platforms support negative timestamps, therefore
your date range may be limited to no earlier than the Unix epoch. This
means that e.g. dates prior to Jan 1, 1970 will not work on Windows, some
Linux distributions, and a few other operating systems.


 Does anybody know of any peculiarities in the strtotime() function?

 If I enter any date before 1 Jan 1970 I get a -1 returned.

 alex hogan

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



Re: [PHP] update mysql using radio button

2004-06-01 Thread Daniel Clark
Right.  (oops)

 From: Daniel Clark [EMAIL PROTECTED]

 input type=radio name=club_member Value=N ?php
 if($row-club_member
  ='N'){echo 'CHECKED';}?

 =='N', you mean. :)

 ---John Holmes...

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



Re: [PHP] installing php4 in windows 2000

2004-05-31 Thread Daniel Clark
Is your php.ini in the windows or winnt directory?

i have configured apache 2.0.49 in my system and included the following lines of 
code in my http:conf file

LoadModule php4_module c:/php/sapi/php4apache2.dll
AddType application/x-httpd-php .php

i have also configured the  php.ini file and created a test 
script(phpinfo.php,placed it in my htdocs directory) to check whether php has been 
properly installed or not
but when i run the testscript by entering the follwoing line in the address bar of 
internet explorer

localhost/phpinfo.php

i get the following error message

HTTP 404 - File not found
Internet Explorer 

can somebody please help me to know where am i going wrong

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



[PHP] BUTTONS

2004-05-31 Thread Brent Clark
Hi all

I came across this on freshmeat, I thought I must share it

http://phpbutton.sourceforge.net/

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



Re: [PHP] multiple checkbox help

2004-05-31 Thread Daniel Clark
Change $_REQUEST to $_POST (a little more secure).

foreach( $deleteID as $key = $value) {
 
echo 'deleting ' . $value . 'br /' ;
}


I tried this HTML:
input name=deleteID value=1 type=checkbox
input name=deleteID value=2 type=checkbox

$_REQUEST['deleteID'] === the last box checked.
so I did a google search and changed my HTML to:

input name=deleteID[] value=1 type=checkbox
input name=deleteID[] value=2 type=checkbox

Now the code:
for ($i = 0; $i  count($_REQUEST['deleteID']); $i++){
 echo deleting ' . $value . ';
}
has the right count but how do I get the values out?

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





Re: [PHP] duplicating a row

2004-05-31 Thread Daniel Clark

INSERT INTO new_table (column1, column2, ...)
SELECT column1, column2, ...
FROM original_table

I want to duplicate a row (back it up - copy to a table with the same 
schema) regardless of the table schema.
This in MySQL but I need a solution that can be made easily portable to 
other databases.

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



Re: [PHP] Re: Re: drop down menu populated from a directory

2004-05-31 Thread Daniel Clark
With the SELECT drop down, you'd need a submit button, and then the value of $file 
would be passed to the next page and read.  There you 
could open that file.

So I made my code:

?php
if ($handle = opendir('../../../mov')) {
while (false !== ($file = readdir($handle)))

if ($file != '.'  $file != '..')

$fileName = str_replace('.mov', '', $file);
echo 'option value=' . $file . '' . $fileName . 
'/option';
closedir($handle);
}
?

And it does display the name in the menu... so that is a good start, 
but the link doesn't work when selected. So I am assuming hte code does 
need those brackets, and I rather need to open the opening one...

d

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



Re: [PHP] Query Query

2004-05-30 Thread Daniel Clark
Can you send more of the code?   I looks good so far.

This may be better suited to the MySQL lists, but I'd appreciate it if 
someone could help. I'm probably just missing something stupid here but 
have been coding non-stop for a week and need another set of eyes.

Here's the line of code giving me an issue. I can print all the 
variables in the script to screen and know that they're ok. It returns 
successfully, but fails to update the database. I'm sure I'm about to 
feel pretty stupid, so fire away... just please fire the answer too.

$query=UPDATE $table_name SET company_name='$company', 
first_name='$first_name', last_name='$last_name', address='$address', 
city='$city', state_province='$state', postal_code='$postal', 
office_phone='$office', fax_phone='$fax', email='$email' WHERE 
company_name='$mod_dataset';

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



Re: [PHP] hyperlink to the mysql data

2004-05-30 Thread Daniel Clark
Can you post some of the code?

--Original Message Text---
From: CurlyBraces Technologies ( Pvt ) Ltd
Date: Mon, 31 May 2004 01:49:17 +0600

hi ,  
 
i have retrived  some perticular data from mysql , and them show in the web browser.( 
It is very few data ) 
When clicking on one of that that perticular data ,  i want to show the whole 
information with related to the above mentioned part.  
So , can some body help me to add like this hyper link to the mysql data ? 
 
thanx in advance 
curlys  
 





Re: [PHP] Preg_match question

2004-05-29 Thread Daniel Clark
Great quote Jeroen.

Always code as if the guy who ends up maintaining your code will be a violent 
psychopath who knows where you live.
  -- Martin Golding

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



Re: [PHP] cookies malfunctioning moving from windows to linux

2004-05-29 Thread Daniel Clark
Apache must have read and write privs on the tmp directory.

Hi, I developed a Poll system that uses cookies. It works fine under Windows
(Apache and MySQL), but it does not work properly under Linux. - I
transitioned my site from my windows based server to a linux machine.

Cookies does not work properly when I use the system under Linux (Apache and
MySQL).

I already checked php.ini and can't seem to find what is wrong.  The only
difference is the session.save_path = /tmp on the Linux box and on the
windows box it was session.save_path = c:/windows/temp 

Could you help me ?

Thank you!
Ryan



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



Re: [PHP] Text file wont' have newlines?

2004-05-29 Thread Daniel Clark
Needs a new line and return.

fwrite($fp, ($credit . \n\r) );

Hi everybody,

I have this script in a file that allows users to upload files, and I want 
to know who submitted what so I write $userfile_name and $credit1(their 
name) to CREDIT.txt in the same directory like so :

$credit = $userfile_name.': '.$credit1.\n;
$fp = fopen('CREDIT.txt','a');
fwrite($fp, $credit);
fclose($fp);

But every new submission ends up on the same line, there is never a line 
break in the text. Any suggestions?

Thanks,
AMP

_
FREE pop-up blocking with the new MSN Toolbar  get it now! 
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/

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





Re: [PHP] how to redirect with post method

2004-05-28 Thread Daniel Clark
I don't believe you can sent those post variables on the URL.

Either as GET variables on the URL.
Set Session variables and read on the next page.

Or setup a FORM with hidden post variables populated with the $post
variables, and JavaScript to auot submit onload.

 Hello,
 I have a webpage that I'm redirecting to other page with header command,
 for instance:
 header(location:information.php?cod1=$cod1cod2=$cod2...codn=$codn);

 I need send all vars (cod1, cod2, ..codn) on POST method, How Can I do
 this? thanks.

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



Re: [PHP] datetime formatting problem

2004-05-28 Thread Daniel Clark
Isn't date a reserved word?

 hi all -

 this is probably straight forward, but i'm learning and would appreciate
 any insight.

 i'm using the datetime type in mysql and have been able to successsfully
 pull the data records's date, but it's failing out and giving me the
 current time [as in what it says on my system's clock]

 basically i'm just spitting out all the rows to an html table and would
 like to have the date AND time formatted as is in the date(...) function
 at the top of the code demo.

 thanks!
 matt

 / begin code demo


 function formatDate($val)
 {
 $arr = explode(-, $val);
 return date(M d, Y g:i A, mktime(0,0,0, $arr[1], $arr[2], $arr[0]));
 }


 // open database connection
 $connection = mysql_connect($host, $user, $pass) or die (Unable to
 connect!);

 // select database
 mysql_select_db($db) or die (Unable to select database!);

 // generate and execute query
 $query = SELECT * FROM outdoor ORDER BY id ASC;
 $result = mysql_query($query) or die (Error in query: $query.  .
 mysql_error());


 // if records present
 if (mysql_num_rows($result)  0)
 {
   // iterate through resultset
   // print title with links to edit and delete scripts
   while($row = mysql_fetch_object($result))
   {
   ?
   tr
   td? echo $row-id; ?/td
   td? echo $row-name; ?/td
   tda href=mailto:? echo $row-email; ?? echo
 $row-email; ?/a/td
   td? echo $row-zip ?/td
   td? echo formatDate($row-date); ?/td
   td? echo $row-club_member ?/td
   td? echo $row-driver ?/td
   !-- tdfont size=-1? echo $row-active ?/font/td --

   tdcentera href=edit.php?id=? echo $row-id; ?img
 src=notepad.gif alt= width=16 height=16 border=0/a  
 a href=delete.php?id=? echo $row-id; ?img src=trashcan.gif
 alt= width=16 height=16 border=0/a/center/td
   /tr
   ?
   }
 }

 --
 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] ColdFusion / SQL PHP / mySQL HELP!

2004-05-28 Thread Daniel Clark
I've used Cold Fusion for years.  However one week at 100 hours might not
be enough time to covert everything to PHP and mySQL.


 Hi everyone,

 Ok, I need serious help. I have been handed a project by my boss to
 convert
 an existing site that was built using ColdFusion / SQL into a site that
 will
 use PHP / mySQL. The site relies heavily on calls to the database for
 everything from site content, to an admin area where you can edit that
 content, to a news ticker, to the actual navigation of the site.

 What's the problem? I have one week to do this. Oh, and did I mention that
 I
 know VERY little about PHP / mySQL. I know NOTHING about ColdFusion or
 MSSQL. And to top it off, the site in question contains over 300 .cfm
 files!

 Does anyone have any idea how I could pull this off?

 Even if I had a working knowledge of ColdFusion, MSSQL, PHP, mySQL...still
 one week isn't enough time to retool a site of this proportion. Especially
 considering that I don't understand any of the code that I'm staring at.

 I've been a web designer for about five years now. Notice I said
 designer
 not developer. I want to learn PHP / mySQL but in order to complete this
 project I also need to understand ColdFusion in order to replicate the
 site
 functionality. Any advice on what I should do?

 Thanks in advance for your help,
 Chris

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



Re: [PHP] ColdFusion / SQL PHP / mySQL HELP!

2004-05-28 Thread Daniel Clark
That's funny Travis !

Here's what you do.   Assume 10-hour work days.  Obviously, you want to start 
with the schema.  That's pretty darn important, so allow yourself a whole day 
for that.

You have four days left.  Oh wait -- you will probably have to work the weekend 
for this one.  So you have six days left.  That's 60 hours, or 3600 minutes. 
You have 300 files, so you can't spend more than 12 minutes per file.  Wait, 
you said OVER 300, so try to keep it to 10 minutes per file.  To play it safe, 
spend no more than 8 minutes per file -- that way, you have a little extra time 
in case something unexpected comes up.

It might be easier to buy a CFM-to-PHP converter.  You can get those at most 
Kmart stores.  They're usually next to the bacon stretchers and smoke-shifters.

Hope this helps!

cheers,

Travis

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



Re: [PHP] dynamic table

2004-05-26 Thread Daniel Clark
Very slick Richard.

$i = 0;
while ($myrow = mysql_fetch_array($sql)) {
  if (++$i % 5 == 0) echo 'tr';
  ...

  
Note: if used repeatedly do not increment the $i again in the loop.

HTH
Richard

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



Re: [PHP] How to check for a $_GET without throwing a Notice?

2004-05-26 Thread Daniel Clark
if (isset( $_GET['id']))

How do I check for the presence of an optional $_GET param without 
throwing a Notice: Undefined index when the param is not present?

Tried all three of these, they all produce the Notice when the param is 
not passed:

if ($_GET['id'])
if ($_GET['id'] != )
if (isset $_GET['id'])

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





Re: [PHP] Session variables not recognized?

2004-05-25 Thread Daniel Clark
Session handling was added in PHP 4.0. 

The first line of my file is session_start(); but whenever I try to set 
or reference $_SESSION['anything'] I get:

  Undefined variable: _SESSION

What's up with that???

- Brian

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



Re: [PHP] Re: test

2004-05-25 Thread Daniel Clark
I think it's someone else on the list getting the email lists, and spaming. 

Signed up litterally 1 minute ago and I'm already getting spam. From
Advance Credit Suisse Bank

Great. Thanks php.net.

Guess you can't even trust the well known sites not to slam you with spam.

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



Re: [PHP] interesting

2004-05-25 Thread Daniel Clark
What does the { } around the array mean?

From: Bob Lockie [EMAIL PROTECTED]

 echo \ . $search_for_list[$i][0] . \ works but
 echo \$search_for_list[$i][0]\ prints Array[0].

$search_for_list[$i] is an 'Array' which is followed by the string '[0]' ...
how is PHP supposed to know you mean
$search_for_list[$i][0]?

echo \{$search_for_list[$i][0]}\; will work, btw.

---John Holmes...




Re: [PHP] interesting

2004-05-25 Thread Daniel Clark
Thank you John, and Michal :-)

From: Daniel Clark

echo \{$search_for_list[$i][0]}\; will work, btw.

 What does the {}around the array mean?

It delimits your variable so PHP knows what to interpret as a variable and
what to interpret as a string.

$ar[1] = 'foo';
echo Value is {$ar[1]}; // Value is foo

$ar = 'foo';
echo Value is {$ar}[1]; //Value is foo[1]
echo Value is {$ar[1]}; //Value is f

echo Hello {$name}, you are {$age} years old;

etc...

---John Holmes...


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



Re: [PHP] interesting

2004-05-25 Thread Daniel Clark
Good point Justin !

John W. Holmes wrote:

 From: Daniel Clark
 
 
echo \{$search_for_list[$i][0]}\; will work, btw.

What does the {}around the array mean?
 
 
 It delimits your variable so PHP knows what to interpret as a variable and
 what to interpret as a string.
 
 $ar[1] = 'foo';
 echo Value is {$ar[1]}; // Value is foo
 
 $ar = 'foo';
 echo Value is {$ar}[1]; //Value is foo[1]
 echo Value is {$ar[1]}; //Value is f
 
 echo Hello {$name}, you are {$age} years old;
 
 etc...
 
 ---John Holmes...

IMHO it's just better to use concatenation and single quotes for your 
string. PHP doesn't have to parse your strings for variables that way 
and it makes it obvious what parts are variables.

-- 
paperCrane Justin Patrin

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



Re: [PHP] interesting

2004-05-25 Thread Daniel Clark
Ok, print or echo :-)

From: Justin Patrin [EMAIL PROTECTED]

 IMHO it's just better to use concatenation and single quotes for your
 string. PHP doesn't have to parse your strings for variables that way
 and it makes it obvious what parts are variables.

To each his own. Shall we discuss the merits of print vs. echo next? Or
maybe template systems!?!?

;)

---John Holmes...

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





RE: [PHP] Re: find out ip address [beginner]

2004-05-24 Thread Daniel Clark
LOL :-)

Jonesy mailto:[EMAIL PROTECTED]
on Monday, May 24, 2004 2:21 PM said:

 WFM:
|$ ping ibm.com
|PING ibm.com (129.42.18.99) 56(84) bytes of data.
:

wow. that's the weirdest looking php i've ever seen. is that a beta or
something?



chris.




Re: [PHP] sessions

2004-05-23 Thread Daniel Clark
Should username have quote around it?   Wouldn't it try to make it a constant 
otherwise?

echo $_SESSION['username']

Hi,

All my session_start() calls were working fine.
But since yesterday the vars i use does not keep there value
i use $_SESSION['varname']

Nothing has been changed to the server normally, but on all my sites it does
work anymore

i think the problem is that when i use session_start() and then for example
$_SESSION[username] = 'test';

on at an other page:

session_start()
then echo $_SESSION[username] gives blanco.

How can this be?

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



Re: [PHP] Random Record Retrieval

2004-05-22 Thread Daniel Clark
How about rand() on your ID column.

http://www.php.net/manual/en/function.rand.php


How's that for alliteration in a subject line?

Got a simple MySQL table that contains records which are made up of only
three fields - ID, quote and author. These are inspirational quotes that
I want to appear at the bottom of the pages of my website. I want them to
come up randomly with every page load. I've posted this on a MySQL board to
see if there's a MySQL command to make things simple. But, I thought about
building a random number generator in PHP that selects a random number out
of the total number of records in the table, saves it into a variable and
then have MySQL retrieve that ID. Is this the way to go or is there
something simpler. And, if this is the best way to go, unfortunately I
don't know how to write a random number generator in PHP so would
appreciate any help.

Thanx in advance,
Robb
 

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



[PHP] want to buy second hand books online - cant remember site

2004-05-21 Thread Brent Clark
Hi all

a while ago someone on the list was kind enough to mention where he or she
buys books online.
The URL im looking for is a site that sells second hand IT books.
I know the site is someone where in the US.

For the likes of my I cant remember it.
If someone could assist it would greatly be appreciated.

Kind Regards
Brent Clark

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



Re: [PHP] Sessions still do not persist

2004-05-21 Thread Daniel Clark
Try a session_start() at the top of pages, see if that works.
Maybe the auto_start does not work.


 I've posted several times mentioning that I am completely unable
 to cause sessions to persist.  Over the intervening time, I have
 replicated this problem to a different machine, with the same
 results.  Here's a recap of the problem.

 I am not using cookies.  Sessions are automatically created (and
 changing that makes no difference)  The relevant session variables
 (copied from phpinfo) are:
Session Support  enabled
session.auto_start   On- hence no session_start
session.name   PHPSESSID
session.use_cookies  Off   - no cookies
session.use_trans_sidOn

 Environment is FreeBSD4.8.  phpinfo for apache says:
Apache/1.3.29 (Unix) mod_perl/1.28 PHP/4.3.4 mod_ssl/2.8.16
 OpenSSL/0.9.6d


 Here is a cut/paste of the borwser screen for the code below:

Stage:0 SessionID: 04ace04b1fe0bc81d2cd678c9bab1619
_ [Submit]
Stage:1 SessionID: 04ace04b1fe0bc81d2cd678c9bab1619 Request: Array ( )

 So I type foo into the box and hit submit.  And the session variable
 is NOT preserved:

Stage:0 SessionID: 55c70989b7279d6a18edfd81b28d67a6
foo___ [Submit]
Stage:1 SessionID: 55c70989b7279d6a18edfd81b28d67a6 Request: Array (
 [PHPSESSID] = 04ace04b1fe0bc81d2cd678c9bab1619 [field] = foo )

 The session directory IS writable and I see the expected information
 being written there:
-rw---  1 nobody   wheel  10 May 21 13:35
 sess_04ace04b1fe0bc81d2cd678c9bab1619
-rw---  1 nobody   wheel  10 May 21 13:38
 sess_55c70989b7279d6a18edfd81b28d67a6

 Apache runs as user nobody on this server.  Both session files contain:
stage|i:1;
 but the files never seem to be being read back!

 Help!?


 Here's the entire php code I'm testing with:

 ?
 if (!isset($_SESSION['stage'])) {
$_SESSION['stage'] = 0;
}
 if (!isset($_POST['field'])) { $_POST['field'] = ; }
 ?
 html
 headtitlePHP Test page/title/head
 body
 ?
   echo Stage:; echo $_SESSION['stage'];
   echo  SessionID: ; echo session_id();
   $_SESSION['stage'] = 1;
 ?
form method=post action=xxx.php
   input type=text maxlength=7 size=7 name=field value=?echo
 $_POST['field']?
   input type=submit value=Submit
/form
 ?
   echo Stage:; echo $_SESSION['stage']; echo  ;
   echo  SessionID: ; echo session_id(); echo  ;
   echo  Request: ; print_r($_REQUEST);
 ?
 /body /html

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



Re: [PHP] Newbie error with cookies and headers already declared

2004-05-21 Thread Daniel Clark
Try putting your HTML below setting the cookie.

 I'm getting this error:

 Warning: Cannot add header information - headers already sent by (output
 started at /home/tiempodemaria/main.php:3) in /home/tiempodemaria/main.php
 on line 11

 With this code in main.php:

 html
 ?
  define(SECONDS_IN_THREE_MONTHS, 3600*24*90);
  define(OFFSET_WITH_GMT, -3*3600);

  $has_visited = isset($_COOKIE[TdM_visited]);

  if (!$has_visited) {
   setcookie(TdM_visited,
   (string) (time() + OFFSET_WITH_GMT),
   time() + OFFSET_WITH_GMT + SECONDS_IN_THREE_MONTHS);

   // the above (not blank) is line 11

  } else {
   $latestVisit = (int) $_COOKIE[TdM_visited];
   setcookie(TdM_visited,
   (string) (time() + OFFSET_WITH_GMT),
   time() + OFFSET_WITH_GMT + SECONDS_IN_THREE_MONTHS);
  }
 ?
 meta http-equiv=Content-Type content=text/html;
 charset=iso-8859-1
 link href=styles/main_style.css rel=stylesheet type=text/css

 body
 .

 Does anybody knows what's going on? I don't understand which header is
 being
 sent before the setting of the cookie, and I don't understand the :3 in
 the error description. This page is a frame, so I don't have any head tag,
 does that matter to php?

 Thanks in advance,
 Nicolas

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



Re: [PHP] How to make program execution go to another file?

2004-05-20 Thread Daniel Clark
This works providing there has NOT been any header (HTML) info outputed.

 if (1==a)
header(Location:  thisotherfile.php);



 Hi,
I want program execution to go to one of several other files
 based on a decision.
 For Example.

 if (1==a)
go to this .php file

 if (1==b)
go to that .php file

 if (1==c)
go to the other .php file


 Thank you for your time.

Michael

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



[PHP] Distance and info

2004-05-19 Thread Brent Clark
Hi all

I have a question regarding phpclasses.org.

There is a section, where is says, Find the closest mirror.

My question is, does anyone know how do they determine the distance (Sits on
the right of the screen) and also
the details for Your approximate location.
Cause its pretty acurrate.

Kind Regards
Brent Clark

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



[PHP] Select box

2004-05-18 Thread Brent Clark
Hi all

For the likes of me I cant seem to figure out how to have a select drop down
box , and have it so, that when I click the submit button, the page displays
the correct content (which is what it does) but at the same time I need the
select box to be at the option of the query.

Below is part of my code.

If someone could help, it would be most appreciated.

select name=uname
?php
$sqlu=SELECT id,user,name FROM users ORDER BY user
ASC;
$name_result = mysql_query($sqlu);
while($rowu=mysql_fetch_array($name_result)){
echooption
value=\$rowu[user]\$rowu[user]/option\n;
}
?
/select

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



[PHP] between date

2004-05-18 Thread Brent Clark
Hi all

I have a table whereby I use  the php date() and time() function.

I retrieve the data etc, no problem.

but I now need to perform a query of between dates.

Is there a function or method to perform this.

Kind Regards and thank you in advance

Brent Clark

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



Re: [PHP] between date

2004-05-18 Thread Brent Clark
Hi

Sorry, I should have copied and pasted the table structure before, sending
the mail.
(Sorry for the scewness)

Kind Regards
Brent Clark



++---+++++
| id | user  | ref_id | stage  | files_captured | time   |
++---+++++
|  7 | admin | 13 | Capture  Batch | 19 | 1084876173 |
|  6 | admin | 12 | Read Batch | 19 | 1084874313 |
|  5 | admin | 10 | Read Batch | 19 | 1084873823 |
|  8 | admin | 14 | Archive|  0 | 1084877521 |
|  9 | admin | 15 | Archive|  1 | 1084877659 |
| 10 | admin | 16 | Archive|702 | 1084877710 |
++---+++++

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



Re: [PHP] XML problem

2004-05-18 Thread Brent Clark
Hi,

I know that this is not an xml list but maybe you could help me.
'm looking for a good tutorial in xml or a list with most of the xml tags.
I've googled for it but i can't find anything.
Could someone send me a link to that kind of tutorial?


http://www.zend.com/zend/tut/index.php

Kind Regards
Brent Clark

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



[PHP] thought I should share this

2004-05-17 Thread Brent Clark
http://developers.slashdot.org/article.pl?sid=04/05/16/1631212mode=threadtid=126tid=169tid=172

Kind Regards
Brent Clark

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



  1   2   3   4   5   6   >