php-general Digest 21 Jul 2008 02:44:33 -0000 Issue 5580

Topics (messages 277122 through 277132):

Re: very very small CMS
        277122 by: tedd
        277123 by: spacemarc

Re: Optimization of PHP Code
        277124 by: Eric Butera

[HTML MAIL FORM] - Body text not coming through
        277125 by: TS
        277126 by: TS
        277127 by: TS
        277128 by: Al

Re: php help.
        277129 by: Jochem Maas

Counting Occurrences within an If statement
        277130 by: Mark Bomgardner
        277131 by: Micah Gersten

Pasword Protecting several pages
        277132 by: R.C.

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 ---
At 9:07 AM -0400 7/20/08, Bastien Koert wrote:
On Sat, Jul 19, 2008 at 9:28 PM, tedd <<mailto:[EMAIL PROTECTED]>[EMAIL PROTECTED]> wrote:

At 8:42 PM -0400 7/19/08, Bastien Koert wrote:


my firefox is not happy finding the site..IE and Opera are both good with it...Dunno if this is my problem or something funky in the site?


Which site?


<http://www.webbytedd.com/a/easy-page-db/>http://www.webbytedd.com/a/easy-page-db/

but it looks like its a gmail issue...not hanlding the link correctly..strange


My FF on the Mac deals with it.

Also, if you'll note all my stuff validates -- that cuts down on browser problems.

Cheers,

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
2008/7/18 OOzy Pal <[EMAIL PROTECTED]>:
> Hello
> I am looking for a simple php CMS. Can anyone help?
>


you can try those:

http://www.cmsmadesimple.org/

-- 
Scripts: http://www.spacemarc.it

--- End Message ---
--- Begin Message ---
On Fri, Jul 18, 2008 at 2:38 PM, Robert Cummings <[EMAIL PROTECTED]> wrote:
> On Fri, 2008-07-18 at 21:33 +0300, Sancar Saran wrote:
>> And one thing.
>>
>> > (1). It is very convenient to pre-process static information at compile
>> > time rather than on every request (specific properties, content chunks,
>> > content relocation, etc). Additionally, it can compile to static HTML,
>>
>> One of my sites using 3rd party as data source (via xml).
>>
>> Their data may change any time, so we have to parse template files in each
>> request.
>>
>> What is your suggestion ?
>
> I didn't say it had to be static. I said it can be either static or
> dynamic. it can house modules, render module data, render arbitrary
> data. Essentially you can make static what needs to be static and make
> dynamic what needs to be dynamic. But the template engine isn't like how
> smarty does things. My engine can produce a PHP file with appropriate
> PHP code to load modules and render data at run-time. The difference is,
> when this page is requested by the browser, the template engine is not
> part of the run-time process. Only the modules are that produce the
> dynamic data. Of course if you have no dynamic data, no modules need be
> loaded (such as for CSS). In fact the PHP engine need not be loaded
> either if it's a true static content file.
>
> Cheers,
> Rob.


I'd have to look into this to see if I really liked it or not.  Is all
of that part of your interjinn framework?  It sounds like an
interesting concept and is probably faster overall, but I'm always
wary of generating executable php code.  You just never know.  Plus I
am not a fan of any template syntax that isn't php.  I like knowing
any file I open will have straight php calls and not have to parse any
meta languages I come up with.  If there is a question about what is
going on it is easy enough to look at any of my api calls or phpdoc to
see what is going on.  I've tried using stuff like that before and it
just wasn't how I liked programming.  More power to you though.  The
end goal is to push something out the door so everything else is just
preference. :)

In my code I always use MVC.  People nitpick about how hard it
is/overly complex but in the end all sites always have changing
requirements.  Past experience has shown me that it is easier in the
long run.  My controllers use table gateways & value objects to
perform data access.  Then the controller creates a view instance
which pumps the data into it and calls render() on it.  If I have
something that I know is going to be intense I put the data caching
directly into my gateway code.  This way I always know where to look.
(Of course there are always those nit-picky edge cases but let's
ignore those! ;))

As for my js & css I have created a 2 step process.  First I have a
class called byte_Page.  This page has 4 sub objects in it that allow
me to build breadcrumbs, current page actions, inject css files, and
inject js files.  It does a bit more than that too, but you get the
idea.  I created it for having a consistent way of being able to have
any piece of executing code be able to say I need X css or X
javascript.  This url then pipes to a file which basically stitches
the files together.  I needed that with the start of using the YUI
files.  On some of my more complex interfaces I was ending up shoving
10 different JS files down the wire which was just killing page
performance.  Those 10 rules for faster pages by the Yahoo performance
group was really helpful.

But like I said that is just how I like to do things.  I just want to
make the point that I'm not saying either is right or wrong.

--- End Message ---
--- Begin Message ---
Can someone spot what I'm doing wrong here? Must have something to do with
headers maybe?

The attached picture comes through but, no text. Here's the headers that do
come through. Thanks for any help. Mail is such a pain.

 

 

Received: (qmail 13640 invoked by uid 48); 19 Jul 2008 17:01:10 -0700

Date: 19 Jul 2008 17:01:10 -0700

Message-ID: <[EMAIL PROTECTED]>

To: [EMAIL PROTECTED]

Subject: 

From: <[EMAIL PROTECTED]>

MIME-Version: 1.0

Content-Type: multipart/mixed;

 boundary="==Multipart_Boundary_x8588974b51cbb9c326958df4c2f8b218x"

 

 

 

                $fileatt = "test-send.jpg"; // Path to the file

                $fileatt_type = "application/octet-stream"; // File Type

                $fileatt_name = "picture.jpg"; // Filename that will be used
for the file as the attachment

                

                $headers = "From: ".$_REQUEST['first_name']."
<".$_REQUEST['from'].">";

                

                $file = fopen($fileatt,'rb');

                $data = fread($file,filesize($fileatt));

                fclose($file);

                

                $semi_rand = md5(time());

                $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";

                

                $headers .= "\nMIME-Version: 1.0\n" .

 
"Content-Type: multipart/mixed;\n" .

                                                                "
boundary=\"--{$mime_boundary}\"";

                

                $body .= "Text that should show up but, I'm a noob.\n" .

 
"--{$mime_boundary}\n" .

 
"Content-Type:text/html; charset=\"iso-8859-1\"\n" .

 
"Content-Transfer-Encoding: 7bit\n\n" .

                $body . "\n\n";

                

                $data = chunk_split(base64_encode($data));

                

                $body .= "--{$mime_boundary}\n" .

 
"Content-Type: {$fileatt_type};\n" .

 
" name=\"{$fileatt_name}\"\n" .

                

                

                //"Content-Disposition: attachment;\n" .

                //" filename=\"{$fileatt_name}\"\n" .

                "Content-Transfer-Encoding: base64\n\n" .

                $data . "\n\n" .

                                                "--{$mime_boundary}--\n";

 

                @mail($toEmail, $subject, $body, $headers);

                echo "sent=OK";

 


--- End Message ---
--- Begin Message ---
So when I tested before my boundaries were wrong in my code. It however was
copied into this email message correctly in the code below below. 

 

This was     " boundary=\"--{$mime_boundary}\"";

 

                      " boundary=\"{$mime_boundary}\"";

 

Notice the double dashes were missing so, when they were added it now works
but, all the header info is now showing in the message body. Any ideas?

 

Thanks

 

 

From: TS [mailto:[EMAIL PROTECTED] 
Sent: Sunday, July 20, 2008 1:36 PM
To: '[EMAIL PROTECTED]'
Subject: [HTML MAIL FORM] - Body text not coming through

 

Can someone spot what I'm doing wrong here? Must have something to do with
headers maybe?

The attached picture comes through but, no text. Here's the headers that do
come through. Thanks for any help. Mail is such a pain.

 

 

Received: (qmail 13640 invoked by uid 48); 19 Jul 2008 17:01:10 -0700

Date: 19 Jul 2008 17:01:10 -0700

Message-ID: <[EMAIL PROTECTED]>

To: [EMAIL PROTECTED]

Subject: 

From: <[EMAIL PROTECTED]>

MIME-Version: 1.0

Content-Type: multipart/mixed;

 boundary="==Multipart_Boundary_x8588974b51cbb9c326958df4c2f8b218x"

 

 

 

                $fileatt = "test-send.jpg"; // Path to the file

                $fileatt_type = "application/octet-stream"; // File Type

                $fileatt_name = "picture.jpg"; // Filename that will be used
for the file as the attachment

                

                $headers = "From: ".$_REQUEST['first_name']."
<".$_REQUEST['from'].">";

                

                $file = fopen($fileatt,'rb');

                $data = fread($file,filesize($fileatt));

                fclose($file);

                

                $semi_rand = md5(time());

                $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";

                

                $headers .= "\nMIME-Version: 1.0\n" .

 
"Content-Type: multipart/mixed;\n" .

                                                                "
boundary=\"--{$mime_boundary}\"";

                

                $body .= "Text that should show up but, I'm a noob.\n" .

 
"--{$mime_boundary}\n" .

 
"Content-Type:text/html; charset=\"iso-8859-1\"\n" .

 
"Content-Transfer-Encoding: 7bit\n\n" .

                $body . "\n\n";

                

                $data = chunk_split(base64_encode($data));

                

                $body .= "--{$mime_boundary}\n" .

 
"Content-Type: {$fileatt_type};\n" .

 
" name=\"{$fileatt_name}\"\n" .

                

                

                //"Content-Disposition: attachment;\n" .

                //" filename=\"{$fileatt_name}\"\n" .

                "Content-Transfer-Encoding: base64\n\n" .

                $data . "\n\n" .

                                                "--{$mime_boundary}--\n";

 

                @mail($toEmail, $subject, $body, $headers);

                echo "sent=OK";

 


--- End Message ---
--- Begin Message ---
Alright in doing that the text comes through but, no picture. Geez

 

From: TS [mailto:[EMAIL PROTECTED] 
Sent: Sunday, July 20, 2008 1:47 PM
To: '[EMAIL PROTECTED]'
Subject: RE: [HTML MAIL FORM] - Body text not coming through

 

So when I tested before my boundaries were wrong in my code. It however was
copied into this email message correctly in the code below below. 

 

This was     " boundary=\"--{$mime_boundary}\"";

 

                      " boundary=\"{$mime_boundary}\"";

 

Notice the double dashes were missing so, when they were added it now works
but, all the header info is now showing in the message body. Any ideas?

 

Thanks

 

 

From: TS [mailto:[EMAIL PROTECTED] 
Sent: Sunday, July 20, 2008 1:36 PM
To: '[EMAIL PROTECTED]'
Subject: [HTML MAIL FORM] - Body text not coming through

 

Can someone spot what I'm doing wrong here? Must have something to do with
headers maybe?

The attached picture comes through but, no text. Here's the headers that do
come through. Thanks for any help. Mail is such a pain.

 

 

Received: (qmail 13640 invoked by uid 48); 19 Jul 2008 17:01:10 -0700

Date: 19 Jul 2008 17:01:10 -0700

Message-ID: <[EMAIL PROTECTED]>

To: [EMAIL PROTECTED]

Subject: 

From: <[EMAIL PROTECTED]>

MIME-Version: 1.0

Content-Type: multipart/mixed;

 boundary="==Multipart_Boundary_x8588974b51cbb9c326958df4c2f8b218x"

 

 

 

                $fileatt = "test-send.jpg"; // Path to the file

                $fileatt_type = "application/octet-stream"; // File Type

                $fileatt_name = "picture.jpg"; // Filename that will be used
for the file as the attachment

                

                $headers = "From: ".$_REQUEST['first_name']."
<".$_REQUEST['from'].">";

                

                $file = fopen($fileatt,'rb');

                $data = fread($file,filesize($fileatt));

                fclose($file);

                

                $semi_rand = md5(time());

                $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";

                

                $headers .= "\nMIME-Version: 1.0\n" .

 
"Content-Type: multipart/mixed;\n" .

                                                                "
boundary=\"--{$mime_boundary}\"";

                

                $body .= "Text that should show up but, I'm a noob.\n" .

 
"--{$mime_boundary}\n" .

 
"Content-Type:text/html; charset=\"iso-8859-1\"\n" .

 
"Content-Transfer-Encoding: 7bit\n\n" .

                $body . "\n\n";

                

                $data = chunk_split(base64_encode($data));

                

                $body .= "--{$mime_boundary}\n" .

 
"Content-Type: {$fileatt_type};\n" .

 
" name=\"{$fileatt_name}\"\n" .

                

                

                //"Content-Disposition: attachment;\n" .

                //" filename=\"{$fileatt_name}\"\n" .

                "Content-Transfer-Encoding: base64\n\n" .

                $data . "\n\n" .

                                                "--{$mime_boundary}--\n";

 

                @mail($toEmail, $subject, $body, $headers);

                echo "sent=OK";

 


--- End Message ---
--- Begin Message ---
Consider using PEAR Mail_Mime or Mail_mimePart.

Works well and is easy to use.

TS wrote:
Can someone spot what I'm doing wrong here? Must have something to do with
headers maybe?

The attached picture comes through but, no text. Here's the headers that do
come through. Thanks for any help. Mail is such a pain.

Received: (qmail 13640 invoked by uid 48); 19 Jul 2008 17:01:10 -0700

Date: 19 Jul 2008 17:01:10 -0700

Message-ID: <[EMAIL PROTECTED]>

To: [EMAIL PROTECTED]

Subject:
From: <[EMAIL PROTECTED]>

MIME-Version: 1.0

Content-Type: multipart/mixed;

 boundary="==Multipart_Boundary_x8588974b51cbb9c326958df4c2f8b218x"

                $fileatt = "test-send.jpg"; // Path to the file

                $fileatt_type = "application/octet-stream"; // File Type

                $fileatt_name = "picture.jpg"; // Filename that will be used
for the file as the attachment

                $headers = "From: ".$_REQUEST['first_name']."
<".$_REQUEST['from'].">";

                $file = fopen($fileatt,'rb');

                $data = fread($file,filesize($fileatt));

                fclose($file);

                $semi_rand = md5(time());

                $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";

                $headers .= "\nMIME-Version: 1.0\n" .

"Content-Type: multipart/mixed;\n" .

                                                                "
boundary=\"--{$mime_boundary}\"";

                $body .= "Text that should show up but, I'm a noob.\n" .

"--{$mime_boundary}\n" .

"Content-Type:text/html; charset=\"iso-8859-1\"\n" .

"Content-Transfer-Encoding: 7bit\n\n" .

                $body . "\n\n";

                $data = chunk_split(base64_encode($data));

                $body .= "--{$mime_boundary}\n" .

"Content-Type: {$fileatt_type};\n" .

" name=\"{$fileatt_name}\"\n" .

                //"Content-Disposition: attachment;\n" .

                //" filename=\"{$fileatt_name}\"\n" .

                "Content-Transfer-Encoding: base64\n\n" .

                $data . "\n\n" .

                                                "--{$mime_boundary}--\n";

                @mail($toEmail, $subject, $body, $headers);

                echo "sent=OK";



--- End Message ---
--- Begin Message ---
Jim Lucas schreef:
Belinda wrote:
Good morning

I have just been browsing the web for help with a php problem that is
driving me mad. I didn't want to post to the site so hope that this email
may get a response. I thank you in advance.

I am learning php myself(self-learning) but just can get me head around this
error.(lack of knowledge L)

With regard to [function.file-get-contents] can anyone explain this error to
me...please :-)

Warning:
file_get_contents(http://www.ecofriendz.com/groups/orca/?action=group_last_t
opics&forum=Bea-Tropical&trans=1) [function.file-get-contents]: failed to
open stream: Connection refused in
/home/sites/ecofriendz.com/public_html/inc/classes/BxDolGroups.php on line
419.

I cannot resolve this issue. any help will be gratefully appreciated.

With Kindest Regards

Belinda Marsh



sounds like you are not allowed to access URL on the internet.

this is indeed more likely than having missed quotes around the
URL (someone else mentioned that possibility).

chances are that Belinda's using shared hosting and that
allow_url_fopen is turned off server wide ... I'll bet money
the sys admins won't turn it on for her.

now the real question! why is code that blatantly belongs to
ecofriendz.com trying to grab output from a 'page script' that
exists in the same site ... it's just plain wrong to have site
screen scraping it's own output, the underlying data should be
retrieved from the datasource directly.

maybe you'd care to explain what it is your trying to achieve?



There is a setting within PHP that either allows or denies you the ability to access remote URLs like the one in your example.

You will need to make sure that in your php.ini configuration file that you have allow_url_fopen set to '1' and that it is not diabled.

Here is the page that references these settings:
http://us2.php.net/manual/en/ini.php#ini.list

It is the second one in the big list of things. I noticed that they also added a new one as of v5.2.0 It is for the allow_url_include You might need to do something with this also. Not sure.

But, I would start with making sure that the allow_url_fopen is set to '1'. If you need to change the value, make sure that you restart your web server so the settings will take effect.

Hope this helps.



--- End Message ---
--- Begin Message ---
I have been working on the something for the last day and can't figure it
out.

 

I am pulling 7500 rows from a MySQL database, but I only want to display a
certain numbers of rows based up an if statement.  I want to count the rows
within the if statement.

 

mysql query result

 

if(x < y){

display a row in a table

}else{

Don't display anything

}

 

Every time a row is displayed, I want to add one to a counter

 

markb


--- End Message ---
--- Begin Message ---
If it's a simple x < y, you might want to consider putting your if
statement in the SQL query so you don't return so many rows.  To make a
counter, just set a variable like:
$counter = 0;

if ($x <$y)
{
    print $row;
    $counter++
}

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Mark Bomgardner wrote:
> I have been working on the something for the last day and can't figure it
> out.
>
>  
>
> I am pulling 7500 rows from a MySQL database, but I only want to display a
> certain numbers of rows based up an if statement.  I want to count the rows
> within the if statement.
>
>  
>
> mysql query result
>
>  
>
> if(x < y){
>
> display a row in a table
>
> }else{
>
> Don't display anything
>
> }
>
>  
>
> Every time a row is displayed, I want to add one to a counter
>
>  
>
> markb
>
>
>   

--- End Message ---
--- Begin Message ---
I'm still trying to get this scenario worked out and don't seem to be able
to get it done.

Here's what I'm trying to do:
User logs into a login page and inputs email address and password.  User
accessess password protected page, which contains a few links.  User clicks
on one of the links, opens page, looks at content and then clicks back to
main page.

User is now asked to input password again.... what do I have to do to make
sure all related links/pages on the main.php page are accessible with that
same password the user input the first time?  Also.. how can I password
protect ALL the linked pages on the main.php site with the same password but
user only has to log in once!!

No database, but just sessions?  I looked at those and also Tedd was kind
enough to send something but for some reason I can't get it to go.

Can someone forward some good instructions on how to accomplish this task?
I would greatly appreciate it. Still learning this program as you can tell.

Best
Ref





--- End Message ---

Reply via email to