Re: [PHP] Outputting text "

2006-03-30 Thread Hugh Danaher

Look up htmlentities() in the php manual and see if it'll work for you.
Hugh
- Original Message - 
From: "Merlin" <[EMAIL PROTECTED]>

To: 
Sent: Thursday, March 30, 2006 1:28 AM
Subject: [PHP] Outputting text "
Hi there,

I would like to output following text with php:


How can I do that? I tried to escape the ? with \? but this did
not help.

Any ideas?

Thank you for any hint,

Merlin

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



--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.3.3/295 - Release Date: 3/28/2006





--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.3.3/295 - Release Date: 3/28/2006

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



Re: [PHP] please help me I try to post my question to Php.net 2-3times

2006-02-16 Thread Hugh Danaher
wvolks wrote "...but when I display data in text file it compress space in 
each lines..."  Sounded to me like he wanted all the blank spaces he put 
into the string, but when he "displayed" it, the spaces were gone.  Since 
html ignores more than one blank space between printable characters, I 
suggested he substitute   for the blank spaces.  He also said "I want 
fixed possition . please help me ?", and so I tried to help.

Regards,
HTD
- Original Message - 
From: "Barry" <[EMAIL PROTECTED]>

To: 
Sent: Thursday, February 16, 2006 12:37 AM
Subject: Re: [PHP] please help me I try to post my question to Php.net 
2-3times




Hugh Danaher wrote:

If you want to preserve the blank spaces then try;

str_replace(" ", " ", $contents); //   is html for blank space.
HTH
HTD


no he don't:
qote:

> read text file to array string


--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.15.6/257 - Release Date: 2/10/2006






--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.15.6/257 - Release Date: 2/10/2006

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



Re: [PHP] please help me I try to post my question to Php.net 2-3 times

2006-02-16 Thread Hugh Danaher

If you want to preserve the blank spaces then try;

str_replace(" ", " ", $contents); //   is html for blank space.
HTH
HTD
- Original Message - 
From: <[EMAIL PROTECTED]>

To: 
Sent: Wednesday, February 15, 2006 10:26 PM
Subject: [PHP] please help me I try to post my question to Php.net 2-3 times



text file problem

read text file to array string. I use function File(). but when I display
data in text file it compress space in each lines such as first record
contain "1_2__3__4__" ( _ = blank )
when store in array string is "1 2 3 4" . I want you tell me howto do?
+

// data in text file is "1_2_3_4" < _ = blank>
// output is "1 2 3 4"
// I want fixed possition . please help me ?
from Wvolks

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



--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.15.6/257 - Release Date: 2/10/2006






--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.15.6/257 - Release Date: 2/10/2006

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



Re: [PHP] static variables

2006-02-09 Thread Hugh Danaher

Suresh,
You could use the link to pass your variable to the next page, or to the 
same page:

Instead of
   $count=0;
use
   if (!isset($_GET['count'])) $count=0;
Then for your link use
   print "http://www.whatever.com?count=$count>link to new 
page"

or use
   print "link to same 
page"

if you want to return to the same page with an updated count.
HTH
HTD
- Original Message - 
From: "suresh kumar" <[EMAIL PROTECTED]>

To: 
Sent: Thursday, February 09, 2006 9:50 PM
Subject: [PHP] static variables



hai everbody

   i am facing a problem with static
variable. i declared $count=0 as Static variable,when
i click the link specified in anchor tag my page is
refreshed again and static variable lose its value and
assigned with 0.i want the logic code say  my stsic
variable will not lose scope when i click next,i am
looking forward reply from u.
  A.suresh



__
Yahoo! India Matrimony: Find your partner now. Go to 
http://yahoo.shaadi.com


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



--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.15.4/255 - Release Date: 2/9/2006






--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.15.4/255 - Release Date: 2/9/2006

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



Re: [PHP] Arrays

2006-02-04 Thread Hugh Danaher

Philip,
You'll often get an error call on a line when there is a problem on the 
previous line.  Say, you forgot to end a line with a semicolon, then it will 
error the next line.

Hugh
- Original Message - 
From: "Philip W." <[EMAIL PROTECTED]>

To: 
Sent: Saturday, February 04, 2006 11:12 AM
Subject: [PHP] Arrays


Sorry if this question seems stupid - I've only had 3 days of PHP 
experience.


When using the following string format, I get an error from PHP.

$text['text'] = "String Text" ;

Can someone help me?

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



--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.15.1/250 - Release Date: 2/3/2006






--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.15.1/250 - Release Date: 2/3/2006

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



Re: [PHP] Permissions on uploaded image don't allow for over writing

2005-01-29 Thread Hugh Danaher
Use php's ftp commands.
Hugh
- Original Message - 
From: "Dave" <[EMAIL PROTECTED]>
To: 
Sent: Saturday, January 29, 2005 11:11 AM
Subject: [PHP] Permissions on uploaded image don't allow for over writing


PHP List,
   The Situation:
   I am building a content management system where users can, among 
other things, upload images into a directory.

   The Problem:
   The image uploads fine, but once it's there, it can't be over 
written. So if a user uploads an image, and then changes his or her mind 
and wants to upload a new version over it, the file upload fails.

   What I've Tried So far:
   I can manually edit the file permissions using chmod and setting the 
files to 777. But of course that's not something I want to have to do 
every time someone uploads a file. I don't know enough about file 
permissions and settings to know how I can set these permissions at the 
time that someone makes the upload.

   The Question:
   How do I allow a user, who is uploading via the web, place an image 
on the server with permissions that allow the file to be over written?

--
Dave Gutteridge
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.7.4 - Release Date: 1/25/2005


--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.7.4 - Release Date: 1/25/2005
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Writing static file from dynamic PHP page

2005-01-18 Thread Hugh Danaher
Chris,
I've done something like this to update website's static pages.  Basically, 
in a php script I've replaced all of the "print" statements with "$line.= " 
statements to accumulate all the items you want printed into one long 
string.  I've then ftp'ed this string, along with the name of the html page, 
to the website where the page is to be viewed.
You could also set up an html page with links to a php page that generates 
the above stuff, and then use a header() command as the last line of the php 
page to go to the .html page you just generated.
Hope this helps.
Hugh

- Original Message - 
From: "Chris Bruce" <[EMAIL PROTECTED]>
To: "PHP-General" 
Sent: Monday, January 17, 2005 7:16 PM
Subject: [PHP] Writing static file from dynamic PHP page


Hi,
I am looking for a way to write to a file what the browser would see (raw 
html) when viewing a dynamic PHP page. I have numerous include files, 
MySQL db queries, loops etc. and I want to generate the static result of 
that file and save it as an html page. I have toyed a little with output 
buffering to no avail.

Is there an easy way to do this?
Thanks,
Chris
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.6.13 - Release Date: 1/16/2005


--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.6.13 - Release Date: 1/16/2005
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Textarea and Php

2005-01-18 Thread Hugh Danaher
Ross,
Try something like this in your form:
$description
You can then edit the contents of the cell
Hope this helps.
Hugh
- Original Message - 
From: "Ross Hulford" <[EMAIL PROTECTED]>
To: 
Sent: Tuesday, January 18, 2005 12:15 AM
Subject: [PHP] Textarea and Php


Is there a way to add and remove lines of text to a textarea inside a 
form?

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

--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.6.13 - Release Date: 1/16/2005


--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.6.13 - Release Date: 1/16/2005
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] parse error, unexpected $

2004-02-11 Thread Hugh Danaher
Bruno,
This often occurs when there is no closing bracket " } " for a conditional
statement or a loop.
hth
Hugh
- Original Message -
From: "Bruno Mattarollo" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, February 11, 2004 2:51 AM
Subject: Re: [PHP] parse error, unexpected $

> Parse error: parse error, unexpected $ in
> /var/www/html/donation/installations/gpi/form.inc on line 528

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



Re: [PHP] Help for code to 'sort list' please

2004-02-02 Thread Hugh Danaher
Chris,
It looks like your data in date_year is not in a format that supports a
simple DESC sort.  Look into getting the column formatted in -mm-dd
order (see the mysql manual for this).  Read the data in your column, format
it, pump it back into the database, then change the column type to 'date'.
Of course, you'll also need to examine any new inputs and get them correctly
formated before they're added to the database.
hugh
- Original Message -
From: "EastLothianDirectory" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, February 02, 2004 11:18 AM
Subject: [PHP] Help for code to 'sort list' please


> I have the following sql query in my Php code:
>
> $sql = "SELECT id, date_day, date_month, date_year, title, content FROM
$table_name
> ORDER BY date_year desc";
>
> The rest of the php code is just a simple db connection with a bullet list
> and 'while' loop with an 'echo result' request.
>
> This shows a list of dates with latest year on top of list.
> I have  Select/Option boxes to chose day,month,year etc to fill in Php
form
> to update database.
>
> This is result of sql query:
>
>2-August-2007
>   1-January-2007
> 30-December-2007
>  8-July-2006
> 29-February-2006
> 3-March-2006
> 16-February-2005
>   1-January-2004
>
> Although it lists in year order descending (in fact what I asked it to do)
> I would like to learn to sort the months and days into desc order properly
too.
>
> Can anyone suggest how I achieve this with php code.
>
> Thank you in advance
>
> --
> 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] Problem Display of data

2003-06-06 Thread Hugh Danaher
Gloria,
Glad to help, but I'd need to see the code that failing.
Hugh

- Original Message -
From: "Gloria L. McMillan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, June 06, 2003 4:53 PM
Subject: [PHP] Problem Display of data


> Hi, again.
>
> I got one suggestion but it did not work for displaying the results from a
40 item poll.
>
> I only want to display item 40: long answer.
>
> My php is cluttered with somebody's select routine that I am not using.
>
> Here is that poll:  http://DakotaCom.net/~glomc/forms/Adj03.html
>
> All I get from the call to the Adj03.php file is the single symbol of:   ]
>
> I will be happy to exchange help for proofreading since I am a college
instructor of
> writing.
>
> Thanks,
>
> Gloria McMillan
>
>
> --
> 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] delete lines from text file

2003-06-05 Thread Hugh Danaher
My bad:
while (!feof($fp))
instead of what I wrote earlier.

- Original Message -
From: "Hugh Danaher" <[EMAIL PROTECTED]>
To: "Matt Palermo" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Thursday, June 05, 2003 10:59 PM
Subject: Re: [PHP] delete lines from text file


> Matt,
> Try something like:
>  $fp=fopen("file_name.txt","r");
> while (!feof($fp))
> {
> $line=fget($fp,100); // grabs text to end of line or 100 characters
> whichever comes first
> if (!preg_match("/delete/",$line))
> {
> $new_line.=$line;
> }
> }
> fclose($fp);
> $fp=fopen("file_name.txt","w");
> fwrite($fp,$new_line) or die ("something died in here");
> fclose($fp);
> ?>
> I didn't check this before posting so there could be some syntax issues,
but
> the flow is what you need.  Open a file for reading, read it line by line
to
> find a text phrase, accumulate the lines (less the one with the phrase) in
a
> new variable, close the file, open it again for writing, write the text to
> the file, and then close it.
> Hope this helps,
> Hugh
> - Original Message -
> From: "Matt Palermo" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, June 05, 2003 8:53 PM
> Subject: [PHP] delete lines from text file
>
>
> > Can anyone help me figure out how to search for a string in a text file,
> > then delete the whole line of text that it occurs in?
> >
> > For example:  I have a text file which contains the following.
> >
> > //** text.txt **
> > Keep this line.
> > Also keep this line.
> > Delete this line.
> > Keep this one too.
> >
> >
> > Now I want to do a search on this text file for the word "delete" and if
> > it finds that word, it will delete the whole line it occurs on.  So
> > after this, the text file will look like this one:
> >
> > //** text.txt **
> > Keep this line.
> > Also keep this line.
> > Keep this one too.
> >
> > Can anyone help me with this?  Thanks.
> >
> > Matt
> >
>
>
> --
> 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] delete lines from text file

2003-06-05 Thread Hugh Danaher
Matt,
Try something like:

I didn't check this before posting so there could be some syntax issues, but
the flow is what you need.  Open a file for reading, read it line by line to
find a text phrase, accumulate the lines (less the one with the phrase) in a
new variable, close the file, open it again for writing, write the text to
the file, and then close it.
Hope this helps,
Hugh
- Original Message -
From: "Matt Palermo" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, June 05, 2003 8:53 PM
Subject: [PHP] delete lines from text file


> Can anyone help me figure out how to search for a string in a text file,
> then delete the whole line of text that it occurs in?
>
> For example:  I have a text file which contains the following.
>
> //** text.txt **
> Keep this line.
> Also keep this line.
> Delete this line.
> Keep this one too.
>
>
> Now I want to do a search on this text file for the word "delete" and if
> it finds that word, it will delete the whole line it occurs on.  So
> after this, the text file will look like this one:
>
> //** text.txt **
> Keep this line.
> Also keep this line.
> Keep this one too.
>
> Can anyone help me with this?  Thanks.
>
> Matt
>


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



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

2003-06-03 Thread Hugh Danaher
try something simpler and see if it passes:

$SelectQuery="SELECT SUM(GiftSubscriptions) AS GiftSubs FROM Registration";
$Result = mysql_query($SelectQuery) or die("Something died in here!
".mysql_error());

- Original Message -
From: "Kurosh Burris" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 02, 2003 7:54 PM
Subject: [PHP] Supplied argument is not a valid MySQL result resource


> Hi Everyone,
>
> I'm trying to get a very simple "sum" of the values in an MySQL database
> field column.  I have very little experience with PHP and SQL, but I learn
> quickly.  :)  Our resident PHP expert who built the full script is really
> busy, so I've been trying to do this myself.  The farthest I could get
from
> just reading various posts in other forums was:
>
> $SelectQuery = new Query ("SELECT SUM(GiftSubscriptions) AS GiftSubs FROM
> Registration");
> $Result = mysql_query($SelectQuery);
> $Value = mysql_fetch_array($Result);
> echo $Value['GiftSubs'];
>
> However, I'm getting this error:
>
> Warning: mysql_fetch_array(): supplied argument is not a valid MySQL
result
> resource
>
> Can someone tell me what's wrong with this part of the code?
>
> Thanks,
> Kurosh
>
>
>
> --
> 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] use web hyperlink to insert data into MySQL?

2003-04-01 Thread Hugh Danaher
Levi,
Very easy to do exactly what you want using php
1. write your link to a php page (described below) which includes the items
you want stored appended to the link "go to next page"
2. create a php page which contains the following:


Easy enough, but you'll need a form if you want user supplied info.  Also,
since the appended data could be altered before sent, this method is not
secure from tampering.  You'll need to evaluate the input to determine that
it's what you expect.
Hugh


- Original Message -
From: "Levi Zander" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, April 01, 2003 12:21 PM
Subject: [PHP] use web hyperlink to insert data into MySQL?


> I am trying to use PHP to create a hyperlink button that writes data to
> MySQL database and sends the user to a new page.. is this possible?  if so
> would you post the syntax/site where I can find out how to do this... thx!
>
>
>
> --
> 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] Adding a URL

2003-03-30 Thread Hugh Danaher
Scott,
try changing:
  print "\t\t$col_value\n";
to:
  print "\t\tmailto:".$col_value.";>$col_value\n";
Hope this helps.
Hugh

- Original Message -
From: "Scott Thompson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, March 29, 2003 8:53 PM
Subject: [PHP] Adding a URL


> Hi,
>
> I am using the following code to query a database and build an HTML table.
>
> 
>   
>SQL Connect
>   
>
>   
>  /* Connecting, selecting database */
>  $link = mysql_connect("localhost", "root", "")
>  or die("Could not connect");
>  //print "Connected successfully";
>  mysql_select_db("irvington") or die("Could not select database");
>
>  /* Performing SQL query */
>  $query = "SELECT * FROM staff";
>  $result = mysql_query($query) or die("Query failed");
>
>  /* Printing results in HTML */
>  print "\n";
>  while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
>  print "\t\n";
>  foreach ($line as $col_value) {
> print "\t\t$col_value\n";
>  }
>  print "\t\n";
>  }
>  print "\n";
>
>  /* Free resultset */
>  mysql_free_result($result);
>
>  /* Closing connection */
>  mysql_close($link);
>?>
>
>   
> 
>
>
> So far so good...
>
> The SQL query returns this:
> mysql> select * from staff;
> ++--+--+
> | name   | email| subject  |
> ++--+--+
> | Scott Thompson | [EMAIL PROTECTED] | Volunteer|
> | |   | Computer Science |
> | Some Teacher   | [EMAIL PROTECTED]   | some subject |
> ++--+--+
> 3 rows in set (0.00 sec)
>
> mysql>
>
> The above is also essentialy what you see in your browser (sans headers).
>
> So far so good...
>
> What I want (and can't figure out) is how to have each email address
> have a URL (i.e. mailto:[EMAIL PROTECTED]).
>
> I'm fairly new to PHP, I hope this question made some sense.
>
> Suggestions?
>
> ~Scott
>
>
> --
> 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] upload question

2003-03-29 Thread Hugh Danaher
Sounds like a Windows configuration issue and not a php issue.  There's an
'open using' (or some such) option buried in the windows file menu that will
let you change this.
Hugh
- Original Message -
From: "Anthony Ritter" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, March 29, 2003 7:12 PM
Subject: [PHP] upload question


> Greetings all,
> Using PHP 4.1.1 / Apache Server / MS Win 98 / IE 5.5
>
> The following script is from Julie Meloni's book PHP Fast and Easy on page
> 170-174.
>
> The first part is an html form in which the user browses and chooses a
file
> to be upoloaded to the server.
>
> The script works fine in that when I chose a file and hit submit it, the
> file ends up in:
>
> C:\apache\htdocs
>
> However, in the book, in the last illustration, she explains:
>
> "Just to be sure, use the File/Open Page menu item in your _browser_ to
> navigate through your filesystem and find the file that you just
uploaded."
>
> The illustration shows the .jpg file _within_ the browser screen on the
> upper left hand side.
>
> When I follow those steps and hit file / open, my paint program takes over
> and opens the uploaded .jpg file and the browser interface of MS IE 5.5 is
> gone.
>
> Any advice would be appreciated.
> Thank you.
>
> Tony Ritter
> ...
>
> // html form
> 
> 
> 
> 
> File to upload:
> 
> 
> 
> 
> 
> 
> 
> 
>
>
> // .php script called  upload.php
>  if ($thefile != "")
>  {
>   copy("$thefile","C:\\apache\\htdocs\\$thefile_name")or die("Could not
copy
> the file.");
>  }
> else
>  {
>   echo "No file to upload.";
>  }
> ?>
> 
> 
> 
> 
> 
> You sent:
> , a  byte file with
a
> mime type of .
> 
> 
> 
>
>
>
>
> --
> 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] why this sript doesn't work

2003-03-27 Thread Hugh Danaher
JP,
Instead of::
global $nome;
global $email;
global $linguagem;
global $browser;
try:
$nome=$_POST['nome'];
$email=$_POST['email'];
$linguagem=$_POST['linguagem'];
$browser=$_POST['browser'];

Hugh

- Original Message -
From: "J. P." <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, March 24, 2003 2:23 PM
Subject: [PHP] why this sript doesn't work


> Hello!
> I am using Apache 2.0.44 and WinXP. I have PHP 4.3.1.
> When i run the script the first page appears. But when i submit nothing
> appends. What's wrong?
>
>
>  function mostrar_formulario()
> {
> global $PHP_SELF;
> ?>
>
> 
> Nome: 
> Email: 
> 
> Qual a sua linguagem de programação preferida?
> PHP
> C++
> C
> PERL
> 
> Qual o seu browser web preferido?
> Netscape
> Navigator
> Internet
> Explorer
> 
> 
> 
>  }
> ?>
>
>  function processa_formulario() {
> global $nome;
> global $email;
> global $linguagem;
> global $browser;
>
> printf ("O utilizador %s cujo endereço de email é %s prefere a linguagem
de
> programação %s e utiliza, normalmente, o browser %s para navegar na www.",
> $nome, $email, $linguagem, $browser);
> }
> ?>
>  if (empty($nome)){
>mostrar_formulario();
>} else {
> processa_formulario();
> }
> ?>
>
> Thanks
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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



Re: [PHP] File Upload and ftp transfer problem

2003-03-27 Thread Hugh Danaher
Jason,
Thanks for your help.  The purpose of this script is to upload an image,
assign an image name based upon a record name received in a mysql query,
store the image name in the mysql table, and then ftp the file to a
directory on the server.
Thanks again,
Hugh

The following script is now working without error.
Input your digital photo.";

  print "";
  print "";
  print "Send this tree picture: ";
  print "";
  print "";
  print "";
  print "";
  print "";
  }
 if ($upload==1)
  {
  $photo2="L".(100*$asset_n).".jpg";
  if (is_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name']))
   {
   $fp=fopen($HTTP_POST_FILES['userfile']['tmp_name'],"rb");
   $file_stream=fread($fp,30);
   fclose($fp);

   $table="  ";
   $db="   ";
   $user="   ";
   $pass="  ";
   $link=mysql_connect("localhost","$user","$pass");
   if (! $link) die("Can't log in at this time");
   mysql_select_db($db,$link) or die ("Can't get database at this time");
   $query="update $table set photo2='".$photo2."' where
asset_n='".$asset_n."' ";
   $result=mysql_query($query);
   mysql_close($link);
   }
  call_user_func('ftp_transfer',$photo2,$file_stream);

  print "return to update
page";
  }
 }
 // set up basic ftp connection

function ftp_transfer($photo2,$file_stream)
 {
 $ftp_server="  ";
 $ftp_user_name="  ";
 $ftp_user_pass="  ";

 $conn_id = ftp_connect($ftp_server);

 // login with username and password
 $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);

 // check connection
 if ((!$conn_id) || (!$login_result))
  {
  print "FTP connection has failed!";
  print "Attempted to connect to $ftp_server ";
  exit;
  }
 // upload the file

 $fp=tmpfile();
 fwrite($fp, $file_stream);
 rewind($fp);

 $destination_file="./directory/".$photo2;
 $upload = ftp_fput($conn_id, $destination_file, $fp, FTP_BINARY);
 // check upload status
 if (!$upload)
  {
  print "FTP upload has failed!";
  }
 // close the FTP stream
 //@ftp_close($conn_id);
 ftp_quit($conn_id);
 }
php?>
- Original Message -
From: "Hugh Danaher" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, March 27, 2003 1:16 PM
Subject: Re: [PHP] File Upload and ftp transfer problem


> Thanks Jason, I'll try that, and let you know the results.  Hugh
> - Original Message -
> From: "Jason Wong" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, March 27, 2003 11:48 AM
> Subject: Re: [PHP] File Upload and ftp transfer problem
>
>
> > On Friday 28 March 2003 03:16, Hugh Danaher wrote:
> > > I'm trying to get the following script to ftp transfer an uploaded
image
> > > file so as to get around a file permission problem.  The upload
portion
> of
> > > this works without problem, the ftp portion doesn't spit out any
errors
> > > either, but the file transfered is just the name of the uploaded temp
> file
> > > and not the file itself. If I do a filesize() on $file_stream, I get
44K
> > > (the size of the image uploaded), I then transfer this var to the ftp
> > > function but what gets ftp and saved as a file is only 14 bytes.  The
> saved
> > > file has "/tmp/phpDcJSOq" as its entire contents. The upload scrip is
> > > below.
> >
> > It's doing exactly what you're telling it to do.
> >
> >   $file_stream=$HTTP_POST_FILES['userfile']['tmp_name'];
> >
> > This only contains the _name_ of the temporary file which contains the
> > contents of your uploaded file.
> >
> > What you need to do is send the _contents_ of the file pointed to by
> > $file_stream. Take a look at fread() and/or file().
> >
> > --
> > Jason Wong -> Gremlins Associates -> www.gremlins.biz
> > Open Source Software Systems Integrators
> > * Web Design & Hosting * Internet & Intranet Applications Development *
> > --
> > Search the list archives before you post
> > http://marc.theaimsgroup.com/?l=php-general
> > --
> > /*
> > I do not find in orthodox Christianity one redeeming feature.
> > - Thomas Jefferson
> > */
> >
> >
> > --
> > 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] File Upload and ftp transfer problem

2003-03-27 Thread Hugh Danaher
Thanks Jason, I'll try that, and let you know the results.  Hugh
- Original Message -
From: "Jason Wong" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, March 27, 2003 11:48 AM
Subject: Re: [PHP] File Upload and ftp transfer problem


> On Friday 28 March 2003 03:16, Hugh Danaher wrote:
> > I'm trying to get the following script to ftp transfer an uploaded image
> > file so as to get around a file permission problem.  The upload portion
of
> > this works without problem, the ftp portion doesn't spit out any errors
> > either, but the file transfered is just the name of the uploaded temp
file
> > and not the file itself. If I do a filesize() on $file_stream, I get 44K
> > (the size of the image uploaded), I then transfer this var to the ftp
> > function but what gets ftp and saved as a file is only 14 bytes.  The
saved
> > file has "/tmp/phpDcJSOq" as its entire contents. The upload scrip is
> > below.
>
> It's doing exactly what you're telling it to do.
>
>   $file_stream=$HTTP_POST_FILES['userfile']['tmp_name'];
>
> This only contains the _name_ of the temporary file which contains the
> contents of your uploaded file.
>
> What you need to do is send the _contents_ of the file pointed to by
> $file_stream. Take a look at fread() and/or file().
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> --
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> --
> /*
> I do not find in orthodox Christianity one redeeming feature.
> - Thomas Jefferson
> */
>
>
> --
> 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] File Upload and ftp transfer problem

2003-03-27 Thread Hugh Danaher
I'm trying to get the following script to ftp transfer an uploaded image file so as to 
get around a file permission problem.  The upload portion of this works without 
problem, the ftp portion doesn't spit out any errors either, but the file transfered 
is just the name of the uploaded temp file and not the file itself.  
If I do a filesize() on $file_stream, I get 44K (the size of the image uploaded), I 
then transfer this var to the ftp function but what gets ftp and saved as a file is 
only 14 bytes.  The saved file has "/tmp/phpDcJSOq" as its entire contents. 
The upload scrip is below.
Thanks for any help to resolve this problem.
Hugh
 
Input your digital photo of the specimen.";

  print "";
  print "";
  print "Send this tree picture: ";
  print "";
  print "";
  print "";
  print "";
  }
 if ($upload==1)
  {
  $photo2="L".(100*$asset_n).".jpg";
  // move_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'], 
"./directory/".$photo2.""); // doesn't work because of file permissions.
  $file_stream=$HTTP_POST_FILES['userfile']['tmp_name'];
   
  if ($upload==1)
   {
   call_user_func('ftp_transfer',$photo2, $file_stream);
   header("location: update.php?asset_n=$asset_n&edit=1");
  }
 }

 // functions
 // set up basic ftp connection
function ftp_transfer($photo2,$file_stream)
 {
 $ftp_server="   ";
 $ftp_user_name="   ";
 $ftp_user_pass="   ";
  
 $conn_id = ftp_connect($ftp_server); 

 // login with username and password
 $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); 

 // check connection
 if ((!$conn_id) || (!$login_result)) 
  { 
  print "FTP connection has failed!";
  print "Attempted to connect to $ftp_server "; 
  exit; 
  } 
 // upload the file
 $fp = tmpfile(); 
 fwrite($fp, $file_stream); 
 rewind($fp); 

 $destination_file="./directory/".$photo2;
 $upload = ftp_fput($conn_id, $destination_file, $fp, FTP_BINARY); 
 // check upload status
 if (!$upload) 
  { 
  print "FTP upload has failed!";
  } 
 // close the FTP stream 
 ftp_quit($conn_id);
 }
php?>


Re: [PHP] numbers problem

2003-03-23 Thread Hugh Danaher
Emanuele,
Some parts of the world use the coma as the separator between whole numbers
and decimals (e.g. Germany & France) and php is formating the number
according to this style.  I surmise that the numbers stored in your database
have been stored with comas separating the thousands from the hundreds
(English & US style), so you'll need to grab the number, eliminate the coma
(something like $num=ereg_replace(",","",$num) will do this but there is
likely a more direct php command for this), then when you want to display
the number use number_format($num,2,".",",").
Hope this helps.
Hugh
- Original Message -
From: "Emanuele" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, March 23, 2003 5:09 AM
Subject: [PHP] numbers problem


> Hi, I'm using a mysql connection to dinamically fill a table with
> descriptions, prices, and so on...
>
> But when the script takes the price of a Plasma Monitor, that costs
8025.00
> $, it outputs only 8,00.
> I recall it by typing :
>
> echo $row_Recordset1['Prezzo']
>
> And please note that I've seen that it happens only when
> $row_Recordset1['Prezzo'] > 1000
>
> Can anyone tell me why and what can I do ?
> Please answer me, it's very important...
> Thanks
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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



Re: [PHP] php, mysql, and method question

2003-03-20 Thread Hugh Danaher
Charles, it sounds like you want the most recent 9 articles ("...order set
to 1 so it shows up first when ..."), so why not something like "select *
from article_table order by id desc, limit 9" [assumes id is int not null
auto_incremented].
You could also increment the value in the field something like:
$result=mysql_query("select article_order from article table");
while ($array_result=mysql_fetch($result))
{
$article_order=$array_result[article_order]+1;
mysql_query("update article_table set article_order=$article_order where
id=$array_result[id] ");
}
hugh
- Original Message -
From: "Charles Kline" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, March 20, 2003 11:10 AM
Subject: [PHP] php, mysql, and method question


> hi all,
>
> i have a question about a good method of handling this challenge.
>
> i have a table that contains articles. i have another table which
> contains  the order 1 - 9 that i would like to display them in.
>
> this part is done, and is not a problem. here is where I am not sure
> how to proceed.
>
> 1. tbl_display_order - can only have 9 records in it (or do i just
> ignore anything beyond 9?)
> 2. when a new article is added to tbl_display_order - it needs to get
> the field that contains it's order set to 1 so it shows up first when I
> display the articles, and all the other articles need to have their
> order number incremented.
>
> Maybe there is a better way to do this? Just not sure. Maybe not with a
> database at all?
>
> Thanks for suggestions.
> Charles
>
>
> --
> 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] Ereg sass

2003-03-18 Thread Hugh Danaher
try two backslashes to escape php special characters
- Original Message -
From: "Liam Gibbs" <[EMAIL PROTECTED]>
To: "php list" <[EMAIL PROTECTED]>
Sent: Tuesday, March 18, 2003 12:33 AM
Subject: [PHP] Ereg sass


I'm not sure why, but I can't include a period in my eregi statement:

[A-Za-z0-9_-.]*

For this, I get Warning: ereg() [function.ereg]: REG_ERANGE in
/home/website/public_html/Functions.inc on line 27

The same goes for [A-Za-z0-9_-\.]*

Anyone know why?



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



Re: [PHP] Reading GIF images in Win2k + Apache + PHP

2003-03-17 Thread Hugh Danaher
//When converting an image from gif to jpeg or png, you need to create an
intermediate image the same size as you want output.  The following should
work, but it's not tested.
hope this helps,
Hugh





- Original Message -
From: "Patrick Teague" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, March 17, 2003 10:47 PM
Subject: [PHP] Reading GIF images in Win2k + Apache + PHP


> I have a class that reads gif images & can then make jpeg or png
thumbnails
> of the gif image, but it only seems to work on linux.  Is there any way to
> open/convert the gif to some other graphic format so I can at least read
the
> gif image in on windows?
>
> here's the current code I have for reading in file types, but the gif
> section blows up.  Is there a way with something like readfile() or
fopen()
> to get the information from a gif file?
>
>   switch($type)
>   {
>case "gif":
> $orig_img = imagecreatefromgif($filename);
> break;
>case "jpg":
> $orig_img = imagecreatefromjpeg($filename);
> break;
>case "png":
> $orig_img = imagecreatefrompng($filename);
> break;
>   }
>
> Patrick
>
>
>
> --
> 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] Function or GD problem?

2003-03-16 Thread Hugh Danaher
Can't tell for sure, but you might have one more closing bracket than
needed.  my suggestion to call it from an href rather than as an img tag was
based upon the fact that the href tag will show an error message whereas the
img tag won't.
Hugh
- Original Message -
From: "Nate" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, March 16, 2003 3:59 PM
Subject: Re: [PHP] Function or GD problem?


> Hi, thanks for your help but im not sure what you mean. My image php page
is
> http://www.maxamplify.com/maxgallery/admin/test.php?src=img.jpg This
> contains the exact same code I posted below.
>
> However if i make that into a function it gives me a red X as you can see
> here: http://www.maxamplify.com/maxgallery/admin/test1.php?src=img.jpg
>
> Just to clarify, im doing a function like
> --
> function ResizeJPG($src) {
>
>global $full_img_url;
>//code below
>
> }
>
> ResizeJPG($src);
> --
>
> Thanks for your help!
> Nate
>
>
> "Hugh Danaher" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>
> > In the receiving page, change your link from an  tag to an  > href= > then see what the error message says.
> > Hugh
>
> > - Original Message -
> > From: "Nate" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Sunday, March 16, 2003 2:55 PM
> > Subject: [PHP] Function or GD problem?
> >
> >
> > > Function or GD problem...
> > > I have a strange problem here, hoping someone can help.
> > >
> > > The following code works great but when I make it into a function it
> > doesn't
> > > error but it gives a RED X image.
> > >
> > > PHP:
> > >  > >
> > > include("functions.inc.php");
> > >
> > > $size = getimagesize("uploads/$src");
> > >
> > > if ($size[2]==2) {
> > >
> > >$sourceimg = imagecreatefromjpeg("$full_img_url/$src") OR
> DIE("DIED");
> > >
> > >
> > >if($size[0]<$size[1]) {
> > >
> > >   if($size[1]<$height) { $height1=$size[1]; } else {
> > $height1=$height; }
> > >
> > >   $width1=($size[0]*$height1)/$size[1];
> > >
> > >} else {
> > >
> > >   if($size[0]<$width) { $width1=$size[0]; } else {
$width1=$width; }
> > >
> > >   $height1=($size[1]*$width1)/$size[0];
> > >
> > >}
> > >
> > >Header("Content-type: image/jpeg");
> > >
> > >$destimg = imagecreatetruecolor($width1,$height1) OR DIE("DIED");
> > >
> > >//Try to resample (needs GD 2)
> > >if(imagecopyresampled($destimg, $sourceimg, 0,0,0,0, $width1,
> $height1,
> > > $size[0], $size[1])) {
> > >
> > >} elseif(imagecopyresized($destimg, $sourceimg, 0,0,0,0, $width1,
> > > $height1, $size[0], $size[1])) {
> > >
> > >} else {
> > >   //HTML RESIZE
> > >}
> > >
> > >imagejpeg($destimg,'',76) OR DIE("DIED");
> > >imagedestroy($destimg) OR DIE("DIED");
> > >
> > >}
> > >
> > > }
> > >
> > > ?>
> > >
> > >
> > >
> > > --
> > > 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] Function or GD problem?

2003-03-16 Thread Hugh Danaher
In the receiving page, change your link from an  tag to an  then see what the error message says.
Hugh
- Original Message -
From: "Nate" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, March 16, 2003 2:55 PM
Subject: [PHP] Function or GD problem?


> Function or GD problem...
> I have a strange problem here, hoping someone can help.
>
> The following code works great but when I make it into a function it
doesn't
> error but it gives a RED X image.
>
> PHP:
> 
> include("functions.inc.php");
>
> $size = getimagesize("uploads/$src");
>
> if ($size[2]==2) {
>
>$sourceimg = imagecreatefromjpeg("$full_img_url/$src") OR DIE("DIED");
>
>
>if($size[0]<$size[1]) {
>
>   if($size[1]<$height) { $height1=$size[1]; } else {
$height1=$height; }
>
>   $width1=($size[0]*$height1)/$size[1];
>
>} else {
>
>   if($size[0]<$width) { $width1=$size[0]; } else { $width1=$width; }
>
>   $height1=($size[1]*$width1)/$size[0];
>
>}
>
>Header("Content-type: image/jpeg");
>
>$destimg = imagecreatetruecolor($width1,$height1) OR DIE("DIED");
>
>//Try to resample (needs GD 2)
>if(imagecopyresampled($destimg, $sourceimg, 0,0,0,0, $width1, $height1,
> $size[0], $size[1])) {
>
>} elseif(imagecopyresized($destimg, $sourceimg, 0,0,0,0, $width1,
> $height1, $size[0], $size[1])) {
>
>} else {
>   //HTML RESIZE
>}
>
>imagejpeg($destimg,'',76) OR DIE("DIED");
>imagedestroy($destimg) OR DIE("DIED");
>
>}
>
> }
>
> ?>
>
>
>
> --
> 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] str_replace

2003-03-14 Thread Hugh Danaher

- Original Message - 
From: "Hugh Danaher" <[EMAIL PROTECTED]>
To: "Sebastian" <[EMAIL PROTECTED]>
Sent: Friday, March 14, 2003 11:37 PM
Subject: Re: [PHP] str_replace


> I just though up a better idea,
> put your conditional statements in your included files not in the calling
> file.  That way, the parsing of the page will pick up the conditions and
> execute them properly.
> Really hope this helps.
> Hugh
> - Original Message -
> From: "Sebastian" <[EMAIL PROTECTED]>
> To: "php list" <[EMAIL PROTECTED]>
> Sent: Friday, March 14, 2003 9:15 PM
> Subject: [PHP] str_replace
> 
> 
> > This may seem weird:
> >
> > How do I str_replace an include function?
> >
> > I want to replace this line: include("$header");
> >
> > with nothing ..
> >
> > something like this:
> >
> > $footer = str_replace(" '. include("$header"); .' ", "", $footer);
> >
> > I get errors, any ideas?
> >
> > cheers,
> > - Sebastian
> >
> 


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



Re: [PHP] inserting parameters into URLs dynamically

2003-03-14 Thread Hugh Danaher
Mo,
"(we haven't found, in our initial research, a way to do this)"
You could format your variables before they're needed in the link
something like:
if(isset($x)) $x_link="&x=$x";
if(isset($y)) $y_link="&y=$y";
etc.
then your link would look like the following
someplace.com
"slug=1" is used so that none of the preformatted variables need to start
with a ? instead of an &.  if one, or several of the preformatted variables
are empty, the line just slides to the left and fills any vacancies.  If all
your pages start with the same if(isset()) table, then the variables will be
passed around as long as the user stays at your site.  No cookies or
sessions required.
Hope this helps,
Hugh
- Original Message -
From: "Maureen Roihl" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 14, 2003 1:31 PM
Subject: [PHP] inserting parameters into URLs dynamically


> We are looking for a way to set several key/value pairs (which will differ
> across  users)  such  that they will persist during the user's session
and
> be  logged  in  the  weblogs for every request that user makes. Some
> potential ways of doing this that occurred to us:
>
> -  implement functionality to programmatically append these parameters to
> the  querystring  of all urls displayed across our site (far too
cumbersome,
> we don't consider this a viable option)
>
> -  find  a  way  for PHP to automatically tack the parameters onto the
ends
> of url querystrings, the same way it can do with PHPSESSIONID (we haven't
> found, in our initial research, a way to do this)
>
> Our primary goal is to get these parameters logged in the weblogs, without
> having to programmatically/physically modify every link on our site. For
> example, if we wanted to track parameters called x and y, the link on the
> page would just point to:
>
> /index.php
>
> but the weblog would show something like the following hit:
>
> /index.php?x=foo&y=bar
>
> The parameter values would need to get set once at the beginning of a
user's
> session, and then would not change over the course of that session (but
> they'd need to get tracked with every request they made). We're planning
to
> implement persistent sessions across our servers as well.
>
> 
> Maureen Roihl
> Senior Web Developer
> Smarter Living
> [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] Re: str_replace

2003-03-14 Thread Hugh Danaher
if the header and footer info come from your config.php file, then you have
to get to that file before it's parsed by the server.  Perhaps, splitting
config.php into three files (header.php, config.php and footer.php), then
when you want to print just call the middle file.

if(isset($_GET['print'])) include("config.php");  // printer version
if(!isset($_GET['print'])) // regular page view
{
include("header.php");
include("config.php");
include("footer.php");
}
Hope this helps.
Hugh

- Original Message -
From: "Sebastian" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, March 14, 2003 10:23 PM
Subject: Re: [PHP] Re: str_replace


> doesn't work but also doesn't give any errors, I will try to explain what
I
> am trying to do:
>
> I am trying to remove the header and footer to create a "printer friendly
> page" with just the content, here's what my pages look like, I need to
> remove header and footer when they visit: file.php?action=print
>
>  include("../config.php");
>
> if($_GET[action] == "print")
> {
>$header = str_replace('include("$header");', '', $header);
>$footer = str_replace('include("$footer");', '', $footer);
> }
>
> include("$header");
> ?>
>
> // html
>
> 
>
> cheers,
> - Sebastian
>
> - Original Message -
> From: "John Gray" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Saturday, March 15, 2003 12:31 AM
> Subject: [PHP] Re: str_replace
>
>
> | $footer = str_replace('include("$header");', '', $footer);
> |
> | The way you have it now, you're telling PHP to first include the file
> | named by the variable $header, then do an str_replace on the result; but
> | the parser is going to fail on that first semi-colon, and that's not
> | what you want to do anyway (as I understand it). Put the line you want
> | to replace inside single quotes (as above) and PHP won't attempt to
> | parse it, it'll just treat it as a string literal. Hope this helps, hope
> | it makes sense.
> |
> | - john
> |
> | Sebastian wrote:
> | > This may seem weird:
> | >
> | > How do I str_replace an include function?
> | >
> | > I want to replace this line: include("$header");
> | >
> | > with nothing ..
> | >
> | > something like this:
> | >
> | > $footer = str_replace(" '. include("$header"); .' ", "", $footer);
> | >
> | > I get errors, any ideas?
> | >
> | > cheers,
> | > - Sebastian
>
>
>
> --
> 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] Checkboxes

2003-03-14 Thread Hugh Danaher
In further thought on this, I'm not sure that $_POST['skill'] is an array.
Hugh
- Original Message -
From: "Stephen" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, March 13, 2003 8:47 PM
Subject: [PHP] Checkboxes


> Hi
>
> I am trying to get results form checkboxes on a form.  Each checkbox is
> given a value of the id of an item in a table.  What I want to do is find
> out what is selected and from there get the id so I can create a sql
insert
> statement for each selected item.
>
> I can get the item selected but not a value.
> I am using:
>
> PHP:
>
> if (count($_POST['skill'])>0) {
>  for  ($i=0;$i   echo "$fskill[$i]\n";
>  }
> }
>
> inside a form
> 
> 
> 
>
> I get a number of bullets representing the items I check but no value!
>
> Thanks,
>
> Stephen
>
>
>
> --
> 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] Checkboxes

2003-03-14 Thread Hugh Danaher
The following is completely untested but might yield the results you want.
It assigns a value to the skill array, prints the post var, and then (I
hope) advances the array pointer to the next array element:
Good luck, hugh

if (count($_POST['skill'])>0)
{
for  ($i=0;$i".$_POST['skill']."\n";
next($_POST['skill']);  // should advance the pointer to the
next element in the array
}
> }
>
> --
> 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] Image resize

2003-03-12 Thread Hugh Danaher
if your system suports the commands, try imagecreatetruecolor() instead of
imagecreate(),
and imagecopyresampled() instead of imagecopyresized(),
hope this helps,
Hugh

- Original Message -
From: "Michael P. Carel" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, March 12, 2003 3:23 PM
Subject: [PHP] Image resize


> hi to all,
>
> I have a problem here in image resizing, after the image has been resized
> , the image has been discolorized. How can i  recreate the image with the
> same resolution and color properties.
>
> Here's the sample code from my class file:
>
>  $origPic = ImageCreateFromJpeg( $this -> iOrig[ 'tmp_name' ] );
>  $this -> iNew = ImageCreate($nWidth,$nHeight);
>   ImageCopyResized($this -> iNew, $origPic, 0, 0, 0, 0, $nWidth, $nHeight,
> $width, $height);
>
> Thanx in advance.
>
>
>
> Mike
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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



Re: [PHP] really simple problem with GET

2003-03-12 Thread Hugh Danaher
Kevin,
first, change your URL statement to: http://.../test.php?test=1 // the $
is not needed.
second, use $test=$_GET['test'] to get the transferred value into $test.
then, echo $test and see if it works.
Hugh
- Original Message -
From: "Poon, Kelvin (Infomart)" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, March 12, 2003 10:04 AM
Subject: [PHP] really simple problem with GET


> Hi,
>
> I am sorry if the level of this question is too simple but I can't figure
> out what's wrong.  I want to pass a variable value through the URL using
the
> Get method.
>
> FOr example http://.../test.php?$test=0
>
> and my test.php code are as follow:
>
> 
> 
> 
> if (!empty($_SERVER))
>   extract($_SERVER);
>
> if (!empty($_GET)) {
> extract($_GET);
> } else if (!empty($HTTP_GET_VARS)) {
> extract($HTTP_GET_VARS);
> }
>
> if (!empty($_POST)) {
> extract($_POST);
> } else if (!empty($HTTP_POST_VARS)) {
> extract($HTTP_POST_VARS);
> }
>
> echo "hello $test";
> ?>
>
>
> 
> 
>
>
> BUt my outcome is
>
> hello
>
> so therefore my $test variable isn't passing through, does anybody know
what
> I did wrong?
>
> Thanks
>
> Kelvin
>
>
>
> --
> 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] Making a Loop.[Scanned]

2003-03-12 Thread Hugh Danaher
 echo"";  // in this statement you are
asking that a number be a variable in php and that is not permitted.
try:
for ($i=0;$i<=10;$i++)
{
echo "";  // this way your select name is
"var_name[1]" and not 1

also,
echo "$productCode";

try instead,
echo "$productCode;  // no  needed here and the  doesn't
need a value

- Original Message -
From: "Philip J. Newman" <[EMAIL PROTECTED]>
To: "Michael Egan" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, March 12, 2003 12:32 AM
Subject: Re: [PHP] Making a Loop.[Scanned]


> assuming the value is 10, I stall can't get it to work
>
>
> - Original Message -
> From: "Michael Egan" <[EMAIL PROTECTED]>
> To: "Philip J. Newman" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
> Sent: Wednesday, March 12, 2003 9:29 PM
> Subject: RE: [PHP] Making a Loop.[Scanned]
>
>
> Philip,
>
> I might be missing something but just looking at the top few lines of your
> code the $number variable has no value.
>
> The loop will run on howver many times corresponds to this value - with
the
> value being null it's not going to run.
>
> You'll need to pass in a value from elsewhere.
>
> Michael Egan
>
> -Original Message-
> From: Philip J. Newman [mailto:[EMAIL PROTECTED]
> Sent: 12 March 2003 08:21
> To: [EMAIL PROTECTED]
> Subject: [PHP] Making a Loop.[Scanned]
>
>
> I have this code to make this form list $x amount of times.
>
>   for ($i = 1; $i <= $number; $i++) {
>
>   echo"";
>
>// LIST ALL PRODUCTS IN DATABASE.
>
>$sql = "SELECT * FROM products ORDER BY productCode ASC";
>   $sql_result = mysql_query($sql, $connection) or die ("Could not
> get Query");
>
>   while ($row = mysql_fetch_array($sql_result)) {
>
>$productCode=$row["productCode"];
>echo "$productCode";
>
>} // END WHILE.
>
>  echo"";
>
>
>   }
>
> and it dose not work any help?
>
> --
> Philip J. Newman.
> Head Developer
> [EMAIL PROTECTED]
>
> +64 (9) 576 9491
> +64 021-048-3999
>
> --
> Friends are like stars
> You can't allways see them,
> but they are always there.
>
> --
> Websites:
>
> PhilipNZ.com - Design.
> http://www.philipnz.com/
> [EMAIL PROTECTED]
>
> Philip's Domain // Internet Project.
> http://www.philipsdomain.com/
> [EMAIL PROTECTED]
>
> Vital Kiwi / NEWMAN.NET.NZ.
> http://www.newman.net.nz/
> [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
>
>
>
> --
> 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] help with insert into table to mysql

2003-03-11 Thread Hugh Danaher
 some obvious errors:

 $submiited on =date(1y-m-d');  // typo on submittedon and the date
format seems off, maybe you're looking for date('y-m-d') .

$query="insert into articles"
(date,submitted,status,title,lead,body,submitted by)
// if the field name is submitted by then you need to write it
'submitted by'
values(!$submittedon',$status',$title',$lead',$body',$author,");

your use of punctuation is more than a bit off, and your field count doesn't
match your values count

values('$submittedon','$status', . )";

$query="insert into articles (date, submitted, status, title, lead, body,
submittedby) values
('$submittedon','$submitted','$status','$title','$lead','$body','$submittedb
y')"; // is the correct form but whether the field names and the value
variables are correctly named is up to you.
Hugh



- Original Message -
From: "Karl James" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, March 11, 2003 10:37 PM
Subject: [PHP] help with insert into table to mysql


> Hey guys
>
> Im trying to have a form submit a body or article into a
> Table called articles for people to post there stories or what not.
> So far what I have written is not working and im not able to view
> My errors for some reson,
> Could some take a look at the three links below, thanks Karl
>
> My code: http://nopaste.php-q.net/7668
> My assignment: http://66.12.3.67/webdb/assign3.html
> My link for the assignemt:
> http://66.12.3.67/webdb/webdb13/insertarticle.php
>
>
>
>
> ultimatefootballleague.com/index.php
> [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] Maths on variables - please help

2003-03-11 Thread Hugh Danaher
simply:
$var1=99;
$var2=0;
$result=$var1*$var2; multiplication by zero is ok
if ($var2!=0) { //division by zero is bad  "!=" means not equal
$result=$var1/$var2; 
}
use brackets in complex equations 
$result=$var1*(1+$var2);

hugh

- Original Message - 
From: "Adriaan Nel" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, March 10, 2003 11:37 PM
Subject: [PHP] Maths on variables - please help


> Hi every1,
> 
> I would like some help on multiplication/division of variables on 1
> anotherI have looked at the bcmath() function, but it doesn't seem to
> work.
> 
> Could any1 pls assist.
> 
> Adriaan
> 
> 
> 
> -- 
> 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] help needed with code!!

2003-03-10 Thread Hugh Danaher
You might try changing  to php?>
something about short tags
hugh
- Original Message - 
From: "Karl James" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, March 10, 2003 10:14 PM
Subject: [PHP] help needed with code!!


> Can anyone give me some pointers on why im note seeing 
> Any output to the browser.
> 
> Thanks Karl
> 
> 
> my link
> http://66.12.3.67/webdb/webdb13/assignment_1.php
> 
> my code
> http://nopaste.php-q.net/7560
> 
> ultimatefootballleague.com/index.php
> [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] newbie: contents will not output

2003-03-10 Thread Hugh Danaher
Anthony,
Oh, I forgot to close the file, and it's an important step!

 fclose($fp);

Hugh
- Original Message - 
From: "Anthony Ritter" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, March 10, 2003 7:22 PM
Subject: [PHP] newbie: contents will not output


> I'm trying to test the following script to display the contents of the
> following URL but it will not output.
> 
> Any advice will be greatly appreciated.
> Thank you.
> Tony Ritter
> ...
> 
> 
> 
> 
> 
> $file_handler = fopen("http://www.weather.com";, "r");
> $contents = fread($file_handler, filesize($file));
> fclose($file_handler);
> echo $contents;
>  ?>
> 
> 
> 
> 
> 
> 
> 
> 
> -- 
> 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] newbie: contents will not output

2003-03-10 Thread Hugh Danaher
Anthony,

Try:

 $file_to_open="http://www.weather.com";;
 $fp=fopen($file_to_open,"r");
 $contents=fread($fp,1); //reads to eof or  ~10K whichever comes first
 print $contents;

Hope this helps.
Hugh
- Original Message - 
From: "Anthony Ritter" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, March 10, 2003 7:22 PM
Subject: [PHP] newbie: contents will not output


> I'm trying to test the following script to display the contents of the
> following URL but it will not output.
> 
> Any advice will be greatly appreciated.
> Thank you.
> Tony Ritter
> ...
> 
> 
> 
> 
> 
> $file_handler = fopen("http://www.weather.com";, "r");
> $contents = fread($file_handler, filesize($file));
> fclose($file_handler);
> echo $contents;
>  ?>
> 
> 
> 
> 
> 
> 
> 
> 
> -- 
> 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] Question

2003-03-10 Thread Hugh Danaher
something like:
print "";
while ( statement )
{
$i++;
if ($i==1) print "";
print "";
your image code;
print "";
if ($i==4) 
{
print "";
unset($i);
}
}
if ($i==1) print "";
if ($i==2) print "";
if ($i==3) print "";
print "";

might work better.
hugh
- Original Message - 
From: "Clint Tredway" <[EMAIL PROTECTED]>
To: "PHP" <[EMAIL PROTECTED]>
Sent: Monday, March 10, 2003 11:53 AM
Subject: [PHP] Question


> I have a display of images that every fourth image I want to start a new
> column. In ColdFusion I would use the MOD operator like this:
> 
> if query.recordcount MOD 4 eq 0
> 
> 
> /if
> 
> I am just having a brain lapse today, can someone help me do this same
> functionality in PHP?
> 
> Thanks!
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


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



Re: [PHP] image question

2003-03-10 Thread Hugh Danaher
Tony,
You might want to try the online php manual, I hear it's very good.
You should be able to do all of the tasks you desire.  Look for "image" in
your search.
Hope this helps.
Hugh
- Original Message -
From: "Anthony Ritter" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, March 10, 2003 10:23 AM
Subject: [PHP] image question


> I'm looking for a php tutorial or script which can open and read an
existing
> .jpg or .png from another URL.
>
> Next, the script then modifies that image by - say - cropping off the
bottom
> by 20px or resizing it by 50%.
>
> Lastly, could this modified file then be renamed on ones server?
>
> Many thanks,
> Tony Ritter
>
>
>
>
>
>
> --
> 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] Mining a file for data

2003-03-08 Thread Hugh Danaher
John,
I reread your post, and spent a bit of time to rewrite my last post.  This
should be more appropriate for your needs.  you'll need to add a few lines
yourself to complete it.  Let me know if it works.
hugh
";
 $temp=fgets($fp,100);
 $card_color=trim(preg_replace("Card Color:","",$temp));
 echo $card_color."";
 $temp=fgets($fp,100);
 $mana_cost=trim(preg_replace("Mana Cost:","",$temp));
 echo $mana_cost.";

 // you can complete the rest of this yourself.  Also, increase the limit of
characters for your card_text and flavor_text

 $query="insert into $table (card_name, card_color, mana_cost,
type_and_class, pow_tou, card_text, flavor_text, artist, rarity,
card_number) values ('".addslashes($card_name)."',
'".addslashes($card_color)."', '".addslashes($mana_cost)."', ...you can fill
in the rest yourself) ";
 $result=mysql_query($query);
 if (!$result) die ("failed on insert ".mysql_error());
 }
mysql_close($link);
fclose($fp);
?>
- Original Message -
From: "John Wulff" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 07, 2003 5:25 PM
Subject: [PHP] Mining a file for data


> I'm just learning PHP so please excuse my ignorance.  I'm trying to
extract
> the data from a simply formatted text file via a simple PHP script.  The
> goal of this project is to take Magic the Gathering spoiler lists and dump
> them into a MySQL database.  I've got plenty of experience with MySQL but
> not file parsing.  How do I about parsing this data?  What sort of pattern
> recognition do I use (if that's the right term).
> Thanks for the help.  The format of the file is below.
> -John
>
> Card Name: Akroma, Angel of Wrath
> Card Color: W
> Mana Cost: 5WWW
> Type & Class: Creature - Angel Legend
> Pow/Tou: 6/6
> Card Text: Flying, first strike, trample, haste, protection from black,
>   protection from red. Attacking doesn't cause Akroma, Angel
>   of Wrath to tap.
> Flavor Text: No rest.  No mercy.  No matter what.
> Artist:  Ron Spears
> Rarity:  R
> Card #:  1/145
>
> Card Name: Akroma's Devoted
> Card Color: W
> Mana Cost: 3W
> Type & Class: Creature - Cleric
> Pow/Tou: 2/4
> Card Text: Attacking doesn't cause Clerics to tap.
> Flavor Text: "Akroma asked for only one thing from her troops: unwavering,
>   unconditional loyalty."
> Artist:  Dave Dorman
> Rarity:  U
> Card #:  2/145
>
> etc.. etc...
>
>
>
> --
> 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] Resizing Images Uploaded to Web Page

2003-03-08 Thread Hugh Danaher
Actually you can input .GIF files but you can't output in that format on
most php-gd installs.  The following script shows most of the steps you're
going to need to get an image resized.  This script resizes files already
stored online but it can be changed to deal with a temp file.
Hope this helps.
Hugh

// resize routine, you may want something different
if (!isset($max)) $max=150;  // maximum dimension
if ($resize=="2") $max=200;


if ($height>$width)
 {
 $nheight=$max;
 $nwidth=$width/($height/$max);
 }
else
 {
 $nwidth=$max;
 $nheight=$height/($width/$max);
 }

//header("content-type: image/jpeg");
$image=imagecreatefromjpeg($picture); //could be imagecreatefromgif()
$image1=imagecreate($nwidth,$nheight);
imagecopyresized( $image1, $image,0,0, 0,0, $nwidth,
$nheight,$width,$height);
//imagecopyresampled( $image1, $image,0,0, 0,0, $nwidth,
$nheight,$width,$height);  // available on newer php versions but, alas, not
mine.
header("content-type: image/jpeg"); // needed if you're going to use the
result as an image on another page
imagejpeg($image1); // changing this to imagejpeg($image1,$new_image,80)
creates an image called $new_image with a quality of 80


ImageDestroy($image);
ImageDestroy($image1);
?>

- Original Message -
From: "Liam Gibbs" <[EMAIL PROTECTED]>
To: "php list" <[EMAIL PROTECTED]>
Sent: Saturday, March 08, 2003 12:32 PM
Subject: Re: [PHP] Resizing Images Uploaded to Web Page


> > I have users uploading images to a server and need to have those files
> > resized on upload. I looked under filesystem, but found nothing like
that.
> > Anyone?
>
> Check the GD extension. You'll need that installed, and the images can't
be
> GIFs (must be JPEGs or TIFs, something like that). Anyway, there should be
a
> function in there called imagecopyresized() you'll want to check out.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
- Original Message -
From: "Vernon" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, March 08, 2003 12:15 PM
Subject: [PHP] Resizing Images Uploaded to Web Page


> I have users uploading images to a server and need to have those files
> resized on upload. I looked under filesystem, but found nothing like that.
> Anyone?
>
> Thanks
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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



Re: [PHP] Mining a file for data

2003-03-07 Thread Hugh Danaher
depending on how the text file is organized, this can be an easy task or
impossible.  But, here goes:

If a line in the text file contains all the info about the card and is
organized routinely and separated by a special character ("," , ; or tab,
then you should be able to do something like the following:



";

$fp=fopen("persons.txt","r") or die ("Couldn't open file!");

while (!feof ($fp))
 {
 $persons=fgets($fp,100); // looks for \n (carrage return) or 100 characters
before moving on

 list($image,$title,$first,$date,)= split ("\t", $persons, 6);  /// splits
on tab
 print "
   $first 
   $title 
   $image 
   $date 
  ";
 $query="insert into $table (first, title, date, directory, image)
  values ('".addslashes($first)."',
'".addslashes($title)."',
'".addslashes($date)."',
'".addslashes($directory)."',
'".addslashes($image)."' )";
  $result=mysql_query($query);
  if (!$result) die ("couldn't update $table".mysql_error());
 }
fclose($fp);
mysql_close($link);
print "";
?>




- Original Message -
From: "John Wulff" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 07, 2003 5:25 PM
Subject: [PHP] Mining a file for data


> I'm just learning PHP so please excuse my ignorance.  I'm trying to
extract
> the data from a simply formatted text file via a simple PHP script.  The
> goal of this project is to take Magic the Gathering spoiler lists and dump
> them into a MySQL database.  I've got plenty of experience with MySQL but
> not file parsing.  How do I about parsing this data?  What sort of pattern
> recognition do I use (if that's the right term).
> Thanks for the help.  The format of the file is below.
> -John
>
> Card Name: Akroma, Angel of Wrath
> Card Color: W
> Mana Cost: 5WWW
> Type & Class: Creature - Angel Legend
> Pow/Tou: 6/6
> Card Text: Flying, first strike, trample, haste, protection from black,
>   protection from red. Attacking doesn't cause Akroma, Angel
>   of Wrath to tap.
> Flavor Text: No rest.  No mercy.  No matter what.
> Artist:  Ron Spears
> Rarity:  R
> Card #:  1/145
>
> Card Name: Akroma's Devoted
> Card Color: W
> Mana Cost: 3W
> Type & Class: Creature - Cleric
> Pow/Tou: 2/4
> Card Text: Attacking doesn't cause Clerics to tap.
> Flavor Text: "Akroma asked for only one thing from her troops: unwavering,
>   unconditional loyalty."
> Artist:  Dave Dorman
> Rarity:  U
> Card #:  2/145
>
> etc.. etc...
>
>
>
> --
> 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] populating textarea with data

2003-03-07 Thread Hugh Danaher
get your field info from a mysql search then do:

print "".stripslashes($array_result['field'])."";

Hope this helps,
Hugh

- Original Message -
From: "Mirco Ellis" <[EMAIL PROTECTED]>
To: "Php-General (E-mail)" <[EMAIL PROTECTED]>
Sent: Friday, March 07, 2003 6:27 AM
Subject: [PHP] populating textarea with data


> Hi, I have a simple RFQ ( request for quotes ) system that runs on mysql
and
> php. The clients inserts data into the database with a simple form, no
> problem! What I would like to do is when the user recalls data from the db
> that the data is displayed in a textarea rather than the old fashioned php
> table format. This way the user can edit the data conveniently and
> repopulate the db. I don't have the foggiest idea where to begin. Can
anyone
> help me please?
>
>
> Mirco Ellis
> I-Soft Solutions
> e-mail: [EMAIL PROTECTED]
> Tel: +27414847161
>
>
> --
> 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] I'm lost: text file upload

2003-03-05 Thread Hugh Danaher
 move_uploaded_file();


- Original Message -
From: "John Taylor-Johnston" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, March 05, 2003 10:33 PM
Subject: [PHP] I'm lost: text file upload


> Jason, I've already been looking at:
>
> http://www.php.net/manual/en/function.move-uploaded-file.php
> http://www.php.net/manual/en/features.file-upload.common-pitfalls.php
> http://www.php.net/manual/en/features.file-upload.php
> Indeed: http://ca.google.yahoo.com/bin/query_ca?p=php.net+upload+file
> and
> http://marc.theaimsgroup.com/?l=php-general
>
> Anyone,
>
> I'm looking for a couple of lines of code so I can upload the contents of
a *.txt into a buffer and declare it as a string so I can spit it back in a
. I don't want to necessarily upload a text file, only load it
into a buffer.
>
> I'm lost
>
>
> > --
> > Search the list archives before you post
> > http://marc.theaimsgroup.com/?l=php-general
> > --
>
> Charming isn't he?
>
>
> --
> 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] Log In

2003-03-05 Thread Hugh Danaher
Rob,
create a mysql table containing usernames and passwords then do something
like the following:
Hope this helps,
Hugh


";
 print "log in information";
 print "Input your name: ";
 print "Input your password: ";
 print "";
 print "";
 }
else
 {
 call_user_func('mysql_log_in',$db, $table, $user, $pass); /  open
database  ///
 $query="select * from $table where username='".addslashes($username)."' and
password='".addslashes($password)."' ";
 $result=mysql_query($query);
 $rows=mysql_num_rows($result);
 if ($rows==0) header("location: index.htm");  kicks them out
 if ($rows==1)
{
your page code goes here

}
}
?>


- Original Message -
From: "Van Andel, Robbert" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, March 05, 2003 3:50 PM
Subject: [PHP] Log In


Is there a handy function in PHP that I can use to retrieve the users
Windows Log in?  We are creating an application that will allow users to add
comments to a mysql database, and we would like to be able to track who is
putting the comments into the table, preferably with their windows log in.

Robbert van Andel





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



Re: [PHP] Can't get upload to work and I wonder...

2003-03-04 Thread Hugh Danaher
Thanks Jason,
Sounds simple.  I'll let the SA know what I want and see if I get it.
Hugh
- Original Message -
From: "Jason Wong" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, March 04, 2003 10:19 PM
Subject: Re: [PHP] Can't get upload to work and I wonder...


> On Wednesday 05 March 2003 13:37, Hugh Danaher wrote:
> > Help,
> > I've moved my upload script from one host to another, and what worked
once,
> > isn't working now.  In the new site's phpinfo file I see that
file_uploads
> > is set to "no value" and in the old it was "on."  What do I tell my
system
> > administrator to do to get this feature enabled? Thanks for any help.
>
> php.ini > file_uploads = On
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> --
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> --
> /*
> We'll try to cooperate fully with the IRS, because, as citizens, we feel
> a strong patriotic duty not to go to jail.
> -- Dave Barry
> */
>
>
> --
> 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] Can't get upload to work and I wonder...

2003-03-04 Thread Hugh Danaher
Help, 
I've moved my upload script from one host to another, and what worked once, isn't 
working now.  In the new site's phpinfo file I see that file_uploads is set to "no 
value" and in the old it was "on."  What do I tell my system administrator to do to 
get this feature enabled?
Thanks for any help.
Hugh



Re: [PHP] entrycheck

2003-03-04 Thread Hugh Danaher
Add the mysql_error() function to your script and run it again.  Could give
you some hint at what is wrong.

$result = mysql_query($query,$connection) or die("Query
failed".mysql_error());

- Original Message -
From: "Diksha Neel" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, March 03, 2003 10:50 PM
Subject: [PHP] entrycheck


> HI EVERYBODY,
>
> WHEN I RUN MY PHP SCRIPT TYPED BELOW, I GET 'connected
> successfully
> query failed'.
> i have in bdoi_change database a table called entry with 2
> fields:
> login and pass in which i have put some data.
>
> can anyone help out?
>
> regards,
> diksha.
>
> I HAVE AN HTML FORM BY NAME entry.html the code of
> which is the following:
>
> 
> User Name
> User Password 
> 
> 
>
> AND THE check.php code is as follows:
>
> 
> $connection=mysql_connect("localhost","root","")or die("Could not
> connect");
> print "Connected successfully";
> mysql_select_db("bdoi_change")or die("could not select
> database");
>
> $query = "select * from entry where login='$login' and
> pass='$pass' ";
> $result = mysql_query($query,$connection) or die("Query
> failed");
> $num=mysql_num_rows($result);
>
> //present results based on validity.
> echo "$num";
> if($num==1)
> {
> echo "You are a valid user!";
> }
>   if($num==0)
> {
> echo "you are not authorised";
> }
> ?>
>
>
>
>
>
> --
> 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] Spaces collapsed in database

2003-02-28 Thread Hugh Danaher
perhaps you are parsing out the spaces before inserting the vars in the
database?
- Original Message -
From: "Alberto Brea" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 28, 2003 7:58 AM
Subject: [PHP] Spaces collapsed in database


Hi, list
I had certain information in a text file, which showed ok upon fopen() and
parsing, but when I put it into a MySQL database, instead of echoing
directly into the browser, the spaces in the strings collapsed, so that "One
Two & Three" became "OneTwo&Three" in the database table. When I retrieve
this the spaces remain collapsed.
Can anybody tell me what I did wrong, or what can I do to prevent this from
happening?
Please find the code below

Thank you,
Alberto

  // QUERY 1: INSERT RECORDS INTO TABLE contacts
  // DEFINE VARIABLES FOR QUERY 1
  $sex=$info[1];
  $lang=$info[2];
  $pretreat=$info[3];
  $fname=$info[4];
  $lname=$info[5];
  $posttreat=$info[6];
  $contabbr=$info[9];
  $persweb=$info[10];
  $idactiv=$info[11];
  $unsubscribe=$info[14];
  $ent=$info[7];
  $city=$info[13];
  $email=$info[8];
  $random=$info[14];

  // DEFINE QUERY 1
  $sql1= "INSERT INTO contacts SET
   sex='$sex',
   lang='$lang',
   pretreat='$pretreat',
   fname='$fname',
   lname='$lname',
   posttreat='$posttreat',
   contabbr='$contabbr',
   persweb='$persweb',
   idactiv='$idactiv',
   unsubscribe='$unsubscribe',
   ent='$ent',
   city='$city',
   email='$email',
   random='$random',
   date= CURDATE()";

  // RUN QUERY 1
  if(!mysql_query($sql1)):
   echo("Unable to add contact: ". mysql_error() . "");
  else:
   echo("Contact added successfully");
  endif;




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



Re: [PHP] strip comma from $value

2003-02-28 Thread Hugh Danaher
try ereg_replace(",","",$value);

- Original Message -
From: "Jim Long" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 28, 2003 9:17 AM
Subject: [PHP] strip comma from $value


> Hi,
>
> I've figured out the way to solve my problem is to get rid of the commas
> before I sort.
>
> Trying to use this:
>
> //strip the commas---
> foreach ($numeric_array as $key => $value) {
> if (stristr($value, ",")){
> //test to see if it worked
> echo("comma striped");
> }
> }
>
> --
>
> It passed the test but,
> I'm doing something wrong because the commas are still there.
>
> TIA,
> Jim Long
>
> Jim Long Wrote:
> > Does anyone know how to make the flag "sort_numeric" work?
> > Will it work with asort?
> >
> > asort ($numeric_array, SORT_NUMERIC);
> > I've tried this but it looks like it's having problems with the comma in
> > big numbers.
> > I'm not absolutely sure, but it looks like it's ignoring everything
> > after a comma when it sorts.
> >
>
>
> >
> > BTW: asort is the one I need as I must maintain the keys
> >
> > JanetVal Wrote:
> >
> > > sort() sorts by value but assigns new keys as numbers.
> > > asort() sorts by value, but keeps the same keys
> > > ksort() sorts by key.
> >
> > THANKS !
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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



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

2003-02-28 Thread Hugh Danaher
A basic html input command using an image will enable you to send the
coordinates of the mouse to the next script.



your x,y variables will become $coordinate_x,$coordinate_y


- Original Message -
From: "Minghua Yao" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 28, 2003 8:59 AM
Subject: [PHP] Any function that gives the coordinates of the cursor?


> Hi, all,
>
> Are there any functions in PHP which can give us the coordinates of the
cursor when we click the mouse?
> Thanks for the replys.
>
> Minghua
>


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



Re: [PHP] button not seen

2003-02-21 Thread Hugh Danaher
Diksha,
A quick google search shows that "buttons" are likely a javascript thing,
not an html or php thing.  Also, I agree with Jason Wong in that  and  tags should be in your script too.

- Original Message -
From: "DIKSHA NEEL" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 21, 2003 12:05 AM
Subject: [PHP] button not seen


> dear all,
>
> hi!
> i have a php script filecheck2.php in which i have written the
> following code.
>
> $fp = fopen("sundar.html", "w");
> fwrite($fp, "dikshai
> solved problem!");
> //fwrite($fp,"your login name is : $login");
> fwrite($fp,"");
> fwrite($fp,"");
> fwrite($fp, "");
> fclose($fp);
>
> now when i run the php script, i am able to see "i solved
> problem"
> on my screen according to the code.
> but i CANNOT SEE THE BUTTON !
>
> can anyone please tell me why?
>
> regards,
> diksha.
>
>
> --
> 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] button not seen

2003-02-21 Thread Hugh Danaher
Diksha,
It's very late in phpland perhaps all the coders have gone out for coffee.
However, perhaps "button" isn't what you want, try radio, submit or
checkbox.
Also, do a google search on html and button to see what's out there.
Cheers,
Hugh
- Original Message -
From: "DIKSHA NEEL" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 21, 2003 12:05 AM
Subject: [PHP] button not seen


> dear all,
>
> hi!
> i have a php script filecheck2.php in which i have written the
> following code.
>
> $fp = fopen("sundar.html", "w");
> fwrite($fp, "dikshai
> solved problem!");
> //fwrite($fp,"your login name is : $login");
> fwrite($fp,"");
> fwrite($fp,"");
> fwrite($fp, "");
> fclose($fp);
>
> now when i run the php script, i am able to see "i solved
> problem"
> on my screen according to the code.
> but i CANNOT SEE THE BUTTON !
>
> can anyone please tell me why?
>
> regards,
> diksha.
>
>
> --
> 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] image creation error

2003-02-17 Thread Hugh Danaher
General builds of the GD library don't contain gif support.  Visit the GD
site to see what they say about gif support.  If you're building a graph
then use png; if an image use jpg.

Hugh
- Original Message -
From: "Michael P. Carel" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, February 17, 2003 6:51 PM
Subject: Re: [PHP] image creation error


> i've already compiled my PHP4 with imagejpeg support but now im loosing my
> imagegif function. Image jpeg function is now working but for the gif im
> receiving this error:
> Fatal error: Call to undefined function: imagegif()
>
> Here's my php info after my re-compilation :
>
> Configure Command  './configure' '--with-mysql'
> '--with-apache=../apache_1.3.24' '--with-gd'
> '--with-jpeg-dir=/php-4.3.0/ext/gd/libgd' '--with-zlib'
> GD Support  enabled
> GD Version  bundled (2.0 compatible)
> GIF Read Support  enabled
> JPG Support  enabled
> PNG Support  enabled
> WBMP Support  enabled
>
>
> Any idea why?
>
>
> Mike
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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




Re: [PHP] text to image

2003-02-14 Thread Hugh Danaher
Alex,
You should either use png or jpg rather than gif.  The most common builds of
the gd library support those image formats--go to the GD Library site to
find out why.  The support of ttf fonts should be taken up with your host.

When testing whether the code in your image creation file works, use
something like
say something wonderful here
and any error messages will be displayed.  Once you've got it down pat, then
you can just swap out the line with an image tag, 

$font="./fonts/verdana.ttf"; // the path to the font is needed if it isn't
in the same directory as the script
$im = imagecreate (400, 16);
$black = imagecolorallocate ($im, 0, 0, 0);
$white = imagecolorallocate ($im, 255, 255, 255);
imagettftext ($im, 10, 0, 10, 20, $black, $font, date('| l | F | d | Y |'));
header ("Content-type: image/png");  //header just before the imagepng call.
imagepng ($im);
imagedestroy ($im);

Hope this helps,
Hugh


- Original Message -
From: "Alex Shi" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 14, 2003 1:00 PM
Subject: Re: [PHP] text to image


> forgot somethingwhen try following script in another server I got
> 500 internal server error.
>
>header ("Content-type: image/gif");
>   $im = imagecreate (400, 16);
>   $black = imagecolorallocate ($im, 0, 0, 0);
>   $white = imagecolorallocate ($im, 255, 255, 255);
>   imagettftext ($im, 10, 0, 10, 20, $black, "verdana.ttf", date('| l | F |
d
> | Y |'));
>   imagegif ($im);
>   imagedestroy ($im);
> ?>
>
> Alex again
>
> >
> > I got following error msg when ran it:
> >
> > 
> > Warning:  ImageTtfText: No TTF support in this PHP build in
> > /home/dotkard/www/current_time.php on line 6
> > 
> > Warning:  ImageGif: No GIF support in this PHP build in
> > /home/dotkard/www/current_time.php on line 7
> >
> > I checked the phpinfo but failed to find which variable I should turn
on.
> >
> > Alex
> >
> > > Alex,
> > > Easy to do what you want.  Check out the "image" functions in the php
> > > manual.  There are some font limitations, specifically dealing with
> > > alternate characters, but you'll find out what works and what doesn't
> soon
> > > enough.
> > > Hugh
> > >
> > > - Original Message -
> > > From: "Alex Shi" <[EMAIL PROTECTED]>
> > > To: <[EMAIL PROTECTED]>
> > > Sent: Friday, February 14, 2003 10:16 AM
> > > Subject: [PHP] text to image
> > >
> > >
> > > > Hello,
> > > >
> > > > I am thinking to create php script to dynamically convert a text
> string
> > to
> > > > image. My questions are:
> > > >
> > > > 1. with a given text string, say "hello, world", is it possible to
> > > > dynamically
> > > > convert it to an image? and what php built-in functions can be
> utilized?
> > > > 2. if I want to use true-type verdana font, can I just upload the
> > windows
> > > > font file to the web server (linux) and use php to load the font?
> > > >
> > > > Thanks in advance!
> > > >
> > > > Alex Shi
> > > >
> > > >
> > > >
> > > > --
> > > > ==
> > > > Cell Phone Batteries at 30-50%+ off retail prices!
> > > > http://www.pocellular.com
> > > > ==
> > > > TrafficBuilder Network:
> > > > http://www.bestadv.net/index.cfm?ref=7029
> > > > ==
> > > >
> > > >
> > > > --
> > > > 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] text to image

2003-02-14 Thread Hugh Danaher
Alex,
Easy to do what you want.  Check out the "image" functions in the php
manual.  There are some font limitations, specifically dealing with
alternate characters, but you'll find out what works and what doesn't soon
enough.
Hugh

- Original Message -
From: "Alex Shi" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 14, 2003 10:16 AM
Subject: [PHP] text to image


> Hello,
>
> I am thinking to create php script to dynamically convert a text string to
> image. My questions are:
>
> 1. with a given text string, say "hello, world", is it possible to
> dynamically
> convert it to an image? and what php built-in functions can be utilized?
> 2. if I want to use true-type verdana font, can I just upload the windows
> font file to the web server (linux) and use php to load the font?
>
> Thanks in advance!
>
> Alex Shi
>
>
>
> --
> ==
> Cell Phone Batteries at 30-50%+ off retail prices!
> http://www.pocellular.com
> ==
> TrafficBuilder Network:
> http://www.bestadv.net/index.cfm?ref=7029
> ==
>
>
> --
> 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] help with script!!!

2003-02-01 Thread Hugh Danaher
echo("| %s | %s | %s | %s | %s |", $array[id], $array[username],
$array[password], $array[status], $array[notes]);

try
echo "| %s | %s | %s | %s | %s |".$array[id]." ".$array[username]."
".$array[password]." ".$array[status]." ".$array[notes];

dots not comas between variables.
Hope this helps.
Hugh
- Original Message -
From: "Karl James" <[EMAIL PROTECTED]>
To: "php" <[EMAIL PROTECTED]>
Sent: Friday, January 31, 2003 10:37 PM
Subject: [PHP] help with script!!!


Hello guys and gals!!!

can you tell me why i can't get this script to print my
table

thanks Karl

please check out the code below
obviously i left my username and passwords blank :-)



-

", $array[id], $array[username],
$array[password], $array[status], $array[notes]);
}
?>

-

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



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




Re: [PHP] best way to save form data on user side

2003-01-28 Thread Hugh Danaher
You could use the mail() function to automatically send an email to your
user.  In the email could be an html page with the same form they'd filled
out plus some hidden input fields which would tell you that they are
updating their stored information.  With this, your user gets confirmation
of what was submitted, a way to edit their initial input and a record which
they can keep on their own computer.
Hope this helps,
Hugh

- Original Message -
From: "Petre Agenbag" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, January 28, 2003 11:35 AM
Subject: [PHP] best way to save form data on user side


> Hi
> I have a rather annoying problem regarding forms.
> I have built an app that allows the users to fill in a rather large form
> (much like a claim form) and then have the data pumped into a mysql db.
> The problem is: the users want to be able to "save" their forms on their
> systems as a) backup/proof that they have filled it in and b) for their
> records for future use and c) the hope is that it would also allow for a
> reliable method to complete the form off-line and then submit it when
> online again.
>
> So, I'm not sure what the best way is to tackle this situation. My gutt
> says it would need some kind of client stand alone app, but I wouldn't
> want to go there unless I am proven beyond reasonable doubt that it is
> the only way.
>
> The users are mostly in computer limbo, and if they had their way, they
> would want to use "Word or Excel" to complete the forms, save it to
> their hard drive and "click to send it away"...
>
> Help!, Please?!
>
>
>
>
>
>
> --
> 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] Multiple sizes for products

2003-01-18 Thread Hugh Danaher
If your customer views these items as different products then store them as
separate records in the same table.
My $0.02
Hugh
- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, January 18, 2003 11:55 AM
Subject: [PHP] Multiple sizes for products


Hi all,

I'm making this web site, where the owner or administrator will be able to
upload new products and these products come in different sizes. Now, I made
a table in MySQL o store the products but only with a VARCHAR field where
the administrator will store the sizes like "12, 14, 16 and 18".

I would like to store the sizes for each product in a different table, but
my question refers on how to do this... one product per row with all the
different sizes (which will leave too many blank fields in every row) or
one size per row, making several rows per product.

Thanks in advance,

Cesar L. Aracena
[EMAIL PROTECTED]
[EMAIL PROTECTED]
(0299) 156-356688
Neuquén (8300) Capital
Argentina


mail2web - Check your email from the web at
http://mail2web.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] Re: List items in table with a hypertext link

2003-01-16 Thread Hugh Danaher
Al,
Something like the following should enable you to display a list of
whatever, then click on the record id to edit the record.  This is a portion
of code which does the display, you'll need another portion to display the
record for editing.

Hugh
snip from street.php
 Click on an ID number to edit the information of that
record.";
 print "
   ID
   Scientific Name (Common Name)
   Address
   District
   ";
 while ($array_result=mysql_fetch_array($result))
  {
   print "".stripslashes($array_result[id])."
 ".stripslashes($array_result[scientific_name])."
(".stripslashes($array_result[common_name]).")
 ".stripslashes($array_result[address])."
".stripslashes($array_result[comments])." 

".stripslashes($array_result[district])." ";
  }
 print "";

?>
- Original Message -
From: "Al" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 16, 2003 2:14 PM
Subject: [PHP] Re: List items in table with a hypertext link


> This may be a bit more than you are looking for.
>
> http://sourceforge.net/projects/phpmyedit/
>
>
>
> Mike Tuller wrote:
> > I have been looking for an example of how to create a listing of items
> > in a table where you have the first item in the list have a link so that
> > when you click on it, it will open a page for editing the contents of
> > that item. So for instance you have a list of employees, and you want to
> > change their phone number you could go to the list and click on the
> > employee id number and it would open a page where you can edit the
> > employee information.
> >
> > I haven't been able to find a good example of this, so if anyone knows
> > where I could find one, please let me know.
> >
> > Mike
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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




Re: [PHP] I am a dullard

2003-01-07 Thread Hugh Danaher
Try,
$Query="INSERT into calendar (meeting_name, meeting_place, meeting_date,
meeting_note)
values
('$meeting_name','$meeting_place','$meeting_date','$meeting_note')";
Hope this helps,
Hugh

- Original Message -
From: "Jason Wong" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, January 07, 2003 7:14 AM
Subject: Re: [PHP] I am a dullard


> On Wednesday 08 January 2003 02:09, Todd Barr wrote:
> > Okay...I am now having difficulty with putting things INTO the database.
> >
> > The form is on another page, and links to this one.
> >
> >  > $Host="localhost";
> > $User="us34992a";
> > $Password="**";
> > $DBname="db34992a";
> > $Link=mysql_connect ($Host, $User, $Password);
> > $db=mysql_select_db($DBname, $Link)
> > or die ("Unable to select database");
> > $Query="INSERT into calendar values
> > ('$meeting_name','$meeting_place','$meeting_date','$meeting_note')";
> > $result=mysql_query($Query);
> > mysql_close ($Link);
> > ?>
>
> And what is the problem?
>
> What does $Query contain?
>
> After doing mysql_query() what does mysql_error() show?
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
>
> /*
> Numbers talk, bullshit walks.
>
> - Dave Miller on linux-kernel
> */
>
>
> --
> 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] Create Online Test Program

2003-01-03 Thread Hugh Danaher
Devin,
I did a 10 question quiz for a local museum which involved using radio
buttons and automatic advance to the next question.  At the end I summed the
correct answers and gave a score.  I've wanted to shorten the whole thing
and use a mysql table, but...
The following snip should give you a bit of knowledge on how to (or not to)
do an online quiz.
The quiz is located at http://www.museumoflocalhistory.org/pages/quiz.php
Hope this helps,
Hugh

//snip




function go(loc)
 {
 window.location.href = loc;
 }



10 Questions to Challengeyour knowledge of Washington
Township";
 print "Take the
Quiz!";
 print "";
 }

// question 1
if ($quest=="1")
 {
 if (!isset($ans))
  {
  $var=1;
  print "";
  print "Question #$var";
  print "";
  print "The City of Fremont was formed from the communities of
Centerville, Irvington, Mission San Jose, Niles, and Warm
Springs.";
  print "
True";
  print "
False";
  print "";
  print "";
  }
 if (isset($ans))
  {
  if ($ans=="1")
   {
   $correct=$correct+1;
   unset($ans);
   print "You are correct!Fremont was formed by the
incorporation of the 5 towns.";
   }
  if ($ans=="0")
   {
   $correct=$correct+0;
   unset($ans);
   print "Sorry, the statement was true.Fremont was formed
by the incorporation of the 5 towns.";
   }
  print "Go
to Question #".($var+1)."";
  print "";
  }
 }
//end snip

- Original Message -
From: "Devin Atencio" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, January 03, 2003 2:47 PM
Subject: [PHP] Create Online Test Program


>
> Dear PHP Users,
>
> I am in the process of trying to create an Online Program that will
> give questions and possible answers then score the test. I was wondering
> if anyone has done this type of thing already and might be able to give
> me some pointers on what the best method of doing this might be?
>
> Devin
>
>
> --
> 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] test

2002-12-17 Thread Hugh Danaher
Nah, I didn't get it either.

- Original Message - 
From: "Roger Lewis" <[EMAIL PROTECTED]>
To: "Martin Towell" <[EMAIL PROTECTED]>
Cc: "Php-General" <[EMAIL PROTECTED]>
Sent: Tuesday, December 17, 2002 10:36 PM
Subject: RE: [PHP] test


> Martin,
> I'm sending too [EMAIL PROTECTED] also.  Never seen anything like
> this before
> Roger
> 
> Martin Towell wrote:
> 
> < actually, I get the same error. I've been putting it down to someone
> < subscribing and now their email is invalid. <<
> 
> < BTW: I'm emailing to [EMAIL PROTECTED] - if that helps
> 
> 
> 
> --
> 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
> 


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




Re: [PHP] Beginner question : Removing spaces in forms

2002-12-13 Thread Hugh Danaher
you could start with something like:
$old_string="44 55 99 111";
$new_string=ereg_replace(" ","",$old_string);
echo $new_string;
should display
445599111
There are other regular expression aids listed on the page at:
http://www.php.net/manual/en/function.ereg-replace.php
Hope this helps,
Hugh

- Original Message -
From: "Andrew Wilson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, December 12, 2002 7:19 PM
Subject: [PHP] Beginner question : Removing spaces in forms


>
> Hay guys i was wondering if there was a form parameter of something
> equivalent for input text boxes that when a user enters a number or series
> of numbers that it removes the spaces.
> If there is no alternative how would you go about solving this issue.
>
> Your help is appreciated.
> Thanks.
>
>
> Netway Networks Pty Ltd
> (T) 8920 8877
> (F) 8920 8866
>
>
>
> --
> 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: Problems connecting to a MySQL database

2002-12-12 Thread Hugh Danaher
Eric,
When the page gets reloaded it "forgets' the variables passed to it from the
previous page.  Try putting the log in information and anything else needed
in hidden fields in your form.
Hugh
- Original Message -
From: "eric" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, December 12, 2002 11:58 AM
Subject: [PHP] Re: Problems connecting to a MySQL database


> A prompt?  Not sure I understand.
>
> The first time around it connects ok with PHP.  I can retrieve all the
rows.
> It's the 2nd time where it doesn't.
>
> Jeff Bluemel wrote:
>
> > have you tried connected to the mysql database from a prompt before
using
> > php???
> >
> >
> > "Eric" <[EMAIL PROTECTED]> wrote in message
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> >> Greetings!
> >>
> >> I have a script which attempts to connect to the database in three
> > different
> >> segments of code.
> >>
> >> I'm using this code to connect to the database:
> >>
> >> $db = mysql_connect("the_host", "the_user",
> > $cfg['Servers'][0]['password']);
> >> .
> >> .
> >> .
> >> .
> >> mysql_close($db);
> >>
> >> The first time I connect ok, retrieve all of the rows from a table, and
> >> display portions of a column.
> >>
> >> A user then clicks on a button to retrieve more detailed information
from
> >> the same table in the database:
> >>
> >> $db = mysql_connect("the_host", "the_user",
> > $cfg['Servers'][0]['password']);
> >>
> >> This bombs with:
> >>
> >> Warning: Undefined offset: 0 in (directory
> > stuff)/www/cgi-php4/my_script.php
> >> on line 228
> >>
> >> Warning: Access denied for user: 'the_user' (Using password: NO) in
> >> (directory stuff)/www/cgi-php4/my_script.php on line 228
> >>
> >> Warning: MySQL Connection Failed: Access denied for user: 'the_user'
> > (Using
> >> password: NO) in (directory stuff)/www/cgi-php4/my_script.php on line
228
> >>
> >> Error: Could not connect to the database.
> >>
> >>
> >> Now, if I change the index to match the exact number of rows in the
> >> table, it's successfully accessed:
> >>
> >> $db = mysql_connect("the_host", "the_user",
> > $cfg['Servers'][4]['password']);
> >>
> >> it works fine.  But I don't think this is right.
> >>
> >> Any ideas as to why this is happening?
> >>
> >> Thanks much!
> >>
> >> Eric
>
>
> --
> 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 know from wich page you came from

2002-12-10 Thread Hugh Danaher
If you have control of the pages the visitor just left, then you should be
able to modify the links there and pass forward a variable similar to the
following.

Then on your receiving page you can check the value of $var and do something
with this info.
Hope this helps,
Hugh

- Original Message -
From: "Rodrigo" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, December 10, 2002 6:20 AM
Subject: [PHP] How know from wich page you came from


> Hi guys I need a way to know how to know from wich page the visitor
> came, something like:
>
> I wanna put in a php file a switch to do a certain action if the visitor
> came from a certain page, and something else if he came from a diferent
> one, this way I could write, update, insert, delete or anything I need
> from a single file.
>
> Thanks for any kind of input,
> Rodrigo
>
>


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




Re: [PHP] writing to mysql using php

2002-12-09 Thread Hugh Danaher
Shams,
Most database actions you want your user to do should be limited to them
writing to one record and/or updating that one record.  If instead you want
to update information on several records, then you'd need a statement like:
$table="your_table_name";
$query=mysql_query("update $table set column_name='what ever' where
other_column_name='something else'");
Hope this helps,
Hugh

- Original Message -
From: "Enrique Garcia Briones" <[EMAIL PROTECTED]>
To: "Shams" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Monday, December 09, 2002 12:10 PM
Subject: RE: [PHP] writing to mysql using php


> If there were no more replies... you can use it by means of BUCLES, isn't
> it?
>
> BR, Enrique
>
> -Mensaje original-
> De: Shams [mailto:[EMAIL PROTECTED]]
> Enviado el: Martes, 03 de Diciembre de 2002 04:32 a.m.
> Para: [EMAIL PROTECTED]
> Asunto: [PHP] writing to mysql using php
>
>
> Hi,
>
> I'm relatively new to PHP and mySQL.
>
> I currently have a simple table created within a MySQL database.  And I
have
> a php script that connects to the database, presents a form for the user
to
> fill in, and then writes that record to the table.
>
> Instead... is it possible, to write to multiple records at once using a
> tabular view rather than one record at a time with a columnar view ?
>
> Many Thanks,
>
> Shams
>
>
>
> --
> 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] Struggling with code

2002-12-05 Thread Hugh Danaher
Great to hear it works!
I'd still consider using addslashes and the only way I've gotten it to work
is to write them in like the following:
url='".addslashes($url)."'
Looks messy but works.  Oh, and stripslashes on the output too.
Good Night!
Hugh
- Original Message -
From: "Ben C." <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, December 05, 2002 12:17 AM
Subject: RE: [PHP] Struggling with code


> Hugh, I took away the comma from $url and it works.
>
> Everyone, Thanks for your help!
>
> Ben
>
> -Original Message-
> From: Ben C. [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, December 05, 2002 12:15 AM
> To: [EMAIL PROTECTED]
> Subject: RE: [PHP] Struggling with code
>
>
> I have incorporated most of the suggestions.  My most recent code is:
>
> 
> $db_name = "db1";
> $table_name = "user";
>
> $connection = mysql_connect("localhost", "user", "password") or
> die("Couldn't connect.");
>
> $db = mysql_select_db($db_name, $connection) or die("Couldn't select
> database.");
>
> $sql = "UPDATE user
> SET
> name = '$name',
> lname = '$lname',
> mobil = '$mobil',
> email = '$email',
> url = '$url',
> WHERE id= '$id'
>
> ";
>
> $result = mysql_query($sql,$connection) or mysql_error("Couldn't execute
> query.");
>
>
> ?>
>
> -Original Message-
> From: Hugh Danaher [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, December 05, 2002 12:07 AM
> To: Ben C.
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] Struggling with code
>
>
> please post lines 20 and 21, get rid of all @, the comma after url='$url'
> and show your most recent code.  Others have posted and given you good
> advice, you should incorporate their suggestions.
>
> hugh
> - Original Message -
> From: "Ben C." <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, December 04, 2002 11:44 PM
> Subject: RE: [PHP] Struggling with code
>
>
> > I am now getting the following error:
> >
> > Warning: Supplied argument is not a valid MySQL-Link resource in
> > /home/httpd/vhosts/localhost/httpdocs/data/up.php
> > on line 21
> >
> > Why do you think that is?
> >
> > -Original Message-
> > From: Jason Wong [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, December 04, 2002 9:53 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: [PHP] Struggling with code
> >
> >
> > On Thursday 05 December 2002 13:24, Ben C. wrote:
> > > I am struggling with the code below.  I keep getting the error
"Couldn't
> > > execute query".  Please help me out, let me know where I am going
wrong.
> > >
> > >  > >
> > > $db_name = "db1";
> > > $table_name = "user";
> > >
> > > $connection = @mysql_connect("localhost", "user", "password") or
> > > die("Couldn't connect.");
> > >
> > > $db = @mysql_select_db($db_name, $connection) or die("Couldn't select
> > > database.");
> > >
> > > $sql = "UPDATE $table_name
> > > SET
> > > name = \"$name\",
> > > lname = \"$lname\",
> > > mobil = \"$mobil\",
> > > email = \"$email\",
> > > url = \"$url\",
> > > WHERE id= \"$id\"
> > > ";
> > >
> > > $result = @mysql_query($sql,$connection) or die("Couldn't execute
> > query.");
> > >
> > > ?>
> >
> > How about NOT masking the error message by using mysql_query(), instead
of
> > @mysql_query(). And instead of using die(), use echo mysql_error().
> >
> > --
> > Jason Wong -> Gremlins Associates -> www.gremlins.biz
> > Open Source Software Systems Integrators
> > * Web Design & Hosting * Internet & Intranet Applications Development *
> >
> > /*
> > A rolling stone gathers no moss.
> > -- Publilius Syrus
> > */
> >
> >
> > --
> > 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
>
>
> --
> 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] Struggling with code

2002-12-05 Thread Hugh Danaher
please post lines 20 and 21, get rid of all @, the comma after url='$url'
and show your most recent code.  Others have posted and given you good
advice, you should incorporate their suggestions.

hugh
- Original Message -
From: "Ben C." <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, December 04, 2002 11:44 PM
Subject: RE: [PHP] Struggling with code


> I am now getting the following error:
>
> Warning: Supplied argument is not a valid MySQL-Link resource in
> /home/httpd/vhosts/localhost/httpdocs/data/up.php
> on line 21
>
> Why do you think that is?
>
> -Original Message-
> From: Jason Wong [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, December 04, 2002 9:53 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] Struggling with code
>
>
> On Thursday 05 December 2002 13:24, Ben C. wrote:
> > I am struggling with the code below.  I keep getting the error "Couldn't
> > execute query".  Please help me out, let me know where I am going wrong.
> >
> >  >
> > $db_name = "db1";
> > $table_name = "user";
> >
> > $connection = @mysql_connect("localhost", "user", "password") or
> > die("Couldn't connect.");
> >
> > $db = @mysql_select_db($db_name, $connection) or die("Couldn't select
> > database.");
> >
> > $sql = "UPDATE $table_name
> > SET
> > name = \"$name\",
> > lname = \"$lname\",
> > mobil = \"$mobil\",
> > email = \"$email\",
> > url = \"$url\",
> > WHERE id= \"$id\"
> > ";
> >
> > $result = @mysql_query($sql,$connection) or die("Couldn't execute
> query.");
> >
> > ?>
>
> How about NOT masking the error message by using mysql_query(), instead of
> @mysql_query(). And instead of using die(), use echo mysql_error().
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
>
> /*
> A rolling stone gathers no moss.
> -- Publilius Syrus
> */
>
>
> --
> 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] Struggling with code

2002-12-04 Thread Hugh Danaher
try
$sql = "UPDATE $table_name SET name = '".addslashes($name)."', lname =
'".addslashes($lname)."', mobil = '".addslashes($mobil)."', email =
'".addslashes($email)."',  url = '".addslashes($url)."',  WHERE id= $id ";

// mysql needs single quote marks ( ' ) around input values that are not
numbers.  The addslashes keeps
// names like Al  "Scar Face" Capone or Nina O'Clock from causing your
script to puke.
Hugh

- Original Message -
From: "Jason Wong" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, December 04, 2002 9:52 PM
Subject: Re: [PHP] Struggling with code


> On Thursday 05 December 2002 13:24, Ben C. wrote:
> > I am struggling with the code below.  I keep getting the error "Couldn't
> > execute query".  Please help me out, let me know where I am going wrong.
> >
> >  >
> > $db_name = "db1";
> > $table_name = "user";
> >
> > $connection = @mysql_connect("localhost", "user", "password") or
> > die("Couldn't connect.");
> >
> > $db = @mysql_select_db($db_name, $connection) or die("Couldn't select
> > database.");
> >
> > $sql = "UPDATE $table_name
> > SET
> > name = \"$name\",
> > lname = \"$lname\",
> > mobil = \"$mobil\",
> > email = \"$email\",
> > url = \"$url\",
> > WHERE id= \"$id\"
> > ";
> >
> > $result = @mysql_query($sql,$connection) or die("Couldn't execute
query.");
> >
> > ?>
>
> How about NOT masking the error message by using mysql_query(), instead of
> @mysql_query(). And instead of using die(), use echo mysql_error().
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
>
> /*
> A rolling stone gathers no moss.
> -- Publilius Syrus
> */
>
>
> --
> 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] Whimper, help :)

2002-12-04 Thread Hugh Danaher
why
'.$table.'
and not
'".$table."'
with what you've got now, I believe you are looking for
.table name.
instead of
table name
and if your table name is only one word, a good practice I'm told, ditch the
' and " marks entirely
and just use
...FROM $table WHERE...
also, use double quotes for start and end of variables as in:
$sql="select * from '".$table."' where var='some value other
than a number' ";

Hope this helps
Hugh

"We have met the enemy and they is us!" Pogo





- Original Message -
From: "John Taylor-Johnston" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, December 03, 2002 10:28 PM
Subject: Re: [PHP] Whimper, help :)


>
http://ccl.flsh.usherb.ca/print/print.html?search=%26quot%3Bready+maria%26qu
ot%3B
>
http://ccl.flsh.usherb.ca/print/index.html?search=%26quot%3Bready+maria%26qu
ot%3B
>
> I blame PHP. Can't be MySQL.
> echo $sql displays the EXACT same thing.
>
> Debugging ... Works jdaxell.ccl = 2 records found:
> $sql = 'SELECT id,AU,ST,BT,AT FROM '.$table.' WHERE MATCH
> (TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO)
> AGAINST (\'"ready maria"\' IN BOOLEAN MODE) ORDER BY id asc';
> http://ccl.flsh.usherb.ca/print/display.test.inc.phps
>
>
> Doesn't work - Resembles +ready +maria
> $sql = "SELECT id,AU,ST,BT,AT FROM $table WHERE MATCH
> (TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO)
> AGAINST ('".stripslashes($search)."' IN BOOLEAN MODE) ORDER BY id asc";
> http://ccl.flsh.usherb.ca/print/display.table.inc.phps
>
> Doesn't work - Resembles +ready +maria
> $sql = "SELECT id,AU,ST,BT,AT FROM ".$table." WHERE MATCH
> (TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO)
> AGAINST ('".stripslashes($search)."' IN BOOLEAN MODE) ORDER BY id asc";
> http://ccl.flsh.usherb.ca/print/display.table.inc.phps
>
>
> Doesn't work - Resembles +ready +maria
> $sql = 'SELECT id,AU,ST,BT,AT FROM '.$table.' WHERE MATCH
> (TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO)
> AGAINST (\''.stripslashes($search).'\' IN BOOLEAN MODE) ORDER BY id asc';
> http://ccl.flsh.usherb.ca/print/display.table.inc.phps
>
>
> :0
> John
>
>
> --
> 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] Prevent storing data when reload

2002-12-03 Thread Hugh Danaher
put
if (!isset($blocker))
{
your form goes here
within your form add
print "
end your form
}

With this, your input form is on the page when the page first loads (and
$blocker is not set), but disapears when the data is submitted and the page
reloads.  Even if the user hits the refresh button on the browser, the
$blocker variable is still set and the form doesn't reapear.
You can chain up a bunch of these and accomplish with one page what would
have taken several.
Hope this helps,
Hugh

- Original Message -
From: "Lars Espelid" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, December 03, 2002 3:17 PM
Subject: [PHP] Prevent storing data when reload


> Hello,
>
> I have a php-page whith a form-schema which stores data to a
mysql-database
> on submit. (The schema posts data to the same page (php-self).)
>
> When I reload the page the data gets stored once more. I'm sure this is a
> well known problem. Are there any smart tricks to prevent this from
> happening?
>
> Thanks!
>
> Lars
>
>
>
> --
> 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] Test links?

2002-12-01 Thread Hugh Danaher
Yes I did.  Thanks.
- Original Message -
From: "Jason Wong" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, December 01, 2002 2:30 AM
Subject: Re: [PHP] Test links?


> On Sunday 01 December 2002 15:33, Hugh Danaher wrote:
> > Not sure how to supress the warning message that PHP automatically does
> > when you haven't got a valid URL though.
>
> Error reporting options can be set in php.ini or by using ini_set().
>
> > should be able to surpress errors by adding an * before the result
variable
> >
> > *$fp = fopen($linkdata['linkurl'],"r");
>
> I think you mean '@':
>
>   $fp = @fopen($linkdata['linkurl'],"r");
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
>
> /*
> Blessed is he who expects no gratitude, for he shall not be disappointed.
> -- W.C. Bennett
> */
>
>
> --
> 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] Test links?

2002-11-30 Thread Hugh Danaher

Not sure how to supress the warning message that PHP automatically does
when you haven't got a valid URL though.

should be able to surpress errors by adding an * before the result variable

*$fp = fopen($linkdata['linkurl'],"r");

Hope this helps--or even works for this particular problem.
Hugh

- Original Message -
From: "Beth Gore" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, November 30, 2002 11:02 AM
Subject: Re: [PHP] Test links?


> Rob Packer wrote:
>
> >Okay, I'm confused... file, fopen, and fsockopen seem to say not found on
> >alot valid URLs...  does this look to be correct usage?
> >$url = $row[0]; // just get the url from the db
> >$fp = implode ('', file ($url));
> > if (!$fp) {echo "Unable to access file"; }
> > else { fclose($fp); echo "The link is working!"; }
> >
> >It seems I always get this warning...
> >
> >Warning: Supplied argument is not a valid File-Handle resource in
> >/web/home/nrc.net/www/robert/links4.php on line 11
> >
> >If someone can tell me what I'm doing wrong, I'd appreciate it.
> >
> >Thanks,
> >Robert
> >
> >
> >
> >
> >
> When fopen successfully opens a file it populates an array
> $http_response_header, which you can examine to see if the link works or
> not - I don't believe you can actually get the file itself, but since
> that's not what we're after that's not a problem!
>
> Having said that, fopen produces a very annoying error if it doesn't
> find the page, but I found the following works:
>
> 
> $SQL = "SELECT linkurl, linkID FROM links";
> $result = mysql_query($SQL);
>
> while($linkdata = mysql_fetch_array($result)){
>
> $fp = fopen($linkdata['linkurl'],"r");
> if($fp)
> {
> echo "".$linkdata['linkurl']." is still valid.";
>
> }else{
>
> echo "".$linkdata['linkurl']." is invalid. Updating
> database... ";
>
> $SQL = "UPDATE links SET status = 0 WHERE linkID =
> '".$linkdata['linkID']."'";
> $result2 = mysql_query($SQL);
> if($result2)
> {
> echo "Database updated";
> }
> }
>
> }
> ?>
>
> Rather than deleting the link, it's probably better to set a flag to
> show it was invalid last time you checked, but check it again next time.
> Or you could keep a count of the  number of failed attempts, and delete
> if it goes beyond 3 or so.
>
> Not sure how to supress the warning message that PHP automatically does
> when you haven't got a valid URL though.
>
> Hope this works for you!
>
> Beth Gore
> --
> http://bethanoia.dyndns.org
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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




Re: [PHP] dynamic arraynames

2002-11-28 Thread Hugh Danaher
Floyd,
I thought about this some and started noodling out a solution for you, but
have a few questions before I go any farther on this.
1. The part about users inputting their own column headers is relatively
straight forward.  Something like this should work:

";
print "Input the following information";
 // these are your fixed cells
print "Name: ";
print "Temp: ";
print "Time: ";
print "Offset: ";
 // User inputs the number of additional cells needed
  print "Input number of additional cells needed: ";
  print "";
  print "";
  print "";
  }
if ($start_button=="1")
 {
 print "";
 print "Input the following information";
 // these are your fixed cells and they now contain user input
   print "Name: ";
   print "Temp: ";
   print "Time: ";
   print "Offset: ";
 print "Input the names of the desired additional cells in the spaces
provided.";
 // this is where your user will name the cells he asked to create
 for($i=1;$i<=$additional_cells;$i++)
  {
  print "$i ";
  }
 print "";
 print "";
 print "";
 print "";
 }
if ($start_button=="2")
   {
print $name."".$temp."".$time."".$offset."";
for($i=1;$i<=$additional_cells;$i++)
{
print "user cell ".$i." ".$user_added[$i]."";
}
}
?>


2. Now comes the tricky part, and the part I'm unsure about.  You can
convert the user input in the above so that it becomes the names of the
input cells, or you can leave them in a numeric array.  Leaving them in a
numeric array will be easier to deal with later.
Also, other than the display of a table, what do you want the user input
for?  If you're planning on doing any data manipulation, then your coding
will get a bit hairy because you won't know what relation the user input
data has to your standard data (name, time, temp and offset).  Finally, if
you're planning on storing the data in a database table, each table will
need to be created on the fly--it can be done, but if you're struggling with
this, it'll take you some time to get the back end working.

Hope this helps,
Hugh

- Original Message -
From: "Floyd Baker" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: "'Hugh Danaher'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, November 27, 2002 5:24 PM
Subject: Re: [PHP] dynamic arraynames


>
>
> Well I might be in the wrong place.  I've also asked in the HTML list
> now too but I'm still stuck and need some help.
>
> This is pretty much as clear as I can make it.  I'm up against a
> mental block and even if it's as clear as glass to others I'm dead in
> the water and would appreciate some pointers.  I have a bunch of
> pieces but can't seem to string them together enough to make it work.
>
> Just trying to build an x-y array of data input fields and then send
> them recursive to be used further down the program.
>
> I can do this fine with a fixed number of columns and rows of user
> input but I cannot figure out how to make this happen using a variable
> number of columns.  I'm a complete array amateur and would appreciate
> a little assistance...
>
> I want it to look something like this:
>
> Name  Temp  Time  OffsetEtc.  As needed...
> process 1[input]   [input]   [input]   [input]   [inputs]
> process 2[input]   [input]   [input]   [input]   [inputs]
> process 3[input]   [input]   [input]   [input]   [inputs]
> process 4[input]   [input]   [input]   [input]   [inputs]
>
> Right now, for the three *basic* columns, I have the lines below in a
> 'while' loop.
>
>  MAXLENGTH='10'>
>  MAXLENGTH='10'>
>  MAXLENGTH='10'>
>
> But when it comes to adding additional columns that a user
> determines are needed, I am lost.  Users might want to add 0, or 4, or
> 10 additional items...  I would like only that number of usable
> input columns be on the input-form, identified for what they contain,
> and then be passed to the next page
>
> Again, many thanks in advance.
>
> Floyd
>
>
>
>
>
>
> On Sun, 24 Nov 2002 23:55:56 -0500, you wrote:
>
> >I'm sorry, but I'm still confused. Can you show us a sample of the data
> >in the database and what you want the resulting form to look like for
> >that data? Maybe that'll help.
> >
> >---John Holmes...
>
>
>
>
>
> --
>


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




Re: [PHP] dynamic arraynames

2002-11-23 Thread Hugh Danaher
Floyd,
if you are using mysql then you can use the mysql_list_fields to get the
names of the mysql table's column (field) names, then do mysql_num_fields to
get the number of columns (fields), then fill the columns with whatever
using a while loop.
I've attached a php page that fetches this info from any size table then
displays the table.  You can extract the info you need and extend it with
check boxes etc.
Hope this helps.
Hugh






Input Data Page



DATABASE TABLES


";
print "Database name:";
print "Username:";
print "Password:";
print "";
print "";
print "";
if ($start=="1")
 {
 $link=mysql_connect("localhost","$user","$pass");
 if (! $link) die("couldn't connect mysql");
 mysql_select_db($db,$link) or die ("couldn't open $db ".mysql_error());
 $tables=mysql_list_tables($db,$link);
 $num=mysql_num_rows($tables)-1;
 mysql_close($link);
 ?>
 
 ";
 print "Table Name: ";

 for ($i=0;$i<=$num;$i++)
  {
  print "".mysql_tablename($tables,$i);
  }
 print "";

 print "";
 print "";

 print "";
 print "";
 print "";
 print "";
 }

if ($start=="2")
 {
 $link=mysql_connect("localhost","$user","$pass");
 if (! $link) die("couldn't connect mysql");
 mysql_select_db($db,$link) or die ("couldn't open $db ".mysql_error());

 $results=mysql_query("select * from $table");
 $fields = mysql_list_fields("$db", "$table", $link);
 $columns = mysql_num_fields($fields);
 mysql_close($link);
 print "$table";
 print "";
 print "";
 for ($i = 0; $i < $columns; $i++)
  {
  print "".mysql_field_name($fields, $i)."";
  }
 print "";
 print "";
 for ($i = 0; $i < $columns; $i++)
  {
  print "".mysql_field_type($results,
$i)."";
  }
 print "";
 while ($a_row=mysql_fetch_row($results))
  {
  print "";
  foreach($a_row as $field)
   {
   if ($field=="")
{
$field=" ";
}
   print "".$field."";
   }
  print "";
  }
 print "";
 }
?>





- Original Message -
From: "Floyd Baker" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Saturday, November 23, 2002 2:07 PM
Subject: Re: [PHP] dynamic arraynames


> On Sat, 23 Nov 2002 10:58:02 -0500, you wrote:
>
> >> I am trying to generate arrays to hold inputs to columns.  Column
> >> titles are input to a table as needed.  They are read by the program
> >> and placed across the page.  Then an array goes under each column name
> >> to collect the inputs to the various rows.  Everything works except to
> >> dynamically change the name of the array.
> >>
> >>
> >> while($foo=mysql_fetch_array($mysql_result)){
> >> print "";}
> >
> >Do you want this??
> >
> >print "";
> >
> >---John Holmes...
>
>
> No John.  I'm ok with simply inputting a value and otherwise using
> arrays that are hard coded and previously named but my problem is in
> creating different arrays on the fly to represent each column that
> there is a name for.  I want to end up with something like $meat[] and
> $potatoes[] and whatever else is needed from a list...  The list of
> meat, potatoes, etc determines how many arrays and their names.
>
> I'm not to swift when it comes to arrays and think I'm probably stuck
> on some simple misconception.  I'm trying to convert $meat to $meat[],
> on the fly, to have something to input to...  I read today maybe I
> don't need the brackets?
>
> Floyd
>
>
> --
>
>
> --
> 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] OT- "Private Registrations" for Domains

2002-11-22 Thread Hugh Danaher
Did you register just to plug this?
- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, November 22, 2002 9:02 PM
Subject: [PHP] OT- "Private Registrations" for Domains


> Has anyone heard of or used somthing like this, just received this notice
from my registrar?
>
> -
>
> Dear Valued Customer,
> Great news! We now offer Private Registrations.
>
> What is a private registration? A private registration allows you to
shield your personal information from the WhoIs database when registering a
domain while retaining the full benefits of ownership. With a private domain
registration, you keep your personal information private.
>
> This process is new and so unique that it is supported by two patent
applications.
>
> The way it works is simple:
> -Domains By Proxy(TM), a sister company of WORXdoamins, becomes the
registrant of record for any new, existing or transferred domain name you
designates.
> -The "WHOIS" database is then populated with Domains By Proxy's contact
information, not yours!
> -Domains By Proxy becomes the registrant of record for any domain name.
> -Domains By Proxy's proprietary registration and e-mail handling systems
even let you elect whether or not to receive postal mail or email
>
> Best of all, you still retain the full benefits of ownership! You can
cancel, sell, renew or transfer your domain names; set-up name servers for
the private domain name; resolve disputes involving the domain name; and
more.
>
> Getting a Private Registration will:
> + Stop domain-related spam
> + End data mining
> + Deter identity theft
> + Prevent harassers & stalkers
> + Protect your family
> + And more!
>
> To use this great new service just use this link:
> http://private.worxdomains.com
>
> -
>
> spud.
>
> ---
> a.h.s. boy
> spud(at)nothingness.org "as yes is to if,love is to yes"
> http://www.nothingness.org
> ---
>
>
>
>
> --
> 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] Graph Question..

2002-11-21 Thread Hugh Danaher
Jim,
Regarding "undefined function: imagegif()," It could be that your build of
the "GD Library" doesn't include gif support.  You can try replacing this
function with imagejpg() or imagepng().  Imagepng() will likely be faster
and sharper than imagejpg().
Hugh
- Original Message -
From: "Jim Hatridge" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, November 21, 2002 7:29 AM
Subject: Re: [PHP] Graph Question..


HI Andrew et al...
On Wednesday 20 November 2002 21:09, Andrew Brampton wrote:
> Try going direct to the image's URL, this might show any PHP errors. If
> that doesn't work, you can request the page via telnet and see if any
> errors are appearing
>
> Andrew

I hate to admit it but I don't understand what you mean. (Please note, I'm
new
with PHP.) All the software is on my personal system. I'm not doing this
over
the 'net.

There is three test files with this software. I picked it up at
http://www.phpclasses.org/  Using two files I get only the broken box.

But when I say http://opus.epost.de/~hatridge/graphs/test_pie.php (this is
the
third test file)  I get this

###
Warning: Cannot add header information - headers already sent by (output
  started at /home/hatridge/public_html/graphs/Piechart.php:159) in
/home/hatridge/public_html/graphs/Graph.php on line 40

Fatal error: Call to undefined function: imagegif() in
/home/hatridge/public_html/graphs/Graph.php on line 43
#

Any ideas?

Thanks

JIM


> - Original Message -
> From: "James Hatridge" <[EMAIL PROTECTED]>
> To: "PHP-GEN" <[EMAIL PROTECTED]>
> Sent: Wednesday, November 20, 2002 3:06 PM
> Subject: [PHP] Graph Question..
>
>
>
> Hi all,,
>
> I d/l'ed a class for graphs last night. When I got the class working
> instead of a line graph I got the netscape symbol for no picture, ie a
> broken box. I must have missed something. Could someone give me a clue
what
> I'm doing wrong?
>
> Thanks
>
> JIM

--
Vielfeind -- Viel Ehr'
Antiamerikanische Propaganda in der Philatelie des 20. Jahrhunderts
  http:/www.fecundswamp.net/~hatridge/stamps/index.html


--
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] Graph Question..

2002-11-21 Thread Hugh Danaher
Jim,
on the calling page change
echo "\n";
to
echo "something here\n";

Now, when you click on the link, the error message should show instead of
the broken box.
Hugh

- Original Message -
From: "Jim Hatridge" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, November 21, 2002 7:29 AM
Subject: Re: [PHP] Graph Question..


HI Andrew et al...
On Wednesday 20 November 2002 21:09, Andrew Brampton wrote:
> Try going direct to the image's URL, this might show any PHP errors. If
> that doesn't work, you can request the page via telnet and see if any
> errors are appearing
>
> Andrew

I hate to admit it but I don't understand what you mean. (Please note, I'm
new
with PHP.) All the software is on my personal system. I'm not doing this
over
the 'net.

There is three test files with this software. I picked it up at
http://www.phpclasses.org/  Using two files I get only the broken box.

But when I say http://opus.epost.de/~hatridge/graphs/test_pie.php (this is
the
third test file)  I get this

###
Warning: Cannot add header information - headers already sent by (output
  started at /home/hatridge/public_html/graphs/Piechart.php:159) in
/home/hatridge/public_html/graphs/Graph.php on line 40

Fatal error: Call to undefined function: imagegif() in
/home/hatridge/public_html/graphs/Graph.php on line 43
#

Any ideas?

Thanks

JIM


> - Original Message -
> From: "James Hatridge" <[EMAIL PROTECTED]>
> To: "PHP-GEN" <[EMAIL PROTECTED]>
> Sent: Wednesday, November 20, 2002 3:06 PM
> Subject: [PHP] Graph Question..
>
>
>
> Hi all,,
>
> I d/l'ed a class for graphs last night. When I got the class working
> instead of a line graph I got the netscape symbol for no picture, ie a
> broken box. I must have missed something. Could someone give me a clue
what
> I'm doing wrong?
>
> Thanks
>
> JIM

--
Vielfeind -- Viel Ehr'
Antiamerikanische Propaganda in der Philatelie des 20. Jahrhunderts
  http:/www.fecundswamp.net/~hatridge/stamps/index.html


--
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] Automatic file upload...

2002-11-21 Thread Hugh Danaher
Tom,
It sounds like the file you want is online someplace.  So, perhaps it's
fread() that you want to use.  With it, you can get the html output of a
page.
Hugh
- Original Message -
From: "Tom Woody" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, November 21, 2002 9:28 AM
Subject: [PHP] Automatic file upload...


> I am trying to put together a script so that I can upload files to a
> php script, with just a URL and can't seem to get my brain around it.
>
> For example, The browser would have a url like:
> http://example.com/upload/fileupload.php?filename=C:\filename.txt
>
> Is there a way to do this and I'm just missing it, or will the client
> have to browse and choose the filename with a  type of
> construct?
>
> I have tried some google searches on  syntax, as well as php
> file uploads to no success.  The simple code I have been working with
> is (obviously nothing has been found for automatically submitting a
> form):
>
>if (is_uploaded_file($_FILES['toProcess']['tmp_name'])) {
> //successfully uploaded
> move_uploaded_file($_FILES['toProcess']['tmp_name'],
>"/var/www/html/filename.txt");
> echo "File successfully uploaded...thank you\n";
>   }
>   else {
> echo "Upload Problem\n";
>   }
>
> ?>
> 
> 
>method="POST">
> Filename:   value="file:///home/user/uploadtest.txt">
> 
> 
> 
> 
>
> --
> Tom
>
> --
> 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] plus sign has changed to space after POST

2002-11-19 Thread Hugh Danaher
Just do ereg_replace(" ","+",$var) on the receiving end and be done with it.
- Original Message -
From: "Bob Eldred" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, November 19, 2002 11:24 PM
Subject: Re: [PHP] plus sign has changed to space after POST


> I don't believe it has anything to do with PHP, to be honest.  I've got
> scripts that are several versions of PHP old that do that.  However, it
> makes no difference in execution of the script.
>
> case "show roster":
> {
> ...
> }
>
> catches submit=show+roster quite nicely.
>
> Bob
>
> - Original Message -
> From: <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, November 19, 2002 3:42 PM
> Subject: [PHP] plus sign has changed to space after POST
>
>
> > After upgrade to 4.2.3, plus "+" sign has changed to space after POST.
I
> > have checked the mailing list but can't find any help to turn this off
> > forever!  is this a bug in PHP?
> >
> > thanks
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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




Re: [PHP] REPLY NEEDED

2002-11-19 Thread Hugh Danaher
Good lord they're at it again!
- Original Message - 
From: "MICHAEL OSHODI" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, November 19, 2002 10:51 PM
Subject: [PHP] REPLY NEEDED



 ASSISTANCE

WE ARE MEMBERS OF A SPECIAL COMMITTEE FOR BUDGET AND
PLANNING OF THE NIGERIA NATIONAL PETROLEUM CORPORATION
 (NNPC)IN WEST AFRICA. THIS COMMITTEE IS PRINCIPALLY CONCERNED
WITH CONTRACT AWARDS AND APPROVAL. WITH OUR POSITIONS,
WE HAVE SUCCESSFULLY SECURED FOR OURSELVES THE SUM OF
THIRTHY ONE MILLION, FIVE HUNDRED THOUSAND UNITED
STATES DOLLARS (US$31.5M). THIS AMOUNT WAS CAREFULLY
MANIPULATED BY OVER-INVOICING OF AN OLD CONTRACT.

BASED ON INFORMATION GATHERED ABOUT YOU, WE BELIEVE
YOU WOULD BE IN A POSITION TO HELP US IN TRANSFERING
THIS FUND (US$31.5M) INTO A SAFE ACCOUNT. IT HAS BEEN
AGREED THAT THE OWNER OF THE ACCOUNT WILL BE
COMPENSATED WITH 30% OF THE REMITTED FUNDS, WHILE WE
KEEP 60% AS THE INITIATORS AND 10% WILL BE SET ASIDE
TO OFFSET EXPENSES AND PAY THE NECESSARY TAXES.WE
INTEND TO USE PART OF OUR OWN SHARE TO IMPORT FROM
YOUR COUNTRY AGRICULTURAL AND CONSTRUCTION MACHINERY.
THIS IS BECAUSE THE PRESENT GOVERNMENT OF MY COUNTRY
IS EMPHASISING ON PROVIDING FOOD AND HOUSING FOR ALL
ITS CITIZENS BEFORE THE NEXT ELECTION. HENCE,
AGRICULTURAL AND CONSTRUCTION EQUIPMENT ARE IN HIGH
DEMAND OVER HERE. WE SHALL ALSO NEED YOUR ASSISTANCE
IN THIS REGARD ON A COMMISSION TO BE AGREED UPON WHEN
WE FINALLY MEET.

ALL MODALITIES OF THIS TRANSACTION HAVE BEEN CAREFULLY
WORKED OUT AND ONCE STARTED WILL NOT TAKE MORE THAN
SEVEN (7) WORKING DAYS, WITH YOUR FULL SUPPORT. THIS
TRANSACTION IS 100% RISK FREE.

MOREOVER, WE SHALL NEED THE FOLLOWING FROM YOU TO 
ENABLE US BEGIN THE TRANSACTION FORMALLY. THEY ARE; 
YOUR FULL NAME AND ADDRESS OR YOUR COMPANY NAME, 
ADDRESS AND TELEPHONE/FAX NUMBERS, YOUR BANKERS 
NAME AND ADDRESS, YOUR ACCOUNT NUMBER AND NAME. 
THIS INFORMATION WILL BE USED ALONGSIDE OTHER VITAL
 DOCUMENTS OVER HERE IN PREPARING THE NECESSARY 
APPLICATION FOR PAYMENT TO THE CONCERNED QUARTERS 
WHERE PAYMENT APPROVALS WOULD BE SECURED IN FAVOUR
 OF YOUR COMPANY FOR THE PAYMENT OF OUR FUND(US$31.5M)
 INTO YOUR NOMINATED ACCOUNT FOR US ALL. BY OUR APPLICATION, 
IT WILL BE ASSUMED THAT THIS SUM IS BEING REQUESTED AS 
PAYMENT, WHICH IS LONG-OUTSTANDING, FOR A CONTRACT, 
WE SHALL CLAIM WITH OUR POSITION, YOU OR YOUR COMPANY
 EXECUTED FOR (NNPC) SOMETIME IN 1997. HENCE, WE SHALL 
FOLLOW ALL THE LEGAL OFFICIAL PROTOCOLS USUALLY 
OBSERVED BY FOREIGN CONTRACTORS WHENEVER THEY 
ARE DEMANDING PAYMENT FOR CONTRACTS EXECUTED 
FOR THE GOVERNMENT OF MY COUNTRY.

FURTHERMORE, IMMEDIATELY THE FINAL APPROVAL IS GRANTED, 
THE FUND WILL BE TRANSFERRED INTO YOUR ACCOUNT WITHIN 72
HOURS, BY WHICH TIME MY PARTNERS AND I WILL BE IN YOUR COUNTRY 
FOR THE FINAL DISBURSEMENT IN THE RATIO ALREADY SPELT OUT TO YOU.

 PLEASE, YOU SHOULD ENDEAVOUR TO GIVE US AN ACCOUNT 
WHICH YOU HAVE ABSOLUTE CONTROL OVER. THIS IS VERY 
IMPORTANT BECAUSE WE WOULD NOT WANT A SITUATION 
WHEN THE MONEY IS IN THE ACCOUNT, YOU NOW TELL US 
YOU WOULD NEED TO BE AUTHORISED BY ANOTHER PERSON 
BEFORE WE CAN HAVE OUR OWN SHARE.

YOU WILL NOT BE REQUIRED TO TRAVEL OUT OF YOUR COUNTRY, 
ME AND MY PARTNERS, WE TRAVEL DOWN TO YOUR COUNTRY 
FOR THE DISBURSEMENT OF THE FUND, AFTER THE FINAL TRANSACTION. 
WE WILL ALSO DISCUSS ABOUT OIL BUSINEES IN MY COUNTRY 
WHEN WE COME DOWN OVER THERE. BECAUSE WE WOULD 
LIKE TO ESTABLISH A JOINT BUSINESS WITH YOU. THAT IS 
WE WILL USE YOUR NAME TO REGISTER AND  
INCORPORATE AN OIL COMPANY IN MY COUNTRY. 

BESIDES, ON THE COMPLETION OF THIS TRANSFER, 
ALL DOCUMENTS USED FOR THE PURPOSE WILL BE 
WITHDRAWN FROM THE QUARTERS THEY ARE SUBMITTED 
BY OUR CONTACTS IN THESE OFFICES AND DESTROYED, 
THEREAFTER. SO, THERE WILL NOT BE ANY PROBLEM 
ARISING FROM THIS TRANSACTION NOW OR IN THE FUTURE.
IF THIS PROPOSAL SATISFIES YOU, PLEASE REACH US ONLY
BY EMAIL FOR MORE INFORMATION. 

PLEASE, TREAT AS URGENT AND VERY IMPORTANT.

YOURS FAITHFULLY,

CHIEF MICHAEL OSHODI




-- 
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] Subtracting Money

2002-11-14 Thread Hugh Danaher
Try:
number_format()
Hugh

- Original Message -
From: "Sascha Cunz" <[EMAIL PROTECTED]>
To: "Stephen" <[EMAIL PROTECTED]>; "PHP List"
<[EMAIL PROTECTED]>
Sent: Thursday, November 14, 2002 5:37 PM
Subject: Re: [PHP] Subtracting Money


Hi Stephen,

> I'm having a problem. I need to subtract money, but if they type in an
> ammount such as $2.30 and I subtract $0.20, instead of returning $2.10
like
> it should, it returns $2.1. How can I fix this keeping in mind that other
> variable could be $2.40 or $100.30 and so on...?

This is because, 2.1 is equal to 2.10 :-) You need to format the numbers in
the way you want them.

have a look at:
  http://www.php.net/manual/en/function.number-format.php
and/or
  http://www.php.net/manual/en/function.sprintf.php

both of them should do that job.

sprintf's Example 6:

  $money1 = 68.75;
  $money2 = 54.35;
  $money = $money1 + $money2;
  // echo $money will output "123.1";
  $formatted = sprintf("%01.2f", $money);
  // echo $formatted will output "123.10"

-Sascha

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

2002-11-11 Thread Hugh Danaher
John, 
Google search turned up nada.  Perhaps it's just a typo.
Hugh
- Original Message - 
From: "@ Edwin" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, November 10, 2002 11:08 PM
Subject: Re: [PHP]  tag


> 
> "John Meyer" <[EMAIL PROTECTED]> wrote:
> 
> > I'm doing some PHP work, and I've come across the  tag.  What,
> exactly,
> > is this?
> 
> Could be a new tag--M$ Frontpage style :)
> 
> Anyway, what does it do? It may not even be a "tag"--perhaps a secret
> code...
> 
> - E
> 
> 
> -- 
> 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] Address array?

2002-11-04 Thread Hugh Danaher
Stephen,
after your line:

>$query = "SELECT * FROM orders WHERE orderid = '$orderid'";

you should add:

mysql_query($query);

in your code line you've just set your variable--you haven't asked mysql to
do anything.

Hope this helps.
Hugh

- Original Message -
From: "Steve Jackson" <[EMAIL PROTECTED]>
To: "PHP General" <[EMAIL PROTECTED]>
Sent: Monday, November 04, 2002 12:42 AM
Subject: [PHP] Address array?


> I want to display an address from my database based on an orderid. Where
> am I going wrong? I am still unsure how Php interacts with mySQL but am
> I right in assuming it should be an array?
>
> My code...
>
> function get_shipping_address($address_array)
> {
> $conn = db_connect();
> $orderid = get_order_id($orderid);
> $query = "SELECT * FROM orders WHERE orderid = '$orderid'";
> $row = mysql_fetch_array($query);
> foreach ($address_array as $row)
> {
> $ship_name = $row["ship_name"];
> $ship_address = $row["ship_address"];
> $ship_city = $row["ship_city"];
> $ship_zip = $row["ship_zip"];
> $ship_country = $row["ship_country"];
> }
> }
>
> Steve Jackson
> Web Developer
> Viola Systems Ltd.
> http://www.violasystems.com
> [EMAIL PROTECTED]
> Mobile +358 50 343 5159
>
>
> --
> 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] Am I blind? simple 15 line code producing error

2002-11-03 Thread Hugh Danaher
Paul,
Got any spaces or lines above the "
To: <[EMAIL PROTECTED]>
Sent: Sunday, November 03, 2002 9:53 AM
Subject: [PHP] Am I blind? simple 15 line code producing error


> Perhaps I am blind but I have the following simple code that gets me
> errors:
>  session_start();
> require_once ("config.inc");
> require_once "classes/HtmlTemplate.class";
>
> if ($HTTP_SESSION_VARS[user_id]){
> //do something
>  } else {
> $message= "*** Area is restricted! Please login! ***";
> $m= urlencode($message);
> $sid_value="&PHPSESSID=".session_id();
> header("Location:
> index.php?error_message=$m$sid_value");
> exit;
>}
> ?>
>
> The error is:
> Warning: Cannot add header information - headers already sent by (output
> started by.. ..line 6) ...on line 12
>
> Line 6 is the line with if ($HTTP_SESSION_VARS[user_id])
> Line 12 is the line starting with header
>
>
>
> --
> 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

2002-11-03 Thread Hugh Danaher
Bryan,
I don't think the variable has any value before assignment--it isn't zerro
nor is it null.  Check the manual for isset() and empty()'
Hope this helps.
Hugh

- Original Message -
From: "Bryan McLemore" <[EMAIL PROTECTED]>
To: "PHP - General" <[EMAIL PROTECTED]>
Sent: Sunday, November 03, 2002 1:01 AM
Subject: [PHP] Variables


What is a variables value before said value has been assigned a value?

Thanks
Bryan



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




Re: [PHP] number_format question

2002-11-01 Thread Hugh Danaher
What you need to do with the input number is to do an ereg_replace() and
eliminate the commas from the string, then use the string variable where
needed.  Then, when you want to display the variable, use the
number_format() function.
Hope this helps,
Hugh

- Original Message -
From: <[EMAIL PROTECTED]>
To: "Jay Blanchard" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Thursday, October 31, 2002 2:36 PM
Subject: RE: [PHP] number_format question


>
>  Tried it. It works but crops everything after the first "," in the number
> if you enter a number with commas. Works great if you don't enter any
> commas.
>
> What I need to be able to do:
>
> IN   OUT
> 123456789 > 123,456,789
> 123456789.00 > 123,456,789
> 123,456,789.00 > 123,456,789
>
> Ed
>
>
> On Thu, 31 Oct 2002, Jay Blanchard wrote:
>
> > [snip]
> >  If I try that I get a wrong parameter count error.
> >
> > [/snip]
> >
> > number_format ( float number [, int decimals [, string dec_point [,
string
> > thousands_sep]]])
> >
> > number_format($number, 0, '', ',');
> >
> > Try that ...
> >
> > Jay
> >
> >
> >
> > --
> > 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] Tricky question - referrer from ousite, or from intern?

2002-08-26 Thread hugh danaher

IFF they just left one of your other sites, then you should be able to pass
a variable in the other site's header such as:

php.net/function-name?variable=from_somewhere_I_own

if the variable isn't set, then they came from a site you don't own.

or you could send them to a unique function-name where you can then record a
hit on that function-name.

- Original Message -
From: "Andy" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, August 26, 2002 10:58 PM
Subject: [PHP] Tricky question - referrer from ousite, or from intern?


> Hi there,
>
> I have a tricky problem which I honestly think is not possible to solve.
> However maybe I am wrong.
>
> As you all know it is possible on php.net to pass a function name just
> behind the adress (e.G. php.net/function-name) this will redirct to the
> propper page. I did the same thing with member sites (e.G
> server.com/member-name) Now I am starting a referrer programm. Every
member
> who follows a link like from anywhere on the net and registeres will be
> tracked and the referrer gets a point. Now I did forget that I do have
> several of this links on my site itself :-) Which means that they have
been
> aquired on my site by accident :-)
>
> My question is how can I make sure that they do come from outside and are
> not surfing my site already. I do set a coockie as soon as someone enteres
> this adress, but it would be fantastic if I could do a if statement on
> something to make sure he does not come from my own site. I would like to
> keep all the links like that, just to find a way to track the origin of
the
> user.
>
> Thank you so much for any idea on this tricky task,
>
> Andy
>
>
>
>
>
>
>
> --
> 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] Call to undefined function mysql_connect()

2002-08-25 Thread hugh danaher
Thanks Edwin, I'll forward your notes to my new host.  I also checked the
archives and find that there's an extension=mysql.so snip that needs to go
in the php.ini file, and I'll forward this to my host too.
Thanks,
Hugh
- Original Message -
From: "@ Edwin" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Sunday, August 25, 2002 8:54 PM
Subject: Re: [PHP] Call to undefined function mysql_connect()


>
> >
> >Help!
> >
> >I am getting the following error message for :
> > >  $link=mysql_connect("localhost","$user","$pass"); // line 34
> >?>
> >
> >Fatal error: Call to undefined function: mysql_connect() in
> /home/www/test.somename.org/aux/db-mod.php on line 34
> >
> >I have used this call successfully on php v4.0.6, and am now trying it on
> a new install (which someone else did, as I haven't a clue in setting up a
> server) which is v4.1.1.  Is mysql_connect a defunct command, or do I need
> to do something to enable its use?
>
> Perhaps, if you check the manual you'll see if a certain function is
> already "defunct".
>
> Checking mysql_connect() here,
>
>   http://www.php.net/manual/en/function.mysql-connect.php
>
> shows that it's even "better" than before.
>
> So, most probably, when the person who set up the server didn't include
> mysql support in php. It'd be better to ask the person to enable it.
>
> BTW, you can do phpinfo() and see if mysql support is enabled or not. (Of
> course, you also need to check IF MySQL is even installed...)
>
> - E
>
>
> >
> >Thanks for any help.
> >Hugh
> >
> >
> >
> >
> >
> >
>
>
>
>
> _
> $B2q0wEPO?$OL5NA!&=< http://auction.msn.co.jp/
>
>
> --
> 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] Call to undefined function mysql_connect()

2002-08-25 Thread hugh danaher

Help!

I am getting the following error message for :


Fatal error: Call to undefined function: mysql_connect() in 
/home/www/test.somename.org/aux/db-mod.php on line 34

I have used this call successfully on php v4.0.6, and am now trying it on a new 
install (which someone else did, as I haven't a clue in setting up a server) which is 
v4.1.1.  Is mysql_connect a defunct command, or do I need to do something to enable 
its use?

Thanks for any help.
Hugh









Re: [PHP] newbie php image importing problems

2002-08-18 Thread hugh danaher

>From reading your post, I believe you've successfully gotten the file upload
to work and now you're interested in using uploaded files (but with smaller
dimensions) on your webpage.  What you'll need to do is create a separate
file named resize.php which includes only the following code.

On your webpage you will call this file using the following:

";
?>

To see the error messages you'll need to substitute the above with:
Click here";
?>
Once you've deloused it you can revert to the img tag.

"resize.php" contains only the code below--with no blank line before the php
tag! "resize.php" will create a smaller image with a maximum dimension of
200 pixels.  Obviously, you can change this to some other method to get the
size you want.  Finally, the images generated aren't the best looking I've
seen, and if you've got a newer version of php than I've got access to, you
could change from imagecopyresized() to imagecopyresampled().

Hope this helps,
Hugh

$width)
 {
 $nheight=$max;
 $nwidth=$width/($height/$max);
 }
else
 {
 $nwidth=$max;
 $nheight=$height/($width/$max);
 }

$image=imagecreatefromjpeg($picture);
$image1=imagecreate($nwidth,$nheight);

imagecopyresized( $image1, $image,0,0, 0,0, $nwidth,
$nheight,$width,$height);

header("content-type: image/jpeg");
imagejpeg($image1);
ImageDestroy($image);
ImageDestroy($image1);
?>


- Original Message -
From: "Brian & Shannon Windsor" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, August 18, 2002 10:48 AM
Subject: [PHP] newbie php image importing problems


> Hello,
>
> I got some great help from this newsgroup a few days ago, and I'm 90%
> complete with my project, but I have one snag.  I'm building a web page
that
> allows a business to import pictures of their products and then display
them
> on their page along ith other information.
>
> My problem is getting in an image but displaying a thumbnail, and if
> clicked, the original image.  The client only wants to load one image.
I'm
> stuck at how to take the one image, copy it to the host server, and then
> display a thumbnail of the image.  I can make the thumbnail linkable to
the
> larger image, and I can display the original image on my home PC, but
that's
> all local.
>
> Please help.
>
> Thanks,
>
> Brian
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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




Re: [PHP] Creating Image...

2002-07-31 Thread hugh danaher

You might also want to add a "quality" factor to the imagejpeg() function if
the image "as is" looks a bit ratty.
$factor="100" // or another suitable number between 100 and 0
imagejpeg($im, "test/im.jpg",$factor);
hope this helps.
Hugh

- Original Message -
From: "Andrew Chase" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 31, 2002 1:10 PM
Subject: RE: [PHP] Creating Image...


> To write a GD image to disk as a jpeg, do this instead:
>
>
> $im = imagecreate(50,100);
>
> imagejpeg($im, "test/im.jpg");
>
>
> You don't need to use file handlers. Of course, without doing anything
like
> adding text or lines to $im, it will just be written to disk as a blank
> image. :)
>
> -Andy
>
> > -Original Message-
> > From: mp [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, July 31, 2002 11:11 AM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] Creating Image...
> >
> >
> > I want to create simple image...
> > I execute this script:
> >
> >  $im = imagecreate (50, 100);
> >  $fp = fopen("test/im.jpg","w");
> >  fwrite($fp, imagegd($im));
> >  fclose($fp);
> >
> > But there is some problems about this...
> > Could somebody help me?
> > Could somebody help me?
>
>
> --
> 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: png image doesn't show

2002-07-06 Thread hugh danaher

Thanks Richard,
I changed from using  to graph and now get my graph, on a page of its own,
without any error messages.  Works just fine, or will, when I change how it
gets its data.  However, I do want to have the graph display on a page with
other information so I'm back to wanting to use some sort of image tag.  Any
suggestions?
Hugh
- Original Message -
From: "Richard Lynch" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, July 05, 2002 9:59 PM
Subject: [PHP] Re: png image doesn't show


> >Hello all,
> >
> >I have been trying to modify the working of one of my pages which prints
a
> >png graph.  What I had was an included file named "graphit.php" which
> >creates a png file.  I used the function
> >imagepng($image,'temp.png') to create an image and then used  >src=temp.png> to have the image printed on the page.  This worked well
> >enough when only one user (me) was using the page, but I want more.  In
> >reading the imagepng() info in the manual, it states that I can output
the
> >raw image stream to the browser by leaving off the file name option.
I've
> >done this, but get nada!  How should this be done?
> >One of the notes (and it's in German) implies that I can call
"graphit.php"
> >using something like
> >
> > to get the image output.  Unfortunately, I get
> >nothing except the red X indicating a missing image.
> >
> >Any and all help is greatly appreciated.
>
> Tips:
>
> 1. Change graphit.php to have the header("Content-type: image/png") line
at
> the *END* of the script, right before you do imagepng($image)
>
> 2. Surf directly to graphit.php, and not the page with 
> in it.
>
> At this point, you'll probably find some PHP error messages from
graphit.php
> -- They don't look anything like a PNG image, so the browser can't display
> them :-)
>
>
>
> --
> Like Music?  http://l-i-e.com/artists.htm
>
>
> --
> 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] png image doesn't show

2002-07-05 Thread hugh danaher

Joakim (and James too)
Thank you for your suggestion regarding the header.  The php page does have
a header but in playing around with things I did get it to generate an error
message along with the "image missing X"
the message is:

Warning: Failed opening 'var/www/html/stocks/dev/graphit2.php' for inclusion
(include_path='.:/php/includes:/usr/share/php') in
/home/virtual/site201/fst/var/www/html/stocks/dev/pg3a.php on line 140

So, it appears I have work to do on figuring out the path.  Again, any help
will ge greatly appreciated.

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, July 05, 2002 3:52 AM
Subject: RE: [PHP] png image doesn't show


> Hi,
>
> Do you output the right headers before you output the imagestream?
> Header("Content-type: image/png");
>
> If this doesn't help you have to post your code (graphit.php) here so we
can
> look at it.
>
> /Joakim
>
> > -Original Message-
> > From: hugh danaher [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, July 05, 2002 10:05 AM
> > To: php
> > Subject: [PHP] png image doesn't show
> >
> >
> > Hello all,
> >
> > I have been trying to modify the working of one of my pages
> > which prints a png graph.  What I had was an included file
> > named "graphit.php" which creates a png file.  I used the function
> > imagepng($image,'temp.png') to create an image and then used
> >  to have the image printed on the page.
> > This worked well enough when only one user (me) was using the
> > page, but I want more.  In reading the imagepng() info in the
> > manual, it states that I can output the raw image stream to
> > the browser by leaving off the file name option.  I've done
> > this, but get nada!  How should this be done?
> > One of the notes (and it's in German) implies that I can call
> > "graphit.php" using something like
> >
> >  to get the image output.
> > Unfortunately, I get nothing except the red X indicating a
> > missing image.
> >
> > Any and all help is greatly appreciated.
> >
> > Hugh
> >
> >
> >
> >
>
> --
> 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] need to change $ char in string

2002-06-29 Thread hugh danaher

try double \\ to escape the special characters used by php for variables and
what not.  I think I read it here on a previous post.
Hope this helps
Hugh
- Original Message -
From: "Beverly Steiner" <[EMAIL PROTECTED]>
To: "PHP List" <[EMAIL PROTECTED]>
Sent: Saturday, June 29, 2002 7:58 AM
Subject: [PHP] need to change $ char in string


> I've tried everything I can think of to change a dallar sign in a string
to
> something else or to split the string on the $ but I can't the the
> information that comes after the $.
>
> Typical string contains: 1.2$General/ms1.zip
>
> when I try:
> $new_string = preg_replace("/\$/", "%", $test_string);
>
> or (trying to avoid specifying the $):
> $new_string = preg_replace("/(\d\.\d{1,2})\D(\w.*$)/", "\1%\2",
> $test_string);
>
> echo "new_string is $new_string"; prints new_string is 1.2
>
> Has anyone solved this problem?
>
> Thanx,
>
> Bev
>
>
> --
> 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] PHP to create static images

2002-06-24 Thread hugh danaher

imagepng() should work.  you can save the file on your server then call it
up wherever you need it.

The manual has more info on using image functions just type in image.

hugh
- Original Message -
From: "Campano, Troy" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 24, 2002 12:39 PM
Subject: [PHP] PHP to create static images


I am doing some work with creating graphs using the GD library.

Does anyone know how I can create the graphs statically so I can save the
output as a GIF or PNG?


I want to run a script that will take in say 10 datasets and then create 10
PNG images on the file server.



Any ideas?


thank you!


Troy Campano



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




  1   2   3   >