[PHP] MS Word text pasted into forms

2001-12-20 Thread jimtronic


Occasionally, I have a problem dealing with some of the special 
characters from text authored in MS Word, and then pasted into a web 
form. It seems that somewhere something bad happens and what 
eventually gets put into mysql via php is not correct.

In particular, I have trouble with apostrophes and accented vowels.

Is the solution to disallow users (it's an admin, so this is 
realistic) from pasting from MS Word?

-- 
Jim Musil
-
Multimedia Programmer
Nettmedia
-
212-629-0004
[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Working with designers...

2001-12-18 Thread jimtronic


I try to seperate the php code from the html as much as possible. So, 
if a page is dynamic, have php figure out the dynamic parts first, 
put them into variables such as $html, or $pull_down_menu, or 
whatever. Then all that needs to replaced in the html is that 
section. HTML coders aren't dumb, so they can be trusted with a 
simple  placement.

Additionally, I try to seperate php logic from php presentation as 
much as possible. This means creating as many variables as possible 
that affect how things look and then including a conf.php file that 
the coders can also change pretty easily with good documentation.

Moving even further in this direction, my logic code calls many 
presentation functions which I find HTML coders can also decipher 
rather well. You can put these in another include file so your 
designers don't ever have to touch any of your precious logic.

Then ... if you have time ... you can make an admin screen to change, 
edit, and preview the finished product.

Jim

>Hi There,
>
>I'm looking for some community feedback on being a coder working 
>with designers. Techniques that work that allow my php-inept 
>page/graphic designer comrade make changes to the layout of the page 
>without destroying my code, or requiring me to make any changes 
>whatsoever.
>
>Or what is the best process? Code the dynamicity (heh -- sad thing 
>is you know what i mean by it) of the site, then integrate a 
>designers HTML into your code, *or* the other way around.. have the 
>designer create the site using all static html files, then go in and 
>remove sample data to be replaced with dynamic data (pulled from a 
>DB, for example).
>
>I'm about to enter a very large project working with about 3 or 4 
>designers and 2 other coders and any suggestions on making this 
>relationship work is greatly appreciated.
>
>Mike
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
Jim Musil
-
Multimedia Programmer
Nettmedia
-
212-629-0004
[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Arrays/Hashes

2001-12-18 Thread jimtronic


I've noticed this, too. There are at least two things you can do to 
make them work...

print("Some text {$myhash['mykey']}\n")

or

print("Some text ".$myhash['mykey']."\n")

jim

>Hey there,
>
>sortta simple question... Is it just me or can't you access hashes within
>strings?
>This works...
>print("Some text $myarray[0]\n");
>This doesn't
>print("Some text $myhash['mykey']\n");
>
>i'm asking in relation to databases (not that that matters). If i fetch a row
>from the database I can use the $array[0], [1], etc in the print statements
>if i use mysql_fetch_array (oh sorry, u people call it associative arrays
>instead of hashes, my mistake) i can't access $array['fieldname'] from within
>a print statement but I CAN do
>$DBID = $resultarray['idfieldname'];
>and then use $DBID.
>
>regards
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
Jim Musil
-
Multimedia Programmer
Nettmedia
-
212-629-0004
[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] HTML Email

2001-12-18 Thread jimtronic

It looks fine to me. The only difference is that I use 
Content-Transfer-Encoding: quoted-printable, which shouldn't make 
much of a difference here. A very small misplacement of a newline 
character or even a space can cause things not to work correctly.

Your best course of debugging is to send a successful (look for a 
"send this page as email" link) HTML email to your outlook account. 
Open the message in a new window and inspect the headers carefully. 
Then you try to mimic that.

In the end I skip using php's mail() function and use a socket 
connection and speak directly with the SMTP host.

It all seems so easy in the beginning, but as soon as you start 
testing your html email in different email programs you realize that 
they all behave slight differently. The differences between Eudora, 
Outlook, Hotmail, AOL, Yahoo, Pine, etc are enough to drive you nuts.

For more info read this: http://www.arsdigita.com/asj/mime/

jim


>Okay I know I must be overlooking somethign super obvious but
>
>I am trying to send a simple HTML email. It works in Netscape mail, 
>Pegasus etc however in Outlook and Outlook express it actually 
>places the
>
>Content-Type: text/html;
>charset=iso-8859-1 Content-Transfer-Encoding: 7bit
>
>in the body of the email all displays all the HTML instead of 
>showing the email as a web page. I ahev inserted the code below. I 
>know it is something stupid,
>so please help.
>
>   if ($htmlEmail) {
>   $headers = 
>"MIME-Version: 1.0\r\n";
>   $headers .= 
>"Content-Type: text/html; charset=iso-8859-1\r\n";
>   $headers .= 
>"Content-Transfer-Encoding: 7bit" . "\r\n";
>   $body = $html_body;
>   }
>
>   $headers .= "From: $from\r\n\";
>   ($cc != "")?($headers .= "Cc: $cc\r\n"):("");
>   ($bcc != "")?($headers .= "Bcc: $bcc\r\n"):("");
>
>   mail($email, $subject, $body, 
>$headers);
>
>Anyone see what I am doing wrong? Thanks in advance!
>
>Gerard
>
>
>
>
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
Jim Musil
-
Multimedia Programmer
Nettmedia
-
212-629-0004
[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] How deep can I go with embedded if s.

2001-12-17 Thread jimtronic


Well, I just made a test program that nested 1000 if() statements and 
it worked.

Just make sure you close all your curly brackets correctly.

IMHO, a large number of nested if else elseif statements indicate 
poor programming design. Sometimes they are necessary, but usually 
can be simplified by employing other methods.

Jim



>Hello All,
>Is anybody aware of any limitations of php on embedded if
>..else statements?
>For example:
>
>   if ($a>$b) {
> if ($c>$d) {
> this();
>} else {
>  if ($gg==$dd) {
>  echo 'ladooo';
>} else {
>  echo 'bab';
>}
> that();
>}
> if ($e<$f) {
>tthis();
>   } else {
>tthat();
>}
>else {
> echo "Oooops";
>
> }
>
>would this work,
>
>
>=
>Mehmet Erisen
>http://www.erisen.com
>
>__
>Do You Yahoo!?
>Check out Yahoo! Shopping and Yahoo! Auctions for all of
>your unique holiday gifts! Buy at http://shopping.yahoo.com
>or bid at http://auctions.yahoo.com
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
Jim Musil
-
Multimedia Programmer
Nettmedia
-
212-629-0004
[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] multicolumn table

2001-12-17 Thread jimtronic

Try something like this...

$my_array = array( 
"A"=>array("1","2","3"),"B"=>array("1","2","3"),"C"=>array("1","2","3"));

$num_columns = 3;

echo "";

foreach($my_array as $key=>$value) {

echo "$key";

for($i=1;$i<=$num_columns;$i++) {

echo "".$value[$i-1]."";

}

echo "";

}

echo "";



>Sorry list,
>
>I think, I was not clear enough. I don't have errors, what I could do with
>this code is output a table in alphabetical order ex:
>
>A
>a..
>ab..
>
>B
>b...
>bc...
>
>But what I really need and I couldn't make work is, my table output one name
>per row and a long one singlke column, and I need a table with 3 colmns and
>many rows as necessary to have all names.
>
>Thank's
>
>  >>
>>>  $sql = "SELECT
>>>  categorias.Nome_Categoria,celebridades.CelebID,celebridades.Nome_Artistico,
>>>  lcase(left(Nome_Artistico,1)) as letra FROM categorias LEFT JOIN
>>>  celebridades ON categorias.CategoriaID=celebridades.Categoria  WHERE
>>>  CategoriaID='1' ORDER BY Nome_Artistico";
>>>  $query = new Query($conexao);
>>>  $query->executa($sql);
>>>
>>>  $ultletra = '';
>>>  $row = '';
>>>  while($resultado = $query->dados()) {
>>>  $curletra = $resultado['letra'];
>>>  if($curletra != $ultletra) {
>>>  $row .= "\n\n>>  width=\"24\" height=\"24\">\n\n\n";
>>>  }
>>>  $row .= ">> 
>>>href=\"interna.php?cat=$resultado[Nome_Categoria]&celebID=$resultado[CelebID
>>>  ]\">".$resultado['Nome_Artistico']."\n";
>>>  $ultletra = $curletra;
>>>
>>>  }
>  >>
>


-- 
Jim Musil
-
Multimedia Programmer
Nettmedia
-
212-629-0004
[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] substr trim functions..

2001-12-14 Thread jimtronic


There are no shortage of ways to do this.

// Using explode() ...

echo array_pop(explode(" ",$full_name));

// Using split() ...

echo array_pop(split(" ",$full_name));

// Using stristr() 

while($haystack = stristr($haystack," ")) {
$haystack = substr($haystack,1);
$last_word = $haystack;
}
echo "$last_word";

Plus all the preg_match and regular expression functions...

http://php.net/explode
http://php.net/split
http://php.net/stristr

jim

>I trying to convert some full names to last names only like:
>-get the subtext from the end until the space
>
>"joe blue" -> "blue"
>"bill western" - "western"
>
>Looked around at php.net docs but im not sure...
>
>Thanks
>
>Andras
>
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
Jim Musil
-
Multimedia Programmer
Nettmedia
-
212-629-0004
[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Passing Variables

2001-12-14 Thread jimtronic


Try this in your form ...







>Can someone tell me how to pass a variable in the url?
>I am using a form and calling a handler file as its action, as in:
>
>
>
>I've also tried single quotes around the variable $login, as in:
>
>METHOD="POST">
>
>Anyone have any suggestions?
>
>Cheers,
>Steve Osborne
>Database Programmer
>Chinook Multimedia Inc.
>[EMAIL PROTECTED]
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
Jim Musil
-
Multimedia Programmer
Nettmedia
-
212-629-0004
[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] How to test the load

2001-12-14 Thread jimtronic


Yes, load time, but in general just to see how much traffic a 
server/script/db can handle and what performance is like.


>Is this to test load time?  To see under what load the script 
>finially craps out, or the server?
>--- jimtronic <[EMAIL PROTECTED]> wrote:
>>
>>  Hi,
>>
>>  This may be more of webserver question, but what methods are used to
>>  test the load on a php script or a family of scripts.
>>
>>  I'm guessing that apache (or equiv) would have a problem before PHP
>>  under a heavy amount of traffic, right?
>>
>>  --
>>  Jim Musil
>>  -
>>  Multimedia Programmer
>>  Nettmedia
>>  -
>>  212-629-0004
>>  [EMAIL PROTECTED]
>>
>>  --
>>  PHP General Mailing List (http://www.php.net/)
>>  To unsubscribe, e-mail: [EMAIL PROTECTED]
>>  For additional commands, e-mail: [EMAIL PROTECTED]
>>  To contact the list administrators, e-mail: [EMAIL PROTECTED]
>>
>
>
>=
>dan mccullough
>
>"Theres no such thing as a problem unless the servers are on fire!"
>
>
>__
>Do You Yahoo!?
>Check out Yahoo! Shopping and Yahoo! Auctions for all of
>your unique holiday gifts! Buy at http://shopping.yahoo.com
>or bid at http://auctions.yahoo.com


-- 
Jim Musil
-
Multimedia Programmer
Nettmedia
-
212-629-0004
[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] How to test the load

2001-12-14 Thread jimtronic


Hi,

This may be more of webserver question, but what methods are used to 
test the load on a php script or a family of scripts.

I'm guessing that apache (or equiv) would have a problem before PHP 
under a heavy amount of traffic, right?

-- 
Jim Musil
-
Multimedia Programmer
Nettmedia
-
212-629-0004
[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Sending out mass mail without having timeout problems ..

2001-12-13 Thread jimtronic


Wouldn't it be easier (better) to create a sendmail alias include 
file that has all the addresses in it and let sendmail or majordomo 
or qmail or whatever handle it?

I'm not knocking your method as much as I'm looking for the pros and 
cons of the different methods.

jim

>the way I handle this is to send a response to the browser before sending
>any mail you can then close the browser window and the script will carry on
>while you do something else. I get the script to send me an email when its
>finished 2-3 hours later. (I have around 6000 newsletters that are sent out)
>
>Paul Roberts
>[EMAIL PROTECTED]
>
>- Original Message -
>To: "bain" <[EMAIL PROTECTED]>
>Cc: <[EMAIL PROTECTED]>
>Sent: Tuesday, December 11, 2001 8:39 AM
>Subject:  [PHP] Sending out mass mail without having timeout problems ..
>
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
Jim Musil
-
Multimedia Programmer
Nettmedia
-
212-629-0004
[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Foreign Language Translation

2001-12-13 Thread jimtronic


I've seen developers use php to translate data into other languages.

Has anyone here done this?

Ideally, I'd like to be able to write or employ a function like this ...

translate($data,"english","french");

Obviously accuracy will be rough, but are there add on modules that 
can do this?


-- 
Jim Musil
-
Multimedia Programmer
Nettmedia
-
212-629-0004
[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Arrays...

2001-12-12 Thread jimtronic


http://php.net/array

Try $data = mysql_fetch_assoc($series)

This will produce an associative array with column names attached to
values for one row
of data from your database.

jim

>Hi,
>
>im trying to fill a chart with some data.
>
>I am using a mysql query:
>$query = "SELECT serie_tot, COUNT(*) FROM statistik WHERE shooter='mindbash'
>GROUP BY serie_tot";
>$series = mysql_query($query)
>
>It returns the results i want, ie
>value - count
>value2 - count
>etc...
>
>Now - i am trying to get this data into an array and is using:
>$data = mysql_fetch_array($series);
>
>But that doesn´t work! If i do it manually:
>$data = array(
>"value" => 4,
>"value2" => 2);
>
>...it works like a charm. What´s the difference between these arrays?
>
>I would also, very much, appreciate a tip on where i could learn how to
>master arrays. I am tearing my hair out here.
>
>Regards
># Daniel Alsén| www.mindbash.com #
># [EMAIL PROTECTED]  | +46 704 86 14 92 #
># ICQ: 63006462   | +46 8 694 82 22  #
># PGP: http://www.mindbash.com/pgp/  #
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]


--
Jim Musil
-
Multimedia Programmer
Nettmedia
-
212-629-0004
[EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Help creating an image repository/library.

2001-12-11 Thread jimtronic


You can also open a socket and put the files up via ftp. I use this 
method frequently when I cannot move the uploaded files.

use the fopen("ftp://user:[EMAIL PROTECTED]/path/to/images","w";) 
command to place the files.

This doesn't work so well if the file already exists, so you have to 
delete it first using the socket connection.

Like so ... (from user comments at php.net/fopen)


$ftp=fsockopen("ftp.your.host",21);
echo fgets($ftp,255);
fputs($ftp,"USER your_username\r\n");
echo fgets($ftp,255);
fputs($ftp,"PASS your_password\r\n");
echo fgets($ftp,255);
fputs($ftp,"DELE file_to_delete.txt\r\n");
echo fgets($ftp,255);
fputs($ftp,"QUIT\r\n");
echo fgets($ftp,255);
fclose($ftp);


Jim

PS Sorry about missing the point of your question the first time around ...

>I have written a simple image uploading system to go along with a simple
>database.  This will be a part of a publiclay accessable search engine for a
>jewelry companie's web site.  Almost every entry has a corresponding image.
>But that was the easy part...  The problem now is that I need to display the
>images next to the corresponding info on the same page.
>
>I do not know much about UNIX permissions but I am strongly advised to keep
>the permission settings on the public-html directory set to 0755 at the very
>least.  Since the PHP script inhereits user permissions (and not the Owner's
>permission)  this means that I can not upload the files to the Public-html
>directory where I could easily grab them with a URL.  The only place I have
>access is outside the public html directory.  Of couse I can open any number
>of images I like and read them to the browser screen... but they can not
>mingle with HTML becuase I have to set the header("Content-type:
>image/jpeg") in order to display the image in the first place.  ARRGGH!
>
>It is forcing me to use frames or a floating window to display the images..
>which is absoutely totaly unacceptable.  Aside from being a hack solution
>there is no way I can align the images with the corresponding database info.
>And inline frames are not supported by all browsers.
>
>*sigh*
>
>I am being blocked on all ends and I need a solution fast.  Any help will be
>**GREATLY** appreciated.
>
>-Kevin Stone
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
Jim Musil
-
Multimedia Programmer
Nettmedia
-
212-629-0004
[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Help creating an image repository/library.

2001-12-11 Thread jimtronic


Presumably, each item in the catalog has a unique id of some sort in 
the database. When you upload the images, you can rename the image 
file to image_(unique_id).jpg. Then when you load a page, you can 
reference the item next to the image.

This is only one way to do it, of course. You could also store the 
image names in another database and link the tables when calling the 
data for the jewelry.

jim


>I have written a simple image uploading system to go along with a simple
>database.  This will be a part of a publiclay accessable search engine for a
>jewelry companie's web site.  Almost every entry has a corresponding image.
>But that was the easy part...  The problem now is that I need to display the
>images next to the corresponding info on the same page.
>
>I do not know much about UNIX permissions but I am strongly advised to keep
>the permission settings on the public-html directory set to 0755 at the very
>least.  Since the PHP script inhereits user permissions (and not the Owner's
>permission)  this means that I can not upload the files to the Public-html
>directory where I could easily grab them with a URL.  The only place I have
>access is outside the public html directory.  Of couse I can open any number
>of images I like and read them to the browser screen... but they can not
>mingle with HTML becuase I have to set the header("Content-type:
>image/jpeg") in order to display the image in the first place.  ARRGGH!
>
>It is forcing me to use frames or a floating window to display the images..
>which is absoutely totaly unacceptable.  Aside from being a hack solution
>there is no way I can align the images with the corresponding database info.
>And inline frames are not supported by all browsers.
>
>*sigh*
>
>I am being blocked on all ends and I need a solution fast.  Any help will be
>**GREATLY** appreciated.
>
>-Kevin Stone
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
Jim Musil
-
Multimedia Programmer
Nettmedia
-
212-629-0004
[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Forms and Results with PHP

2001-12-06 Thread jimtronic


It's good practice to check that needed variables were passed at the 
top of the page.

if($name) {

normal display
exit

} else {

error display
exit
}

To take this further, you should verify that not only was the 
required data sent, but that it was in the correct format and not 
some malicious attack.


>I have a form that a user can put his contact info.  This form posts to a
>file called results.php.  The results.php file has a mail() command and the
>echo (i.e. )  to show the user confirmation of what he
>has submitted.
>
>However, if someone goes directly to results.php it will show Name: blank
>and email blank information.  Is there a way for the page to post an error
>stating no information was submitted or is there a way to enable the page to
>process without information?
>
>Thanks for the help,
>Ben
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
Jim Musil
-
Multimedia Programmer
Nettmedia
-
212-629-0004
[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Strange problem with some includes...

2001-12-06 Thread jimtronic


It looks like you put a full URL into your include ... which would be 
incorrect.

The syntax is ...

include("path/relative/to/your/script");

jim

-- 
Jim Musil
-
Multimedia Programmer
Nettmedia
-
212-629-0004
[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] move_uploaded_file on NT Server

2001-12-06 Thread jimtronic

Hi,

I've been having a problem moving uploaded files recently.

I have a script in directory

/foo/bar

  and it has no trouble moving a file into

/foo/rex

  but it can't move a file into

/foo/zip

This is strange because I created all the folders and the scripts, so 
presumably they would have the same gid/pid as required by safe mode. 
But this all seems like *nix terminology and not NT. The folders (rex 
and zip) are as identical as I could make them.

Actually, to clarify, I created all the folders but I used different 
ftp programs to
create them. (FTP Voyager, WS-FTP, Homesite)

Anyone else have this problem?

-- 
Jim Musil
-
Multimedia Programmer
Nettmedia
-
212-629-0004
[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Creating multidimensional array dynamically

2001-12-06 Thread jimtronic


you could also do this ...

$data = mysql_fetch_assoc($res); //this is a nice function because it 
returns an associative array. so
// if you change your SQL db, you 
wouldn't need to change your php code
// as much.

$quarterbacks[$name]= $data;


jim




>Something like this?
>
>while( list( $name, $attempts, $completions, $yards, $td, $int ) =
>mysql_fetch_row($res) )
>{
>   $quarterbacks[$name] = array( "ATTEMPTS" => $attempts,
>   "COMPLETIONS" =>
>$completions,
>   "YARDS" => $yards,
>   "TD" => $td,
>   "INT" => $int );
>}
>
>echo $quarterbacks["GARCIA"]["YARDS"];
>
>Jason Lotito
>[EMAIL PROTECTED]
>www.NewbieNetwork.net
>
>>  -Original Message-
>>  From: J. Roberts [mailto:[EMAIL PROTECTED]]
>>  Sent: Thursday, December 06, 2001 4:08 PM
>>  To: [EMAIL PROTECTED]
>>  Subject: [PHP] Creating multidimensional array dynamically
>>
>>
>>  I can't seem to figure out how to create a multidimensional
>>  array from a database query.  Here is an example of what I
>>  was looking for, using NFL quarterbacks as a statistical
>>  foundation... A record contains the following fields:
>>
>>  NAME, ATTEMPTS, COMPLETIONS, YARDS, TD, INT
>>
>>  Now I would like to be able to create an array with NAME as a
>>  key containing the array(ATTEMPTS, COMPLETIONS, YARDS, TD, INT).
>>
>>  That way I would be able to do the following:
>>
>>  echo $quarterbacks["GARCIA"]["YARDS"];
>>
>>  and get the output of 3,100 or whatever the case may be.
>>
>>  Thanks,
>>  -Jamison.
>>
>>
>>
>>  --
>>  PHP General Mailing List (http://www.php.net/)
>>  To unsubscribe, e-mail: [EMAIL PROTECTED]
>>  For additional commands, e-mail:
>>  [EMAIL PROTECTED] To contact the list
>>  administrators, e-mail: [EMAIL PROTECTED]
>>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
Jim Musil
-
Multimedia Programmer
Nettmedia
-
212-629-0004
[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Equivalent of the Basic function SELECT...CASE

2001-12-06 Thread jimtronic


switch {} will do it.

http://www.php.net/manual/en/control-structures.switch.php

>Could anyone tell me if there is a PHP equivalent to:
>
>SELECT x
> CASE 1 to 5
> {...}
> CASE ELSE
> {...}
>END SELECT
>
>Muchos gracias.
>
>Robin
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
Jim Musil
-
Multimedia Programmer
Nettmedia
-
212-629-0004
[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Checking Checkboxes using Arrays

2001-12-06 Thread jimtronic



When you perform the test you want to know if the $id is the user's 
choice and if the user's choice is in the array.

Your code reads differently. You are checking to see if $id is the 
user's choice OR $id is in the array. which would always check the 
countries in the array.

>   if(($id == $register_country_of_origin) ||
(in_array($id, $european_union))) {

try this ...

> if(($id == $register_country_of_origin) ||
(in_array($register_country_of_origin, $european_union))) {


jim

>
> $european_union = array('24', '17', '1', '58', '74', '80',
>'73', '83', '101', '103', '119', '144', '164', '186', '193', '212');
> print_r($european_union);
>
> if(mysql_num_rows($europe_result) > 0) {
>
> while(list($id, $country) =
>mysql_fetch_array($europe_result)) {
>
> if(($id == $register_country_of_origin) ||
>(in_array($id, $european_union))) {
>
> echo"\tCLASS=\"pofgreencard\">VALUE=\"$id\" CHECKED> $country\n";
>
> } else {
>
> echo"\tCLASS=\"pofgreencard\">VALUE=\"$id\"> $country\n";
>
> }
> }
>

-- 
Jim Musil
-
Multimedia Programmer
Nettmedia
-
212-629-0004
[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] parse error when requiring

2001-12-06 Thread jimtronic

You forgot the semicolon (;) after session_start()


>  > This works fine, but now i made the files sessionstart.php and bottom.php
>>
>>  sessionstart.php
>>  --
>>  >  session_start()
>>  if ($SessieEIA->Login == 1)
>>  { 
>>  ?>
>>
>>
>>  bottom.php
>>  --
>>  >  else {
>>  require "error.php";
>>  }
>>  ?>
>>
>>  And i require these files on top resp. bottom of the page and i get two
>  > parse errors.
>>

-- 
Jim Musil
-
Multimedia Programmer
Nettmedia
-
212-629-0004
[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Checking Checkboxes using Arrays

2001-12-06 Thread jimtronic

I'm sorry, your message doesn't make sense...

First you say that you want to do what the script is doing, and then 
you say you don't want it to do that.

>i want to select the
>countries (check their checkboxes) if they are equal to a particular country
>variable I have set or if they appear in an array.

>... if i select a country which is not in
>the array, it still checks all the boxes of the countires in the array?!

Please clarify.

-- 
Jim Musil
-
Multimedia Programmer
Nettmedia
-
212-629-0004
[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]