Re: [PHP] MySql injections (related question)

2005-05-12 Thread Jennifer Goodie
 -- Original message --
From: Richard Lynch [EMAIL PROTECTED]
 On Thu, May 12, 2005 4:43 pm, Chris Shiflett said:
   From me:
  The fact that it uses the character set of your current connection to
  MySQL means that what your escaping function considers to be a single
  quote is exactly what your database considers to be a single quote. If
  these things don't match, your escaping function can miss something that
  your database interprets, opening you up to an SQL injection attack.
 
 Under the following pre-conditions:
 1. C Locale / English in MySQL data
 2. No intention to ever switch natural language, nor database.
 
 is there any real benefit to spending man hours I really can't afford for
 legacy code to switch from Magic Quotes to mysql_real_escape_string -- and
 make no mistake, it would be a TON of man hours.

I believe it also takes into account special characters like _ and %, which 
addslashes does not.  In certain instances if you do not escape special 
characters, such as the wildcards I mentioned, the results that you get can 
differ from what you intended.  One instance this comes into play is a search 
form used by a non-technical user.  You should probably check that though, it 
has been a while since I have looked into it.

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



Re: [PHP] Secure system calls -- how

2005-02-08 Thread Jennifer Goodie
 -- Original message --
From: Niels [EMAIL PROTECTED]
 Hi list,
 
 I'm doing an intranet website for managing users. I need to be able to
 change passwords, move files and folders around and that kind of thing.
 What is the best way?
 

I wouldn't use system calls to move files around.  PHP has built in file system 
functions.  Why shell out to do something that is built in?

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



Re: [PHP] Secure system calls -- how

2005-02-08 Thread Jennifer Goodie
 -- Original message --
From: Niels [EMAIL PROTECTED]
 Jennifer Goodie wrote:
 
  I wouldn't use system calls to move files around.  PHP has built in file
  system functions.  Why shell out to do something that is built in?
 
 Well, the apache user really shouldn't have access to the entire file system
 -- that's the problem.

Should web applications have access to areas on the file system that the apache 
user doesn't?  I personally only allow my web applications access to certain 
areas on purpose and set my permissions to accomplish this.  If I need to be a 
user other than nobody to do something I don't want my web applications doing 
it.  Of course, I work in an environment where I have root access to dedicated 
servers and a sysadmin that listens to what I want, so your experience may be 
different.  I admittedly do not have a lot of experience getting around the 
problems caused by shared hosting.

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



Re: [PHP] Avoiding NOTICEs on Array References

2005-01-26 Thread Jennifer Goodie
 -- Original message --
From: Tom Rawson [EMAIL PROTECTED]
 I have many places where I use references like this:
 
   if ($fields['flags']['someflag']) ...
 
 or perhaps
 
   if ($_POST['checkboxfieldname']) ...
 
 If there is no value for 'someflag', or if the check box was not 
 checked -- both of which are often the case -- these generate errors at 
 level E_NOTICE.  Is there any way to prevent references to missing 
 array elements from generating errors without turning off all E_NOTICE 
 notifications?

if (isset($fields['flags']['someflag'])  $fields['flags']['someflag'])
if (isset($_POST['checkboxfieldname'])   $_POST['checkboxfieldname']) 

The  short-circuits, so the second part of the conditional only gets 
evaluated if the first part is true.

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



Re: [PHP] Re: Parsing search strings from referer urls?

2005-01-26 Thread Jennifer Goodie

 -- Original message --
From: Jason Barnett [EMAIL PROTECTED]
 T.J. Mahaffey wrote:
  First time post, please be gentle.
 
 You will probably find parse_url() to be useful:
 http://www.php.net/manual/en/function.parse-url.php
 
 ?php
 
 $url = 
 http://username:[EMAIL 
 PROTECTED]/path?arg=valuearg2=valuearg3=value3#anchor
 ;
 
 $parts = parse_url($url);
 $args = explode('', $parts['query']);
 
 for($i = 0; $i  sizeof($args); $i++) {
list($key, $value) = explode('=', $args[$i]);
$query[$key] = urldecode($value);
 }
 
 print_r($query);
 
 ?
parse_str will take care of turning the query string into key/value pairs
http://us2.php.net/manual/en/function.parse-str.php

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



Re: [PHP] MySQL Excel

2004-11-12 Thread Jennifer Goodie
 -- Original message --
From: Sam Smith [EMAIL PROTECTED]
 
 I've got it working writing out a file (fopen) to CSV (comma delimited) and
 the header('Content-Disposition: attachment; filename=myFile.csv')
 method but it's clumsy for the user to figure out how to use the file.
 
 Is there some totally slick way of spitting out a file that Excel can open
 right up?

Instead of opening a file and writing to it, just push excel headers and then 
just print like you would nomally do when generating a web page.  If you output 
an html table excel will render it like a spreadsheet.  I don't think I phrased 
that very well, so here's an example
?
//get your result set up here
if($sExport){
if ($sExport == 'xls'){
header(Content-Type: application/vnd.ms-excel);
header(Content-Disposition: attachment; filename=report.xls);
$joiner = /tdtd;
$begin = trtd;
$end = /td/tr\n;
print table border='1';
} else{
header(Content-Type: text/plain);
header(Content-Disposition: attachment; filename=report.csv);
$joiner = ,;
$begin = ;
$end = \n;
}

print $begin .implode($joiner, $aDisplayColumns).$end;  //prints out a 
header row with column name (stored in $aDisplayColumns with row name as key 
and display value as value)
while ($row = $dbObj-fetch_array($rs)){
unset ($push);
$push = array();
foreach ($aDisplayColumns as $key = $val)  { 
if ($sExport=='xls'){
$push[] = $row[$key];
}else{
$push[] = addslases($row[$key]);
}
}
print $begin .implode($joiner, $push).$end;
}
if ($sExport=='xls'){
print /table;
}
exit;
}

Hope that helps and is not too confusing.

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



Re: [PHP] Programmatic Browser Rendering Engine?

2004-11-10 Thread Jennifer Goodie
 -- Original message --
From: Richard Lynch [EMAIL PROTECTED]
 Please Cc: me, as it's been quite some time since I posted 50 emails per
 day to this list... :-^
 
 
 I'm interested in anybody's experience, good or bad, in what I am naively
 coining as a Programmatic Browser Rendering Engine:
 
 In an ideal world, it would be a PHP function definition not unlike this:
 
 
 bool imagesurfto(resource image, string url, [int width, int height]);
 
 This function surfs to the given URL, as if a browser window the
 dimensions (imagesx, imagesy) of image were opened to that URL, and places
 in image a representation of what the user would see if they surfed to
 that site.
 

You might want to look at webthumb http://www.boutell.com/webthumb/
It is a linux command line utility that creates thumbnails of webpages. 

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



Re: [PHP] Error Code Airhead

2004-11-02 Thread Jennifer Goodie
 -- Original message --
From: Jeff Oien [EMAIL PROTECTED]
 //always gives error message even if one of the two codes entered:
 if ($Promotion_Sub == 'Checked'  ($code != 'D04E' || $code != 'Y04KG')) {

If $code is D04K then it is not Y04KG making the statement true since it is an or. 
 I think either ($code != 'D04E'  $code != 'Y04KG') or !($code == 'D04E' || $code == 
'Y04KG') are what you are looking for.  

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



Re: [PHP] getting screen resolution

2004-10-29 Thread Jennifer Goodie
 -- Original message --
From: Louis O'Carroll [EMAIL PROTECTED]
 Hi,
 is there a function that gets the screen resolution of the user?
 you can also reply directly to me... [EMAIL PROTECTED]
 
 Thanks,
 Louis

Search the archives before posting.  This was discussed two days ago.

http://marc.theaimsgroup.com/?l=php-generalm=109891606117713w=2

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



Re: [PHP] Date Calculation

2004-10-28 Thread Jennifer Goodie
-- Original message from Mike Tuller [EMAIL PROTECTED]: -- 

 Ok, so here is what I have. Please check to see if there is a better 
 way. There are a lot of database calls to me. 

There are.  Do it in one query.
 
 $query = SELECT * FROM hardware_assets WHERE ethernet_address = 
 '$ethernet_address'; 
 $result = mysql_query($query, $db_connect) or die (mysql_error()); 
 
 while ($row = mysql_fetch_array( $result )) 
 { 
 $timestamp = $row[script_ran]; 
 $timequery = SELECT SEC_TO_TIME(UNIX_TIMESTAMP() - 
 UNIX_TIMESTAMP('$timestamp')) as diff; 
 $timeresult = mysql_query($timequery, $db_connect) or die 
 (mysql_error()); 
 $time = mysql_result($timeresult, 0, 0); 
 
 $secondquery = SELECT TIME_TO_SEC('$time'); 
 $secondresult = mysql_query($secondquery, $db_connect) or die 
 (mysql_error()); 
 $seconds = mysql_result($secondresult, 0, 0); 
 
 echo $seconds; 
 } 
 

I don't know why you're doing both TIME_TO_SEC and SEC_TO_TIME, so I'm leaving them 
out as they are inverses.  But I'm sure you can figure out what you want.

$query = SELECT  *, (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(script_ran)) as seconds FROM 
hardware_assets WHERE ethernet_address =  '$ethernet_address'; 

This will return all the columns from the matching rows, plus an extra field called 
seconds that is the difference in seconds between now and wehn the script ran.  

Here is the list of mysql date/time functions for refernece 
http://dev.mysql.com/doc/mysql/en/Date_and_time_functions.html#IDX1454

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



Re: [PHP] fopen by URL is disabled, is there another way of reading a remote webpage?

2004-10-20 Thread Jennifer Goodie
-- Original message from Chuck Barnett : -- 

 Hi, my new server has fopen by url disabled. My ISP doesn't want to turn it 
 on. So is there a way to do an equivilant function some other way? I need 
 to read a remote webpage and manipulate it. 
 
 Thanks, 
 Chuck 

You could use sockets. Here's an example from the archives
http://marc.theaimsgroup.com/?l=php-generalm=105052005332001w=2

The example is sending a POST, but you can easily change it to a GET.

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



RE: [PHP] CPU usage @5% during 2 minutes

2004-10-19 Thread Jennifer Goodie
-- Original message from Janke Dávid : -- 

 The sample code (in seperate, this piece of code runs with normal speed, 
 but it is this part which runs slowly when executed as a whole, 
 everything else is fast): 
 
 
 $sqlquery = SELECT sh_Number, sh_Status FROM service_sheet ORDER BY 
 sh_Number DESC; 
 $result = mysql_query($sqlquery) 
 or die (mysql_error().

Are you sure it is not the query that is running slow?  Have you looked to see what 
mysql is doing when the application hangs?  What processes does top show as running 
and using resources?  Has the mysql config recently changed?  What does an explain on 
that query show?

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



Re: [PHP] general research question (maybe a little OT, sorry)

2004-10-07 Thread Jennifer Goodie
-- Original message from Matthew Sims : -- 
 
 www.thewb.com (uses PHP for the interactive areas such as message 
 boards, polls, etc.) 
 

Up until September 2003 I was the developer for PHP applications for this site.  To 
the best of my knowledge the message board is the only thing using PHP.  

Prior to the AOL/Time Warner merger the majority of interective content on the site 
was driven by PHP.  But after the merger all developement started migrating to 
Vignette, I would estimate this was around 2001 or 2002.  Occassionally if they needed 
quick turn around time a poll or sweepstakes would be done in PHP.  The same holds 
true for kidswb.com.  My knowledge is a little over a year old, but when I left my 
former position there was very little WB development being done in PHP.  I went from 
spending 30+ hours a week doing it to well under 5.  

This was slightly off topic, but I would not use this site as an example of something 
that has a lot of php driven content. 

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



Re: [PHP] Referencing a constant class variable

2004-10-06 Thread Jennifer Goodie
-- Original message from Chris Boget : -- 
 Parse error: parse error, expecting `','' or `';'' in 
 /usr/local/etc/httpd/domains/eazypro.com/interactive/cron_scripts/test/rate_ 
 version.php on line 9 
 
 with line 9 being this line: 
 
 var $MyVar = MyEnums::thisVar; 
 

That is because In PHP 4, only constant initializers for var  variables are allowed. 
To initialize variables with non-constant values, you need an initialization function 
which is called automatically when an object is being constructed from the class. 
(from the manual)  

Whether or not the syntax MyEnums::thisVar is correct and will accomplish what you 
want when moved into a function is another story.

I haven't been paying close attention and am not sure what you are trying to do, but 
since it appears you want something that is constant, have you thought about using 
DEFINE?  

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



Re: [PHP] mysql_connect does not connect

2004-09-17 Thread Jennifer Goodie
-- Original message from John Holmes : -- 

 Whatever happened to those monthly stat posts? most posts, most posts per 
 thread, etc...?? Who was doing that? I haven't seen one in a while. 
 
 ---John Holmes... 
 
Bill Doerrfeld
http://marc.theaimsgroup.com/?a=9211645541r=1w=2

STFA!!! :)

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



Re: [PHP] Secret Codes in Spam and PHP

2004-09-16 Thread Jennifer Goodie


-- Original message from Kristopher Spencer-Yates : -- 

 As many of you may have noticed, A friend and I have noticed the odd 
 text at the bottom of spam. My friend once stated What if this is some 
 secret code.. they send it to everyone to hide that it is code.. but the 
 person it is intended for knows how to decipher? Hmm.. interesting. 

Now that they know that we know, we're all in danger.  Be on the look out for 
assassins.

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



Re: [PHP] Re: Convert Smart Quotes to Sraight Quotes - Need Help!

2004-09-07 Thread Jennifer Goodie
-- Original message from Monty : -- 

 Anyone! I'm out of online resources and answers. I guess this isn't possible 
 to do... 
 
  I've been reading for the last three days about character encodings and 
  such, but, have still been unable to figure out what I think should be a 
  simple solution. 
  

A quick google search led me to http://us4.php.net/htmlentities

If you scroll down the page or search for smart there's a note from  01-Apr-2004 
02:49 that gives a function for replacing these characters with their htmlentities.  
You will have to change the substitution array to what you want to replace them with, 
but that should be easy.  I didn't test to see if the function actually works, but the 
character values it uses look correct.

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



Re: [PHP] MSSQL, PHP and Linux

2004-09-01 Thread Jennifer Goodie
-- Original message from blackwater dev : -- 

 I need some help...I am helping a local business with a site which 
 needs to connect to a mssql db, my webhost uses linux and compiled php 
 with the freetds library and when I go to the info page..it does show 
 Microsoft SQL Server under dbx yet I still get the errors called to 
 undefined function mssql_pconnect()...what can I try next? 

The dbx extension is compiled in, not the mssql extension.  You need to either use the 
functions in the dbx extension to do what you want, or if you would rather use the 
mssql functions you need to compile in the mssql extension.

http://us3.php.net/manual/en/ref.dbx.php
http://us3.php.net/manual/en/ref.mssql.php

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



Re: [PHP] MSSQL, PHP and Linux

2004-09-01 Thread Jennifer Goodie
-- Original message from blackwater dev : -- 

 I have tried recompiling with --with-mssql and --with-mssql=/usr/include/freetds 
 It all appears to compile correctly, except the info page does not 
 reflect the config was done with mssql at all. below is a snippet of 
 the config switches that were used. 

  http://mwvre.ht-tech.net/info.php 

It also shows a build date in June.  Did you restart apache?

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



Re: [PHP] MSSQL, PHP and Linux

2004-09-01 Thread Jennifer Goodie


-- Original message from blackwater dev : -- 

 the date is a very good question? Here is the info from my system 
 
 -rwxr-xr-x 1 root root 1371932 Sep 1 19:50 /usr/bin/php 
 
 Not sure why its showing that date - Apache has been restarted. 
 

Are you sure apache is loading the version you just built and not an old one in some 
other location (possibly /etc)? Did you read the install instructions for PHP with 
Apache 2.0 on a Linux system?  Check step 14 and make sure you are loading the module 
from the correct location.  Just a guess, but since none of your new configure flags 
are showing on the php info page and the build time is old, it looks like you are not 
running from the location you think you are.

http://us3.php.net/manual/en/install.unix.apache2.php   

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



Re: [PHP] Dynamic Function with return?

2004-08-27 Thread Jennifer Goodie
 -Original Message-
 From: bskolb [mailto:[EMAIL PROTECTED]
 Sent: Friday, August 27, 2004 3:59 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Dynamic Function with return?
 
 
 Sample Code:
  
 //
 ?PHP // version 4.3.6
 function testFunction($foo) {
 return $foo==TEST;
 }
  
 function wrapper($foofunc, $foovar) {
 return eval(return $foofunc($foovar););
 }
  
 echo wrapper(testFunction, TEST);
 ?
 //
  
 This code works.  It calls the function and 
 receives the appropriate return value.  
  
 But, is there a better way of doing this?
 It seems a bit round-a-bout.

Did you already try this?  
function wrapper($foofunc, $foovar){
 return $foofunc($foovar);
}

http://us3.php.net/manual/en/functions.variable-functions.php

Maybe I'm missing something, but I don't see the need for the eval since PHP supports 
variable function names.

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



Re: [PHP] Securing Forms???

2004-08-18 Thread Jennifer Goodie
  $token = md5(uniqid(rand(), true)); 
  
  .. is a pretty bad idea, since the output could include quotes, 
  newlines, low-ascii-characters, thereby messing up the form. 
 How do you figure that? md5() only returns 0-9 and a-f characters. 
 
 From the manual: http://php.net/md5 
 string md5 ( string str [, bool raw_output]) 
 If the optional raw_output is set to TRUE, then the md5 digest is 
 instead returned in raw binary format with a length of 16. 

The true is the second argument (more_entropy) for uniqid.

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



RE: [PHP] rename variables

2003-09-24 Thread Jennifer Goodie
 I'm trying to rename some variables.

 first I have a function -
 randomize (3,4); //has created unique $numbers

 then I want to create a function for the renaming:

 renameit($sculp); //sends $sculp for the new variable name

 and this function (and variations)

 function renameit($var){
 $z = 1;
 foreach ($numbers as $currNum){
 $var[$z++] = $output[$currNum];  //creates $sculp[1 and 2]
 }
 }

 but failed

 if I use
 $z = 1;
 foreach ($numbers as $currNum){
 $sculp[$z++] = $output[$currNum];

 after randomize (3,4);

 it works fine -but I want it in a function.

 Any suggestions?

Read up on scope.  If you want $numbers to be available to your function it
has to be in that function's scope.  Either pass it or declare it global.

http://us2.php.net/variables.scope

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



RE: [PHP] SQL statement

2003-09-23 Thread Jennifer Goodie
 Ive used this
 $query = (SELECT username, password, DATE_FORMAT(timestamp,
 '%d%m%y')  FROM
 custlogon);

 But I recieve unknown index timestamp.  *shrug*


You are receiving the error on an array returned by fetch_array?  If so, it
is because the index is DATE_FORMAT(timestamp, '%d%m%y'), not timestamp,
which isn't so great.  You can see this by doing a print_r on the array to
see what is actually in it.  Use aliasing in your query to give it a better
index.
SELECT username, password, DATE_FORMAT(timestamp, '%d%m%y') as formatted_ts
FROM custlogon or something like that.

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



RE: [PHP] SQL statement

2003-09-23 Thread Jennifer Goodie
 Jennifer, you're right, I am using fetch_array...  I tried to use your
 suggestion, and it failing as well, It wont even execute

 Do you have a better method of looping through all these records??


There's probably an error in my SQL syntax.  What is mysql_error() telling
you?  If it was my query and my database I'd probably know what the problem
is just by looking, but it isn't and I don't.

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



RE: [PHP] SQL statement

2003-09-23 Thread Jennifer Goodie
 try this:

 $query = SELECT username, password,
 DATE_FORMAT(CURRENT_TIMESTAMP(), '%d%m%y') FROM custlogon;

 or if that doesnt work try:

 $query = SELECT username, password, DATE_FORMAT(NOW(), '%d%m%y')
 FROM custlogon;
[snip]
original query as posted:
SELECT username, password, DATE_FORMAT(timestamp, '%d%m%y') FROM custlogon
[/snip]


Unless timestamp is actually the name of a column in the database, in that
case NOW() and CURRENT_TIMESTAMP() won't give the expected results.

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



RE: [PHP] SQL statement

2003-09-23 Thread Jennifer Goodie
   Jennifer, you're right, I am using fetch_array...  I tried to use your
   suggestion, and it failing as well, It wont even execute
  
 
  There's probably an error in my SQL syntax.  What is
 mysql_error() telling
  you?

 I dont believe it to be an error because Ive run this from the CLI on my
 zeus system.  I have also echoed out the sql statement to read
 exactly what
 I know its got to be problem with the string terminators and or
 the way the
 fetch_array reads the elements of a record in my database.


Why don't you humor me and tell me what the error is and show me the code
that is generating it.  A PHP error message and the output from
mysql_error() will go a long way in debugging a problem.  I can't really
work with it stops working and it fails to execute, those don't tell me
much except that there's probably a problem with the query.

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



RE: [PHP] SQL statement

2003-09-23 Thread Jennifer Goodie
 http://www.mysql.com/doc/en/Reserved_words.html

 [snip]
 6.1.7 Is MySQL Picky About Reserved Words?

 A common problem stems from trying to create a table with column
 names that use the names of datatypes or functions built into
 MySQL, such as TIMESTAMP or GROUP. You're allowed to do it (for
 example, ABS is allowed as a column name). However, by default,
 in function invocations no whitespace is allowed between the
 function name and the following `(' character, so that a function
 call can be distinguished from a reference to a column name.
 [/snip]

If you keep scrolling on the page you gave the link for, you'll get to a
list of reserved words and notice that timestamp is not reserved.  In fact
if you scroll even farther, you will see that it is explicitly allowed in
mySQL, but that doesn't mean using it is a good idea.

 try renaming the field timestamp to something else and see if that helps?

If you are using a reserved word and renaming is not an option you can use
the backtick operator ` to escape it.

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



RE: [PHP] SQL statement

2003-09-23 Thread Jennifer Goodie
 Thank you for your time on this.

No problem.


 ?php
 // Function that runs reports on logon history

 function logonHist() {

  db_connect(); //establish connection

  $_qlogonhist = (SELECT username,host_info,status, DATE_FORMAT(timestamp,
 '%d%m%y')
   as formatted_ts FROM custlogon_hist); // Build query.
  //$_qlogonhist = ('SELECT * FROM custlogon_hist');
  $_rlogonhist = mysql_query($_qlogonhist) or die(mysql_error());


For testing purposes add or die(mysql_error()) to your code as I have above.
That way we can see if the error is in the query.


 ?php echo $row['timestamp'];?/font/td?

 Notice: Undefined index: timestamp in C:\Program Files\Apache
 Group\Apache2\htdocs\Ameriforms\admintool\includes\getlogonhist.ph
 p on line
 44
timestamp is still undefined, we aliased the column to formatted_ts, so
formatted_ts is the array index.  I did this because I'm not certain you can
use a column name that already exist as an alias becuase mySQL likes unique
aliases and I didn't feel like looking up whether or not we could use
'timestamp'

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



RE: [PHP] Attention: List Administrator

2003-09-19 Thread Jennifer Goodie
 And I get this:
 
 [snip]
 Violation Information:
 The subject violated the content filtering rule PHP as subject is a
 malacious code - Not Allowed.  No attempt was made to repair.
 [/snip]
 
 How can PHP be a code so powerfull it is not even allowed in the 
 subject? I thought PHP was a drug.
 

Apparently there is a virus written in PHP
http://securityresponse.symantec.com/avcenter/venc/data/php.virdrus.html

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



RE: [PHP] Need to convert seconds to DD:HH:MM:SS

2003-09-19 Thread Jennifer Goodie
can't seem to figure
 out how to get the number of days integrated in here for $hh that
 are  24.
 to days:hours:minutes:seconds...  This function works for what it
 does, can
 someone embelish it to handle days too?

 function convertToHHMMSS($seconds)
 {
   $hoursPerDay= 24;
   $SecondsPerHour = 3600;
   $SecondsPerMinute   = 60;
   $MinutesPerHour = 60;

   $hh = intval($seconds / $SecondsPerHour);
   $mm = intval($seconds / $SecondsPerMinute) % $MinutesPerHour;
   $ss = $seconds % $SecondsPerMinute;

   return $hh.h:.$mm.m:.$ss.s;
 }

Not quite what you're looking for, but I'm sure you can figure out how to
customize it

function sec2time($sec){
$returnstring =  ;
$days = intval($sec/86400);
$hours = intval ( ($sec/3600) - ($days*24));
$minutes = intval( ($sec - (($days*86400)+ ($hours*3600)))/60);
$seconds = $sec - ( ($days*86400)+($hours*3600)+($minutes * 60));

$returnstring .= ($days)?(($days == 1)? 1 day:$days days):;
$returnstring .= ($days  $hours  !$minutes  !$seconds)? and
: ;
$returnstring .= ($hours)?( ($hours == 1)?1 hour:$hours
hours):;
$returnstring .= (($days || $hours)  ($minutes  !$seconds))?
and : ;
$returnstring .= ($minutes)?( ($minutes == 1)?1 minute:$minutes
minutes):;
$returnstring .= (($days || $hours || $minutes)  $seconds)? and
: ;
$returnstring .= ($seconds)?( ($seconds == 1)?1 second:$seconds
seconds):;
return ($returnstring);
}

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



RE: [PHP] Excel Files

2003-09-18 Thread Jennifer Goodie
 Hi, is there a way to create excel files with php?

 Thanks.

This was answered yesterday and I'm way too lazy to type out my reply again.

Here is an archive search on the word 'excel'
http://marc.theaimsgroup.com/?l=php-generalw=2r=1s=excelq=b

Here is yesterday's thread
http://marc.theaimsgroup.com/?t=10637468632r=1w=2

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



RE: [PHP] How to use file() function with an HTTPS:\\www.example.com

2003-09-17 Thread Jennifer Goodie
 How to use file() function with an HTTPS:\\www.example.com

 ?php

  $lines = file ('https://www.example.com/');

  foreach ($lines as $line_num = $line) {
 echo Line #b{$line_num}/b :  . htmlspecialchars($line)
 . br\n;
  }

My interpretation of the manual page
(http://us3.php.net/manual/en/function.file.php) is as follows:
1.) you need fopen_wrappers enabled
2.) https is only available in versions = 4.3.0

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



RE: [PHP] Re: Need Help With gethostbyname()

2003-09-17 Thread Jennifer Goodie
  I have a section of my script where I call gethostbyname($hostname) .
  For some host names that are not registered (according to register.com)
  I am still getting an IP address returned?
 
  What is happening?

 Well, try only the toplevel domain... For example, I have like
 hns345667dsvdtrt34.telia.com, I doubt that is registred, but
 telia.com sure
 is... I hope.. :S

telia.com is a second level, not a top level, .com is the top level in your
example.  Also, only looking up the second level is a bad idea.  In many
cases the third level is actually being used to signify something (the
host).  All of the hosts in our server farm use the same second level, but
the third level signifies which box I'm talking about.  If I do an nslookup
on my second level I'm going to get the IP bound to the webserver that hosts
the corporate site (because that's how we have it set up), but if I do an
nslookup on servername.domain.com (servername being the name of one of the
servers in our farm) I'm going to get the IP for the host designated by
servername.  For example, ftb.ca.gov (California franchise tax board) is not
the same as dot.ca.gov (California Dept. of Transportation) which is not the
same as cdfa.ca.gov (department of food and agriculture), but they all fall
under the ca.gov second level because they are all government offices for
the state of California, which falls under the .gov top level because it is
a government branch within the United States.

To answer the original question, verisign has decided it is a good idea to
wildcard the .com and .net TLDs to point to http://sitefinder.verisign.com,
so if you do a look up on a non-existant domain in those TDLs it will now
give an IP.  I believe a BIND patch has already been released to negate this
change.

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



RE: [PHP] output to Excel

2003-09-16 Thread Jennifer Goodie
 Is there a way to output PHP to MS Excel format?

Send the headers for the appropriate application type and then format your
output as HTML with Excel's styles.  In order to get a feel for what my
output should be, I just create a sample of what I want in Excel, save as
html and then open the file in a text editor. Once you look at a few it's
pretty easy to understand.

Here's a small example (okay, it is kind of long, but is probably helpful):

?php
Code to execute a query, etc.  my result identifier is $results
header(Content-disposition: filename=$file_title.xls);
header(Content-type: application/vnd.ms-excel);
header(Pragma: no-cache);
header(Expires: 0);
?
html xmlns:o=urn:schemas-microsoft-com:office:office
xmlns:x=urn:schemas-microsoft-com:office:excel
xmlns=http://www.w3.org/TR/REC-html40;

head
meta http-equiv=Content-Type content=text/html; charset=windows-1252
meta name=ProgId content=Excel.Sheet

!-- STYLES --
style id=Book1_29054_Styles
!-- //this is all swiped from excel, but I removed most of the content
//--
!--table
{mso-displayed-decimal-separator:\.;
mso-displayed-thousand-separator:\,;}
.general
{BUNCH of STUFF}
.col_header
{BUNCH of STUFF}
.date
 {BUNCH of STUFF}
//--
/style
/head

body
div id=Book1 align=center x:
table x:str border=1 cellpadding=0 cellspacing=0
style='border-collapse:collapse;table-layout:fixed;border-color:#B71E00;'
   tr
td colspan=4 class='col_header' align='center'b?php
echo $title;?/b/td
/tr
tr
td class='col_header'ID/td
td class='col_header'Email/td
td class='col_header'Visits/td
td class='col_header'Date Applied/td
 /tr
?php
while ($row = $db-fetch_array($results)){
foreach($row as $key=$val){
$$key = ($val ==
'')?'nbsp;':htmlentities(stripslashes($val),ENT_QUOTES);
}
printf (tr
td class='general'%d/td
td class='general'%s/td
td class='general'%d/td
td class='date'%s/td
 /tr\n,++$count, $email,$visits,$apply_date);
}
print /table/div/body/html;
?

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



RE: [PHP] Control Structure problem

2003-09-16 Thread Jennifer Goodie

 This doesnt work as expected.

 if ( $var === TEST ONE || TEST TWO || TEST THREE) {

 do something;

 }

 It returns true on all strings.  Ive tried using the or operator
 and the == but these fail as well.  Any Ideas?

It behaves exactly as expected.  Try checking the manual section on control
structures, I believe it explains that the syntax you are using is invalid.

What you are saying is if ( $var === (TEST ONE || TEST TWO || TEST
THREE)) {
(TEST ONE || TEST TWO || TEST THREE) is always going to evaluate as
true.  I think what you want is
if ( $var === TEST ONE || $var ===  TEST TWO ||  $var === TEST THREE)
{

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



RE: [PHP] How to comment out chunk of html/php mixed code?

2003-09-15 Thread Jennifer Goodie

 ?php /*

 your mixed html and php code here

 */ ?

 that way php will take everything inside the ?php ? tags and
 comment them
 out, regardless of if they are html or php or whatever.

This won't work is your PHP code has comments using /* */ syntax in it
already.  I always just through an if(false){ } around huge portions of
mixed content that I want to comment out.  Unless you have unbalanced curly
braces in the chunk you want to comment out, it should work.

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



RE: [PHP] Session stealing, ..

2003-09-12 Thread Jennifer Goodie
  93 # When deserialized we are called and need to check if the
 stored IP address equals the client's
  94 function __wakeup() {
  95 global $Log;
  96 if ($_SERVER['REMOTE_ADDR'] !=
 $this-Night['IP']) {
  97 $Log-Warning('IP Address changed during
 sleep and wakeup, will clear userdata');
  98 $this-Data = Array();
  99 };
 100 }

 Upon sleep it stores the IP and time in the session data, and
 when it smells
 coffee my object wakes up, checks if he's still being used on the
 same host
 and if not the userdata is plainly cleared.


I hope none of your site visitors are on AOL as the IP can change between
page requests for AOL users.

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



RE: [PHP] Re: cookies under php 4.06

2003-09-04 Thread Jennifer Goodie
 setcookie(UserName, $HTTP_POST_VARS['UserName'],
 time()+(60*10), /,
  $HTTP_SERVER_VARS['SERVER_NAME']);
 setcookie(Password, $password, time()+(60*10), /,
  $HTTP_SERVER_VARS['SERVER_NAME']);
 print login - set cookie;


 sorry for kinda answering my own post... but anyway...

 setcookie(UserName, $HTTP_POST_VARS['UserName']);
 setcookie(Password, $password);

 solves my problem, although means i can't have a time limit on my
 cookies i
 guess... but can set a time limit with another cookie...

1.) I would not store the user's password in a cookie.

2.) As far as I know, set_cookie() has worked the same since PHP3, so your
problem is something else, not the PHP version.  Are you sure
$HTTP_SERVER_VARS['SERVER_NAME'] is the same as what's in the location bar
in your browser.  If the server name is set up as www.domain.com but the
user is just at http://domain.com the cookie won't set.

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



RE: [PHP] Get the lowest value out of different fields

2003-09-03 Thread Jennifer Goodie
 Hi All,

 I hope you can help me with this:

 I have a tabel in my database like this

 TEST

 fieldnameValue's

 testid  1
 testf1   3
 testf2   4
 testf3   0
 testf4   2
 testf5   0

 (so this is one record!)

 I want to display the lowest value, except 0.. So the SQL
 statement will be SELECT testf1, testf2, testf3, testf4, testf5
 FROM test where testid='1' .

 I can't figure out if i can do this into a SQL statement or put
 it in an Array and sort it..

 Please help!


If you really want to do this in an SQL statement and you're using mySQL you
can nest IFs, but it's really ugly.  For example...

SELECT IF(IF(IF(IF(testf1 testf2 || testf2 = 0, testf1,testf2)  testf3 ||
testf3 = 0,IF(testf1 testf2, testf1,testf2), testf3)  testf4 || testf4 =
0, IF(IF(testf1 testf2 || testf2 = 0, testf1,testf2)  testf3 || testf3 =
0,IF(testf1 testf2, testf1,testf2), testf3), testf4)  testf5 || testf5 =
0,IF(IF(IF(testf1 testf2 || testf2 = 0, testf1,testf2)  testf3 || testf3 =
0,IF(testf1 testf2, testf1,testf2), testf3)  testf4 || testf4 = 0,
IF(IF(testf1 testf2 || testf2 = 0, testf1,testf2)  testf3 || testf3 =
0,IF(testf1 testf2, testf1,testf2), testf3), testf4),testf5)  from TEST
where testid =1;

I didn't test that, and I really wouldn't use it.  Maybe there's a prettier
way, check the function refrence for the DB you are using.  I'd just pull
the results into an array and use PHP to figure it out.

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



RE: [PHP] Get the lowest value out of different fields

2003-09-03 Thread Jennifer Goodie
 BUT how can i make the function loop through the whole
 result?

 ---
 if (mysql_num_rows($result3)  0)
 {
 $test = mysql_fetch_array($result3);
 echo minnum($test);
 }

 --


Someone will probably come up with something a little cleaner, but quick and
dirty...

 if (mysql_num_rows($result3)  0)
 {
while ($row = mysql_fetch_array($result3)){
$min[] = minnum($test);
}
$overall_min = minnum($min);
 }

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



RE: [PHP] Problem with date('w')

2003-08-26 Thread Jennifer Goodie
 I have a problem with the date function

 ?
  $theday = date(Y-m-d, time());
   echo date((w), $theday);
 ?

I'm pretty sure the optional second argument for date is a unix timestamp
that you would generate by using either time or mktime or strtotime.  You
are passing it something in the form of Y-m-d, or 2003-08-23 when it is
expecting 1061852640.
http://www.php.net/manual/en/function.date.php

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



RE: [PHP] Impossible error

2003-08-26 Thread Jennifer Goodie
 I have a 163 line file.  I get a parse error on line 164.  Ideas?
 

You're probably missing a } somewhere.

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



RE: [PHP] Bug in Ereg?

2003-08-15 Thread Jennifer Goodie
 What is posted [ from phpinfo() ]:

 _POST[color-1]  on
 _POST[color-4]  on
 _POST[color-6]  on


 Parser:
 foreach($_POST as $ThisVar=$ThisVal){
 if(ereg(color-, $ThisVar) AND $ThisVal==on OR $ThisVal==1){
 $newVarA=explode(-, $ThisVar);
 $colors.=$newVarA[1]:;
 }
 }

 Expected Output:

 $colors=1:4:6:;

 Real Output:

 $colors=:1:4:6:;

Do you have anything else in _POST that's equal to 1?  I didn't look up
order of operation, so I may be off here, but your if condition might not be
doing what you are expecting.  Try using parentheses to group it like this
if(ereg(color-, $ThisVar) AND ($ThisVal==on OR $ThisVal==1)){  (I'm
guessing that's what you want).  Why are you using ereg anyway?  You're not
using a regular expression so strstr would work just as well and be slightly
faster.


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



RE: [PHP] strtotime()

2003-08-14 Thread Jennifer Goodie
   strtotime( '+1 month', mktime( 0, 0, 0, 1, 1, 2003 ));
   I get back the timestamp for 1/31/2003 and not 2/1/2003.
  Are you sure?

 Yeah, but I missed something in my above example.  If I did this:

 strtotime( '+1 month GMT', mktime( 0, 0, 0, 1, 1, 2003 ));

 It came back with 1/31/2003 and not 2/1/2003.  Removing the GMT
 made it work.

Are you somewhere behind GMT?  I get an hour shift when using GMT that puts
me in the previous day.  I'm GMT -8.  I can't think right now, but for some
reason it seems like it's shifting in the wrong direction or at least the
opposite of what I'd expect.  I guess it is subtracting my 8 hours and then
shifting, making it 16:00 of the previous day.  It seems like it should add
8 hours since GMT is 8 ahead of me.  This is making my head hurt, maybe
someone else can make it make sense.

# php
?php
$ts = mktime( 0, 0, 0, 1, 1, 2003 );
echo date (Y-m-d H:i:s,$ts).\n;
$ts2 = strtotime('+1 month GMT', $ts);
echo date (Y-m-d H:i:s,$ts2).\n;
$ts3 = strtotime('+1 month', $ts);
echo date (Y-m-d H:i:s,$ts3).\n;
?
X-Powered-By: PHP/4.2.3
Content-type: text/html

2003-01-01 00:00:00
2003-01-31 16:00:00
2003-02-01 00:00:00


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



RE: [PHP] bug in code - can't find it!

2003-08-14 Thread Jennifer Goodie

 Ok, here is my query and the bit of code I can't figure out:

 $query = SELECT * from apt_user_t a, apt_company_t b ;
 $query .= WHERE a.user_cd = b.user_cd ;
 $query .= ORDER BY a.username;

  $search_results = mysql_query($query) or die(Select
 Failed!);
 while ($search_result2 = mysql_fetch_array($search_results))
 {
 INPUT
 TYPE=checkbox
 NAME=? echo $search_result2['user_cd'];?
 SIZE=20
 MAXLENGTH=50
 VALUE=?if ($search_result2[a.retired_flag] ==
 1){?CHECKED?}? ?echo $search_result2[a.retired_flag]?
 }
 Nothing shows up with the echo or the value.  I only included this
 checkbox, but all of the other values show up fine.  Can someone give me a
 hint?

Mysql does not prefix returned columns with table_name., so there's probably
no a.retired_flag index in your array.  A simple way to check this would
be to print_r($search_result2).  If you have a column named retired_flag in
both table a and table b and you specifically want the one from table a in
your result set you are going to have to alias it to a different name in
your query, i.e. SELECT *, a.retired_flag as r_flag



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



RE: [PHP] setting function variables

2003-08-14 Thread Jennifer Goodie
 Tried this and it returns errors of type:
 
 Warning: Wrong parameter count for mssql_result() in
 c:\inetpub\wwwroot\webpage10\example\utilities\dsp_del_images.php 
 on line 78
 
 Warning: mssql_result(): supplied argument is not a valid MS SQL-result
 resource in
 c:\inetpub\wwwroot\webpage10\example\utilities\dsp_del_images.php 
 on line 79
 
 Lines 78 and 79 read like this:
 
 $img_numbers = $qryResults(SELECT COUNT(img_id) AS TotalImages 
 FROM images
 WHERE category_id = '$row[0]');
 $img_count = $qryResults($img_numbers,0,TotalImages)
 
 The variables are specified as
 
 $runQuery = 'mssql_query';
 $qryResults = 'mssql_result';
 

You are using mssql_result instead of mssql_query on line 78. 

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



RE: [PHP] strtotime()

2003-08-14 Thread Jennifer Goodie
 strtotime( '+1 month', mktime( 0, 0, 0, 1, 1, 2003 ));

 I get back the timestamp for 1/31/2003 and not 2/1/2003.

Are you sure?

I tried it on my system (php 4.2.3 freeBSD 4.6.2) and this is the output I
got...
# php
?php
echo date(Y-m-d, mktime( 0, 0, 0, 1, 1, 2003 )).\n;
echo date(Y-m-d,strtotime( '+1 month', mktime( 0, 0, 0, 1, 1,
2003 ))).\n;
?
X-Powered-By: PHP/4.2.3
Content-type: text/html

2003-01-01
2003-02-01

What are you doing with the timestamp strtotime gives you?  Could that be
where the error is?


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



RE: [PHP] discussion forum from j. meloni's book

2003-08-14 Thread Jennifer Goodie

 // the query

 $verify = select ft.topic_id, ft.topic_title from forum_posts as fp left
 join forum_topics as ft on fp.topic_id = ft.topic_id where fp.post_id =
 $_GET[post_id];
 ...

 My question: why - or how can - the columns ft.topic_id and ft.topic_title
 come from the table forum_posts?

 In the original schema, there is no column called topic_title in the table
 called forum_posts.

They don't.  ft is aliased to forum_topics.


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



RE: [PHP] Commands out of sync; You can't run this command now

2003-08-14 Thread Jennifer Goodie
 Hi

 For a few days or maybe even a week or two I'm getting this error
 message in my site.
 This happens when i do : mysql_select_db()

 This doesn't happen all the time and there are pages that it happens
 more than others
 so it seems.

 I looked in the manual and the explanation there doesn't apply to me.
 Any ideas?

 http://mickey.lcsc.edu/manual.html#Commands_out_of_sync

 Sincerely

 berber

1.) This has been asked on the mysql list and the this list a lot of times,
search the archives
http://marc.theaimsgroup.com/?l=mysqlw=2r=1s=commands+out+of+syncq=b or
http://marc.theaimsgroup.com/?l=php-generalw=2r=1s=commands+out+of+syncq
=b .  From a brief search it appears it is a known bug in PHP 4.2.3, what
version of PHP are you running?

2.) Are you using mysql 3.22.14-gamma?  If not check the current manual at
http://www.mysql.com as I'd imagine a lot has changed since the 3.22.14
gamma manula you are refrencing.  If you are using 3.22 you should upgrade
to at least 3.23.55 as there have been huge security patches and I don't
think the 3.22 tree is still supported.


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



RE: [PHP] discussion forum from j. meloni's book

2003-08-14 Thread Jennifer Goodie
 Anyway, in the textbook and the zip her mySQL query reads:
 ...
 $verify = select ft.topic_id, ft.topic_title from forum_posts as fp left
 join forum_topics as ft on fp.topic_id = ft.topic_id where fp.post_id =
 $_GET[post_id];
 .

 The part that I'm confused about is:
 ...
 select ft.topic_id, ft.topic_title from forum_posts
 

 It seem that the alias of ft refers to forum_title - not forum_posts.

ft refers to forum_topics forum_topics as ft 


 In fact, I switched the query to read as follows:
 
 $verify = select ft.topic_id, ft.topic_title from forum_topics as ft left
 join forum_posts as fp on fp.topic_id = ft.topic_id where fp.post_id =
 $_GET[post_id];
 ..

 And that seems to run fine.

 Any explanations will be appreciated.

You didn't switch the aliases around, you just switched the join order.
This will provide unexpected results.  In order to understand it, you should
read up on left joins.
http://www.mysql.com/doc/en/JOIN.html



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



RE: [PHP] Question on class syntax

2003-08-14 Thread Jennifer Goodie
 I am currently using a php class that uses the following syntax:

 $value= htmlcleaner::cleanup($value);


 What exactly is the :: used for? Is there a different syntax for :: ?

The manual has an entire section on this
(http://www.php.net/manual/en/keyword.paamayim-nekudotayim.php) have you
read it and are still unclear and looking for further input?  Or have you
not read it yet?


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



RE: [PHP] Stop neurotic posting

2003-08-08 Thread Jennifer Goodie
Not to beat a dead horse, but...

From two separate responses:

 And as for Google, I don't feel like I have time to wade through pages and
 pages of irrelevant links until I find what I'm looking for when I have a
 better resource right here.



 I've actually learned quite a few useful things from questions in
 the past
 couple of weeks since I joined this list that have obviously reappeared
 several times. Now, I could spend hours trawling the archives to see if
 there's anything of interest, but I don't really have the time -
 and in any
 event they're often things I wouldn't have thought about looking
 up anyway.


I love how the argument for not doing research is not having the time/not
wanting to waste time.  That is just lazy and selfish.  Since you don't want
to waste your time looking, it is perfectly acceptable for everyone else to
waste time reading a question that's been posted 80 times in the last month,
and possibly waste more time typing up the same answer that has probably
been posted 80+ times.  How is your time more important or valuable than
everyone else's?

This is not a personal attack on the two posters quoted, just my feelings on
that general attitude.


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



RE: [PHP] setting function variables

2003-08-07 Thread Jennifer Goodie
 I am trying to specify a single php file to contain all the
 variables and I
 just call this file where necessary.  What I am running into is
 that I want
 to do this for all the built in functions (i.e. mssql_query) as
 well.  I've
 tried numerous attempts but can't get it to operate without wanting to run
 the functions or return an error.  Something like this:

 $runQuery = @mssql_query;
 $qryResults = @mssql_result;
 $getRow = @mssql_fetch_row;
 $getRowNums = @mssql_num_rows;

 I've tried using the %, $, ,'', and the @ symbol without any
 luck.  Anyone
 know of way to do this, so I can use a generic name for all the functions
 and be able to distribute it to those using either SQL Server or MySQL
 without them having to go through the code and manually change it?

 thanks

Have you looked into variable functions?
http://www.php.net/manual/en/functions.variable-functions.php


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



RE: [PHP] AOL Email client

2003-08-07 Thread Jennifer Goodie
 I am using php mail and setting all my $headers info to show From:, To:,

What does your call to mail() look like?  How are you formatting you
headers?



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



RE: [PHP] AOL Email client

2003-08-07 Thread Jennifer Goodie
 Here is what my header look like:

   $headers .= MIME-Version: 1.0\r\n;
   $headers .= Content-type:  text/plain;
 charset=us-ascii\r\n;
   $headers .= From: .$name. .$email.\r\n;
   $headers .= To: .$myname. .$toAddress.\r\n;
   $headers .= Reply-To: .$name. .$email.\r\n;
   $headers .= X-Priority: 1\r\n;
   $headers .= X-MSMail-Priority: High\r\n;
   $headers .= X-Mailer: Just My Server;


It appears to work fine in AOL 6.0 when I send from unix box using PHP 4.2.3
and sendmail, what version of AOL are you having problems with, what server
platform and PHP version are you using to send?  If you are using the php
mail function you must be passing To as the first parameter since it is not
optional, so why are putting it in your headers as well?  If I remember
correctly, RFC2822 states there should only be 1 to header.


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



RE: [PHP] Regular Expression

2003-08-04 Thread Jennifer Goodie
 Been working on this one for a while but can't get it working properly.
 I need a regular expression to match if address is

 1. PO Box
 2. P.O. Box
 3. P.O.Box

 I got it working with 1  2, but it's still not matching 3. Any
 suggestions?

 if(preg_match( /p[\.]o\.* +box/i, trim($_POST['address'])){
echo Address is P.O. BOX;
 }

You are using a + as the modifier on the space between p.o. and box.  +
means 1 or more.  Option 3 does not have a space.  Try using * which is 0 or
more, or ? which is 0 or 1.


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



RE: [PHP] Values from forms

2003-08-04 Thread Jennifer Goodie
 --- Beauford.2005 [EMAIL PROTECTED] wrote:
  FORM ACTION=teams-write.php action=post name=inputs

 You misspelled method. :-)

 Hope that helps.

 Chris

It seems like this exact same problem has been addressed before.
http://marc.theaimsgroup.com/?l=php-generalm=105900603231518w=2
http://marc.theaimsgroup.com/?l=php-generalm=105906453817129w=2

Having the action attribute in there twice will mess stuff up.  You might
want to check all of your forms since this seems to be a re-occurring
problem, it'll probably save you some time and frustration.



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



RE: [PHP] Escaping nasty quotes

2003-07-31 Thread Jennifer Goodie
 I have this:

 $query = LOAD DATA LOCAL INFILE '/home/data.txt' INTO TABLE
 mytable FIELDS
 TERMINATED BY ',' ENCLOSED BY ' . '' . ' ;
 $result = MYSQL_QUERY($query);
 PRINT br$query2br;

 The query doesn't take ... but if I cut and paste the printed
 response into
 the mysql server manually ... works like a charm

What error do you get from mysql_error()?  Are you uusing the same user in
both shell and script?  If not does the script user have the proper
permissions?


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



RE: [PHP] Re: include help please

2003-07-31 Thread Jennifer Goodie
 if (isset($page)) {
 include $$_GET['page'];
 } else {
 $page = $home;
 include $page;
 }

 would that be right?
 or should i use

 if (isset($page)) {
 include $$_GET['page'];
 } else {
 include $home;
 }

 hopefully that's right.  if so, pretty good for a n00b


I don't think I'd let someone pass any page they wanted via a get and just
include that page.

If you have URL fopen wrappers on I can create a page on my server and
include it to your page and pretty much execute any code I want on your
server.

example:

http://www.yourdomain.com?yourscript.php?page=http://mydomain.com/myscript.p
hp

Now my code is included in your page and executed.  Do you really trust me
to only have nice code in my page?


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



RE: [PHP] is there a way?

2003-07-31 Thread Jennifer Goodie
 Is there a way to have your html table represent one color,
 Cause when I click the link it turnes purple, and I want it to stay
 336699
 no matter what state.

 I tried to use css, but it does the whole page.
 And I want the 336699 to be in this table alone.

 Can anyone help me out with this small problem?

Create a class specifically for that table and it's links.

for example

.yourtable {font-family: Verdana, Arial, Helvetica, sans-serif;font-size:
8pt; color: #ff;}
A.yourtable:link { text-decoration: underline; font-weight: normal; color:
#336699;}
A.yourtable:visited { text-decoration: underline; font-weight: normal;
color: #336699;}
A.yourtable:hover { text-decoration: underline; font-weight: normal; color:
#336699;}
A.yourtable:active { text-decoration: underline; font-weight: normal; color:
#336699;}


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



RE: [PHP] Is there an easier way?

2003-07-31 Thread Jennifer Goodie
 if(!($rs = mysql_query($q))) // querying
   { echo Query failed. mysql_error(); exit; }
 
 
$n = 0;
   while ($line = mysql_fetch_assoc($rs)) { //dumping into an array
 foreach ($line as $field = $value) {
   $data[$field][$n] = $value;
 }
 $n++;
   }
 
 and this is how i use the arrays values (blah is the field name):
 $blah1=$data['blah'][0];
 $blah2=$data['blah'][1];
 $blah3=$data['blah'][2];

This should work.  Try it and see.
$n = 0;
   while ($line = mysql_fetch_assoc($rs)) { //dumping into an array
 foreach ($line as $field = $value) {
$tmp = $field.$n;
$$tmp = $value;
}
 $n++;
   }

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



RE: [PHP] Using link to submit a form

2003-07-30 Thread Jennifer Goodie
 Hi everyone,
 
 Can I replace Submit buttons on forms with a text button?
 I need to be able to click on a link:
 a href=index.php?option=editEdit/a
 
 and have it submit the form.  The form only contains one 
 field...does anyone
 know how to do this?  I've been searching google for an answer, 
 but couldn't
 find any info that really applies to my question.  


This was answered yesterday.

http://marc.theaimsgroup.com/?t=10516067212r=1w=2

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



RE: [PHP] Bizarre SQl, if issue....

2003-07-29 Thread Jennifer Goodie
 Actually, what you see is *exactly* the code being used. Nothing
 has changed
 about it.  And whether the variable is regarded as a string or a
 number, it
 gives me the same stupid issue.  Not recognizing it as a True
 statement. :\

 Is there any way possible that this could be the client's server?
  I had to
 beg to get 'em to recompile to 4.1.2 from 4.0.3.  There are using
 a version
 of Linux I don't recognize (it isn't redhat or mandrake), but it
 looks like
 their kernel is up to date.

 On my redhat server (with php 4.3.3), the same code responds
 properly (i.e.
 that $vthere ==0 is true).


Database set up is the same on both servers?  If they are using the same
remote database server, do both webservers have perms to select from the
database and table you are trying to use?


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



RE: [PHP] Weird Problem

2003-07-29 Thread Jennifer Goodie
 I have the following chunk of code:

   $sql = SELECT setting from settings where name='display_rows';
   include(connect.inc.php);
   print $sql;
   $row = mysql_fetch_row($result);
   $path = $row[0];
   print $path;

 It always prints out 1

 But if I run the code at the sql command prompt, it prints out 25,
 which is the correct value.

 Does anyone have any ideas why im having this problem??


Are you actually executing the query?  I don't see a mysql_query() anywhere
and it would be anti-intuituve to have that in your connection include.


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



RE: [PHP] Weird Problem

2003-07-29 Thread Jennifer Goodie
 The only setting contained in that table is the one im calling for,
 and its value is 25.


see what print_r($row) outputs, then you'll at least know what is in the
array.


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



RE: [PHP] MySQL query/PHP logic?

2003-07-29 Thread Jennifer Goodie
 select * from main
   left join fof on main.id = fof.id
   left join pub on main.id = pub.id
   left join gov on main.id = gov.id
   left join med on main.id = med.id
   left join ngo on main.id = ngo.id
   left join own on main.id = own.id
   left join sup on main.id = sup.id
[snip]
 BUT, although it seems to be joining the tables correctly AND only
 returning the ones with the correct date criteria, it does NOT return
 the id or the information_sent fields correctly ( due to duplication
 in the result )

 Can this be done in one query without sub-selects, or should it
 be broken up
 (in which case I would still need help with the logic and to minimize the
 amount of queries inside loops)


Instead of select * list out the fields you want to select and alias the
duplicates, for example

select fof.id as fof_id, pub.id as pub_id, gov.id as gov_id etc.

Then when you do you mysql_fetch_array the indexes will be the aliases you
gave the columns so nothing will get overwritten.


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



RE: [PHP] Include Problems

2003-07-24 Thread Jennifer Goodie
Without seeing what you have in your includes, it will be hard to determine
where your scope is messed up.

 ?php
  $subnav = home;
  include(incHeader.php);
 ?

 !--- CONTENT AREA ---

 The content would go here.

 !--- END CONTENT AREA ---

 ?php include (incFooter.php); ?

 Now, when I try to reference the subnav variable in the inHeader.php or
 incFooter.php files, it comes up blank.  I am basically trying to
 adjust the
 navigation on each page depending on the page I am on.  I am just learning
 PHP, have programmed in ColdFusion for years and in ColdFusion
 this was not
 a problem.  Any ideas?


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



RE: [PHP] File upload?

2003-07-24 Thread Jennifer Goodie
 $uploaddir = 'C:\Inetpub\wwwroot\pix';
 $filnamn=$_FILES['userfile']['name'];

 I thought of just adding a backslash at the very end of the $uploaddir
 variable but that just leaves me with this error-message instead:

 Parse error: parse error, unexpected T_STRING in
 c:\inetpub\wwwroot\alterdb\upload2.php on line 25

 Line 25 happens to be that $filnamn line you can see above.

 I'm at a loss as to what could be the problem so any suggestions
 to where to
 look?


Since a ' comes right after the \ it is escaping it.  Instead escape the \
so it is interpreted as \ and not the escape character.
$uploaddir = 'C:\Inetpub\wwwroot\pix\\';


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



RE: [PHP] newbY prob

2003-07-23 Thread Jennifer Goodie

 ! am trying to count the number of items in this table. The table
 has one field in it.

 The code I am using is:

 $dbquerymeal = select COUNT(*) from mealtype;
 $resultmeal = mysql_db_query($dbname,$dbqueryshipping1);
 if(mysql_error()!=){echo mysql_error();}
 $mealcount = mysql_fetch_row($resultmeal);
 echo $mealcount;

 The result I am getting is:

 Query was empty
 Warning: mysql_fetch_row(): supplied argument is not a valid
 MySQL result resource in search.php

 Any suggestions?

Where is  $dbqueryshipping1 set?  I see $bdquerymeal, but not
$dbqueryshipping1.


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



RE: [PHP] MySQL/PHP problem.

2003-07-22 Thread Jennifer Goodie
Off the top of my head, try using OR in your query rather than AND

 day=\2\ or day=\3\

day probably won't equal both 2 and 3, which is why you are getting 0.
Also, if you group by item name, you are going to get the total for each
itemname, is that what you want, or just the overall total?

 -Original Message-
 From: Phillip Blancher [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, July 22, 2003 2:09 PM
 To: PHP List
 Subject: [PHP] MySQL/PHP problem.


 I am trying to count in mySQL the number of entries in the field
 day where day=2 or 3.

 Then I want to check just to see if that returned a value greater
 than 0 or not.

 I am using the code below, but having a problem, I keep getting 0
 as the total

 What am i doing wrong.


$dbqueryshipping1 = select *, COUNT(day) from
 tempuserpurchase where day=\2\ and day=\3\ GROUP BY itemname;
 $resultshipping1 =
 mysql_db_query($dbname,$dbqueryshipping1);
 if(mysql_error()!=){echo mysql_error();}
$shipping1 = mysql_fetch_array($resultshipping1);



 Thanks in advance,

 Phil



 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.501 / Virus Database: 299 - Release Date: 7/14/2003



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



RE: [PHP] Javascript multi text box form validation?

2003-07-18 Thread Jennifer Goodie
 2. a sql_scrubber function to handle the apostrophes

addslashes() http://www.php.net/manual/en/function.addslashes.php

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



RE: [PHP] php - javascript together prob?

2003-07-09 Thread Jennifer Goodie
Since you had problems with quotes yesterday too, I would suggest reading
the manual page on strings so you do not continue to have the same problems
day after day.

http://www.php.net/manual/en/language.types.string.php


 -Original Message-
 From: Micah Montoy [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, July 09, 2003 2:51 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] php - javascript together prob?


 Anyone have an idea of how to get this to work?  Its the onClick part that
 wont work.  I know if I pull it out of PHP it works just fine but
 I need it
 part of the script as I have a loop that it runs under.

 echo (td width=50%a href='' onClick='javascript:window.open
 (v_images/dsp_img_viewer.php?$image_loc, imageView, height=350,width=450,
 toolbar=no, menubar=no, scrollbars=yes, resizable=yes,location=no,
 directories=no,status=no);');

 I considered and tried sending it to a js function but it doesn't like not
 having the  but I need the quotes in the echo statement to read in the
 variables passed to it.

 thanks


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



RE: [PHP] Returning values from functions

2003-07-09 Thread Jennifer Goodie
 function auth_user($logged_in) {
   if (isset($logged_in)) {
 list($s_username, $hash) = explode(',',$logged_in);
 global $secret_word;
 if (md5($s_username.$secret_word) == $hash) {
   $username = $s_username;
   return $username;
 } else {
   die (You have tampered with your session.);
 }
   } else {
 die (Sorry, you are not logged in.  Please log in and try again.);
   }
 }
 auth_user($_SESSION['login']);
 var_dump($username);

$username = auth_user($_SESSION['login']); will actually assign the returned
value to the variable $username.  The $username variable in your function
does not have global scope and only exist in the function.


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



RE: [PHP] preg_replace - understanding

2003-07-08 Thread Jennifer Goodie
 $filevalue = str_replace(\\, /, $filevalue);

 it is reversing the \\ to // but not replacing them with just a single
 /.

I think you need to escape your \ so each \ is \\ so your string should be




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



RE: [PHP] how to get the date of this Saturday all the time?

2003-06-24 Thread Jennifer Goodie
   We have a meeting at every Saturday,I'd like to post the
 news and write the date of this Saturday every week,how can I get
 the date of Saturday.


This has not been tested, there might be a bug.
?php
function get_sat_ts($timestamp){
$dow = date(w,$timestamp);
$days_to_add = 6 - $dow;
$ts_sat = mktime
(0,0,0,date(m,$timestamp),date(d,$timestamp)+$days_to_add,date(y,$time
stamp));
return ($ts_sat);
}
$ts = get_sat_ts(time());
echo date(Y-d-m,$ts);
?

Something like that should be what you want though.




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



RE: [PHP] Agh! Driving me crazy!

2003-06-18 Thread Jennifer Goodie
You are missing the closing ) around the values you are inserting.

 Anyone see anything wrong with this line of code?

 $fine = mysql_query(INSERT INTO
 tblPOItems(poID,poItemUPC,poItemNumber,poItemDescription,poItemInn
 erCasePkg,
 poInnerQuantity,poItemEstQuantity,poItemCostEach,poItemSuggestedSellPrice)
 values('$poID', '$place[0]', '$inmb', '$ides', '$iicp', '$cases',
 '$place[1]', '$iice', '$isgs');

 I keep getting:

 Query failed: You have an error in your SQL syntax near '' at line 1 Query
 was: 1064 exiting.



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



RE: [PHP] Quickie array question

2003-06-11 Thread Jennifer Goodie

 foreach($newlines as $newline) {

 #how do I get the index of the array each time $newline is printed out?

 echo ??;
 }

foreach($newlines as $id=$newline){
echo $id.''.$newline;
}

read the documentation
http://us3.php.net/manual/en/control-structures.foreach.php


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



RE: [PHP] Headers in body - what am I doing wrong???

2003-06-11 Thread Jennifer Goodie

// pull fields from form query
$to = [EMAIL PROTECTED];
$name = $HTTP_POST_VARS['name'];
$address = $HTTP_POST_VARS['address'];
$listname = $HTTP_POST_VARS['listname'];
$action = strtoupper($HTTP_POST_VARS['action']);

// build headers
$from = \$name\ $address\r\n;
$message = $action. .$listname. .$name.\r\n;
$message .= EXIT\r\n;

$headers = MIME-Version: 1.0\r\n;
$headers .= Content-type: text/plain; charset=iso-8859-1\r\n;
$headers .= From: .$from.\r\n;
$headers .= Reply-to: .$from.\r\n;


You have an extra \r\n.  There is one contained in the variable $from so the
line $headers .= From: .$from.\r\n; is putting \r\n\r\n which signifies
the end of the headers and the begining of the message body.


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



RE: [PHP] Headers in body - what am I doing wrong???

2003-06-11 Thread Jennifer Goodie

 PS some mailservers do not like \r\n, check the manual on mail() and see
 what they suggest, i think it was just \n.

RFC for SMTP states that CRLF (\r\n) should be used.  A lot of mail servers
will accept just \n, but it is best to try and be standards compliant, you
have less potential for problems when changing server set-ups.


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



RE: [PHP] Re: Warning Spammer

2003-06-10 Thread Jennifer Goodie
 so do they get the emails from the archive ? ?if so password protect
 please !!

Which one?  This list is archived on numerous sites. 

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



RE: [PHP] Heredoc question

2003-06-06 Thread Jennifer Goodie
 Can one use ?php ? within the heredoc syntax or is there
 another way?? I'm trying to dynamically generate email from
 generic text but with obvious additions, like this:

http://us4.php.net/types.string says that heredoc acts just like double
quoted, which would mean it expands variables, so I would try just throwing
them in there like this...


 $message = my_message
 Name: {$lot-get_name()}

 Lot {$lot-get_id()} has been approved. Here is the
 link to the lot:
 my_message;


There's an example of almost exactly like this on that page.







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



RE: [PHP] Heredoc question

2003-06-06 Thread Jennifer Goodie
 That's fine for that but I have several places that use if's and else's...

 Sparky
  http://us4.php.net/types.string says that heredoc acts just like double
  quoted, which would mean it expands variables, so I would try just

Than I would suggest reading the manual page (the link I gave) to see if you
can do that.  Would you put an if or an else inside a double quoted string
and expect it to work?  I wouldn't.  Maybe I'm wrong though.  Read the
manual.


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



RE: [PHP] [FYI] phpbooks.com

2003-06-06 Thread Jennifer Goodie
 I mean if someone is into programming/php they will have enough
 brains (most of the time) to do that much right?

By that logic they'd also have enough brains to look at the documentation
before asking questions on the mailing list, or to not reply to spam on the
list, etc., etc. and we all know that isn't true.


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



RE: [PHP] insert loop logic

2003-06-05 Thread Jennifer Goodie
 When i get these values I want to enter them into the database but
 1)I should enter only the first 5 (and ignore the rest) into the database
 2)it has to enter 1 record for every every id picked
 eg:
 if id[1], id[2],id[3] and id[4] were picked it should enter this as 4
 differient records


 How do i do this? I have tried using a for loop but somewhere the logic is
 very very bad :-) and so i deleted the whole damn thing.

?php
$count = 0;
if (is_array($id)){
while( (list(,$val) = each($id))  $count  5){
$count++;
$query = INSERT INTO table () VALUES ('$val');
mysql_query($query);
}
}
?

Obviously the query is not all there and needs fleshing out, I don't know
what all you are inserting.  I didn't really test, so it might have a bug or
something.


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



RE: [PHP] What's wrong with this code??

2003-05-31 Thread Jennifer Goodie


  Problem lines

 if ($mo == 06 and $dy  01 and $dy  09) { $wd = 8; }
 if ($mo == 06 and $dy  08) { $wd = 9; }

but if I change my date to 06/02 then no matter what I
 try, $wd always gets the value of 9 (it should be 8 on this
 date). It should
 not get the value 9 until the 9th of June.

If the first if is true, so is the second, unless $dy == 8. In this case,
the number is 2, which is greater than 1 and less than both 8 and 9, making
both statements true.

Check your logic.


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



RE: [PHP] Code Help Please

2003-05-31 Thread Jennifer Goodie
 I need to find if table1.username = table2.domain/table2.username  is

If you are using mySQL you can use CONCAT

table1.username = CONCAT(table2.domain,'/',table2.username)

http://www.mysql.com/doc/en/String_functions.html#IDX1174 
 

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



RE: [PHP] Quick Sessions ?

2003-04-04 Thread Jennifer Goodie
Your cookie path is  not / so your cookie is only readble by the
directory it was set in.  Check your session.cookie_path

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

 -Original Message-
 From: Anthony [mailto:[EMAIL PROTECTED]
 Sent: Friday, April 04, 2003 12:03 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Quick Sessions ?


 I have an issue.  For some reason I can't pass session data to
 pages within
 different folders.  What I have is a page in like
 mydomain.com/something/somepage.php  This page creates session information
 and holds it correctly.  The app collects user data and then
 eventualy sends
 a location header to ../index.html - in this file there is php that check
 to see if the session data is there and. no longer there!!!  So what
 gives?  Can I not pass session info from pages in folders?  I'm
 not changing
 the domain, so I shouldn't loose the cookie I'm lost   Please help
 me out :)

 - Anthony



 --
 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] Includes confusion

2003-04-04 Thread Jennifer Goodie
PHP parses includes inline, so whatever the scope is where the file is
included, is the scope of the variables that the include contains.  You can
declare the variables global in your fuction and it will use what was
included, that would be the quick fix, you could also switch your include to
use DEFINE instead of just instantiating variables. Constants have global
scope.

 -Original Message-
 From: Mike Tuller [mailto:[EMAIL PROTECTED]
 Sent: Friday, April 04, 2003 12:25 PM
 To: php mailing list list
 Subject: [PHP] Includes confusion


 I can't figure this out. I have a line where I include a file

 include /Library/WebServer/includes/database_connection.inc;

 I want to have this declared in one location, so that I don't have to
 change multiple lines if I ever move the application, everything works
 fine except inside functions. So if I have the following:

 include /Library/WebServer/includes/database_connection.inc;

 function list_search_results()
 {
   // my code that lists search results
 }

 The functions returns an error, but if I do this:


 function list_search_results()
 {
   include /Library/WebServer/includes/database_connection.inc;
   // my code that lists search results
 }

 Everything works fine. Shouldn't the function be able to use the
 include file when it is declared outside the function?

 Mike


 --
 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] Quick Sessions ?

2003-04-04 Thread Jennifer Goodie
You want it to be / so they are readable by the entire site.  From your
syptoms a bad path seemed to be the problem, but it looks like it is
something else.

 -Original Message-
 From: Anthony [mailto:[EMAIL PROTECTED]
 Sent: Friday, April 04, 2003 12:37 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] Quick Sessions ?


 Thanks for the response.  I think I might just not totaly understand this
 switch. This is right out of my php.ini file:

 ; The path for which the cookie is valid.
 session.cookie_path = /

 I tried deleting the / and got no change in behavior. It seems to me that
 what I need is something like
 session.cookie_path = /, ../
 but that doesn't work.  Any other ideas?

 - Anthony

 Jennifer Goodie [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  Your cookie path is  not / so your cookie is only readble by the
  directory it was set in.  Check your session.cookie_path
 
  http://www.php.net/manual/en/ref.session.php
 
   -Original Message-
   From: Anthony [mailto:[EMAIL PROTECTED]
   Sent: Friday, April 04, 2003 12:03 PM
   To: [EMAIL PROTECTED]
   Subject: [PHP] Quick Sessions ?
  
  
   I have an issue.  For some reason I can't pass session data to
   pages within
   different folders.  What I have is a page in like
   mydomain.com/something/somepage.php  This page creates session
 information
   and holds it correctly.  The app collects user data and then
   eventualy sends
   a location header to ../index.html - in this file there is php that
 check
   to see if the session data is there and. no longer
 there!!!  So what
   gives?  Can I not pass session info from pages in folders?  I'm
   not changing
   the domain, so I shouldn't loose the cookie I'm lost   Please
 help
   me out :)
  
   - Anthony
  
  
  
   --
   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] dynamic IF statement

2003-04-04 Thread Jennifer Goodie
HTTP_GET_VARS[id] is probably empty so this won't work, stick a $ in front
of it.

 -Original Message-
 From: Leif K-Brooks [mailto:[EMAIL PROTECTED]
 Sent: Friday, April 04, 2003 12:38 PM
 To: Tim Haskins
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP] dynamic IF statement


 If I understand you right, you want:

 if (HTTP_GET_VARS[id] == $row_rsProducts['prID']){
 ...do stuff...
 }


 Tim Haskins wrote:

 How does one create a statement that basically says:
 
 ?php if (HTTP_GET_VARS[id] == ?php echo
 $row_rsProducts['prID']; ?  )
 { ?
 
 Basically, I want to say, show if url value is equal to this database
 record's ID value - The last part is what I can't seem to get to
 work- any
 ideas???


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



RE: [PHP] no worky :|

2003-04-03 Thread Jennifer Goodie
Have you checked to make sure your query works, the syntax looks really odd.
I've never seen INSERT ... WHERE

 -Original Message-
 From: Sebastian [mailto:[EMAIL PROTECTED]
 Sent: Thursday, April 03, 2003 2:20 PM
 To: php list
 Subject: [PHP] no worky :|


 Hello,

 This form is really giving me a fight.

 I am connected to the database, yet it won't submit, Is the form and
 $_POST's Okay?

 echo 
  form name=\sendform\ action=\report.php\ method=\post\
  reason: br
   textarea name=\reason\ cols=\50\ rows=\3\/textarea
   br/br/
  input type=\submit\ name=\report\ value=\mark for moderation\
  /form;

 if($_POST[reason]) {
  $result = $db-sql(INSERT INTO comments (reported, reportedby, reason)
 VALUES ('1', '$username', '$_POST[reason]') WHERE id = '$id');

   if($result) {
echo centermessage sent to moderators.br/a
 href=\$_SERVER[HTTP_REFERER]\return to your previous
 page/a./center;

}
 }


 cheers,
 - Sebastian





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



RE: [PHP] no worky :|

2003-04-03 Thread Jennifer Goodie
Since you are using a database abstraction layer, I do not know what type of
database you are using, but if your object has debugging, why don't you turn
it on and see if the database is throwing up an error.  If it does not have
debugging, I would suggest printing out the query instead of trying to run
it, so you can see what is wrong with it.

 -Original Message-
 From: Sebastian [mailto:[EMAIL PROTECTED]
 Sent: Thursday, April 03, 2003 2:33 PM
 To: Jennifer Goodie; php list
 Subject: Re: [PHP] no worky :|


 thanks for pointing that out yeah, you're right it was wrong,
 should be
 UPDATE news_comments SET  WHERE ...

 since there was already a row.

 ... still can't get it to post to the database though.

 cheers,
 - Sebastian


 - Original Message -
 From: Jennifer Goodie [EMAIL PROTECTED]


 | Have you checked to make sure your query works, the syntax looks really
 odd.
 | I've never seen INSERT ... WHERE
 |
 |  -Original Message-
 |  From: Sebastian [mailto:[EMAIL PROTECTED]
 |  Sent: Thursday, April 03, 2003 2:20 PM
 |  To: php list
 |  Subject: [PHP] no worky :|
 | 
 | 
 |  Hello,
 | 
 |  This form is really giving me a fight.
 | 
 |  I am connected to the database, yet it won't submit, Is the form and
 |  $_POST's Okay?
 | 
 |  echo 
 |   form name=\sendform\ action=\report.php\ method=\post\
 |   reason: br
 |textarea name=\reason\ cols=\50\ rows=\3\/textarea
 |br/br/
 |   input type=\submit\ name=\report\ value=\mark for
 moderation\
 |   /form;
 | 
 |  if($_POST[reason]) {
 |   $result = $db-sql(INSERT INTO comments (reported,
 reportedby, reason)
 |  VALUES ('1', '$username', '$_POST[reason]') WHERE id = '$id');
 | 
 |if($result) {
 | echo centermessage sent to moderators.br/a
 |  href=\$_SERVER[HTTP_REFERER]\return to your previous
 |  page/a./center;
 | 
 | }
 |  }
 | 
 | 
 |  cheers,
 |  - Sebastian
 | 
 | 
 | 
 |



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



RE: [PHP] Which PHP version is stable with apache 2.0.39

2003-04-03 Thread Jennifer Goodie
http://www.php.net/manual/en/install.apache2.php



 -Original Message-
 From: Jason Smith [mailto:[EMAIL PROTECTED]
 Sent: Thursday, April 03, 2003 5:22 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Which PHP version is stable with apache 2.0.39
 
 
 Hi,
  
 Need some information as I cant seem to find it in the manual or online.
  
 We are running apache 2.0.39 on redhat 7.3 and would like to run PHP on
 the same server.
 I am having trouble finding out if there is a stable version that runs
 with Apache 2.0.39
  
 Any help appreciated
  
 Cheers
 jason
 

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



RE: [PHP] Making it so the .php isn't needed

2003-04-02 Thread Jennifer Goodie
You can accomplish this by enabling multiviews in your httpd.conf

 -Original Message-
 From: Teren Sapp [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, April 02, 2003 3:18 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Making it so the .php isn't needed
 
 
 Hi, I had it setup on my server before i reloaded it, but what i 
 need to have happen is so that when i'm passing variables to a 
 php file, I don't have to include the .php in the link...so i can have 
 
 http://www.my-domain.com/page1?var1=3var2=4
 instead of 
 http://www.my-domain.com/page1.php?var1=3var2=4
 
 Anybody know how i can make this work? THanks
 
 Teren
 
 

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



RE: [PHP] Command line php

2003-04-01 Thread Jennifer Goodie
Try sending a control d to signify EOF, because fread will only read to end
of file.  But I wouldn't do 255 because you might want to enter more.  Maybe
stick a while !EOF in there.

 -Original Message-
 From: John Nichel [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, April 01, 2003 6:01 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] Command line php


 I did that orginally, but it waits for me to enter 255 characters before
 closing the freadno matter how many times I hit enter.

  Benny Pedersen wrote:
 
  On Wednesday 02 April 2003 03:17, John Nichel wrote:
 
  if I do a...
  $name = fread ( STDIN, sizeof ( STDIN ) );
 
 
 
   $name = fread ( STDIN, 255 );
 
  tryit :)
 
 
 
 



 --
 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 there a PHP for Dummies?

2003-03-31 Thread Jennifer Goodie
I tend to get more out of the users comments than the actual manual..

It is possible that is because you don't want to put the time into figuring
things out for yourself.  It's a lot easier to post a ton of RTFM questions
than to actually read the manual or research your question.  I seem to
recall you having the same problem with the MySQL documentation.

-Original Message-
From: Beauford.2002 [mailto:[EMAIL PROTECTED]
Sent: Friday, March 28, 2003 6:52 PM
To: Leif K-Brooks
Cc: PHP General
Subject: Re: [PHP] Is there a PHP for Dummies?


I found that after the fact, but my question was regarding tutorials, books,
or other docs. This was just an example I used. In general I don't find the
PHP manual very helpful - I tend to get more out of the users comments than
the actual manual..

- Original Message -
From: Leif K-Brooks [EMAIL PROTECTED]
To: Beauford.2002 [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Friday, March 28, 2003 9:49 PM
Subject: Re: [PHP] Is there a PHP for Dummies?


 After a quick search of the php manual, I came upon
 http://www.php.net/manual/en/ref.info.php#ini.magic-quotes-gpc, which
says:

 Sets the magic_quotes state for GPC (Get/Post/Cookie) operations. When
 magic_quotes are on, all ' (single-quote),  (double quote), \
 (backslash) and NUL's are escaped with a backslash automatically.

 Seems to explain it pretty nicely.

 Beauford.2002 wrote:

 No,  the name explains absolutely squat. What is a magic quote? Sounds
like
 something I smoked in the 60's. Maybe to you it makes sense as you know
what
 it does. To me it means absolutely nothing - nor does the PHP manual
explain
 it.
 
 B.
 
 
 - Original Message -
 From: Jennifer Goodie [EMAIL PROTECTED]
 To: Beauford.2002 [EMAIL PROTECTED]; PHP General
 [EMAIL PROTECTED]
 Sent: Friday, March 28, 2003 5:07 PM
 Subject: RE: [PHP] Is there a PHP for Dummies?
 
 
 
 
 That is a really, really, really poor example.  Tha name says it all.
It
 gets the magic quotes setting for gpc(get, post, cookie).  You can
figure
 out what most PHP functions do just by looking at their names, that's
 actually what I like about PHP.
 
 -Original Message-
 From: Beauford.2002 [mailto:[EMAIL PROTECTED]
 Sent: Friday, March 28, 2003 1:54 PM
 To: PHP General
 Subject: [PHP] Is there a PHP for Dummies?
 
 
 I'm really tired of trying to figure out the PHP manual and need
something
 that explains things in plain straight forward English. Like
 get_magic_quotes_gpc() for example - the manual says how to use it and
 
 
 what
 
 
 it returns - but nowhere can I find out what it's for. Does it count
 
 
 sheep,
 
 
 do a quote of the day, or what - maybe I'm just stupid - but in any
event
 
 
 I
 
 
 have spent more time in the last two weeks searching for things and
 
 
 getting
 
 
 no answers - Any help in pointing me a good straight forward
 
 
 tutorial/manual
 
 
 would be appreciated.
 
 B.
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 
 
 
 
 
 

 --
 The above message is encrypted with double rot13 encoding.  Any
unauthorized attempt to decrypt it will be prosecuted to the full extent of
the law.






--
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] require/include from a different directory

2003-03-31 Thread Jennifer Goodie
If the includes are within the website, using
$_SERVER[DOCUMENT_ROOT]/pathtofile/file is a good way to go.

-Original Message-
From: John W. Holmes [mailto:[EMAIL PROTECTED]
Sent: Saturday, March 29, 2003 2:10 PM
To: 'Greg Macek'; [EMAIL PROTECTED]
Subject: RE: [PHP] require/include from a different directory


  try using an absolute path.

 I've considered that route, but an issue I have with that is I do most
 of my development work on a machine that a different directory
structure
 than the production server (currently a Cobalt RaQ4), so the paths are
 different. Accommodating both would be a time consuming project for
me.

I always put it into a variable.

$_CONF['path'] = '/home/web/www/';

and then use that variable in all of your includes or requires. I also
make an HTML variable that's used in all links and images.

$_CONF['html'] = 'http://www.mysite.com/';

Sure, you have to get used to using this variable everywhere, but it
makes switching server pretty easy.

---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



RE: [PHP] if statment

2003-03-31 Thread Jennifer Goodie

if( $HTTP_GET_VARS[pr_ID] == nothing){
echo there are no products;
}
http://www.php.net/manual/en/control-structures.php

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

-Original Message-
From: Tim Haskins [mailto:[EMAIL PROTECTED]
Sent: Monday, March 31, 2003 11:56 AM
To: [EMAIL PROTECTED]
Subject: [PHP] if statment


I'm used to asp and not php, but what would the code be for and if statement
that was like:

 if $HTTP_GET_VARS[pr_ID] = nothing then
there are no products
end if

Also does anyone know a great resource that lists different examples of php
variables, if statements, and so on?

Thanks so much!
--
Tim Haskins




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



RE: [PHP] if statment

2003-03-31 Thread Jennifer Goodie
so change it to 

-Original Message-
From: Tim Haskins [mailto:[EMAIL PROTECTED]
Sent: Monday, March 31, 2003 12:12 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] if statment


My bad, I actually meant that the nothing was like, if the pr_ID in the
url is empty then show the following text.

--
Tim Haskins

Jennifer Goodie [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

 if( $HTTP_GET_VARS[pr_ID] == nothing){
 echo there are no products;
 }
 http://www.php.net/manual/en/control-structures.php

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

 -Original Message-
 From: Tim Haskins [mailto:[EMAIL PROTECTED]
 Sent: Monday, March 31, 2003 11:56 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] if statment


 I'm used to asp and not php, but what would the code be for and if
statement
 that was like:

  if $HTTP_GET_VARS[pr_ID] = nothing then
 there are no products
 end if

 Also does anyone know a great resource that lists different examples of
php
 variables, if statements, and so on?

 Thanks so much!
 --
 Tim Haskins






-- 
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



  1   2   >