[PHP] How to print nice looking text on an image?

2003-11-18 Thread Kevin Stone
Hello,
 
I am producing a script that writes text onto a JPEG image to create
custom printable gift certificates for an online store.  The basics of
the scripts are straight forward.  However I found that the
imagestring() function produces absolutely horrible looking pixelized
text and on these gift certificates looks are important.  I attempted to
employ the imagepstext() family of functions but they do not appear to
be installed on this account (it's a shared server), I'm getting call
to undefined function errors.
 
So my question is; Is there any other way to produce good looking
anti-aliased text on an image?  I'd appreciate any information, classes
and links to guides you can point me to.
 
Thanks!
Kevin Stone
[EMAIL PROTECTED]
 


RE: [PHP] preg question

2003-11-13 Thread Kevin Stone
The period is a modifier within the expression (see manual on pattern
syntax link below).  You need to escape it with a back slash:

\.

http://www.php.net/manual/en/pcre.pattern.syntax.php

--
Kevin


-Original Message-
From: Jake McHenry [mailto:[EMAIL PROTECTED] 
Sent: Thursday, November 13, 2003 12:50 PM
To: [EMAIL PROTECTED]
Subject: [PHP] preg question

Hi all,

I am trying to do a simple validation of an email address being
submitted. I have the @ sign being validated, but I can't get the
period to work.. Can someone help me out?

Here's my code..

if ($_POST['Travel_Request_Email_Address'] != )
{
  if (preg_match_all(/(@)/,
$_POST['Travel_Request_Email_Address'], $match) != 1)
  {
$errorcount++;
$error = $error . nbsp;nbsp;nbsp;nbsp; . $errorcount .)
font color=\red\Email Address/font field does not contain @br
\n;
  }
  else if (preg_match_all(/(.)/,
$_POST['Travel_Request_Email_Address'], $match)  1)
  {
$errorcount++;
$error = $error . nbsp;nbsp;nbsp;nbsp; . $errorcount .)
font color=\red\Email Address/font field does not contain .br
\n;
  }
  else
  {
$_SESSION['Travel_Request_Email_Address'] =
$_POST['Travel_Request_Email_Address'];
  }
}
else
{
  $errorcount++;
  $error = $error . nbsp;nbsp;nbsp;nbsp; . $errorcount .)
font color=\red\Email Address/font field is emptybr\n;
}

Thanks,

Jake McHenry
Nittany Travel MIS Coordinator
http://www.nittanytravel.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] removing all duplicate values from an array

2003-10-30 Thread Kevin Stone
Or... you could use array_count_values() and loop through the array it
produces to find out how many of each duplicate value exists in the
original array.

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

Kevin


-Original Message-
From: Allowee [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 30, 2003 10:28 AM
To: [EMAIL PROTECTED]
Subject: [PHP] removing all duplicate values from an array

Hi,

I'm looking for a function that does almost the same as array_unique()

But it must also delete the other duplicate entry.

sample to explain:

array(
'a' = 'one',
'b' = 'one',
'c' = 'zero',
'd' = 'two'
);

I now want the result to be:

array(
'c' = 'zero',
'd' = 'two'
);

This way I will be able to do an array_diff and then see all the
duplicate 
entries listed.

this is to find dup. ip address for a hosting system, displaying both
accounts will make it easy to trace the amount of accounts 1 
ip curruntly has.


Anybody know how to do this?

Thanks,
Allowee

-- 
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] Re: Random Quotes...

2003-10-22 Thread Kevin Stone

Payne [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]
 Hi,
 
 I am working on a project and I need to see sample quote for doing 
 random quotes. These quotes will be put from a database. Can some please 
 share me some sample code. Thanks.
 
 Chuck

For more solutions go to, http://groups.google.com
and type in, select random row mysql

- Kevin


[PHP] a href=website-dictionary.html#vanitysiteVanity Sites/a

2003-10-17 Thread Kevin Stone



[PHP] Re: header() refresh vs location

2003-10-14 Thread Kevin Stone
The Refresh directive is a valid header.  I've used it for many years and it seems to 
be supported by the majority of browsers.  However I've never read anything that would 
indicate that Refresh works any differently than Location.  The only difference is 
that Refresh allows you to set a number of seconds before redirecting to the given 
URL.  As to whether or not it will solve your problem is something only you can answer.

- Kevin

Chris Hubbard [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]
 All,
 I have done a number of searches.
 I have read the online documentation and user supplied comments.
 
 I recently ran into problem using:
 
 -some code here to create session and set variables-
 header('Location: index.php');
 
 where the sessions would sometimes get lost, they wouldn't make it to the
 index.php page.  A print_r on $_SESSION would display an empty array.  And
 yes the sessions are getting set properly.  The same code works on three
 different servers, with no modifications.
 
 So a friend recommended using:
 header (Refresh: 0; url=index.php);
 
 I haven't seen documentation for refresh in the header function.  Is there
 any reason to use one in lieu of the other?  Any comments on 'refresh'?
 
 As I said, I've looked at the online documentation:
 this page: http://us4.php.net/manual/en/function.header.php doesn't have the
 word refresh on it.
 this page: http://www.w3.org/Protocols/rfc2616/rfc2616 doesn't have the word
 refresh on it.
 this page: http://us4.php.net/manual/en/function.headers-sent.php does have
 the word refresh but it's not relevant.
 
 Thanks in advance.
 
 Chris Hubbard
 [EMAIL PROTECTED]
 www.wildcharacters.com
 425 481 2020
 
 php based web application development
 
 Y! [EMAIL PROTECTED]
 MSN [EMAIL PROTECTED]
 AIM ganeshacph


[PHP] Re: header() function for displaying an opened PDF document.

2003-10-13 Thread Kevin Stone
Forget the content length and disposition headers.  Just set the content type then 
output the file..

header(Content-type: application/pdf);
readfile(junk.pdf);

- Kevin

Scott Fletcher [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]
 I seem to be having problem with sending the PDF document to the browser to
 be open on screen.  I kept getting the error message, it say 'Windows cannot
 open this file'.  Here's my sample script, so what am I doing wrong?...
 
 --snip--
 header(Content-Type: application/pdf);
 header(Content-Length: '40736');
 header(Content-Disposition: inline; filename='junk.pdf');
 --snip--
 
 Thanks,
  Scott F.


[PHP] Re: header() function for displaying an opened PDF document.

2003-10-13 Thread Kevin Stone
I'm sorry but it can't be done.  You cannot output a file without printing it to the 
output buffer.  You cannot print a file to the output buffer without opening the file 
into memory.  You cannot open a file into memory without using a function like fopen() 
or readfile().  It's as simple as that.

There must be something wrong with Internet Explorer on your end.  Corrupt files 
perhaps?  Try installing the latest update, or use system restore to go back a few 
weeks, or reinstall the components from the Windows CD.  That's my best advice.  But I 
guarentee this is not a PHP problem and that there is no work around for it other than 
to fix what's wrong on your system.  Good luck.

Once everything is working you will see the PDF open in the browser plugin when you 
set the Content-type header.  And you should see a download prompt when you set the 
Content-disposition header.

- Kevin

Scott Fletcher [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]
 I can't do readfile() because of lots of bug in IE (Internet Explorer)
 
 Kevin Stone [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  Forget the content length and disposition headers.  Just set the content
 type then output the file..
 
  header(Content-type: application/pdf);
  readfile(junk.pdf);
 
  - Kevin
 
  Scott Fletcher [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
   I seem to be having problem with sending the PDF document to the browser
 to
   be open on screen.  I kept getting the error message, it say 'Windows
 cannot
   open this file'.  Here's my sample script, so what am I doing wrong?...
  
   --snip--
   header(Content-Type: application/pdf);
   header(Content-Length: '40736');
   header(Content-Disposition: inline; filename='junk.pdf');
   --snip--
  
   Thanks,
Scott F.
 


[PHP] Re: Display a JPG Image

2003-10-10 Thread Kevin Stone
Delete the line with header(Content-disposition:  ... ).  Just set the content type 
and output the file.
-Kevin


Pushpinder Singh Garcha [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]
Hello Everyone,

   I am trying to display a JPG image to a use, who has logged in. Some 
research on google revealed a way to do this. I am using the following 
code to display it.

if (session_is_registered(valid_user)){

if(session_is_registered(cmi)){

header(Content-type: image/jpg);
$file = docs/picture1.jpg;
   header(Content-disposition: attachment; filename=$file );
readfile($file);

 } 

My question is that while this approach works fine with Mozilla on the 
MAC and Win platform. it throws up a dialog box asking whether the user 
wants to download  the file or view it. However IE on either platforms 
does not work fine. On the PC it does not recognize the file extension 
correctly. While on the MAC side of things, it just shows the image in 
the same frame.

Any suggestions would be most welcome. !

Thanks in advance
Pushpinder Singh




[PHP] Re: Check for page change efficiently [was Re: Creating a blogrolling/link management system]

2003-10-08 Thread Kevin Stone

Chris [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]
 [EMAIL PROTECTED] (Paul Van Schayck) wrote in
 news:[EMAIL PROTECTED]: 
 
   First of all you need to check with the website you are going to check
  if they really enjoy all bandwith required. And people will not see
  their banners anymore.
 
 I'm not sure I understand-- I want to check to see if their page has 
 changed once each day and, if so, I will highlight that link in my list... 
 I doubt most web sites would have a problem with one hit per day :)
 
 I am not scraping and redisplaying content...
 
 My question boils down to the most efficient method to detect whether a 
 page has been modified recently...

Chris,

This is just a thought.. I have never employed this method personally.. but I suppose 
you could read the page into a string and use the md5() function to generate a 
hexidecimal value based on that string.  Store the hex value in a database and compare 
it against the new value generated the next day.  If anything on the page has been 
modified the values should not match.  Even the most minute change should trigger a 
new value.  Obviously you won't know *what* has been modified only that the page *has* 
been modified

There are some pitfalls to keep in mind such as if the page contains dynamic content, 
if there is a server error, or if the page has been removed.  Thanks to Network 
Solutions evil Sitefinder you may find it difficult if not impossible to predict what 
will be read by your script if the page goes missing.  But this will all show up in 
the hex value and you won't know if the page is still relevant until you personally 
visit the links.

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

Good luck,
Kevin


[PHP] Re: Check for page change efficiently [was Re: Creating a blogrolling/link management system]

2003-10-08 Thread Kevin Stone

Paul Van Schayck [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]
 [EMAIL PROTECTED] (Kevin Stone) wrote
 Hello Kevin.
 
  This is just a thought.. I have never employed this method
  personally.. but I suppose you could read the page into a string and
  use the md5() function to generate a hexidecimal value based on that
  string.  Store the hex value in a database and compare it against the
  new value generated the next day.  If anything on the page has been
  modified the values should not match.  Even the most minute change
  should trigger a new value.  Obviously you won't know *what* has been
  modified only that the page *has* been modified 
 
  There are some pitfalls to keep in mind such as if the page contains
  dynamic content, if there is a server error, or if the page has been
  removed.  Thanks to Network Solutions evil Sitefinder you may find it
  difficult if not impossible to predict what will be read by your
  script if the page goes missing.  But this will all show up in the hex
  value and you won't know if the page is still relevant until you
  personally visit the links. 
 
 Too much pittfals and too slow! Really the socket connection only 
 retreiving the headers is really the best way. 
 
 This function is what you need:
 
 function fileStamp($domain, $file)
 {
 $file = / . $file;
 $fp = fsockopen ($domain, 80, $errno, $errstr, 30);
 $header = HEAD $file HTTP/1.0\r\nHost: $domain\r\n\r\n;
 if (!$fp){
echo $errstr ($errno);
return false;
 }
 fputs ($fp, $header);
 while (!feof($fp)) {
$output .= fgets ($fp,128);
 }
 fclose ($fp);
 $begin = strpos($output, Last-Modified: ) + 15;
 if($begin==15) //no last-modified (like yahoo.com)
return false;
 $end = strpos($output, \n, $begin);
 $time = substr($output, $begin, $end-$begin-1);
 return strtotime($time);
 } 
 
 Polleke

Slow?  Hogwash.  You're pining over microseconds.  Besides most of the time is taken 
opening the file which you're doing anyway.  Except that the socket method relies on 
header information that may or may not be there.  I agree it would be ideal if you 
could use that information but your fileStamp() function isn't going to work for all 
files on all servers.

- Kevin


Re: [PHP] Read a PDF File using php

2003-10-01 Thread Kevin Stone
?
header(Content-type: application/pdf);
header(Content-disposition: attachment; filename=filename.pdf );
readfile(filename.pdf);
?

Launching this script will prompt a file download screen if the Acrobat Reader Plugin 
is not available on the client browser.  Otherwise it will display inside the browser 
window using the plugin.

Hope that helps.

- Kevin


Pushpinder Singh Garcha [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]
 No I am not sending any headers to the browser. Any suggestions !
 
 Thanks
 
 On Wednesday, October 1, 2003, at 04:05 PM, Tyler Lane wrote:
 
 
  Are you sending a Content-Type header to the browser to let it know 
  what
  type of file you are sending it?


[PHP] Re: Sort an array of objects

2003-10-01 Thread Kevin Stone

Matt Palermo [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]
 I have an array of object for files on my site.  The objects hold a file's
 name, size, extension, etc...  I was wondering if anyone knows where I could
 find a relatively easy function for sorting the array of these objects by
 either name, size, etc...  Please let me know if got any tips.  Thanks a
 lot!
 
 Matt

Off the top of my head..

?
$object_array = array(
array(
'name' = 'Kevin',
'company' = 'IBM'),
array(
'name' = 'Steve',
'company' = 'Apple'),
array(
'name' = 'Bill',
'company' = 'Solaris')
);

// Store names by group index..
foreach($object_array as $i = $a) {
$sorted_array[$i] = $a['name'];
}

// Sort names and keep associated indicies..
asort($sorted_array);

// Store original groups on sorted indicies..
foreach($sorted_array as $i = $v) {
$sorted_object_array[$i] = $object_array[$i];
}

echo pre;
print_r($sorted_object_array);
?

Badda bing.

- Kevin


[PHP] Re: Central authentication for multiple sites

2003-09-29 Thread Kevin Stone
If all domains have access to the same database then there is absolutely nothing 
preventing you from using a Cookie.  Have a normal login on Domain1.com.  Once 
authenticated produce a random ID and store it in the database.  Store the ID in a 
cookie then Redirect the client to the desired domain.  The page the client is 
redirected to checks to see if the ID matches one stored in the database.  If it does 
then the user is valid.  A logout request on any one of the domains destroys the ID in 
the database and erases the cookie.  Associate a timestamp with the ID in the database 
so that you can make the login invalid after a period of no activity.

- Kevin


Fraser Campbell [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]
 Hi,
 
 Does anyone know of a way to authenticate a person on one site and have that 
 authentication carried through to multiple sites?
 
 Basically I'd like to have someone login on www.domain1.com and then have 
 their login be valid on www.domain2.com and www.domain3.com ... the domain 
 name is different so I don't see how I could use a common cookie.
 
 The 3 sites in question are hosted on a common server with a common user 
 database if that helps but still the domain names that people access the 
 sites with are unique.
 
 Any ideas?
 
 Thanks!
 -- 
 Fraser Campbell [EMAIL PROTECTED] http://www.wehave.net/
 Halton Hills, Ontario, Canada   Debian GNU/Linux


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

2003-09-19 Thread Kevin Stone

Jennifer Goodie [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 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){
(snip)


This is less code and is tested.

$seconds = 86397; // any starting value
$days = floor($seconds/86400);
$days_mod = $seconds%86400;
$hours = floor($days_mod/3600);
$hours_mod = $days_mod%3600;
$minutes = floor($hours_mod/60);
$minutes_mod = $hours_mod%60;
$seconds = floor($minutes_mod);

- Kevin

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



Re: [PHP] countries,states and cities

2003-09-09 Thread Kevin Stone

Chris W. Parker [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Augusto Cesar Castoldi mailto:[EMAIL PROTECTED]
on Monday, September 08, 2003 4:16 PM said:

 where can I download a database with all countries and
 states and cities?

I don't know but I would also be interested in this!!

 like:
 http://www.datingplace.com/servlet/NewRegistration

What? No North Korea? ;)

Chris.

--

The world is a big place.  To get you started here's the 2000 US Census
data.  The file you want is the one labled 'Places.zip'.  The schema is
available on the page but I've posted it below for convenience sake..
http://www.census.gov/geo/www/gazetteer/places2k.html

  a.. Columns 1-2: United States Postal Service State Abbreviation
  b.. Columns 3-4: State Federal Information Processing Standard (FIPS) code
  c.. Columns 5-9: Place FIPS Code
  d.. Columns 10-73: Name
  e.. Columns 74-82: Total Population (2000)
  f.. Columns 83-91: Total Housing Units (2000)
  g.. Columns 92-105: Land Area (square meters) - Created for statistical
purposes only.
  h.. Columns 106-119: Water Area(square meters) - Created for statistical
purposes only.
  i.. Columns 120-131: Land Area (square miles) - Created for statistical
purposes only.
  j.. Columns 132-143: Water Area (square miles) - Created for statistical
purposes only.
  k.. Columns 144-153: Latitude (decimal degrees) First character is blank
or - denoting North or South latitude respectively
  l.. Columns 154-164: Longitude (decimal degrees) First character is blank
or - denoting East or West longitude respectively
Enjoy!

Kevin

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



[PHP] info

2003-08-14 Thread Kevin Stone
domain: asiostudios.com

host: Helpelf

ftp_un: asio
ftp_pw: uZGG7ai

registrar: Godaddy
reg_un: 1398706
reg_pw: iktomi
reg-account email: [EMAIL PROTECTED]



email1: [EMAIL PROTECTED]

un: asio

pw: iktomi



email2: [EMAIL PROTECTED]

un: webmaster

pw: turtle



email3: [EMAIL PROTECTED]

un: bonny

pw: spinfly







www.helpelf.com

un: helpelf

pw: spinfly

cp: www.helpelf.com/menu





www.bubbleshop.net

un: bubble

pw: bubble





www.legendsandlore.com

menu: www.legendsandlore.com/controlpanel

un: legends

pw: pp782on

godaddy un: leglore

godaddy pw: iktomi

Mals-e un: 3843396

Mals-e pw: helpelf

Mals-e server: www.aitsafe.com





www.dakotatextiles.com

un: bhssc

pw: JmvKShfE

cp: www.dakotatextiles.com/menu





www.montileaux.com

cp: www.montileaux.com/menu

un: ybird

pw: gvqAFXYv

godaddy un: ybird

godaddy pw: gvqAFXYv

Mals-e un: 5823628

Mals-e pw: horses

Mals-e server: ww3.aitsafe.com





www.dragonsaretooseldom.com

un: puppets

pw: YysQTNKS

godaddy un: dragonsr

godaddy pw: puppets

Domain Expires: 12/6/2003

Mals-e un: 6165274

Mals-e pw: qw72707

Mals-e server: ww4.aitsafe.com





www.stockmanboot.com

www.stockmans.com

menu: www.stockmanboot.com/menu

ip: 64.177.22.228

un: taxicab

pw: jimjana





www.psdoffice.com

un: sunshine

pw: awUHvgTo

menu: www.psdoffice.com/menu

Mals-e un: 474

Mals-e pw: dh4855

reg_un: 688782

reg_pw: ballball





www.mycampground.com

un: edge

pw: kN5XC2xg





www.genewoodle.com

host: Internet Planners

un: woodle

pw: cXm8vfo9





www.termespheres.com

host: Internet Planners

ip: 64.176.99.91

un: dtermes

pw: y4JwbGpp

registrar: Godaddy

reg_un: 688782

reg_pw: ballball

mals-e_serv: www.aitsafe.com

mals-e_un: 4743045

mals-e_pw: eagle



www.yippykiyo.com

reg_un: 688782

reg_pw: ballball





www.langtermes.com

menu: not available

un: lang

pw: Lp5mvoa4





www.brewereducationalresources.com

menu: www.brewereducationalresources.com/menu

un: brewer

pw: taxicab

reg_un: 688782

reg_pw: ballball





www.bigbats.biz

menu: www.bigbats.biz/menu

ip: 208.56.137.167

un: bigbats

pw: cwQur3MK

reg_un: 688782

reg_pw: ballball





www.ecoloringpages.com

menu: www.ecoloringpages.com/menu

un: ecolor

pw: igvWKSUQ

mals-e un: 6463616

mals-e pw: pk34421

registrar: Godaddy

reg_un: iktomi

reg_pw: buffalo





www.scentsandsuch.com

ip: 64.176.84.196

menu: 64.176.84.196/menu

un: scents

pw: F3gBraQM

registrar: Godaddy

reg_un: scents1

reg_pw: F3gBraQM

mals-e server: ww3.aitsafe.com

mals-e un: 5208542

mals-e pw: hg7414





www.leadoperahouse.org

menu: www.leadoperahouse.org/menu

host: Internet Planners

un: lopera

pw: FLNH67YR

mals-server: ww5.aitsafe.com

mals-un: 7920820

mals-pw: kg46715

godaddy un: humming

godaddy pw: birds





www.bocabeth.com

menu: www.bocabeth.com/menu

un: bocab

pw: RBECB3uG

mals-server: ww4.aitsafe.com

mals-un: 6085847

mals-pw: bocab

go-daddy un: toucan

go-daddy pw: toucan

reg2_un: 688782

reg2_pw: ballball





www.rallytradingcards.com

host: Internet Planners

un: cards

pw: QpoaxWT

mals-server: ww4.aitsafe.com

mals-un: 6285886

mals-pw: xk48666

godaddy-un: vsteele

godaddy-pw: spice





www.tonyramer.com

menu: www.tonyramer.com/menu

un: tramer

pw: APYDDQ6T

godaddy-un: Phillip J LaQua

godaddy-pw: Olivia





www.wildideabuffalo.com

un: buffalo

pw: 9CcS6Yun





www.FabulousOneGuy.com

menu: www.fabulousoneguy.com/menu

un: oneguy

pw: v3mhaHMV

mals-un:

godaddy-un: jeager

godaddy-pw: jeager





www.vanwaytrophy.com

ip: ???

un: vanway

pw: cheemohd

Defunct..

networksolutions_un: 15357249

networksolutions_pw: nolan





www.oldfarmcampground.com

un: oldfarm

pw: k4Nw89q8

mals-un : 7953755
mals-pw : qe73611





www.gordypratt.com

ip: 65.108.5.92

un: gpratt

pw: WKFftqaQ





www.jamesvannuys.com

un: vannuys

pw: E7zndZV6

mals_un: 8565605

mals_pw: pp15101



www.leadmethere.org

host: Internet Planners

ip: 65.109.88.27

un: chamber

pw: SupbXSX

registrar: Network Solutions

ns_account: 27766779

ns_pass: 374BwX2i

previous name servers: NS.BLACKHILLSCORP.COM, NS3.MCI.NET

previous host: Black Hills Fibercom



www.thestudiollc.com

registrar: Godaddy

reg un: 1398706
reg pw: iktomi





www.mycampground.com (edgewater acers)

un: edge

pw: kN5XC2xg





www.thudbuster.com (rjconcepts.com)

menu: rjconcepts.com/vadmin

un: rjci

pw: 29ryan29

registrar: www.directnic.com

reg_un: mcfarlandryan

reg:pw: 29ryan29

mals-e server: ww4.aitsafe.com

mals-e un: 6719593

mals-e pw: rb49506





www.thudbuster.com

ip: 65.109.74.59

un: thudbust

pw: Ps5EStFu

registrar: www.directnic.com

reg_un: mcfarlandryan

reg_pw: 29ryan29

mals un: 6719593

mals pw: rb49506





www.jermacsracing.com

ip: 65.109.74.52

un: racing

pw: 7x3XPvLn

registrar: www.directnic.com

reg_un: mcfarlandryan

reg_pw: 29ryan29





www.rjworldwide.com

un:  rjdesign

pw:  KTogLYCf

ip: 65.109.74.54

registrar: www.directnic.com

reg_un: mcfarlandryan

reg_pw: 29ryan29






Re: [PHP] greedy preg

2003-08-14 Thread Kevin Stone

- Original Message -
From: skate [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, August 06, 2003 3:16 PM
Subject: [PHP] greedy preg



   $contents = preg_replace( |item.*?$file.*?/item|si, ,
$contents );

 it's being run on an XML file, where each entry is item../item
with
 a $file pointer in there.

 it works okay, except for the fact that it deletes that record, and every
 record before it. i can't figure out why it's being greedy? i know i gotta
 be missing something real simple...

You cannot store file pointers.  If you output the variable it's going to
look something like Resource ID #1 which is meaningless except to the
instance of the script that created it.  Or did you mean something different
by $file pointer?

- Kevin



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



[PHP] Re: Frequent Mode Switching

2003-08-10 Thread Kevin Stone

Derrick Fogle [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Thoughts on frequent switching in and out of PHP mode:

 ? switch in, do some code
 ?Switch out, static HTML
 ? switch in, do more code
 ?Switch out, more static HTML

 I've found that I prefer programming this way, for the most part,
 putting most of the heavy PHP programming at the top, and then using
 static HTML interspersed mostly with quick ?= $variable ? statements
 for what users see.

 I'm sure there's more than one viewpoint out there, so I'd like to hear
 a couple of them. Is this frequent mode switching good, bad, or
 indifferent? Is there a point at which the mode switching starts to
 seriously degrade performance and reliability?

 -Derrick


I used to program that way.  The logic and presentation portions of my
scripts were combined into one or two monolithic files.  That worked well
for small projects.  But as I got involved in larger projects and had to
juggle many code files at once I found that I prefered to separate as much
of the HTML from the PHP code as possible.

Typically what I do now is set up my HTML in a template-like format using
?= $var? as the outputs.  Very little logic goes between the ?php? tags
in my HTML files but of course sometimes it's unaviodable and that's why you
want to use ?php? tags here and not some phoney template language.  Then
sipmly include() the HTML file back into the script allowing the outputs to
fill in.  This makes for a very 'plastic' interface that you can mold very
easily in an HTML editor without screwing up your script.  For example I did
a calendar script recently with the following outputs...

$next_year
$prev_year
$cur_year
$cur_month
$cur_day
$january
$february
$march
$april
$may
$june
$july
$august
$september
$october
$november
$december
$event_list
$event_header

Each output contains a portion of the final calendar page.  So I could take
the months and put them into rows or columns, take the event list and put it
on the top or the bottom, take the interface elements and place them where
they work best.  Or I can ignore half of the outputs and display only one
month if I wanted to.  Point being I could do this in a fraction of the time
it would take me to do it in logic portion of the script.

Anyway.. just my two bits.  Take it or leave it.  :-)

- Kevin



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



[PHP] Re: why doesn't default values for this function work

2003-08-05 Thread Kevin Stone

Anders Thoresson [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi,

 I'm having problem with a function that I'll use to validate user input
 before passing it to MySQL. For strings, I want to make sure that they
 aren't to long, so I have written this function:

 function secure_string($unsafe_string, $max_length = -1, $errormessage =
 Too many characters. ) */ { // verify that string isn't longer then
 $max_length, if $max_length is set if ($max_length  -1) { if
 (!is_int($max_length)) { error(Variable max_length is not an integer. );
 } if (strlen($unsafe_string)  $max_length) { error($errormessage); } }
...
 and the validation will continue here.


 When I want to use the max length check I pass a value to the function
like
 this:

 $a_header = secure_string($_POST['a_header'], 60, Header must not be more
 then 60 characters. );

 But I having to problems:
 1) If no max length is passed, and $max_length gets the value -1, the if-
 loop if ($max_length  -1) is still run.
 2) Calls to my own function error doesn't work. Instead of creating a
 popupwindow with javascript (which works in other places where error() is
 called) the errormessage is printed like html.

 What's wrong?

 Best regards,

 --
 anders thoresson

Having trouble with your line wrap?

Okay.. from what I can decipher you have a logic error starting with the
first if() statement.  You've set a default value of -1 and then you're
testing if the input is greater than -1.  However if the variable Is Set but
Empty the input will evaluate to 0 which is greater than -1 and the
condition will be true.  This is what Jason was talking about but it's only
half the problem.

The other thing is if you're going to use the default value then the
is_int() statement should come *before* the value comparison.  But you
should not need the default value at all becuase your're testing the
validity of $max_length against the length of the string later in the
function.  Provided you know that the value is an integer and less than
$max_length then any testing beyond that is just redundant nonsense.

So fortunately all you need to do is eliminate the default value along with
the first if() statement and you should be good to go..

function secure_string($unsafe_string, $max_length)
{
 if(!is_int($max_length))
  error(Variable max_length is not an integer. );

 if (strlen($unsafe_string)  $max_length)
  error(Too many characters.);
}

- Kevin



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



[PHP] Re: using mail()

2003-08-01 Thread Kevin Stone

Amanda McComb [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 If I am using this code:

 mail([EMAIL PROTECTED], test, testbody);

 and want to add a From: line, how do I do it?

 Also, is this an excepted way of sending mail from a web page?

 Thanks,
 Amanda

The mail() function has two optional inputs.  Additional Headers and
Additional Parameters.  FROM and other optional headers can be set up like
this..

$headers = From: [EMAIL PROTECTED];
$headers .= Cc: [EMAIL PROTECTED];
$headers .= Reply-To: [EMAIL PROTECTED];

And then included as the fourth input to the function..

mail([EMAIL PROTECTED], test, testbody, $headers);

Be aware that forging headers can get you into trouble with the spam
blockers regardless of the legitimacy of your intentions.  Go to Google
Groups and read up on what you need to know in order to keep your legitimate
mail servers from being black listed.

Read more about the mail() function..
http://www.php.net/manual/en/function.mail.php

-Kevin



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



Re: [PHP] Simple date question

2003-07-30 Thread Kevin Stone

David Nicholson [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Hello,

This is a reply to an e-mail that you wrote on Wed, 30 Jul 2003 at
19:18, lines prefixed by '' were originally written by you.

 If I have:
 $firstdate = 2003-06-28;
 then how can I get $firstdate plus 4 days?
 Thanks!

date(Y-d-m,mktime(0,0,0,substr($firstdate,5,2),substr($firstdate,8,2),subs
tr($firstdate,0,4))
+ (60*60*24*4));

Should do the trick, you can probably use strtotime instead of all
the substr()'s but at a guess I would expect the above to be quicker
(not that I have benchmarked it).

HTH

David.
--

David's reply was spot on but I thought I'd break it down for you in case
you didn't understand...

$firstdate = 2003-06-28;

// Parse the date
list($year, $month, $day) = explode(-, $firstdate);

// Get the timestamp for this date..
$ts = mktime(0,0,0,$month,$day,$year);

// Add four days to timestamp..
$ts += 345600;

// Get year, month, day for new date..
$newdate = date(Y-m-d, $ts);

The only thing that I'm doing differntly is the way in which I'm parsing the
date.  I'm using the list()=explode() method as opposed to substr() becuase
this method is not prone to fail when values are not zero filled.

Good luck,
Kevin



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



[PHP] Re: retrieving multi-select form values

2003-07-30 Thread Kevin Stone

Hank Tt [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Given the following querystring generated by, for example, a multi-select
 form list (menu), the contents of $_GET['list'] is expected to be an array
 holding 3 elements:

 http://awebsite.net/formlist.php?list=2list=3list=99

 Yet I only see the last value returned as a lone string.  Is this
expected?

 Thanks.

Yup it's working perfectly.  $_GET['list'] overwrites $_GET['list']
overwrites $_GET['list'].  You will only ever see the last one.  Instead add
square brackets to each variable name..

http://awebsite.net/formlist.php?list[]=2list[]=3list[]=99

Now $_GET['list'] is an array wth three elements.

echo $_GET['list'][0]; // prints 2
echo $_GET['list'][1]; // prints 3
echo $_GET['list'][2]; // prints 99

To do this within your multi-select form field add the square brackets to
the field name...

select name=list[] select-multi
option/option
option/option
option/option
/select

In the future you might consider performing a search on Google Groups prior
to posting on the list.  9 out of 10 times you'll find the answer you're
looking for.  This topic is particularly common.

-Kevin



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



[PHP] Re: textbox+database

2003-07-30 Thread Kevin Stone

Mehdi Achour [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Patrik Fomin wrote:
  hi, i have a textbox, after someone puts text into it, it saves into the
  database,
  textarea cols=2 rows=2/textarea
 
 
  when it saves to the database the formattion in the textbox dosent work
  properly,
  eg:
  i add this:
 
  Test
 
  Test
 
 
  Hello
 
 
  and when i retrive the text from the database it looks like this:
  TestTestHello
 
  is there anyway to save (enter formattions)?
 

 echo nl2br($data_from_database);  // see php.net/nl2br

 Mehdi

Not to be picky but this is considerablly more reliable..

// Convert end of line to br..
$str = ereg_replace(\n|\r|\r\n, 'br', $str);

// Convert br to end of line..
Not to be picky but this is considerablly more reliable..
$str = ereg_replace(br, \n, $str);

- Kevin



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

Aaron Axelsen [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Yes, connect.inc.php does the following:

 @$connect=mysql_connect(localhost,$dbuser,$dbpass);
 if (!$connect) {
 echo Could not connect to mysql!;
 exit();
 }

 @$db=mysql_select_db($dbname);
 if (!$db){
 echo Could not connect to database;
 exit ();
 }

 @$result=mysql_query($sql);
 if (!$result){
 echo Invalid Sql Command;
 exit ();
 }


 - ---
 Aaron Axelsen
 AIM: AAAK2
 Email: [EMAIL PROTECTED]

 Want reliable web hosting at affordable prices?
 www.modevia.com

 Web Dev/Design Community/Zine
 www.developercube.com


The resource identifier returned by mysql_connect() is an optional input to
the mysql_query() function.  You should test it out to see if your system
isn't passing the value automatically.

$result = mysql_query($sql, $connect); //-- like this

The reason you may be seeing 1 instead of the value you expected is that the
mysql_query() function can return True even if it doesn't succesfully
execute the query.  In that case you may see the output 1 becuase the
boolean True evaluates to 1 in the parser.

--
Kevin



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



Re: [PHP] I'm really getting annoyed with PHP

2003-07-24 Thread Kevin Stone

Zerof [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 You are absolutely right, exit, quits my script, this let me use an
independent script to
 handle the headers. if used with conditional calls. .
 
 zerof
 -
 Comex [EMAIL PROTECTED] escreveu na mensagem
 news:[EMAIL PROTECTED]
  [EMAIL PROTECTED]
 -
  Why?  AFAIK, exit quits the script, exactly what you want if you want to
redirect.
 ---

Zerof, Comex is absolutely correct.  exit() should almost always be used in
conjucntion with header(Location: ).  I would be interested in learning
what collateral effects you see when doing so.   By any logic exit()
should reduce the number of adverse effects when using header() redirects.

Consider this example..

?
if($i==10){
header(Location: $nextpage);
}

$_SESSION['i'] = $i;
?

If we were to employ this code $i would be set to the session even if
header() was called and the user was redirected.  PHP does not care that
another script has been launched and happily continues to execute this
script.  Is this really a desirable effect?  No.. surely not.  Instead what
we should do is exit the script after redirecting the user.

?
if($i==10) {
header(Location: $nextpage);
exit;
}

$_SESSION['i'] = $i;
?

Now we're safe becuase nothing beyond the header() call is going to execute.
Obviously this is an extraordinarily simple example.  But most scripts are
not so straight forward.  If you don't exit after a header redirect you
could be causing yourself one hell of a headache.

Be wise and have one script running at one time.

- Kevin



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



[PHP] Re: ARRAY QUESTION

2003-07-24 Thread Kevin Stone

Dale Hersh [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I have a question regarding the count function. Here goes:

 Lets pretend I have this array called myStuff. If I add two elements to
 myStuff and call the count function, I will get a result of 2. My question
 is how do I re-initialize the array after adding elements so when I call
the
 count function on the array, I get a result of 0.

 Thanks,
 Dale

I assume you want to KEEP the other values in the array?  If not then you
can just unset($myStuff).

If you do want to keep the array intact then I suppose you could store the
count in a variable $counta, add more elements to the array (or not), take
the count again and store it in a new variable $countb, then subtract the
values $count = abs($counta - $countb);

abs() converts to the absolute value if the result is negative.

- Kevin



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



[PHP] Re: How to pass connection to next page

2003-07-23 Thread Kevin Stone

Minghua Yao [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

  Hi,
  On one page, I have:
  ?php
  ...
  $dbcnx0 = @mysql_connect(localhost, $name, $password);
  ...
  session_start();
  $_SESSION['my_con'] = $dbcnx0;
  ...
  ?
  On another page, I have:
  ?php
  ..
  session_start();
  $dbcnx1 = $_SESSION['my_con'];
  .
  ?
  The problem is:
  $dbcnx0 = Resource id #1 while $dbcnx1 = 0.
  The reason I want to pass the handle to next page is that I want to use
  that connection on the next page to do some queries.
  Help will be appreciated.
  -MY

You cannot do what you propose and there is no work around becuase PHP
automatically closes any connctions left open when the script closes,
rendering the resource/object handels invalid.

The compromise most people live with is to put their connection script
within a separate file and include it (either manually or automatically) at
the top of any script they may need to access the database in.  This at
least saves you the headache of maintaining twelve different instances of
the same code in a pile of scripts.

- Kevin



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



[PHP] Re: Global variable question question

2003-07-23 Thread Kevin Stone

Jason Giangrande [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 When registered globals is set to off this does not effect the $PHP_SELF
 variable right?  In other words I should be able to call $PHP_SELF with
 out having to do this $_SERVER['PHP_SELF'], right?

 Thanks,
 Jason Giangrande

I would assume that if you turned register_globals off $PHP_SELF will no
longer be available.  Course you can always extract($_SERVER); if you want
the effect of register_globals inside your script without turning the
feature on globally.
- Kevin



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



[PHP] Re: newbY prob

2003-07-23 Thread Kevin Stone

Phillip Blancher [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Problem with Count.

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

Looks like you're not passing the correct variable to the second parameter
in mysql_db_query().
- Kevin



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



[PHP] Re: I'm really getting annoyed with PHP

2003-07-23 Thread Kevin Stone

Beauford.2005 [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Yes, I'm still screwing around with this stupid redirection thing, and
 either I'm just a total idiot or there are some serious problems with
 PHP. I have now tried to do it another way and - yes - you guessed it.
 It does not work.

 I mean really, it can not be this hard to redirect a user to another
 page. If it is, then I must look into using something else as I just
 can't be wasting days and days on one minor detail that should take 30
 seconds to complete.

 If anyone has some concrete suggestion on how to get this to work It
 would be greatly appreciated. In the mean time I have given up on it as
 I am just totally pissed off at it.

 TIA

Beauford, here's a login routine that I wrote using Sessions and Header
redirects.  It is my interpretation of what you are trying to do.  I'm not
saying this is the only way to do it but it works well for me.  Compare it
to what you're doing to see if you're doing anything wrong.

page-whatever.php
? // -- line 1
session_start();
$thispage = http://www.yourdomain.com.$_SERVER['REQUEST_URI'];
$_SESSION['return-to'] = $thispage;
if($_SESSION['valid_user'] !== true)
{
// Access Denied!  Redirect to the login screen.
header(Location: http://www.yourdomain.com/login.php;);
exit;
}

// Access Granted!  Display secure content.
?

Hello World!br
a  href=login.php?logout=trueClick here to logout/a
-

login.php
? // -- line 1
session_start();

// Honor logout request and destroy the session..
if(isset($_GET['logout']))
{
foreach($_SESSION as $key = $val)
{
$_SESSION[$key] = '';
}

echo You have logged out succesfully.;
// Continue to the login form..
}

// Validate form input if submitted..
if(isset($_POST['submit']))
{
if(valid_user($_POST['username'], $_POST['password']))
{
// Access Granted!  Redirect to the page that brought us here.
$_SESSION['valid_user'] = true;
header(Location: . $_SESSION['return-to']);
exit;
}
else
{
echo Invalid Username/Password.;
}
}

// Function to validate username/password..
function valid_user($un, $pw)
{
// Open database/userfile.
// Check submited input against content
// Return true or false based on result.
}

// Display the login form.
?
form method=post action=?= $_SERVER['PHP_SELF']?
Username: input type=text name=usernamebr
Password: input type=password name=passwordbr
input type=submit name=submit value=Login
/form
--

Good luck,
Kevin



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



[PHP] Re: closing windows

2003-07-23 Thread Kevin Stone

Jon Phipps [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I am curious as to how, from within php, you could emulate the javascript
 window.close() function. The other thing is how would I blend javascript
and
 php, it call javascript functions from php. The javascript will be located
 in the same page as the php.

 Jon


You cannot emulate the javascript close command with PHP.  Output code from
within the PHP script and allow the browser to execute the javascript
independently.

?
echo scriptwindow.close(this);/script;
?

- Kevin



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



[PHP] Re: Sending data using the POST method.

2003-07-22 Thread Kevin Stone

Guillermo Scharffenorth [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hello,

 I am a beginner programmer and I am trying to do the following:

 I have a commercial  script (catalog.php) which accepts variables using
the
 POST method.  This script, however, is not designed to handle form
fields
 other than textfield.

 I have an intermediate script (translate.php) which
 reads variable from a form and creates a query string.
 If I wanted to call the original catalog script to process my
translate.php
 query string using GET I would do translate.php?query-string.
However,
 because it uses the POST method, I do not know how to send the variables.

 Any ideas?

 Thanks so much,

 Guillermo Scharffenorth


POST and GET are synonymous in PHP thanks to the $_REQUEST array.  If you
are not concerned about the input method then use $_REQUEST in place of
$_GET and $_POST.

HTH,
Kevin



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



Re: [PHP] Redirection Question

2003-07-22 Thread Kevin Stone
The other methods suggested avoid that entanglement.
Kevin

Beauford.2005 [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Maybe I didn't explain enough. What if they come from b.php or c.php.
 How do I automatically log what page they tried to access. So hard
 coding login.php?next=a.php would only work for one page.

 TIA

 -Original Message-
 From: Curt Zirzow [mailto:[EMAIL PROTECTED]
 Sent: July 22, 2003 4:16 PM
 To: PHP
 Subject: Re: [PHP] Redirection Question


 * Thus wrote Beauford.2005 ([EMAIL PROTECTED]):
  Hi,
 
  I am trying to figure out how to redirect a user back to a page but
  not having much luck.
 
  For example: I click on a menu item on my site which goes to a.php.
  This file includes another file that determines if they are logged in
  or not. If not, they are sent to login.php using header(:Location:
   ). How would I automatically redirect them back to a.php after
  they have logged in successfully. I have tried using HTTP_REFERRER,
  but it isn't redirecting.

 You can use the HTTP_REFERRER, but i wouldn't depend on it, it isn't a
 required header for the client.

 what you prolbably should do is when the arn't logged int, you can send
 them to something like:
  header('location: login.php?next=a.php');

 Then on your login form add a hidden variable:
 input type=hidden name=next value=?echo $_GET['next']?

 Finally when the user submits this form, and the user logs in
 successfully you know that you need to redirect them to the a.php.

 HTH,

 Curt
 --
 I used to think I was indecisive, but now I'm not so sure.

 --
 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] Re: Redirection Question

2003-07-22 Thread Kevin Stone

Beauford.2005 [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi,

 I am trying to figure out how to redirect a user back to a page but not
 having much luck.

 For example: I click on a menu item on my site which goes to a.php. This
 file includes another file that determines if they are logged in or not.
 If not, they are sent to login.php using header(:Location:  ). How
 would I automatically redirect them back to a.php after they have logged
 in successfully. I have tried using HTTP_REFERRER, but it isn't
 redirecting.

 Any help is appreciated.


When you redirect to login.php store the refering page in a hidden form
field field and redirect back to that url after the user has logged in
succesfully.

HTH,
Kevin



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



[PHP] Re: bug in addslashes command?

2003-07-22 Thread Kevin Stone

Merlin [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hello there,

 I am running php 4.2.1 on a linux machine. Not sure, but I think there
might
 be a bug in there.

 While putting data into the db I do get an error in a verry rar case. All
 values are escaped by addslashes commands.

 This is the original string:
 the 'capitol-' of Kefalonia

 This is the string after addslashes:
 the \'capitol\-' of Kefalonia

 Which leaves the last ' unescaped.

 Am I wrong, or is this a bug? Anny suggestions?

 Thanx for any help,

 Merlin

That's strange.  Tested on PHP v4.2.3 on Linux and it seems to be working
okay..
output: \'capitol-\' of Kefalonia

- Kevin



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



[PHP] Re: Print help

2003-07-21 Thread Kevin Stone

Ron Allen [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 What I would like to do is to make an optional page that can print
 information to a specified printer.  Can PHP do this?
 If so how???

 Please help!!!

Look in the manual under 'printer'..
http://www.php.net/manual/en/ref.printer.php

Printer functions are server-side and work on Windows operating systems
only.

- Kevin



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



[PHP] Re: echo statements

2003-07-18 Thread Kevin Stone

Jay Fitzgerald [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 When echoing html code that will include variables from a while or if
loop,
 which method is best?
  Method 1: echo td align=\left\ VALIGN=\top\font
 class=\dbtables\$employer/font/td;
  OR
  Method 2: td align=left valign=topfont class=dbtables?php echo
 $employer; ?/font/td
  If you would, please give reasons why to support your opinion.
  Thanks

Method 3:  font class=dbtables?= $employer;?/font
- Kevin



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



Re: [PHP] Re: Eval var from query

2003-07-14 Thread Kevin Stone
The string you send to eval() must be valid PHP code.  So try this..

eval( 'echo '.$data.';');

- Kevin


- Original Message -
From: Shawn McKenzie [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, July 14, 2003 1:15 PM
Subject: [PHP] Re: Eval var from query


 eval($data)

 returns Parse error: parse error, unexpected T_STRING in
 C:\apps\apache2\htdocs\test\query.php(23) : eval()'d code on line 1

 Thanks!
 Shawn

 Shawn McKenzie [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  How can I evaluate a var that is from a text field of a database?
 Example:
 
  MySQL field `name` = hi my name is $name
 
  In my script I have:
 
  $name = Shawn;
 
  After fetching a query result as an associative array I have the
contents
 of
  the `name` field in $data
 
  If I echo $data I get:  hi my name is $name
 
  I would like to get:  hi my name is Shawn
 
  TIA,
  Shawn
 
 



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





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



Re: [PHP] Re: Eval var from query

2003-07-14 Thread Kevin Stone
I realized that may not make any sense.  Following up the eample relates to
your original query like this..

 MySQL field `name` = hi my name is $name
 In my script I have:
 $name = Shawn;

$data = 'hi my name is $name';
$code = 'echo '.$data.';';
$name = 'Shawn';
eval($code); // prints hi may name is Shawn.

Hope that makes it more clear.

- Kevin



- Original Message -
From: Kevin Stone [EMAIL PROTECTED]
To: PHP-GENERAL [EMAIL PROTECTED]
Sent: Monday, July 14, 2003 1:23 PM
Subject: Re: [PHP] Re: Eval var from query


 The string you send to eval() must be valid PHP code.  So try this..

 eval( 'echo '.$data.';');

 - Kevin


 - Original Message -
 From: Shawn McKenzie [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Monday, July 14, 2003 1:15 PM
 Subject: [PHP] Re: Eval var from query


  eval($data)
 
  returns Parse error: parse error, unexpected T_STRING in
  C:\apps\apache2\htdocs\test\query.php(23) : eval()'d code on line 1
 
  Thanks!
  Shawn
 
  Shawn McKenzie [EMAIL PROTECTED] wrote in message
  news:[EMAIL PROTECTED]
   How can I evaluate a var that is from a text field of a database?
  Example:
  
   MySQL field `name` = hi my name is $name
  
   In my script I have:
  
   $name = Shawn;
  
   After fetching a query result as an associative array I have the
 contents
  of
   the `name` field in $data
  
   If I echo $data I get:  hi my name is $name
  
   I would like to get:  hi my name is Shawn
  
   TIA,
   Shawn
  
  
 
 
 
  --
  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] Re: Eval var from query

2003-07-14 Thread Kevin Stone
- Original Message -
From: Shawn McKenzie [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, July 14, 2003 1:51 PM
Subject: Re: [PHP] Re: Eval var from query


 Thanks Kevin!  That works great.  It outputs:  hi my name is Shawn

 Now if I want to assign $data to another var, let's say $newdata and have
it
 eval the $name var inside of that.  How would that work?

 Meaning I want to $newdata = hi my name is Shawn

 Thanks!
 Shawn

Umm.. well.. '$name' is a litteral inside the string until it is evaluated.
It doesn't matter if you make a copy of the variable, '$name' is still going
to be a litteral value.  So you'll have to eval() it exactly the same way
every time.  But maybe I can offer an alternative...

You look at this string and see a code evaluation problem.  I look at this
string and see a find and replace problem.  Consider useing str_replace()
to search for and replace '$name' as a template marker rather than a
variable to be evaluated..

$data = 'hi my name is $name';
$name = 'Shawn';
echo str_replace('$name', $name, $data);

This accomplishes exactly the same thing and it's a perfectly valid form.
Plus it's going to work on any string becuase you don't have to turn them
into PHP code first.

- Kevin



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



[PHP] Re: A MySQL question

2003-07-14 Thread Kevin Stone

Zavaboy [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Ok, I want to delete only 1 row off of a database table...
 Example:
 I have a table with columns user and item...
 Lets say the table contains the following rows (user | item):
 582-668243 | Toothbrush
 582-668243 | Toothbrush
 582-668243 | Toothbrush
 582-668243 | Trash can
 582-668243 | Trash can
 582-668243 | Something else
 582-668243 | Something else
 582-668243 | Something else
 582-668243 | Something else
 720-387690 | Dog treats
 720-387690 | Car
 720-387690 | Car
 720-387690 | Toothbrush
 720-387690 | Toothbrush

 Ok, user 582-668243 is buying a lot, eh? LoL
 Anyway, how can I remove only 1 Toothbrush from user 582-668243?
 I just want the query... I've been trying to find it out for a few hours
 now...

 Thanks in advance!

 --

 - Zavaboy
 [EMAIL PROTECTED]
 www.zavaboy.com


You can try putting LIMIT 1 on the end of your query but to be honest I
don't know if  LIMIT works with the DELETE command.  Worth a try.  Ideally
you should have an additional column with an autoincrementing value to act
as your primary key and you delete on that key.

- Kevin



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



Re: [PHP] How To Ask Questions - Some List Guidelines

2003-07-14 Thread Kevin Stone

Chris Shiflett [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 --- Burhan Khalid [EMAIL PROTECTED] wrote:
  Next thing, please add a reply-to header that has the lists mailing
  address.

 This is a topic of debate, and many people (including myself) would urge
people
 to ignore this advice. Mangling mail headers can have bad consequences,
and
 there is very little reason to do so. If people want to reply to the
sender,
 they can. If they want to reply to all, they can do that, too. Intelligent
mail
 clients even allow you to reply to list.

 Mangling the Reply-To header just screws all of this up. It's as annoying
as
 those phone number form fields that automatically tab over.

 Chris

 =
 Become a better Web developer with the HTTP Developer's Handbook
 http://httphandbook.org/

You make an interesting point however the problem is people reply to this
list using Email, Newsgroup and Web-based clients.  The clients don't all
put the same information in their headers and they don't all understand the
same headers.  If it were strictly a newsgroup list or strictly an email
list or strictly a web-based list then Yes you would have a valid point.
But if the list is to remain open to these different portals then you are
going to have to live with the occasional broken thread.

Case in point... = ME =... I only recently moved from an Email client to a
Newsgroup client to view this list and I had no idea what-so-ever that any
of my replies were breaking threads.  It was a real eye opener.  :-)

- Kevin



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



Re: [PHP] Session Problem

2003-07-14 Thread Kevin Stone
- Original Message -
From: Sourabh G [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, July 13, 2003 11:15 AM
Subject: [PHP] Session Problem


 Hi,

 I am getting a weird session problem in my site.

 Background of the Problem:
 --
 My site use sessions for user authentication. Site has a Admin Panel where
 admin can search users and then through a link

 (which has login and password appended) login as user.

 On login as user, session var changes to the new user vars, like user id
 etc. So, if some one try to access any thing on

 admin panel, they get error which is quite evident why is that happened.
The
 login user is not a admin any more, its a normal

 user with no privilege.

 I came to a conclusion that if I spawn new browser window it takes old
 session. After trying for hours, I was able to solve

 this. I started a new session when I login as user by setting session name
 and storing the other vars. This way I can start

 the session as needed.

 After solving this problem I thought I am done. But some thing really
weird
 popped up. The links on the page, like My

 Account, Change Password goes to admin when I click them. This looks
like
 on clicking the link, Old admin session becoming

 active and showing the page as a admin. I have no idea why is that
 happening. I have searched goggle but no result.

 Is it a browser issue, or php issue, or I am doing something wrong.


 * I have compiled PHP with trans-sid option.
 ** I store session in my sql database. I can see the user session active.

 Ideal Solution:-)
 --

 When I search the user and login as user. Both admin and user session
remain
 alive and I can work on both windows seamlessly.

 Can Any one point me in the right direction.

 Thanks


This is a problem that many of us have had to deal with.. Session ID's
caching and revalidating when the back button is used or a page is
revisited.  The solution is simple.  Don't just destroy the Session, also
write over all variables within the session like this..

foreach($_SESSION as $key = $val)
{
$_SESSION[$key] = '';
}

The next time session_start() is called the session file will be emptied.
This will ensure that if you click the back button and the Session ID has
been cached the session file no longer contains any useful data and there is
no possibility that your Login script will revalidate the user.

Quite frankly I wouldn't even bother using session_destroy().  It doesn't
seem to do anything useful.

Good luck,
Kevin



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



Re: [PHP] Mind exploded on this one!

2003-07-11 Thread Kevin Stone
- Original Message -
From: Phil Powell [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Friday, July 11, 2003 12:21 PM
Subject: [PHP] Mind exploded on this one!


$booleanNonFormVars = array('hasSelectedLetter', 'hasEnteredProfile',
'hasSelectedProfile',
 'hasEditedProfile', 'hasDeletedProfile',
'willDeleteProfile',
 'willDeletePic');
 $booleanVars = array('profileID', 'showemail', 'showbirthday', 'season',
'profilememberid');
 $profileVarArray = array('firstname', 'lastname', 'city', 'state',
'country', 'favebands',
  'faveconcert', 'favescandinavia', 'faveviking',
'favemeat',
  'freetime', 'thingslove', 'thingshate',
'favebibleverse',
  'changeonething', 'maritalstatus', 'birthday',
'favemovie',
  'faveplace', 'favetv', 'imgpath', 'imgext');
 $profileNonFormVarArray = array('profileName', 'letter', 'name');

 $arrayListArray = array('booleanNonFormVars', 'booleanVars',
'profileVarArray',
'profileNonFormVarArray');

Bluntly put, I need to get:
$hasSelectedLetter
$letter

Etc..

I have absolutely NO idea how to do this, help!

Phil

---

Oh my.  :)

Looks like to me you've got..
$hasSelectedLetter = $arrayListArray['booleanNonFormVars'][0];
$letter = $arrayListArray['profileNonFormVarArray'][1];

HTH,
Kevin



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



Re: [PHP] Mind exploded on this one!

2003-07-11 Thread Kevin Stone

- Original Message -
From: Kevin Stone [EMAIL PROTECTED]
To: Phil Powell [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Friday, July 11, 2003 12:33 PM
Subject: Re: [PHP] Mind exploded on this one!


 - Original Message -
 From: Phil Powell [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Sent: Friday, July 11, 2003 12:21 PM
 Subject: [PHP] Mind exploded on this one!


 $booleanNonFormVars = array('hasSelectedLetter', 'hasEnteredProfile',
 'hasSelectedProfile',
  'hasEditedProfile', 'hasDeletedProfile',
 'willDeleteProfile',
  'willDeletePic');
  $booleanVars = array('profileID', 'showemail', 'showbirthday', 'season',
 'profilememberid');
  $profileVarArray = array('firstname', 'lastname', 'city', 'state',
 'country', 'favebands',
   'faveconcert', 'favescandinavia', 'faveviking',
 'favemeat',
   'freetime', 'thingslove', 'thingshate',
 'favebibleverse',
   'changeonething', 'maritalstatus', 'birthday',
 'favemovie',
   'faveplace', 'favetv', 'imgpath', 'imgext');
  $profileNonFormVarArray = array('profileName', 'letter', 'name');

  $arrayListArray = array('booleanNonFormVars', 'booleanVars',
 'profileVarArray',
 'profileNonFormVarArray');

 Bluntly put, I need to get:
 $hasSelectedLetter
 $letter

 Etc..

 I have absolutely NO idea how to do this, help!

 Phil

 ---

 Oh my.  :)

 Looks like to me you've got..
 $hasSelectedLetter = $arrayListArray['booleanNonFormVars'][0];
 $letter = $arrayListArray['profileNonFormVarArray'][1];

 HTH,
 Kevin

Correction!  The indicies are not valid.  My mistake.  :)

$hasSelectedLetter =
$arrayListArray['booleanNonFormVars']['hasSelectedLetter'];
$letter = $arrayListArray['profileNonFormVarArray']['letter'];

- Kevin



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



Re: [PHP] TextArea vs. URLEncode/URLDecode/quotes

2003-07-09 Thread Kevin Stone

- Original Message -
From: Arcadius A. [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, July 09, 2003 12:50 PM
Subject: [PHP] TextArea vs. URLEncode/URLDecode/quotes

(snip)
 So, My question is: What's the best way to get the value of a textarea
back
 after validation without using session?

 Thanks.

 Arcadius Ahouansou.

Try htmlspecialchars() or htmlentities() to convert quotes and other non-url
friendly characters..
http://www.php.net/manual/en/function.htmlspecialchars.php
http://www.php.net/manual/en/function.htmlentities.php

- Kevin



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



Re: [PHP] session data missing

2003-07-09 Thread Kevin Stone

- Original Message -
From: ulf sundin [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, July 09, 2003 1:00 PM
Subject: Re: [PHP] session data missing


 ok, so now the variable names are registred and stored in the file. But
 without values.
 check this:

 --firstpage.php
 session_start()
 session_register('foo');
 $HTTP_SESSION_VARS['foo'] = 'bar';
 echo $HTTP_SESSION_VARS['foo']; //outputs bar;

 transport by a href to:
 secondpage.php
 session_start();
 echo $HTTP_SESSION_VARS['foo']; //outputs nothing

 ---
 checking the contents of the file called /tmp/sess_{session_id}:
  !foo|
(snip)


Make a choice here..

= session_register('foo');
= $HTTP_SESSION_VARS['foo'] = 'bar';

Use either the session_register() function or the session global array.  Not
both.

- Kevin



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



Fw: [PHP] preg_replace - understanding

2003-07-08 Thread Kevin Stone

- Original Message -
From: Micah Montoy [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, July 08, 2003 4:01 PM
Subject: [PHP] preg_replace - understanding


 I'm trying to understand how the code works within the preg_replace
function
 but the manual is just obscure as the examples are.  Anyway, I am looking
to
 use it to replace \\ in a string with / and I can not figure how how.
 At first, I thought I could just do:

 $filevalue = preg_replace('\\', /, $filevalue);

 but it doesn't do anything.  If someone could relate what it is and what
the
 parts mean between the (), I would appreciate it.

 thanks

You're not using the function correctly.  You've got the search string and
replace string tied up into one input there.  They need to be separate.

$filevalue = preg_replace('\\', '/', $filevalue);
http://www.php.net/manual/en/function.preg-replace.php

However you should consider using the str_replace() function in your case
since you aren't doing any pattern matching and it's a lot faster than
preg_replace().

$filevalue = str_replace('\\'. '/', $filevalue);
http://www.php.net/manual/en/function.str-replace.php

--
Kevin



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



Re: [PHP] New to PHP

2003-07-07 Thread Kevin Stone
There are many great books to help get you started.  Infact.. believe it or
not.. for the complete newbie PHP for Dummies is a great chioce.  It's
very well written and starts with no assumptions about your skill level.

But if you do happen to have some programming experience try PHP and MySQL
Web Development (do a search on Amazon).  That's the book that helped me
out the most.  It has some great real-world examples with complete
walk-through tutorials.

Don't bother purchasing a function reference becuase the php.net reference
is the best there is.  And it's free.  :)

HTH,
Kevin


- Original Message -
From: Hiren Mehta [EMAIL PROTECTED]
To: PHP [EMAIL PROTECTED]
Sent: Monday, July 07, 2003 3:27 PM
Subject: [PHP] New to PHP


Hi I am new to PHP and would like to learn more about it. Which would be the
best place to start with besides the manual and what would you suggest is a
pre-requiste for learning PHP.

Thanks

Regards,

Hiren




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



Re: [PHP] New to PHP

2003-07-07 Thread Kevin Stone
No there are no real pre-requisites to learning PHP.  You should be
comfortable working with the OS that you're used to, but that goes without
saying.  PHP is an almost ideal beginner's language.  Knowledge of Linux is
certainly not required.  There are PHP installers for Windows and Mac that
are point and click.  Very easy step by step.  And there's plenty of easily
accessible info on Google Groups if you get stuck.
- Kevin

- Original Message -
From: Hiren Mehta [EMAIL PROTECTED]
To: PHP [EMAIL PROTECTED]
Sent: Monday, July 07, 2003 3:49 PM
Subject: Re: [PHP] New to PHP


 Do you suggests any pre-requisites before starting off with the books?
 Someone told me it would be much better if I learn Linux first
 Hiren

 - Original Message -
 From: Kevin Stone [EMAIL PROTECTED]
 To: Hiren Mehta [EMAIL PROTECTED]; PHP
[EMAIL PROTECTED]
 Sent: Tuesday, July 08, 2003 3:18 AM
 Subject: Re: [PHP] New to PHP


  There are many great books to help get you started.  Infact.. believe it
 or
  not.. for the complete newbie PHP for Dummies is a great chioce.  It's
  very well written and starts with no assumptions about your skill level.
 
  But if you do happen to have some programming experience try PHP and
 MySQL
  Web Development (do a search on Amazon).  That's the book that helped
me
  out the most.  It has some great real-world examples with complete
  walk-through tutorials.
 
  Don't bother purchasing a function reference becuase the php.net
reference
  is the best there is.  And it's free.  :)
 
  HTH,
  Kevin
 
 
  - Original Message -
  From: Hiren Mehta [EMAIL PROTECTED]
  To: PHP [EMAIL PROTECTED]
  Sent: Monday, July 07, 2003 3:27 PM
  Subject: [PHP] New to PHP
 
 
  Hi I am new to PHP and would like to learn more about it. Which would be
 the
  best place to start with besides the manual and what would you suggest
is
 a
  pre-requiste for learning PHP.
 
  Thanks
 
  Regards,
 
  Hiren
 
 
 
 
  --
  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] Table trouble

2003-07-07 Thread Kevin Stone
I'd just dump all of the results into an array and do something like this:

echo table border=1\n;
for($i=0; $icount($array);)
{
echo \ttr\n;
for($j=0; $j2; $j++)
{
echo \t\ttd.$array[$i]./td\n;
$i++;
}
echo \t/tr\n;
}
echo /table\n;

On odd numbered arrays you'll end up with an empty cell.  Most browsers will
handel the empty cell by simply not displaying it.  Others might show the
box.  It's a minor cosmetic thing but if you want it to look consistent then
test for that situation and add a non-breaking space to the final cell.

HTH,
Kevin

- Original Message -
From: phpu [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, July 07, 2003 4:03 PM
Subject: [PHP] Table trouble


Hello
I need help.
I'm querying a database then printing the results in a table. I want the
result to be in a table with 2 columns per row.
something like that


----  --
--  row 1  -- row 2 --
----  --

----  --
--  row 3  -- row 4 --
----  --

----  --
--  row 5   -- row 6 --
----  --

 and so on.

How can I do that?
Please help me asap






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



[PHP] Reg Ex to search for both Integer and Comma-spaced Integer

2003-07-01 Thread Kevin Stone
I'm a little confused by something.  I need to build a reg-ex to scrape for
both plain integers and comma spaced integers in the same place in the same
string at the same time.  For example..

$string = Mark's average score was 544.;
preg_match(/average score was ([0-9]+)/, $string, $matches);
$score = $matches(1);

$string = Julie's average score was 10,443.;
preg_match(/average score was ([0-9]+,[0-9]+)/, $string, $matches);
$score = $matches(1);

How do I combine these two queries so that the reg-ex matches both the comma
spaced integer and regular integer?

Thanks!
- Kevin



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



Re: [PHP] Reg Ex to search for both Integer and Comma-spaced Integer

2003-07-01 Thread Kevin Stone

- Original Message -
From: Ford, Mike [LSS] [EMAIL PROTECTED]
To: 'Kevin Stone' [EMAIL PROTECTED]; PHP-General
[EMAIL PROTECTED]
Sent: Tuesday, July 01, 2003 12:19 PM
Subject: RE: [PHP] Reg Ex to search for both Integer and Comma-spaced
Integer


  -Original Message-
  From: Kevin Stone [mailto:[EMAIL PROTECTED]
  Sent: 01 July 2003 18:07
 
  $string = Mark's average score was 544.;
  preg_match(/average score was ([0-9]+)/, $string, $matches);
  $score = $matches(1);
 
  $string = Julie's average score was 10,443.;
  preg_match(/average score was ([0-9]+,[0-9]+)/, $string, $matches);
  $score = $matches(1);
 
  How do I combine these two queries so that the reg-ex matches
  both the comma
  spaced integer and regular integer?

   preg_match(/average score was ([0-9]+(,[0-9]+)*)/, $string, $matches);

 should do it.

 Cheers!

 Mike

Excelent thinking Mike that's exactly the result I was after.  Thanks!
- Kevin



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



Re: [PHP] Please help can anyone figure whats wrong with this?

2003-06-25 Thread Kevin Stone

- Original Message -
From: Mark Clarkstone [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, June 25, 2003 10:10 AM
Subject: [PHP] Please help can anyone figure whats wrong with this?

 if (!$logusername)
 echo html

 head

 title$sitename -- Login --- Error/title
 /head

 body

 font size=\2\font face=\Tahoma\Please enter Your Username or Sign
 Upbr
 /font
 /body

 /html;
 }

You're missing a starting bracket.

You know this was WAY too easy to find.  What kind of editor are you using
that would miss something this obvious?

On an unrelated note you can save yourself a lot of grief by separating your
logic and content.  In your case a page template with the look and feel of
the message page.

/** message_page.html  **/
html
body
div align=center
 font size=2 face=Tahoma?= $message?/font
/div
/body
/html

/** index.php **/
if($login)
{
$message = Please enter your Username or Sign Up.;
include(message_page.html);
}
else
{
$message = Thank you for login in.;
include(message_page.html);
}

This is just a friendly suggestion.  I know most people don't like to be
preached to.  :)

HTH,
Kevin



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



Re: [PHP] clearing cache

2003-06-20 Thread Kevin Stone
- Original Message -
From: Mark McCulligh [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, June 20, 2003 11:44 AM
Subject: Re: [PHP] clearing cache


 I can't just create a link on the last page back to the first page.
Because
 if the user hits the back button on the browser they end up on page 2.
 Which can't happen.  Once you are on the last page the user can't by
anyway
 get back to page 2, unless they start over on page 1.

 What I am planning on doing is passing the variables using the POST
method.
 Then have a hidden variable pass with the pages.  If this hidden variable
is
 missing then redirect the user back to page 1.  Thus if I can get page 2
to
 be cleared from the browsers cache after it has been displayed, if the
user
 came back to this page using the back button the page will be reload from
 the server because it is not in cache, there for my code will not find the
 hidden variable and redirect the user back to page 1.

 I think the theory of this will work ok, but I don't know how to clear a
 page from the browsers cache after it is displayed.

 Thanks,
 Mark.

[SNIP]

Mark, this is kind of a lame hack but give it a try...

/** PAGE A (first form) **/
?
session_start();
if (isset($_POST['submit'])) {
 header(Location: test3.php);
 exit;
}
?

/** PAGE B (second form) **/
?
session_start();
if ($_SESSION['startover']) {
 $_SESSION['startover'] = false;
 header(Location: test2.php);
 exit;
}

if (isset($_POST['submit'])) {
 header(Location: test4.php);
 exit;
}
?

/** PAGE C (results page) **/
?
session_start();
$_SESSION['startover'] = true;
?


The idea is to keep a startover variable in the session.  The variable is
set when you reach Page C (the results page).  When the user hits the back
button the variable is tested on Page B for true or false.  If it's true
header() redirect back to Page A.  Otherwise it prints and/or validates the
form on Page B.

Why header() redirect between each page?  Becuase it overwrites the post
data allowing you to use your back button without a repost.  This results in
a much cleaner more controlable user interface.  If you need to pass form
data between forms then simply store the post data in the Session and
extract it on the next page.

If I'm right, what you're going to see in the browser's back button history
using this method is a single instance of PAGE A repeated for each cycle.

Good luck with this.

HTH,
Kevin



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



Re: [PHP] Strange roblems with sessions

2003-06-18 Thread Kevin Stone

- Original Message -
From: Logan McKinley [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Wednesday, June 18, 2003 12:51 PM
Subject: [PHP] Strange roblems with sessions


 what it is meant to do:
 take a querystring set it to a session variable (outputs error if neither
 querystring nor sesison exist) then reloads the page (to remove the
 querystring)
 what it (appears) to do:
 it sets the querysting to the session, reloads the page and outputs an
error
 saying it doesn't have the session variable
 if you reload the page with a querystring back in and it works as it is
 meant to
 --  the code in question 
 ?
 session_start();
 if(!isset($_SESSION['HID'])  !isset($_SERVER['QUERY_STRING']))
  die(There was an error registering your product please call techinal
 support at (111)-111-);
 else if(!isset($_SESSION['HID'])  isset($_SERVER['QUERY_STRING']))
 {
  $_SESSION['HID'] = $_SERVER['QUERY_STRING'];
  header(Location: http://localhost/PHP/registration_form.php;);
 }
 ?
 -
 I have attached the actual files if that would be of more help,
 Thanks in advance for any help,
 ~Logan


Logan,

When you're activating the script through the browser then
$_SERVER['QUERY_STRING'] is always set.  It is only empty or not empty.  You
should modify your conditional statements to reflect that..

?
session_start();
if(!isset($_SESSION['HID'])  empty($_SERVER['QUERY_STRING']))
{
die(There was an error registering your product please call techinal
support at (111)-111-);
}
elseif(!isset($_SESSION['HID'])  !empty($_SERVER['QUERY_STRING']))
{
  $_SESSION['HID'] = $_SERVER['QUERY_STRING'];
  header(Location: http://www.helpelf.com/test2.php;);
}
?

This is tested.

HTH,
Kevin



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



[PHP] How to avoid Socket Post output?

2003-06-16 Thread Kevin Stone
Hello list,

I'm attempting to use the PostToHost() function to send a request to a
remote script.  The purpose for this is to request and retrieve information
from a remote database without the need for messy HTTP  HTML methods.   I
realize that I could use an HTML form, put the data in hidden fields, and
send the request that way, but then I would have to redirect back from the
master script recording an unwanted page in the 'Back Button' history.  I'd
like to avoid that so I'm investigating methods of POST'ing through a manual
socket connection.

Here is that PostToHost() function..

/*
 PostToHost($host, $path, $data_to_send)
 $host; valid domain (ie. www.domain.com)
 $path; relative URL (ie. /myfile.php)
 $data_to_send; urlencoded key/val string (ie.
key=valkey2=val2key3=val3)
*/
function PostToHost($host, $path, $data_to_send)
{
 ob_end_flush();
 $fp = fsockopen($host,80);
 fputs($fp, POST $path HTTP/1.0\n);
 fputs($fp, Host: $host\n);
 fputs($fp, Content-type: application/x-www-form-urlencoded\n);
 fputs($fp, Content-length:  . strlen($data_to_send) . \n);
 fputs($fp, Connection: close\n\n);
 fputs($fp, $data_to_send);
 while(!feof($fp))
 {
  echo fgets($fp, 128);
 }
 fclose($fp);
}


It works great!  The only problem is I get output from the socket connection
and I don't know how to skip over it...

HTTP/1.1 200 OK
Date: Mon, 16 Jun 2003 20:10:36 GMT
Server: Apache/1.3.20 (Unix) ApacheJServ/1.1.2 PHP/4.2.3
FrontPage/5.0.2.2510 Rewrit/1.1a
X-Powered-By: PHP/4.2.3
Connection: close
Content-Type: text/html

I'm very much a newbie to all of this so you'll have to forgive me.  But I'm
wondering if there is anyway to avoid this output and have a completely
invisible manual socket POST?


Thanks,
Kevin Stone
[EMAIL PROTECTED]



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



Re: [PHP] How to avoid Socket Post output?

2003-06-16 Thread Kevin Stone
ACK!  NEVER MIND!

I'm just blind.  I didn't see the echo statement on the fgets() line.

Problem solved.

- Kevin

- Original Message -
From: Kevin Stone [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, June 16, 2003 2:46 PM
Subject: [PHP] How to avoid Socket Post output?


 Hello list,

 I'm attempting to use the PostToHost() function to send a request to a
 remote script.  The purpose for this is to request and retrieve
information
 from a remote database without the need for messy HTTP  HTML methods.   I
 realize that I could use an HTML form, put the data in hidden fields, and
 send the request that way, but then I would have to redirect back from the
 master script recording an unwanted page in the 'Back Button' history.
I'd
 like to avoid that so I'm investigating methods of POST'ing through a
manual
 socket connection.

 Here is that PostToHost() function..

 /*
  PostToHost($host, $path, $data_to_send)
  $host; valid domain (ie. www.domain.com)
  $path; relative URL (ie. /myfile.php)
  $data_to_send; urlencoded key/val string (ie.
 key=valkey2=val2key3=val3)
 */
 function PostToHost($host, $path, $data_to_send)
 {
  ob_end_flush();
  $fp = fsockopen($host,80);
  fputs($fp, POST $path HTTP/1.0\n);
  fputs($fp, Host: $host\n);
  fputs($fp, Content-type: application/x-www-form-urlencoded\n);
  fputs($fp, Content-length:  . strlen($data_to_send) . \n);
  fputs($fp, Connection: close\n\n);
  fputs($fp, $data_to_send);
  while(!feof($fp))
  {
   echo fgets($fp, 128);
  }
  fclose($fp);
 }


 It works great!  The only problem is I get output from the socket
connection
 and I don't know how to skip over it...

 HTTP/1.1 200 OK
 Date: Mon, 16 Jun 2003 20:10:36 GMT
 Server: Apache/1.3.20 (Unix) ApacheJServ/1.1.2 PHP/4.2.3
 FrontPage/5.0.2.2510 Rewrit/1.1a
 X-Powered-By: PHP/4.2.3
 Connection: close
 Content-Type: text/html

 I'm very much a newbie to all of this so you'll have to forgive me.  But
I'm
 wondering if there is anyway to avoid this output and have a completely
 invisible manual socket POST?


 Thanks,
 Kevin Stone
 [EMAIL PROTECTED]



 --
 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] How to avoid Socket Post output?

2003-06-16 Thread Kevin Stone
Oh wait..  unless that output is required somehow.  I removed the echo
statement now my request isn't being replied to by the database script.

Seems I desparately need a lesson in socket connections.  Does anyone know
of a good book or tutorial other than the manual that goes into this stuff
in depth?

- Kevin


- Original Message -
From: Kevin Stone [EMAIL PROTECTED]
To: Kevin Stone [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Monday, June 16, 2003 2:54 PM
Subject: Re: [PHP] How to avoid Socket Post output?


 ACK!  NEVER MIND!

 I'm just blind.  I didn't see the echo statement on the fgets() line.

 Problem solved.

 - Kevin

 - Original Message -
 From: Kevin Stone [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Monday, June 16, 2003 2:46 PM
 Subject: [PHP] How to avoid Socket Post output?


  Hello list,
 
  I'm attempting to use the PostToHost() function to send a request to a
  remote script.  The purpose for this is to request and retrieve
 information
  from a remote database without the need for messy HTTP  HTML methods.
I
  realize that I could use an HTML form, put the data in hidden fields,
and
  send the request that way, but then I would have to redirect back from
the
  master script recording an unwanted page in the 'Back Button' history.
 I'd
  like to avoid that so I'm investigating methods of POST'ing through a
 manual
  socket connection.
 
  Here is that PostToHost() function..
 
  /*
   PostToHost($host, $path, $data_to_send)
   $host; valid domain (ie. www.domain.com)
   $path; relative URL (ie. /myfile.php)
   $data_to_send; urlencoded key/val string (ie.
  key=valkey2=val2key3=val3)
  */
  function PostToHost($host, $path, $data_to_send)
  {
   ob_end_flush();
   $fp = fsockopen($host,80);
   fputs($fp, POST $path HTTP/1.0\n);
   fputs($fp, Host: $host\n);
   fputs($fp, Content-type: application/x-www-form-urlencoded\n);
   fputs($fp, Content-length:  . strlen($data_to_send) . \n);
   fputs($fp, Connection: close\n\n);
   fputs($fp, $data_to_send);
   while(!feof($fp))
   {
echo fgets($fp, 128);
   }
   fclose($fp);
  }
 
 
  It works great!  The only problem is I get output from the socket
 connection
  and I don't know how to skip over it...
 
  HTTP/1.1 200 OK
  Date: Mon, 16 Jun 2003 20:10:36 GMT
  Server: Apache/1.3.20 (Unix) ApacheJServ/1.1.2 PHP/4.2.3
  FrontPage/5.0.2.2510 Rewrit/1.1a
  X-Powered-By: PHP/4.2.3
  Connection: close
  Content-Type: text/html
 
  I'm very much a newbie to all of this so you'll have to forgive me.  But
 I'm
  wondering if there is anyway to avoid this output and have a completely
  invisible manual socket POST?
 
 
  Thanks,
  Kevin Stone
  [EMAIL PROTECTED]
 
 
 
  --
  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] How to avoid Socket Post output?

2003-06-16 Thread Kevin Stone

- Original Message -
From: David Nicholson [EMAIL PROTECTED]
To: Kevin Stone [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Monday, June 16, 2003 3:22 PM
Subject: Re: [PHP] How to avoid Socket Post output?


 Hello,


 This is a reply to an e-mail that you wrote on Mon, 16 Jun 2003 at 22:00,
 lines prefixed by '' were originally written by you.

  Oh wait..  unless that output is required somehow.  I removed the echo
  statement now my request isn't being replied to by the database
  script.

 For a quick fix, change:
   echo fgets($fp, 128);
 to:
   fgets($fp, 128);

 All the best,

 David.


Yes but when I fail to output the socket file the request is no longer
recieved.  No data is recorded in the POST array.  Let me explain once more
what I'm doing..

1) Initiate Script-A through the browser.
2) Script-A opens a socket connection to Script-B and posts a request.
3) Script-B produces a formated data string based on the requst.
4)  Script-B then opens a socket connection to Script-A and posts the data.

It should be seamless and it works for the most part.  But the thing is it
outputs this generic server info which you can see in this working example..

http://www.helpelf.com/test.php

You'll notice in the example that this server info.. I don't know what it is
becuase this is the first time I've done anything like this.. gets outputed
along with the request.  I can't NOT (double negative) output the request
file becuase it contains the headers and data which make it all work.  At
least that is what I realized a few minutes ago when I said ACK then Oh (see
two posts below).  :-)

Now I'm looking for a way to avoid that server info output, without
compromizing the functionality of the method,  if it is possible to do so.

- Kevin




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



Re: [PHP] How to avoid Socket Post output?

2003-06-16 Thread Kevin Stone

- Original Message -
From: Kevin Stone [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, June 16, 2003 4:02 PM
Subject: Re: [PHP] How to avoid Socket Post output?



 - Original Message -
 From: David Nicholson [EMAIL PROTECTED]
 To: Kevin Stone [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Sent: Monday, June 16, 2003 3:22 PM
 Subject: Re: [PHP] How to avoid Socket Post output?


  Hello,
 
 
  This is a reply to an e-mail that you wrote on Mon, 16 Jun 2003 at
22:00,
  lines prefixed by '' were originally written by you.
 
   Oh wait..  unless that output is required somehow.  I removed the echo
   statement now my request isn't being replied to by the database
   script.
 
  For a quick fix, change:
echo fgets($fp, 128);
  to:
fgets($fp, 128);
 
  All the best,
 
  David.


 Yes but when I fail to output the socket file the request is no longer
 recieved.  No data is recorded in the POST array.  Let me explain once
more
 what I'm doing..

 1) Initiate Script-A through the browser.
 2) Script-A opens a socket connection to Script-B and posts a request.
 3) Script-B produces a formated data string based on the requst.
 4)  Script-B then opens a socket connection to Script-A and posts the
data.

 It should be seamless and it works for the most part.  But the thing is it
 outputs this generic server info which you can see in this working
example..

 http://www.helpelf.com/test.php

 You'll notice in the example that this server info.. I don't know what it
is
 becuase this is the first time I've done anything like this.. gets
outputed
 along with the request.  I can't NOT (double negative) output the request
 file becuase it contains the headers and data which make it all work.  At
 least that is what I realized a few minutes ago when I said ACK then Oh
(see
 two posts below).  :-)

 Now I'm looking for a way to avoid that server info output, without
 compromizing the functionality of the method,  if it is possible to do so.

 - Kevin

After brainstorming and experimenting for about an hour I found that I was
able to get by with a dirty hack.  I do an ereg match for each line that
comprises the server info being outputed.  These lines are not required for
the request to work so if the output matches one of the values in the
'skipit' array I ignore it, and if there are no matches then I assume it's a
required header and I output it.  Again I'm working off of very little
knowlege about how all of this actually works so I'm sure there's got to be
a real solution to this.  But for now at least the request works 100%
invisibly between these two servers and I am able to accomplish what I set
out to do.

Thanks for everybody's suggestions.  Here is the modified function...

# ===
# PostToHost($host, $path, $data_to_send)
# $host = valid domain (ie. http://www.asiostudio.com)
# $path = relative URL (ie. /myfile.php)
# $data_to_send = urlencoded key/val string (ie.
key=valkey2=val2key3=val3)
# ===
function PostToHost($host, $path, $data_to_send)
{
 $fp = fsockopen($host,80);
 fputs($fp, POST $path HTTP/1.0\n);
 fputs($fp, Host: $host\n);
 fputs($fp, Content-type: application/x-www-form-urlencoded\n);
 fputs($fp, Content-length:  . strlen($data_to_send) . \n);
 fputs($fp, Connection: close\n\n);
 fputs($fp, $data_to_send);
 while(!feof($fp))
 {
  $str = fgets($fp, 128);

  $skpit = array(
  HTTP/1.1 200 OK,
  Date:,
  Server:,
  X-Powered-By:,
  Connection:,
  Content-Type:,
  enSSL);

  $out = true;
  for($i=0; $icount($skipit); $i++)
  {
   if(eregi($skpit[$i], $str))
$out = false;
  }

  if ($out == true)
   echo $str;
 }
 fclose($fp);
}


- Kevin



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



Re: [PHP] Redirects in PHP

2003-06-13 Thread Kevin Stone
Javascript.. bah humbug.  :)

Carl, you can avoid these issues by using output buffering allowing you to
call header() whever you want in your script.

? // example..
ob_start(); // buffer output
echo this is output you'll never see;
header(Location: thankyou.html);  // header redirect
ob_end_flush(); // flush output
?

- Kevin

- Original Message -
From: Johnny Martinez [EMAIL PROTECTED]
To: 'Carl Furst' [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Friday, June 13, 2003 10:28 AM
Subject: RE: [PHP] Redirects in PHP


 try a delayed javascript redirect. location header must be in the header
 whichprevents your visitor from seeing html...thats irritating. i miss the
 ASP response.redirect which can be placed anywhere

 J

 -Original Message-
 From: Carl Furst [mailto:[EMAIL PROTECTED]
 Sent: Friday, June 13, 2003 9:23 AM
 To:
 Subject: [PHP] Redirects in PHP


 I want to do one of those redirect pages where a php script prints HTML
 saying sorry we're not here, we're redirecting you to the right location
 and then after about 2-3 seconds a new location header gets printed and
you
 are transported to the new location. I see this everywhere but don't know
 how it's done.

 I tried this by printing the Location header first and then the text and
 it just
 relocated me without seeing the text. I tried printing the text first and
 then the Location header and php complains that my header was already
sent
 and I
 can't modify it to relocate.

 How do you do this?? Is there something in the header I have to specify to
 wait before it relocates? Do I have to do it manually by printing the
text..
 tell the script to wait and then clear the header somehow and send a new
one
 (can that be done?) I looked at HTTP1.1 docs and I didn't really get
 anywhere.

 Any ideas?


 Carl.



 --
 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] Redirects in PHP

2003-06-13 Thread Kevin Stone

- Original Message -
From: Zak Johnson [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, June 13, 2003 11:00 AM
Subject: Re: [PHP] Redirects in PHP


 On 2003-06-13 10:54-0600, Kevin Stone wrote:
  Carl, you can avoid these issues by using output buffering allowing you
to
  call header() whever you want in your script.

 This will not solve the OP's problem; the header will still be output
 first, and the client will be immediately redirected.  I am curious
 though; why is everyone suggesting to use JavaScript when the following
 in the head section of the HTML document will work just as well?

   meta http-equiv=refresh
 content=3;URL=http://example.com/new-page.html; /

 Am I missing something?

 -Zak

Oh you're right I didn't read the original post.  You can still use the OB
method and redirect to an HTML page containing the sorry we're not here,
we're redirecting you to the right location message and meta refresh
without goofing up the output in the original script.  It's a straight
forward and clean transition.

- Kevin



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



Fw: [PHP] uploading files after passing vars between forms

2003-06-12 Thread Kevin Stone

- Original Message -
From: Artoo [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, June 12, 2003 10:16 AM
Subject: [PHP] uploading files after passing vars between forms


 Hey

 I'm confused!

 Do I use move_uploaded_file() or copy() and what is the first parameter of
 both in the following case:

... SNIP...
 I get  Warning: Unable to open '' for reading: No such file or
 directory...

 I did have print statements for each of the vars being passed into
 send_file.php to make sure they were seen. And they were.

 What fucntion should I use the move_uploaded_file() or copy() and what's
the
 function's first argument so that the file is copied to the server?

 Thanks

Hi,

Your problem isn't your code, it's your method.  The temp file is
automatically deleted after confirmation.php dies.  Therefore by the time
you send the tmp_name through to the send_file.php it no longer exists.
What you're going to have to do is copy() the tmp file to a permenant
location within confirmation.php.  And then post that information to
send_file.php with an added subroutine to delete the file if the user goes
back to change some info.

Confirmations are normally only used durring descructive actions so you may
consider ditching the confirmation screen all together.

HTH,
Kevin



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



Re: [PHP] sessions, IE and pop-up windows

2003-06-09 Thread Kevin Stone

- Original Message -
From: Emma Jane Hogbin [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, June 09, 2003 1:08 PM
Subject: Re: [PHP] sessions, IE and pop-up windows


 On Mon, Jun 09, 2003 at 09:26:45PM +0200, winst0n wrote:
  Hi, try to write a @session_start(); in ur popup windows... it will call
the
  last session opened by the client.

 I already do thatboth the parent and the main window call a file which
 has the session_start in it. I believe the problem is that I have two
 windows open with the same session information. According to this page,
 tha'ts a problem:

 http://ca.php.net/manual/en/function.session-start.php
 benja at benja dot be
 15-Apr-2003 12:45
 Just for info, session_start() blocks if another PHP using the same
 session is still running in background. It seems it's waiting the other
 PHP to finish... and sometimes it can be a problem. Create 2 different
 sessions by setting 2 different names : session_name() solve the problem.

 Benja.

I'll bet you're using an onLoad command to launch the popup aren't you.  Use
Output Buffering to keep stdout from flushing before the parent script dies.
If my assumption about onLoad is correct then that'll solve your problem.

HTH,
Kevin



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



Re: [PHP] sessions, IE and pop-up windows

2003-06-09 Thread Kevin Stone

- Original Message -
From: Emma Jane Hogbin [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, June 09, 2003 2:32 PM
Subject: Re: [PHP] sessions, IE and pop-up windows


 On Mon, Jun 09, 2003 at 02:27:50PM -0600, Kevin Stone wrote:
  I'll bet you're using an onLoad command to launch the popup aren't you.
Use
  Output Buffering to keep stdout from flushing before the parent script
dies.
  If my assumption about onLoad is correct then that'll solve your
problem.

 Um not onload the link looks like this:
 a onclick='openEdit(add=eventamp;cellid=10); return false;'
 onkeypress='openEdit(add=eventamp;cellid=10); return
 false;'href='edit.php?add=eventamp;cellid=10'Add an event/a

 and the javascript looks like this:
 // its goal is to EDIT any type of content in a pop-up window
 function openEdit(params) {
 var url = editsmall.php?+params;
 var ewin = window.open(url, ewin,
width=500,height=300,toolbar=0,resizable=1,scrollbars=1);
 ewin.focus();
 }

Blows that theory away.  :-)

I still believe what's happening is the edit script is being executed before
the parent script has died.  Are you doing some kind of looping background
process or something that's keeping the parent script from exiting?

As far as I know you cannot have two instances of the same session running
simultaneously.  The way I understand sessions it should be systemically
impossible to do so unless there's some kind of flock'ing option for session
files that I don't know of.  Of course that doesn't mean PHP won't let you
try.

You need to avoid this situation by - killing that parent script- before
the edit script is launched.  You can ensure this with output buffering as I
suggested before.  Becuase you're controlling the output there won't be a
button to press until the parent script has died.

ob_start();
//script here//
ob_end_flush();

HTH,
Kevin



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



Re: [PHP] solved Re: [PHP] sessions, IE and pop-up windows

2003-06-09 Thread Kevin Stone

- Original Message -
From: Emma Jane Hogbin [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, June 09, 2003 4:21 PM
Subject: [PHP] solved Re: [PHP] sessions, IE and pop-up windows


 On Mon, Jun 09, 2003 at 03:56:28PM -0600, Kevin Stone wrote:
  I still believe what's happening is the edit script is being executed
before
  the parent script has died.  Are you doing some kind of looping
background
  process or something that's keeping the parent script from exiting?

 No. In fact I have explicitly closed the session at the end of the page
 with a session_write_close(); This is called as the very last line on the
 page (even after the /html).

Calling session_write_close() at the end of the script will do nothing of
consiquence if you launch the edit script before the function is called.
You end up with the same page not found error.

  You need to avoid this situation by - killing that parent script-
before
  the edit script is launched.  You can ensure this with output buffering
as I
  suggested before.  Becuase you're controlling the output there won't be
a
  button to press until the parent script has died.

 What ended up working was passing the session ID to the pop-up window
 manually by including it in the function (and thus the URL).

I just don't see how this could have solved your problem except to do the
same thing that output buffering would have done and that is to
(essentially) queue the execution of the two scripts.  Anyone care to
explain this?

*gnashing his teeth* :D

- Kevin



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



Re: [PHP] Passing values back to form

2003-06-06 Thread Kevin Stone
Hi Daniel,

My advice is to use php sessions.  You can register both the filled and
empty values in the session after processing them.  Then you can header()
redirect normally with no fuss and extract the values from the session file
on the form page.

And here's a tip.  Set up some CSS in a switch() statement to highlight the
form fields that are left blank.  This makes for a nice user interface,
esspecially on larger forms.

Read up on sessions..
http://www.php.net/manual/en/ref.session.php

HTH,
Kevin Stone


- Original Message -
From: Daniel J. Rychlik [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, June 05, 2003 10:31 AM
Subject: [PHP] Passing values back to form


Im new to PHP coming from a background in perl devlopement.  I have a form
that a user can fill out.

On submit the values are iterated over a foreach to check for empty().  If
the an emtyp $key is found then it passes an error string to my error
function.

I have 2 php files, one that is the Form called profile.php and one that
processes the values from the form, called profileprocess.php.  There are
multiple functions in profileprocess.php.  When the header function is
called in the profileprocess.php it takes you back to the profile.php with
empty values in the fields.  I was wandering if their is a way, (which Im
sure their is) to pass back all the data that was correctly entered back to
the form, and then a nice little message that displays the error of the data
that needs to be checked by the user.  I could do this a number of ways, but
the key is not writing code that you dont have to.  Its just smarter
programming.

Any ideas, or functions I could read on in the rtFM manual is greatly
appreciated.

I appreciate you looking at this problem...
Thanks in advance,
Daniel



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



Re: [PHP] Question about fopen

2003-06-06 Thread Kevin Stone

- Original Message -
From: Jay Blanchard [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, June 06, 2003 1:13 PM
Subject: [PHP] Question about fopen


 I have a file named billed.crm.php and it fopen throws the error no
 such file or directory. It seems to have something to do with the
 multiple . in the file name. Does anyone know why?

 Thanks!

 jay

It should make no difference.  I hate to ask this but you're absolutely 100%
certain the path is correct?
- Kevin



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



Re: [PHP] Passing page referrer on as variable

2003-05-31 Thread Kevin Stone

- Original Message -
From: Mallen Baker [EMAIL PROTECTED]
To:  [EMAIL PROTECTED]
Sent: Friday, May 30, 2003 8:48 AM
Subject: [PHP] Passing page referrer on as variable


 I have a login process for an intranet that aims to allow all people to
view the intranet front page, but as soon as they click on a link, they are
taken to a login page. Once they have logged in (authentication via
sessions, drawing from info held in a mysql database) they can then go
wherever they want.

 What I am trying to get is that when they click on a link and login, the
process then forwards them on to the page whose link they clicked on, rather
than presenting them back with the home page.

 Basically, every page calls a function that checks whether the person is
logged in, and if not redirects them to the login page. The login page
register the $http_referer as a variable on the form - and when the form is
submitted (ie. login takes place) that variable is passed on, and used for a
location: instruction on success.

 The real kicker is that this worked fine when I developed it - using IE5
on my Mac (and still does). Only after a short while did I discover and
realise that it wasn't working at all on IE5.5 / 6 on Windows. But surely
these are server side operations, and if it works for one it should work for
others?

 The only thing I can think of is that IE5.5 on Windows doesn't pass on the
referer info in the same way?? In which case, is there an alternative way of
capturing this that would withstand the differences?

 Thanks - Mallen

print_r($_SERVER) to see what values are available to you.

If HTTP_REFERER is blank, which is entirely possible, try HTTP_HOST and
SCRIPT_NAME and pass those to your from the intranet page to your login
script instead of getting the referrer after you've redirected to the login
script.

- Kevin



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



Re: [PHP] reserver variable names

2003-05-31 Thread Kevin Stone

- Original Message -
From: Lee Doolan [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, May 30, 2003 10:49 AM
Subject: [PHP] reserver variable names



 I could swear that I once saw a statement to the effect that
 certain variable names were reserved in PHP.  Something along
 the lines of

 ''variable names starting with two underscores (__) are
 reserved... ''

 Is anyone else aware of this or do I have a circuit crossed
 somewhere?

 thanx
 --lee

Predefined constants:
http://us3.php.net/manual/en/language.constants.predefined.php?PHPSESSID=3ff
34aabf314aabe3ba7b35de816ac94

- Kevin



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



Re: [PHP] array count() oddity

2003-05-31 Thread Kevin Stone
- Original Message -
From: Guru Geek [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, May 30, 2003 3:15 PM
Subject: [PHP] array count() oddity


 Hello,

 I have a mysql statement listed below.  The table contains about 100
 rows of information.  Only one row matches the $criteria.  Can anyone
 tell me why the count($myrow) is 8?  Shouldn't it be 4 (id, vanNumber,
 origin, destination)?

 $criteria = 02-25-2003;
 $result = mysql_query(SELECT id, vanNumber, origin, destination FROM
 thisHereTable WHERE date='$criteria');
 $myrow = mysql_fetch_array($result);

 And when I run the rest of the script, it prints out the results 8 times
 instead of once
 for ($count=0; $countcount($myrow); $count++)
 {
 print p.$myrow[vanNumber];
 print br.$myrow[origin]. to .$myrow[destination];
 }

 THANKS,
 Roger

Hi,

mysql_fetch_array(); produces two arrays, one indexed and one associative,
thus count() will return twice the expected number.  Use mysql_fetch_row()
to retrieve a single indexed array or mysql_fetch_assoc() to retrieve a
single associative array.

Refer to the documentation:
http://us2.php.net/manual/en/function.mysql-fetch-array.php

- Kevin



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



Re: [PHP] Opinion on a method....

2003-04-04 Thread Kevin Stone

- Original Message -
From: Jon Haworth [EMAIL PROTECTED]
To: Dan Joseph [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Friday, April 04, 2003 12:19 PM
Subject: RE: [PHP] Opinion on a method


 Hi Dan,

  I would like to get some opinions here on a method I'm doing
  to grab connect information for a mysql connection. Currently
  I am doing:
$pinfo = fopen (/director1/directory2/filename.ini,r);

 Does this filename.ini contain the code to connect to your database? If
so,
 I usually do two things with this file:

 1. put it outside the document root, so users can't browse to it
 2. put any code that might output something (an error message, for
example)
 inside a function, so even if it is run, nothing will happen - you need to
 include() it and then call the function yourself.

 If it's just connection information, with no code (I'm a bit confused by
the
 .ini extension :-) then just make sure it's somewhere outside your
document
 root.

  Is XML a solution?

 I don't think XML is inherently any more secure than plain text - it's all
 down to how you store and transmit the data.

 Cheers
 Jon

I will add in this case that include() is going to be no less secure than
fopen(), plus it's going to be a whole hell of a lot easier.

- Kevin



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



Re: [PHP] Session Variables and Posting

2003-04-04 Thread Kevin Stone

- Original Message -
From: Van Andel, Robbert [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, April 04, 2003 4:00 PM
Subject: [PHP] Session Variables and Posting


 Is there a way that I can prevent session variables getting values from
 query strings.  I want them to receive values only from posted forms.


 Robbert van Andel


You should be accessing the $_GET, $_POST and $_SESSION arrays directly
rather than relying on request vars to be parsed automatically.  This will
allow you to be much more discriminatory in your code.

Read up on Predefined Variables in the manual..
http://www.php.net/manual/en/reserved.variables.php

HTH,
Kevin



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



Re: [PHP] mysql_num_rows

2003-04-04 Thread Kevin Stone
Uh. no that can't be right becuase  mysql_query() returns a pointer not an
array.  The variable does contain a string refering to the pointer ID but
that's about all the information you're going to disseminate from print_r();
--
Kevin

- Original Message -
From: [EMAIL PROTECTED] [EMAIL PROTECTED]
To: Mike Tuller [EMAIL PROTECTED]; J J [EMAIL PROTECTED]
Cc: php mailing list list [EMAIL PROTECTED]
Sent: Friday, April 04, 2003 4:18 PM
Subject: Re: [PHP] mysql_num_rows


 Someone helped me out with this to see exactly what the query is
 returning...

 echo pre the Query: ; print_r ($select_result); echo /pre;

 This should show you exactly what the result is getting...

 /T

 on 4/4/03 4:49 PM, Mike Tuller at [EMAIL PROTECTED] wrote:

  I can't believe I forgot that. time to go home for the week.
 
  thanks.
 
  On Friday, April 4, 2003, at 04:28 PM, J J wrote:
 
  oh and your SQL statement is wrong:
 
  SELECT * FROM table WHERE  you are missing the
  FROM...
 
 
 
  --- Mike Tuller [EMAIL PROTECTED] wrote:
  I can't get mysql_num_rows to work for some reason.
  Here is a snippet
  of what I have
 
 
  $department_name = $_POST['department_name'];
 
  $select_query = SELECT * WHERE department_name =
  '$department_name';
  $select_result = mysql_query($select_query,
  $db_connect);
  $select_total_rows = mysql_num_rows($select_result);
 
  if ($select_total_rows1)
  {
  $insert_query =  insert into departments
  (department_name)
  values
  ('$department_name');
 
  mysql_query($insert_query, $db_connect) or die
  (mysql_error());
 
 
  I am getting back an error mysql_num_rows():
  supplied argument is not a
  valid MySQL result resource. I have looked over it
  again and again, and
  can't see what is wrong. Can anyone else see where
  the problem might be?
 
  Mike
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
  __
  Do you Yahoo!?
  Yahoo! Tax Center - File online, calculators, forms, and more
  http://tax.yahoo.com
 
 






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





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



Re: [PHP] mailing forms and input into MySQL

2003-04-02 Thread Kevin Stone
There is no trick to it.  Query the database, build a string, send it off.

?
$query = SELECT * FROM mytable;
$result = mysql_query($query);
while($row = mysql_fetch_assoc($result))
{
foreach ($row as $column = $value)
   {
$body .= $column : $value\n;
   }
$body .= \n;
}

mail($to, $subject, $body, $headers);
?

HTH,
Kevin

- Original Message -
From: Scott Miller [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, April 02, 2003 12:05 PM
Subject: [PHP] mailing forms and input into MySQL


Hi all,

   I have a current php script that allows me to add/remove customer
information from a particular MySQL Database.  What I would like to do, is
when an employee adds a customer, have some (if not all) of that information
e-mailed to a particular e-mail address.

   I've created scripts that e-mail info, and ones that just enter info into
a database, but have not attempted combining them.

   Anyone have any ideas, or is anyone doing this?  If so, could you give me
a quick how-to or point me in the direction of some online documentation?

Thanks,
Scott Miller



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



Re: [PHP] Humour in programming?

2003-04-01 Thread Kevin Stone
The image is grabbed from their servers.

- Original Message -
From: Aaron Gould [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED];
[EMAIL PROTECTED]
Sent: Tuesday, April 01, 2003 1:36 PM
Subject: Re: [PHP] Humour in programming?


 Hehe, I though something was wrong with my machine when I checked out
 phpinfo() on one of my boxes today.  It didn't even occur to me that it
 might be related to April Fools.

 I know it's usually the PHP logo, but how is that picture generated
anyway?

 --
 Aaron Gould
 Web Developer
 Parts Canada


 - Original Message -
 From: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Sent: Tuesday, April 01, 2003 3:32 PM
 Subject: RE: [PHP] Humour in programming?


  Yeah...check out the phpinfo() function on your machine
 
  ? phpinfo(); ?
 
  -Original Message-
  From: Liam Gibbs [mailto:[EMAIL PROTECTED]
  Sent: Tuesday, April 01, 2003 3:36 PM
  To: php list
  Subject: [PHP] Humour in programming?
 
 
  Sorry if this is OT, but... heheheh... has anyone taken a look at the
  PHP site? Check out the upper-left corner. Who is that? Nice to know
  the guys at PHP can have a laugh.
 
 
  --
  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] Date Problem - Last Day Of Month

2003-03-31 Thread Kevin Stone

- Original Message -
From: Vinesh Hansjee [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, March 31, 2003 6:55 AM
Subject: [PHP] Date Problem - Last Day Of Month


 Hi there, can anyone tell me how to fix my code so that on the last day of
 the month, my code doesn't repeat the months...
 What the code suppose to do is, makes a drop down box from which you can
 select the month, and if its the current month
 the box is already selected.

 select name=month

 ?

 for ($i=1; $i=12; $i++) {
  if ($i == date(m)) {
   print option selected value=\. $i . \ .
 date(F,mktime(0,0,0,$i,date(d),date(Y))) . /option;
  } else {
   print option value=\. $i . \ .
 date(F,mktime(0,0,0,$i,date(d),date(Y))) . /option;
  }
 }

 ?

 /select

 Thanks
 Vinesh


Vinesh, there's a fundemental flaw in your logic.  The date(d) input will
fail to produce a reliable list if it is executed on any day after the 28th
of the month.  Since today is the 31st obviously this is going to cause some
problems becuase any month that ends on the 30th or earlier will return plus
one the month.  So February will return March, April willl return May, and
so on.  If you wait until tommorrow (the 1st) your function will magically
work.  :)

One way to fix this is to build your own array of month names and reference
that instead of using the date() function.

$months = array(1=January, 2=February, 3=March, 4=April,
5=May, 6= ... and so on...);

for($i=1; $i=12; $i++)
{
$selected = ;
if ($i == date(m));{$selected = SELECTED;}
echo option $selected value=\${months[$i]}\\n;
}

HTH,
Kevin




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



Re: [PHP] str_replace() problem

2003-03-31 Thread Kevin Stone

- Original Message -
From: Ren Fournier [EMAIL PROTECTED]
To: php [EMAIL PROTECTED]
Sent: Monday, March 31, 2003 1:52 PM
Subject: [PHP] str_replace() problem


 I am performing a str_replace() on a large string, and everything works
 fine, except that two of the elements I'm searching for (and replacing)
 have the same first letters. To keep it the issue clear, here's a
 simple example of what I'm talking about:

 Blue
 Blueberry

 Now, if I use:

 str_replace(Blue,Red,$paragraph);
 str_replace(Blueberry,Strawberry,$paragraph);


 ...all occurrences of Blueincluding Blueberrywill be replaced with
 Red. The result will be something like:

 Red
 Redberry

 ...But what I want is...

 Red
 Strawberry

   I need str_replace to somehow only search for a complete occurrence of
 each item. How do I do that? I've read the docs, and I just can't see
 any examples.

 Thanks.

 ...Rene

 ---
 Ren Fournier,
 [EMAIL PROTECTED]

You might be able to be more precise using ereg_replace().  But I donot know
the regular expression to make it happen.  Or if your situation allows it
you can hack it by appending a single space on the end of each input.
Either way what you need to do is give the script more information about
exactly what you want to replace.

echo str_replace(Blue , Red , $paragraph);

HTH,
Kevin



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



Re: [PHP] Files uploads problem

2003-03-31 Thread Kevin Stone

- Original Message -
From: Adrian Greeman [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, March 31, 2003 3:04 PM
Subject: [PHP] Files uploads problem


 I am a learner in PHP - I have been using Larry Ullman's Peachpit
beginners
 book which I have found useful to take me through the basics.

 But the examples were written before the general applicaton of the new
 $_POST, $_GET and similar arrays. It has been valuable learning to change
 the code for that (I use version 4.2. (and a bit) and Larry Ullman  is
very
 helpful on his own website forum with readers' queries on the book
examples.

 But I am having real trouble making a file upload programme work. It needs
 substitution of $FileName given in the example with $_FILES array values
 which I have done and use of isset instead of a raw if().  But I still
 cannot get it to work

 May I put the code here and ask if anyone can tell me the problme.
 Incidentally I use Windows ME with Apache 2.0.36 and PHP 4.2.. The files
 upload is on with a max size of 2M and no specific directory given for a
 temp store (the INI says it will use the default directory.)

 My test out script is as follows::-


 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN

 html
 head
 titleUploader/title
 /head
 body
 ?php

 if(isset($_FILES['File'])) {

 $File=$_FILES['File'];
 $File_name=$_FILES['File']['name'];
 $File_size=$_FILES['File']['size'];


 echo (p$File_name/pbr /\n);
 echo ($_FILES['File']['name']);

 print(File name: $File_namep /\n);
 print(File size: $File_sizep /\n);




 if (copy ($_FILES[File][tmp_name],users/$File_name)) {
print(The file was sucessfully uploaded.p /\n);
}else{
print(Your file could not be copied unfortunately.p /\n);
}

  unlink($File);
  }

  echo (Upload a file to the server.);
  echo (Form action=\FileUpload.php\ method=POST
 enctype=\multipart/form-data\\n);
  echo (File: input type=file name=\File\br /\n);
  echo (input type=submit name=\submit\ value=\Press here to
 upload.\br // form\n);


 //test whether anything prints for the FILES array
 echo (pemfont color=\green\Can I get it to print the variable
 outside the conditional? i.e.  this one 
 {$_FILES['File']['name']}./font/em/p\n);



 //set any old variable and print it to be sure basics work
 $TestPrint=pbigfont color=\purple\Print this out
 then./font/big/p.\n;

 echo($TestPrint);

 ?
 /body
 /html


 Is there something I've missed in the script. Or perhaps Apache 2 is the
 problem?
 Thanks

Couple of HTML problems to point out.  Where you have br // form\n, /
form is an invalid tag.  Remove the space.  Also where you have
enctype=\multipart/form-data\ you need quotes after the slashes (ie. \)
otherwise PHP is going to assume that you want the litteral slash in the
HTML.

Niether of these errors will return visable error code but both will result
in you not being able to submit the form.

Also when you go to unlink($File); you're going to see an error becuase
$File is not a valid file path, it's an array.  Besides you shouldn't worry
about trying to clean up the temp file.  PHP will do it automatically when
the script exists.  :-)

HTH,
Kevin



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



Re: [PHP] Apache vs. IIS

2003-03-28 Thread Kevin Stone
As much as I disaprove of off topic posts... that was hillarious.  LOL
- Kevin

- Original Message - 
From: Richard Whitney [EMAIL PROTECTED]
To: php [EMAIL PROTECTED]
Sent: Friday, March 28, 2003 2:30 PM
Subject: [PHP] Apache vs. IIS


 How do you take out the Iraqi Intelligence Service?
 
 -- 
 Richard Whitney   *
 Transcend Development
 Producing the next phase of your internet presence.
 [EMAIL PROTECTED]   *
 http://xend.net*
 602-971-2791
   * *   *
 *  *  *__**
  _/  \___  *
  *  /   *\**
   */ * *  \
 **/\_ |\
  /   \_  /  \
 /  \/\
/  \ 
   /\
  /  \
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 



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



Re: [PHP] Re: Include Question

2003-03-28 Thread Kevin Stone
Guys I would say looping include()'s is just a bad idea all together.  It
can get you into some gritty situations.  For example it would be very easy
to end in an infinte loop, or overwrite variables, or just confuse the heck
out of the PHP parser.  I recommend you do a header() redirect rather than
include() at the end of the script.  Just my opinion.
- Kevin

- Original Message -
From: Tim Burden [EMAIL PROTECTED]
To: Beauford.2002 [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Friday, March 28, 2003 1:36 PM
Subject: [PHP] Re: Include Question


 You could try this instead:

  Checklogin.php

  if (!$name || !password) {
 $message = $enter_info;
  }

  if ($message){
 include (login.php);
 echo $message;
 exit;
  }

 But the way you had it should work, you might just need to
 global $message;
 right before the echo in login.php in case it is inside a function

 - Original Message -
 From: Beauford.2002 [EMAIL PROTECTED]
 Newsgroups: php.general
 To: PHP General [EMAIL PROTECTED]
 Sent: Thursday, March 27, 2003 3:47 PM
 Subject: Include Question


  Hi,
 
  First, I fixed my other problem of the stack overflow by moving the
files
  back to the root directory (although I would rather have them in a login
  directory). Anyway, I have a question regarding the include function. I
 have
  a login script in a file called login.php - in this file it includes
  checklogin.php and loginerrors.php. If the user inputs an incorrect
login
 I
  assign $messages the appropriate error from loginerrors, then I
re-include
  login.php where I want to show the error message, but no matter what I
do
  the error message will not show up.
 
  Example.
 
  Login.php 
 
  Enter your Name:
  Enter Your Password:
  if ($message) { echo $message; }
 
  Checklogin.php
 
  if (!$name || !password) {
  $message = $enter_info;
  include (login.php);
  exit;
  }
 
  Any help is appreciated.
 
 


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



Fw: [PHP] post method with fopen

2003-03-28 Thread Kevin Stone

- Original Message -
From: Lambert Antonio [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, March 24, 2003 8:16 PM
Subject: [PHP] post method with fopen


 if it possible to send a post data when using fopen?

 --
 Lambert Antonio
 Re:Site WebWorks and System Solutions

You can open a file, write to a variable, and then send that through a POST
request.  Is this what you're asking?
- Kevin



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



Re: [PHP] register globals :|

2003-03-26 Thread Kevin Stone

- Original Message -
From: Sebastian [EMAIL PROTECTED]
To: php list [EMAIL PROTECTED]
Sent: Wednesday, March 26, 2003 3:45 PM
Subject: [PHP] register globals :|


 Is there any work-around to get a scipt that requires globals to be ON
work
 when globals is OFF?

 Its a small script so it shouldn't be too hard... I just don't know what
to
 look for or what has to be changed so it works again... (since i moved
 servers...)

 Thanks for any help.

 cheers,
 - Sebastian


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

You'll find examples at the bottom of the page of some code that you can add
to the script.  Or if you know where the input for the script is coming from
then you can use extract($_POST) or extract($_SERVER), or whatever, at the
top of the script.

HTH,
Kevin



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



Re: [PHP] Grabbing image information from an html string

2003-03-25 Thread Kevin Stone
You need to use preg_match_all() and a more greedy expression that is not
case sensitive..

preg_match_all('/src=(\S*)/i', $html, $matches);
$image_array = $matches[1];

HTH,
Kevin



- Original Message -
From: Dan Rossi [EMAIL PROTECTED]
To: Luis Lebron [EMAIL PROTECTED]; Php-General (E-mail)
[EMAIL PROTECTED]
Sent: Tuesday, March 25, 2003 12:39 PM
Subject: RE: [PHP] Grabbing image information from an html string


 if (preg_match('/(href|HREF)=?(\S+\.(jpg|png))?/',$line, $matches)){
 $filename[] = $matches[2];
 }

 -Original Message-
 From: Luis Lebron [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, March 26, 2003 7:07 AM
 To: Php-General (E-mail)
 Subject: [PHP] Grabbing image information from an html string


 Let say I have an html string that looks like this:

 bTitleb
 img src=graphics/image1.jpgfoo bar bar fooimg
 src=graphics/image2.jpgSome more text.

 I would like to pull the image filenames from the html and end up with
 something like this

 $images=array(image1.jpg, image2.jpg)

 How can I do this?

 thanks,

 Luis R. Lebron
 Project Manager
 Sigmatech, Inc


 --
 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] variables??

2003-03-25 Thread Kevin Stone

- Original Message -
From: Rick Gaine [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, March 25, 2003 1:25 PM
Subject: [PHP] variables??



 I'm having a problem with form data being recognized by a php script.
 If I send information with a GET the variable data appears in $GET[var]
 but not $var.  I just upgraded to php4.2.2 and then 4.3.1 and I've been
 having this problem.  I didn't have the problem with older versions.  I
 suspect it is a configuration option I missed some place, just don't know
 what one.  Also, the new 4.3.1 and one of my scripts fails because fopen()
 can't find a file, yet this works on the older version.  Any help is
 appreciated.

 Rick

Rick, this is an option in your php.ini file called register_globals.  Set
this to ON if you want this feature.

HTH,
Kevin



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



Re: [PHP] Default setting garbage

2003-03-25 Thread Kevin Stone

- Original Message -
From: Liam Gibbs [EMAIL PROTECTED]
To: php list [EMAIL PROTECTED]
Sent: Tuesday, March 25, 2003 2:10 PM
Subject: [PHP] Default setting garbage


Why is it that when I send call this function:
function GetNextDate($whichfriday, $month = , $frequency = 1, $basedate =
)

with this line:
GetNextDate(4, 2003-03, 5);

that $frequency ends up ? Whether I set it myself when I call the
function, or I leave it blank and let the function set it itself, it ends up
with nothing in it. empty() returns 1, while isset() returns nothing on
this.



Good question.  Are you certain your not misspelling frequency when you
check it or try to look at it?  Sorry if that sounds insulting.. just trying
to search for the simplest explaination.  : 
- Kevin



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



Re: [PHP] mail() Bcc:

2003-03-24 Thread Kevin Stone

- Original Message -
From: Oden Odenius [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, March 24, 2003 1:44 PM
Subject: [PHP] mail() Bcc:


 How can send bcc: with mail()?



 --
 Programmers are tools for convert coffeine into code... (c) Oden

From, CC and BCC are headers to be set in the fourth parameter of the mail()
function.  Headers must be spearated by end-of-line characters.

$headers = From: [EMAIL PROTECTED]
CC: [EMAIL PROTECTED]
BCC: [EMAIL PROTECTED];

mail($to, $subject, $body, $headers);

There are many other headers that you may find useful that are just as easy
to add through the mail() function.

HTH,
Kevin



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



Re: [PHP] File uploads...

2003-03-24 Thread Kevin Stone
- Original Message -
From: Al [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, March 24, 2003 1:14 PM
Subject: [PHP] File uploads...


 Trying to do what should be rather simple and I have done before.
 Maybe I am just overlooking the obvious but this is the error I get...

 Warning: Unable to open 'Array' for reading: No such file or directory
 in /var/www/html/nepso_noah/NEPSO/includes/reporters/update_profile.inc
 on line 33

 This 'Array' is just the value of the name from the form field for the
 file upload...
 Here are the pieces of the form that seem to matter...

 form name=\profile\ method=\post\
 action=\$PHP_SELF?action=update_profile\
 enctype=\multipart/form-data\

 input type=\hidden\ name=\MAX_FILE_SIZE\ value=\50\
 input type=\file\ name=\photonew\

 Now when I call to the submitted data

 copy($photonew, images/reporters/$user_id/$photonew_name);

 And for error checking I echo the following

 $photonew -- This results as Array -- though this should be the tmp
path???
 $photonew_name -- This gives me the file name
 etc...
//snip//
 Thanks
 --Al

The uploaded file's path is stored in $_FILES['photonew']['tmp_name'];  You
could extract($_FILES['photonew']) for convenience sake and access with
$tmp_name;
- Kevin



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



Re: [PHP] mail() Bcc:

2003-03-24 Thread Kevin Stone

- Original Message -
From: CPT John W. Holmes [EMAIL PROTECTED]
To: Kevin Stone [EMAIL PROTECTED]; Oden Odenius
[EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Monday, March 24, 2003 3:51 PM
Subject: Re: [PHP] mail() Bcc:


   How can send bcc: with mail()?
  
  From, CC and BCC are headers to be set in the fourth parameter of the
 mail()
  function.  Headers must be spearated by end-of-line characters.
 
  $headers = From: [EMAIL PROTECTED]
  CC: [EMAIL PROTECTED]
  BCC: [EMAIL PROTECTED];
 
  mail($to, $subject, $body, $headers);
 
  There are many other headers that you may find useful that are just as
 easy
  to add through the mail() function.

 I don't think that'll work. The concept is right, but the way you are
typing
 it, you're actually adding in two line breaks between each header. That's
 going to cause your CC: and BCC: header to show up in the body of the
 message because anything after two consecutive line breaks is considered
the
 body.

 You can do it like this:

 $headers = From: [EMAIL PROTECTED]: [EMAIL PROTECTED]:
 [EMAIL PROTECTED];

 or

 $headers = From: [EMAIL PROTECTED]
 CC: [EMAIL PROTECTED]
 BCC: [EMAIL PROTECTED];

 Also, you may want to check the regs on the capitalization of the headers.
 If I'm wrong, someone please let me know, but some servers may only accept
 Bcc: instead of bcc: or BCC:, etc... ?? Does anyone know if that matters?
If
 it does, is it only dependant upon the sending SMTP server and not any
 servers the message is sent through or the receiving server?

 Thanks.

 ---John Holmes...

\r\n should be used (esspecially in email!) to be compatible with all
operating systems.  However there were mistakes in my example.  Notedly the
string I supplied would break the header with superfulous \n end-of-line
characters.  The safe syntax would be..

$headers = From: [EMAIL PROTECTED];
$headers .= CC: [EMAIL PROTECTED];
$headers .= BCC: [EMAIL PROTECTED];

In one continuous line.  I do believe headers are case insensitive.

HTH,
Kevin



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



Re: [PHP] mail() Bcc:

2003-03-24 Thread Kevin Stone

- Original Message -
From: Kevin Stone [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, March 24, 2003 4:17 PM
Subject: Re: [PHP] mail() Bcc:



 - Original Message -
 From: CPT John W. Holmes [EMAIL PROTECTED]
 To: Kevin Stone [EMAIL PROTECTED]; Oden Odenius
 [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Sent: Monday, March 24, 2003 3:51 PM
 Subject: Re: [PHP] mail() Bcc:


How can send bcc: with mail()?
   
   From, CC and BCC are headers to be set in the fourth parameter of the
  mail()
   function.  Headers must be spearated by end-of-line characters.
  
   $headers = From: [EMAIL PROTECTED]
   CC: [EMAIL PROTECTED]
   BCC: [EMAIL PROTECTED];
  
   mail($to, $subject, $body, $headers);
  
   There are many other headers that you may find useful that are just as
  easy
   to add through the mail() function.
 
  I don't think that'll work. The concept is right, but the way you are
 typing
  it, you're actually adding in two line breaks between each header.
That's
  going to cause your CC: and BCC: header to show up in the body of the
  message because anything after two consecutive line breaks is considered
 the
  body.
 
  You can do it like this:
 
  $headers = From: [EMAIL PROTECTED]: [EMAIL PROTECTED]:
  [EMAIL PROTECTED];
 
  or
 
  $headers = From: [EMAIL PROTECTED]
  CC: [EMAIL PROTECTED]
  BCC: [EMAIL PROTECTED];
 
  Also, you may want to check the regs on the capitalization of the
headers.
  If I'm wrong, someone please let me know, but some servers may only
accept
  Bcc: instead of bcc: or BCC:, etc... ?? Does anyone know if that
matters?
 If
  it does, is it only dependant upon the sending SMTP server and not any
  servers the message is sent through or the receiving server?
 
  Thanks.
 
  ---John Holmes...

 \r\n should be used (esspecially in email!) to be compatible with all
 operating systems.  However there were mistakes in my example.  Notedly
the
 string I supplied would break the header with superfulous \n end-of-line
 characters.  The safe syntax would be..

 $headers = From: [EMAIL PROTECTED];
 $headers .= CC: [EMAIL PROTECTED];
 $headers .= BCC: [EMAIL PROTECTED];

 In one continuous line.  I do believe headers are case insensitive.

 HTH,
 Kevin

Sorry John I wrote before I read.  I misunderstood what you were correcting
me about.  I  see now that you nailed my mistake.
- Kevin



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



Re: [PHP] problem with page loading

2003-03-21 Thread Kevin Stone

- Original Message -
From: Amanda McComb [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, March 21, 2003 12:11 PM
Subject: [PHP] problem with page loading


 Hello!

 I am working on a site that I thought was working just fine - I tested it
 in Netscape 7 and IE.  However, several people trying to access it using
 Netscape 4.7 have been having problems.  Specifically, there is a search
 that returns linked results.  The link transfers the result's id to the
 page that displays all of the data.  That works fine IF the result person
 has no books assigned to them.  If they do, the page is blank.  However,
 if you hit return or refresh the page, everything shows up fine.  If you
 view the source, all of the info is there, but it's just not displaying.

 Here is the link to the site:

 http://tillergroup.com/test/

 This person has a book, and therefore produces the problem (on Netscape
 4.7):

 http://tillergroup.com/test/speaker_full.php?speaker_id=29

 This person does not have a book, and the page loads fine without
 refreshing:

 http://tillergroup.com/test/speaker_full.php?speaker_id=60

 The page is huge, so I hate to send the code for the whole page unless
 someone wants to see it.

 I am desperate for help!

 Thanks!!

 Amanda


Well I can tell you that you're commenting out the lower half of the page
source with this..  !--NETSCAPE--!.  The correct syntax for HTML comments
is !-- code --.  I can also tell you that your first table is invalid.
Apparently it doesn't have a closing tag but that's as much as my validator
will tell me.

Perhaps these problems are associated with the missing info?

- Kevin



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



Fw: [PHP] php and javascript

2003-03-21 Thread Kevin Stone

- Original Message -
From: shaun [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, March 21, 2003 12:25 PM
Subject: [PHP] php and javascript


 Hi,

 I'm not sure if this is a PHP or a JavaScript question but I have found
the
 following code to enable me to select all of the checkboxes on my form.

 SCRIPT LANGUAGE=JavaScript
 !-- Begin
 var checkflag = false;
 function check(field) {
 if (checkflag == false) {
   for (i = 0; i  field.length; i++) {
   field[i].checked = true;}
   checkflag = true;
   return Uncheck all; }
 else {
   for (i = 0; i  field.length; i++) {
   field[i].checked = false; }
   checkflag = false;
   return Check all; }
 }
 //  End --
 /script

 form name=mon_formulaire action= method=post
 table
 bWhere do you connect to the Internet from?/bbr
 input type=checkbox name=list value=1Homebr
 input type=checkbox name=list value=2Officebr
 input type=checkbox name=list value=3Friends' homebr
 input type=checkbox name=list value=4Post officebr
 input type=checkbox name=list value=5Internet Cafébr
 br
 input type=button value=Check all
 onClick=this.value=check(this.form.list)
 /form

 The problem is that in the example all of the boxes are called list and i
 need to name each checkbox on my form with a different user_id so that i
can
 collect the data sent from the form, is there a way around this?

 Thanks in advance for any advice offered.


I see a number of possible solutions through PHP.  The way that I would
handle this is to give each group its own numerical id.  So something like..

Group #1
input type=checkbox name=list_1[] value=1Homebr
input type=checkbox name=list_1[] value=2Officebr
input type=checkbox name=list_1[] value=3Friends' homebr

Group #2
input type=checkbox name=list_2[] value=1Homebr
input type=checkbox name=list_2[] value=2Officebr
input type=checkbox name=list_2[] value=3Friends' homebr

Then in my script each group array can be accessed with something like this.

?
$num_groups = 2;
for($i=1; $i=$num_groups; $i++)
{
 echo bGROUP #$i/bbr;
 for($j=0; $jcount($_POST['list_'.$i]); $j++)
 {
  echo $_POST['list_'.$i][$j].br;
 }
}
?

If you need to define each group with a userid then you cuold store those
ids in an array and use ereg() in a loop to parse the groups.

HTH,
Kevin



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



Re: [PHP] Increase a month

2003-03-21 Thread Kevin Stone
echo date(F); // prints March
echo date(F, strtotime(month + 1)); // prints April

- Kevin


- Original Message - 
From: Boaz Yahav [EMAIL PROTECTED]
To: shaun [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Friday, March 21, 2003 1:44 PM
Subject: RE: [PHP] Increase a month


 This can help : 
 
 http://www.weberdev.com/index.php3?GoTo=get_example.php3?count=3541
 
 Sincerely
 
 berber
 
 Visit http://www.weberdev.com/ Today!!!
 To see where PHP might take you tomorrow.
 
 
 -Original Message-
 From: shaun [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, March 20, 2003 4:00 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Increase a month
 
 
 Hi,
 
 could someone tell me why this:
 
 ?php
$month = date(m);
echo \$month: .date(F,strtotime($month)).br;
$month = $month + 1;
echo \$month: .date(F,strtotime($month)).br;
 ?
 
 outputs this:
 
 $month: March
 $month: March
 
 surely it should be:
 
 $month: March
 $month: April
 
 Thanks in advance for your help.
 
 
 
 -- 
 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] Sessions question

2003-03-21 Thread Kevin Stone
This is one of those rare things in programming that can only be done one
way.  Absolutely the only way to kill the session when a user leaves your
site is to go through a script and then redirect after the session has been
destroyed.  For this to work every outgoing link on your website will have
to point to a script.  Then you'll pass the redirect url or url id (that
referse to a url in your database) through the link and redirect after
session_destroy() has killed the session.

The link can look like this:
a href=exit.php?url=http://www.thiersite.com;www.theirsite.com/a

The script will look something like this:
? // exit.php
session_start();
session_destroy();
header(Location: .$_POST['url']);
?

Keep in mind if you want to do this then the user will not be able to use
his/her back button in order to return to your website unless you define an
additional redirect in a conditional that states if the session is not
active then go here.

Voodoo.  *LOL*

- Kevin


- Original Message -
From: Beauford.2002 [EMAIL PROTECTED]
To: Ford, Mike [LSS] [EMAIL PROTECTED]; 'Justin French'
[EMAIL PROTECTED]; PHP General [EMAIL PROTECTED]
Sent: Friday, March 21, 2003 12:56 PM
Subject: Re: [PHP] Sessions question


 So is there anyway to do this - perl, javascript, voodo?


 - Original Message -
 From: Ford, Mike [LSS] [EMAIL PROTECTED]
 To: 'Justin French' [EMAIL PROTECTED]; Beauford.2002
 [EMAIL PROTECTED]; PHP General [EMAIL PROTECTED]
 Sent: Friday, March 21, 2003 11:04 AM
 Subject: RE: [PHP] Sessions question


   -Original Message-
   From: Justin French [mailto:[EMAIL PROTECTED]
   Sent: 21 March 2003 15:59
  
   on 22/03/03 2:27 AM, Beauford.2002 ([EMAIL PROTECTED]) wrote:
  
What about cookies - someone said if you put no time limit
   on a cookie it
dies when you leave the site - I'm not sure about this, but
   any help is
appreciated.
  
   I think it's defined as when the browser is closed, not
   when the browser
   is no longer in your domain
 
  That is correct.
 
  Cheers!
 
  Mike
 
  -
  Mike Ford,  Electronic Information Services Adviser,
  Learning Support Services, Learning  Information Services,
  JG125, James Graham Building, Leeds Metropolitan University,
  Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
  Email: [EMAIL PROTECTED]
  Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211
 
  --
  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] Session Not Working

2003-03-21 Thread Kevin Stone
Why is there a space between = = ?  And where is $user_data and
$database_data coming form?  First thing I would recommend you do is print
out those variables to make sure they actually contain the information
you're expecting.

- Kevin


- Original Message -
From: Guru Geek [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, March 21, 2003 2:46 PM
Subject: Re: [PHP] Session Not Working


 ok, I tried this:
 session_start();
 if ($user_data = = $database_data) {
 $_SESSION['verified_user']=1;
 header(Location:http://www.myserver.com/main.php;);
 exit;

 and it still doesn't work...hehe

 anymore suggestions?

 Thanks,
 Roger

 Mike wrote:

  you forgot session_start at the beginning of the login script
 
  On Fri, 2003-03-21 at 12:31, Guru Geek wrote:
   Hello,
  
   I'm trying to use sessions for the first time.
  
   I have a log in script that gets the user to enter their name and
   password.  Then the script compares the entered data to a database.
If
   the entered data matches whats in the database then the user is
granted
   access to the main php script.
  
   basically my code in the log in script is this:
  
   if ($user_data = = $database_data) {
   $_SESSION['verified_user']=1;
   header(Location:http://www.myserver.com/main.php;);
   exit;
  
   The opening code in my main.php script is this:
   session_start();
   if ( isset($_SESSION['verified_user'])) {
   run the whole script
   }else {
   return to log in page
   exit;
   }
  
   Anyone care to clue me in as to why I'm always sent back to the log in
   page even when the log in is correct?
  
   Did I miss the session boat all together?  Perhaps I'm not grasping it
   at all..
  
   Thanks,
   Roger
  
  
  
  
  



 --
 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] detecting end of line - php 4.1.2

2003-03-21 Thread Kevin Stone
- Original Message -
From: Paul Godard [EMAIL PROTECTED]
To: PHP [EMAIL PROTECTED]
Sent: Friday, March 21, 2003 3:53 PM
Subject: [PHP] detecting end of line - php 4.1.2


 Hi

 I am trying to get php 4.1.2 to read a Mac file (exported from
 FileMaker Pro) and split it into different lines  using the following
 but php does not recognize the end of line.  For some tech reason I
 cannot upgrade php now but I need to be able to read my Mac files
 now.  What is the easiest : edit the Mac file and replace the end of
 line or modify the script below?  In any case I need help to know
 exactly what to do.

   // first read the entire file
$file = file($Export_ImageBank);

// process each line in turn
foreach ($lines as $line_num = $line) {


 // first split tab-separated fields

list($Image_ID,$Mark_Check,$Image_Good,$Image_VeryGood,$Image_ShortCodeOrgan
,$Image_Number,$Image_SubFolder,$Image_Format,$Image_MaxPxWidth,$Image_MaxPx
Height,$Image_Year,$Image_Month,$Image_Subject,$Image_CodeCountry,$Image_Reg
ion,$Image_Location,$Image_Collection,$Image_Caption,$Image_CodePrice)
 = explode(\t, $line);

 Please email me directly at [EMAIL PROTECTED]  Thanks.

 --

 Kind regards, Paul.

 Gondwana
 [EMAIL PROTECTED]
 http://www.gondwanastudio.com


I take it the file is ending up as one whole line in $file?  Try the atomic
reaction method..
$file = explode(\r, implode(\r, file($_Esport_ImageBank)));

implode() ensures $file is a string, not an array and explode() breaks the
string on Mac end-of-line characters.  With any luck that'll work for you.

- Kevin




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



Re: [PHP] credit card validations..

2003-03-20 Thread Kevin Stone

- Original Message -
From: Edward Peloke [EMAIL PROTECTED]
To: [EMAIL PROTECTED] Php. Net [EMAIL PROTECTED]
Sent: Thursday, March 20, 2003 11:50 AM
Subject: [PHP] credit card validations..


 The owner of the php site I am working on just told me he want to do
credit
 card validations on the site.  Currently, we aren't doing anything with
 credit cards.  I have no idea as to where to even start with this.  Should
I
 simply go the paypal route?

 Thanks,
 Eddie

Credit card validation is somewhat involved but not terribly difficult.
There are several good tutorials (such as the one below) and many classes
and functions already written if you don't feel like reinventing the wheel.
Good luck.

http://www.sitepoint.com/article/728

-Kevin



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



Fw: [PHP] function for $array

2003-03-20 Thread Kevin Stone

- Original Message -
From: pei_world [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, March 20, 2003 4:30 PM
Subject: [PHP] function for $array


 I want to use the following function the test the array elements,
 if all element is number return true, otherwise false;
 but the command marked, it print out only the first char of every strings
in
 the array;
 can help?

 ie: ++0++ for 0.234

  function check_int_float($array){
   $result=true;

for($i=0; $isizeof($array); $i++){
  echo ++.$array[$i].++;==
 if($array[$i]!=){
   if(is_numeric($array[$i])){
   $result=true;
  }else{
   $result=false;
break;
   }//if
 }//if
 }//foreach
  return $result;
  }

 --
 Sincerely your;

 pei_world ( .::IT::. )


There are some (what I would call) engineering issues with your  function
but it looks like it should work.  Maybe your problem lies in the array?

// Cleaned up function..
function array_is_numeric($array)
{
 $result=true;
 for($i=0; $isizeof($array); $i++)
 {
   if(!is_numeric($array[$i]))
   $result=false;
 }
 return $result;
}

- Kevin



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



  1   2   3   4   5   6   >