php-general Digest 30 May 2004 19:03:28 -0000 Issue 2793
Topics (messages 187218 through 187244):
Re: ColdFusion / SQL > PHP / mySQL HELP!
187218 by: Galen
Re: cookies malfunctioning moving from windows to linux
187219 by: Thomas Seifert
187229 by: Ryan Schefke
187231 by: Hodicska Gergely
187235 by: Ryan Schefke
[Newbie Guide] For the benefit of new members
187220 by: Ma Siva Kumar
Simple preg I think
187221 by: Dave Carrera
187222 by: Larry Brown
Submitting a form from <a> tags
187223 by: GodFoca
187225 by: John W. Holmes
187228 by: GodFoca
187232 by: Marek Kilimajer
including an html file!!
187224 by: little boy
187226 by: Johan Holst Nielsen
187227 by: GodFoca
187230 by: Johan Holst Nielsen
Data reading and writing for a chat
187233 by: Stephen Lake
187234 by: Johan Holst Nielsen
Associative array question
187236 by: csnm.ns.sympatico.ca
187237 by: Johan Holst Nielsen
"lasso" (a bit 0T)
187238 by: Ryan A
Windows to Linux -- Issues with mkdir()function and picture uploading
187239 by: Ryan Schefke
187240 by: Thomas Seifert
187243 by: Ryan Schefke
PEAR Mail/smtp sending problem
187241 by: Christopher J. Mackie
187244 by: Khan
CMS with best administration part?
187242 by: Khan
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
Yeah, I'd say it's completely hopeless in a week. PHP is a totally
different language than ColdFusion. SQL and MySQL may be different. The
databases alone, as others have mentioned, could easily be a week even
if you're experienced. Moving BOTH databases and scripting languages
will probably mean you have to more reimplement, not just duplicate
exact. Certain features may exist in your current database and not in
MySQL, making it impossible to port your database as-is and requiring
massively more function.
If you really want this thing done and don't know what you're doing,
try giving yourself 6 months. Or more. And a very long read through the
PHP and MySQL documentation. And lots of posts to the php list when you
can't figure things out.
You could also try outsourcing your code. If ALL you want is an exact
copy in PHP, I bet there are plenty off off-shore (well, off the U.S.
shore) companies willing to do it for a very reasonable rate. I can't
speak for their design and how easy the code will be to work with, but
that would be the way to do it fast and cheap (well, relatively cheap).
But it better be important, because I bet it would be massively cheaper
to buy another ColdFusion license than to try and re-implement
ColdFusion in PHP on this scale!
Please post back here and let us know what happened with this. I'm
guessing you posted feeling pretty freaked out after your boss pushed
you to do this. Or perhaps you just thought that ColdFusion and PHP
were very similar and there was some kind of converter or easy process,
like going from GIF to PNG or something. Unfortunately, that's just not
the case. If you come back and ask smaller, more specific questions,
preferably somewhat pre-researched (just spend 3 minutes googling), we
can help and we promise not to group-lynch you :)
-Galen
--- End Message ---
--- Begin Message ---
Ryan Schefke wrote:
I don't think that is it. I believe session.save_path is only for sessions,
not cookies. I'm only using cookies in the application.
Can someone please help?
Thanks,
Ryan
Yeah, tell HOW you set the cookies.
There is really no difference in linux/windows-php in this cases.
thomas
--- End Message ---
--- Begin Message ---
Thomas/All,
To summarize, my code containing cookies running on windows with a working
php installation (and Apache) executed all scripts containing cookies
perfectly. However, I transitioned my code to a Linux box with a fresh
install of PHP and now my cookies aren't working. Below is an example of
setting and writing cookie values from one script. Again, everything worked
like a charm on my old machine. That's why I think it has something to do
with the Apache or PHP installation settings.
Note - on the new PHP installation I've had to change the "register_global"
switch to "on" in my php.ini file to get my code working. Now the cookies
don't work...
Please, please help!
===================== SET value of cookie =============
setcookie ("showpoll_ck", "$ID"); // set cookie to show poll answers
header ('Location: '.$PHP_SELF);
===================== SET value of cookie =============
===================== WRITE value of cookie =============
<?php
echo '<p>';
if ($showpoll_ck == "$ID") {
echo '<font color="blue"><b><div align="center">Thank you for your vote.
Results:</div></b></font>';
}
echo '</p>';
?>
===================== WRITE value of cookie =============
** PS, I also tried $_COOKIE['showpoll_ck'] when writing value...that
doesn't make a difference, that's why I think it's something with the
install.
-----Original Message-----
From: Thomas Seifert [mailto:[EMAIL PROTECTED]
Sent: Sunday, May 30, 2004 3:43 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] cookies malfunctioning moving from windows to linux
Ryan Schefke wrote:
> I don't think that is it. I believe session.save_path is only for
sessions,
> not cookies. I'm only using cookies in the application.
>
> Can someone please help?
>
> Thanks,
> Ryan
Yeah, tell HOW you set the cookies.
There is really no difference in linux/windows-php in this cases.
thomas
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Hi!
On the server register_globals = off.
Use $_COOKIE['ID'] instead of $ID.
Felho
u.i. always develop with register_globals = off
--- End Message ---
--- Begin Message ---
Hi All,
Please consider this topic/subject closed. There was conflict with my
firewall.
Ryan
-----Original Message-----
From: Hodicska Gergely [mailto:[EMAIL PROTECTED]
Sent: Sunday, May 30, 2004 10:13 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] cookies malfunctioning moving from windows to linux
Hi!
On the server register_globals = off.
Use $_COOKIE['ID'] instead of $ID.
Felho
u.i. always develop with register_globals = off
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
=======================================
Please feel free to add more points and send
to the list.
=======================================
1. If you have any queries/problems about PHP
try http://www.php.net/manual/en first. You
can download a copy and use it offline also.
Please also try
http://www.php.net/manual/faq.php
for answers to frequently answered questions
about PHP (added by Christophe Chisogne).
2. Try http://www.google.com next. Searching
for "php YOUR QUERY" may fetch you relevant
information within the first 10 results.
3. There is a searchable archive of the
mailing list discussion at
http://phparch.com/mailinglists. Many of the
common topics are discussed repeatedly, and
you may get answer to your query from the
earlier discussions.
For example: One of the repeatedly discussed
question in the list is "Best PHP editor".
Everyone has his/her favourite editor.
You can get all the opinions by going through
the list archives. If you want a chosen list
try this link :
http://www.thelinuxconsultancy.co.uk/phpeditors/
(contributed by Christophe Chisogne).
4. Not sure if PHP is working or you want
find out what extensions are available to
you?
Just put the following code into a file with
a .php extension and access it through your
webserver:
<?php
� � � � phpinfo();
?>
If PHP is installed you will see a page with
a lot of information on it. If PHP is not
installed (or not working correctly) your
browser will try to download the file.
(contributed by Teren and reworded by Chris W
Parker)
5. If you are stuck with a script and do not
understand what is wrong, instead of posting
the whole script, try doing some research
yourself. One useful trick is to print
the variable/sql query using print or echo
command and check whether you get what you
expected.
After diagnosing the problem, send the
details of your efforts (following steps 1,
2 & 3) and ask for help.
6. PHP is a server side scripting language.
Whatever processing PHP does takes place
BEFORE the output reaches the client.
Therefore, it is not possible to access
users' �computer related information (OS,
screen size etc) using PHP. Nor can you
modify any the user side settings. You need
to go for JavaScript and ask the question in
a JavaScript list.
On the other hand, you can access the
information that is SENT by the user's
browser when a client requests a page from
your server. You can find details about
browser, OS etc as reported by
this request. - contributed by Wouter van
Vliet and reworded by Chris W Parker.
7. Provide a clear descriptive subject line.
Avoid general subjects like "Help!!", "A
Question" etc. �Especially avoid blank
subjects.
8. When you want to start a new topic, open a
new mail composer and enter the mailing list
address [EMAIL PROTECTED] instead of
replying to an existing thread and replacing
the subject and body with your message.
9. It's always a good idea to post back to
the list once you've solved your problem.
People usually add [SOLVED] to the subject
line of their email when posting solutions.
By posting your solution you're helping the
next person with the same question.
[contribued by Chris W Parker]
10. Ask smart questions �
http://catb.org/~esr/faqs/smart-questions.html
[contributed by Jay Blanchard)
11. Do not send your email to the list with
attachments. If you don't have a place to
upload your code, try the many pastebin
websites (such as www.pastebin.com).
[contributed by Burhan Khalid]
--
Integrated Management Tools for leather
industry
----------------------------------
http://www.leatherlink.net
Ma Siva Kumar,
BSG LeatherLink (P) Ltd,
Chennai - 600106
--- End Message ---
--- Begin Message ---
Hi List,
How do I match an accordance of "./" in a string (without the quotes) ?
I have tried preg_match("/\.\//i", $str);
Which I thought would work , as per the manual, but no joy.
Any help or guidance is appreciated
Thank you in advance
Dave C
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.692 / Virus Database: 453 - Release Date: 28/05/2004
--- End Message ---
--- Begin Message ---
That works for me...
$testVal = "this is the ./command";
if(preg_match("/\.\//i", $testVal))
{
echo "hello";
}
This printed hello, then I removed the slash and it did not match and did
not print hello. Sounds like it is a logic problem, or the variable is not
arriving as you expected.
-----Original Message-----
From: Dave Carrera [mailto:[EMAIL PROTECTED]
Sent: Sunday, May 30, 2004 6:55 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Simple preg I think
Hi List,
How do I match an accordance of "./" in a string (without the quotes) ?
I have tried preg_match("/\.\//i", $str);
Which I thought would work , as per the manual, but no joy.
Any help or guidance is appreciated
Thank you in advance
Dave C
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.692 / Virus Database: 453 - Release Date: 28/05/2004
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Heyp! I wanted to know if there is some way to do the submitting of a form
from a normal href link, instead of the big-dumb-gray button.
If it can't be done with PHP, how can it be done?
Thanks in advance,
Nicolas Sanguinetti
--- End Message ---
--- Begin Message ---
GodFoca wrote:
Heyp! I wanted to know if there is some way to do the submitting of a form
from a normal href link, instead of the big-dumb-gray button.
If it can't be done with PHP, how can it be done?
Why would you think PHP can do anything client side?
<a href="javascript:document.form.submit()">submit</a>
or something like that...
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
--- End Message ---
--- Begin Message ---
Thank you very much!
N.
--- End Message ---
--- Begin Message ---
GodFoca wrote:
Heyp! I wanted to know if there is some way to do the submitting of a form
from a normal href link, instead of the big-dumb-gray button.
If it can't be done with PHP, how can it be done?
Thanks in advance,
Nicolas Sanguinetti
Thought it is possible to use javascript as suggested by John, the
recomended way is to use styles to change the appearance of the submit
button.
Example:
<style>
.submit {
border: none;
background-color: white;
}
.submit:hover {
border: none;
background-color: white;
text-decoration: underline;
cursor: hand;
cursor: pointer;
}
</style>
<input type="submit" value="Send" class="submit">
--- End Message ---
--- Begin Message ---
when i include a html file i alwas do it with:
echo(include('htmlfile.html')); everythings works fine except the fact, that
after the included file the is a '1' printed out, anybody, an idea why???
--- End Message ---
--- Begin Message ---
Little Boy wrote:
when i include a html file i alwas do it with:
echo(include('htmlfile.html')); everythings works fine except the fact, that
after the included file the is a '1' printed out, anybody, an idea why???
Because you dont need echo - include output the html :)
just
<?php
include('htmfile.html');
?>
Check the documentation http://php.net/include - include returns 1 -
thats why it is printed out when you do echo :)
--
Johan Holst Nielsen
Freelance PHP Developer
http://phpgeek.dk
--- End Message ---
--- Begin Message ---
echo returns 1 on success, so the interpreter first evaluates the expression
inside the echo() call, and thus includes the html file, and then, as the
evaluation returned 1, it echoes 1 to the final file.
You should only do "include(...)", without the echo.
Good luck,
Nicolas
--- End Message ---
--- Begin Message ---
Godfoca wrote:
echo returns 1 on success, so the interpreter first evaluates the expression
inside the echo() call, and thus includes the html file, and then, as the
evaluation returned 1, it echoes 1 to the final file.
Just to clear it out... include does not always return 1.
An example
File: includeFile.php
<?php
$foo = "Test with return";
return $foo;
?>
<?php
$bar = include("includeFile.php");
echo $bar; //Output "Test with return"
?>
--
Johan Holst Nielsen
Freelance PHP Developer
http://phpgeek.dk
--- End Message ---
--- Begin Message ---
Hey All,
I got a question for you all.
What would be more effiecient for datastoring that is going to be constantly
extracted like in a chat application?
a MySQL database? or a Flat text file?
Right now I am working on a flat text file base but would also like to do it
as a database version too if the performance wouldn;t be hit that bad.
--- End Message ---
--- Begin Message ---
Stephen Lake wrote:
I got a question for you all.
What would be more effiecient for datastoring that is going to be constantly
extracted like in a chat application?
a MySQL database? or a Flat text file?
Well, the most effiecient would be the memory :) With some socket
programming it should be possible to create a connection to each client
- and a server show sent out the incoming messages to the clients.
But flat file vs. mysql. I would prefer MySQL - it is fast, it can
handle a lot of request. If you use flatfile, you need to do some
checking for the if the file is open already - so only one client at the
time can write to the file - if can be very slow if a lot of users is on
the chat at the same time and write a lot of messages - cause the whole
file need to be locked every time a single user write a message.
So in my opinion, you should do some socket client and a server - or use
a database :)
--
Johan Holst Nielsen
Freelance PHP Developer
http://phpgeek.dk
--- End Message ---
--- Begin Message ---
Hello,
If I have an associative array like:
$myFriendsAges['Tom']=25;
$myFriendsAges['Bill']=35;
$myFriendsAges['Al']=45;
$myFriendsAges['Mark']=55;
Is there a way to index name into a string. I would like to be able to
echo something like:
My friend Bill is 35 years of age.
Is there a way to do this?
Thanks
Tim
--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] wrote:
Hello,
If I have an associative array like:
$myFriendsAges['Tom']=25;
$myFriendsAges['Bill']=35;
$myFriendsAges['Al']=45;
$myFriendsAges['Mark']=55;
Is there a way to index name into a string. I would like to be able to
echo something like:
My friend Bill is 35 years of age.
Is there a way to do this?
No sure what you mean... but it is possible this way:
<?php
foreach($myFriendsAges as $name=>$age) {
echo "My friend ".$name." is ".$age." years of age.<br>\n";
}
?>
--
Johan Holst Nielsen
Freelance PHP Developer
http://phpgeek.dk
--- End Message ---
--- Begin Message ---
Hey,
A prospective client has asked me to try to convert his Swedish site so that
visitors have a choice between Swedish and English, which is not a problem
as I am fluent in both languages. After going through the site to convert I
was just checking out the current pages and I saw that all the links have a
.lasso extension instead of the "normal" .htm,.html,.php etc
Did a quick search on google and found this
http://store.blueworld.com/lp7.lasso
sure looks like the same stuff but am not sure...
Anybody here worked with Lasso? any suggestions or comments?
Thanks,
-Ryan
--- End Message ---
--- Begin Message ---
Hi All,
I recently migrated code from my home server (windows) to a dedicated
hosting server (Linux). I seem to have some issues with permissions and I'm
not sure how to fix it.
Take the simple script I wrote below.
=================================================
<?php
$directory_make = $_SERVER['DOCUMENT_ROOT'] . "/tgwedding/test";
mkdir("$directory_make", 0777);
?>
It produces the following error:
Warning: mkdir() failed (Permission denied) in
/home/httpd/vhosts/tgwedding.com/httpdocs/tgwedding/php4.php on line 3
=================================================
The above behavior is on the Linux machine. Now, I run the same script on
my windows box and it works perfectly.
In another script I upload .jpg files to a directory. It was working
perfectly on the windows home server and on the Linux box I get an access
denied error like this:
Warning: Unable to create
'/home/httpd/vhosts/tgwedding.com/httpdocs/tgwedding/users/client1/album/175
_7538.jpg': Permission denied in
/home/httpd/vhosts/tgwedding.com/httpdocs/tgwedding/photos.php on line 226
Could someone please?
--- End Message ---
--- Begin Message ---
Ryan Schefke wrote:
The above behavior is on the Linux machine. Now, I run the same script on
my windows box and it works perfectly.
windows has (afaik in its default settings) no good file-permissions.
the php-scripts usually run as the user the webserver runs as ...
so the webserver-user has to have write-permissions on the directory it
needs to write to.
so either chown (change the owner) or chmod (change the permissions to
be writable for the group or even other if needed) the directory.
thomas
--- End Message ---
--- Begin Message ---
Thomas, thanks, that worked perfectly!
-----Original Message-----
From: Thomas Seifert [mailto:[EMAIL PROTECTED]
Sent: Sunday, May 30, 2004 2:32 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: Windows to Linux -- Issues with mkdir()function and
picture uploading
Ryan Schefke wrote:
> The above behavior is on the Linux machine. Now, I run the same script on
> my windows box and it works perfectly.
windows has (afaik in its default settings) no good file-permissions.
the php-scripts usually run as the user the webserver runs as ...
so the webserver-user has to have write-permissions on the directory it
needs to write to.
so either chown (change the owner) or chmod (change the permissions to
be writable for the group or even other if needed) the directory.
thomas
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
I'm following the PEAR docs to use Mail/SMTP. Below is the code I use,
swiped directly from the docs--I've changed the authorization data to
protect privacy, but otherwise it's identical (and email sent from a client
on this same machine using the same settings works fine). I'm running PHP
4.3.6 ISAPI on Win2k3 Server, IIS6.0.
No errors are generated back to me, but the messages aren't going through.
I can't see the smtp server logs, so I don't know what's failing.
I'm new to PHP: what am I missing? Is there a way that I can examine on my
end the errors that are presumably being generated at the SMTP server?
Tx, --CJ
<?php
include('Mail.php');
$recipients = '[EMAIL PROTECTED]';
$headers['From'] = '[EMAIL PROTECTED]';
$headers['To'] = '[EMAIL PROTECTED]';
$headers['Subject'] = 'Test message';
$body = 'Test message';
$params['host'] = 'smtpserver.princeton.edu';
$params['auth'] = TRUE;
$params['username'] = 'cjm';
$params['password'] = 'mypass';
$params['port'] = '25';
$mail_object =& Mail::factory('smtp', $params);
$mail_object->send($recipients, $headers, $body);
?>
--- End Message ---
--- Begin Message ---
Christopher J. Mackie wrote:
I'm following the PEAR docs to use Mail/SMTP. Below is the code I use,
swiped directly from the docs--I've changed the authorization data to
protect privacy, but otherwise it's identical (and email sent from a client
on this same machine using the same settings works fine). I'm running PHP
4.3.6 ISAPI on Win2k3 Server, IIS6.0.
No errors are generated back to me, but the messages aren't going through.
I can't see the smtp server logs, so I don't know what's failing.
I'm new to PHP: what am I missing? Is there a way that I can examine on my
end the errors that are presumably being generated at the SMTP server?
you have Pear dedicated mailing list at http://pear.php.net/ Maybe
someone will answer you sooner there.
--- End Message ---
--- Begin Message ---
Hello,
I'm looking for CMS that have great administration part. I'm not
interested in site displaying, speed, HTML standards or anything like
that. I just need stable administration part with modules:
- News with archives;
- Blogs;
- Some users Can be administrators of blogs;
- Link directory;
- Navigation with multiple categories and subcategories;
- Different news for different parts of my web site;
Web site will be very large and it will have almost any module that you
can find these days :)
I like XOOPS [1]. I also have my eye on Mambo [2]. A friend of mine told
me that Drupal [3] has best community and if not drupal that I should
check EZ [4].
What do you think? Which CMS has best PHP coding standards, best
community, most modules etc...
Any advice is appreciated.
1. http://xoops.org/
2. http://mamobserver.com/
3. http://drupal.org/
4. http://ez.no/
If you know of some other CMS please send link. I know of
opensourcecms.com but I'm interested in your opinions about project
future, community etc.
--- End Message ---