php-general Digest 18 Apr 2004 11:55:07 -0000 Issue 2712

Topics (messages 183746 through 183760):

Re: why doesn't this work ?
        183746 by: Daniel Clark
        183754 by: Pooya Eslami
        183756 by: Andy Ladouceur

Removing line breaks...
        183747 by: Russell P Jones
        183749 by: -{ Rene Brehmer }-
        183750 by: Daniel Clark

Bookmark server
        183748 by: Chris W
        183758 by: PHP Email List

Why are Session Variables carried over into a brand new browser window?
        183751 by: Bob Bruce - Programmer
        183752 by: Travis Low
        183755 by: Greg Donald
        183757 by: Torsten Roehr

Re: Array Problem
        183753 by: Tom Rogers
        183760 by: Don Read

addslashes vs. mysql_real_escape_string
        183759 by: Richard Davey

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 ---
Can you post the code and error.


>>I took out the scrip tags and put in <?php in the beginning and ?>  at the
>>end, but it returns this:
>>
>>$file
>>"; } } closedir($handle); } echo "
>>"; ?>

--- End Message ---
--- Begin Message ---
I put this in the body of an html file:

<?php
if ($handle = opendir('.')) {
   while (false !== ($file = readdir($handle))) {
       if ($file != "." && $file != ".." && eregi('\.html$', $file)) {
           echo "<li><a href=\"$file\"><font color=\"#CC0000\">$file</

font></a></li><br>";
       }
   }
   closedir($handle);
}

echo "</ul>";
?>

the output page contains :

$file
"; } } closedir($handle); } echo "
"; ?>

I don't understand why.

"Daniel Clark" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Can you post the code and error.
>
>
> >>I took out the scrip tags and put in <?php in the beginning and ?>  at
the
> >>end, but it returns this:
> >>
> >>$file
> >>"; } } closedir($handle); } echo "
> >>"; ?>

--- End Message ---
--- Begin Message --- It's already been mentioned, but you do need to ensure you are using a .php extension on the file. Also, forgive me if this has already been covered, but are you sure the server even supports PHP?

Try creating a new file with:
<?php
phpinfo();
?>

And save it as something.php, check and see if it returns a table full of information or not.

Andy

Pooya Eslami wrote:
I put this in the body of an html file:

<?php
if ($handle = opendir('.')) {
   while (false !== ($file = readdir($handle))) {
       if ($file != "." && $file != ".." && eregi('\.html$', $file)) {
           echo "<li><a href=\"$file\"><font color=\"#CC0000\">$file</

font></a></li><br>";
       }
   }
   closedir($handle);
}

echo "</ul>";
?>

the output page contains :

$file
"; } } closedir($handle); } echo "
"; ?>

I don't understand why.

"Daniel Clark" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]

Can you post the code and error.



I took out the scrip tags and put in <?php in the beginning and ?> at

the


end, but it returns this:

$file
"; } } closedir($handle); } echo "
"; ?>

--- End Message ---
--- Begin Message ---
How do i turn this...

[br]
  [b]My Title [/b]
[br]

into

[br][b]My Title[/b][br]


--- I just need to have line breaks removed basically...

any ideas?

Russ Jones

--- End Message ---
--- Begin Message --- str_replace("\n",'',$string);

don't think it'd be any faster with the regex ones...


Rene


At 01:18 18-04-2004, Russell P Jones wrote:
How do i turn this...

[br]
  [b]My Title [/b]
[br]

into

[br][b]My Title[/b][br]


--- I just need to have line breaks removed basically...


any ideas?

Russ Jones

-- Rene Brehmer aka Metalbunny

~ If you don't like what I have to say ... don't read it ~

http://metalbunny.net/
References, tools, and other useful stuff...
Check out the new Metalbunny forums @ http://forums.metalbunny.net/

--- End Message ---
--- Begin Message ---
str_replace( $line, '\n', '')

http://us2.php.net/manual/en/function.str-replace.php

>>How do i turn this...
>>
>>[br]
>>  [b]My Title [/b]
>>[br]
>>
>>into
>>
>>[br][b]My Title[/b][br]
>>
>>
>>--- I just need to have line breaks removed basically...
>>
>>any ideas?

--- End Message ---
--- Begin Message --- I am planning on writing a "bookmark server" in php. The idea is I will have a database that stores all my internet favorites on a web server some where, so if I am doing some web browsing away from home and find a site I want to save, I can go to my bookmark server and save the url there. Now for the part I can't figure out an easy way to do. I want to have it so if I am looking at a page I want to save I can type in a nice short url for my bookmark server and it will some how be able to know where I just came from and have the form fields for URL and description already filled in for me. Then I just have to tell it what category to save the bookmark in.
First I thought the _SERVER["HTTP_REFERER"] variable, but that only works if you click on a link and since every web page I want to save won't have a link to my bookmark server that won't work.
Then I thought I could use the history array with javascript, but that only works if your script is signed and I don't want to go there.


So now I am out of ideas and was wondering if anyone here had any.

Chris W
http://thewishzone.com:8086/

--- End Message ---
--- Begin Message ---
> I am planning on writing a "bookmark server" in php.  The idea is I will
> have a database that stores all my internet favorites on a web server
> some where, so if I am doing some web browsing away from home and find a
> site I want to save, I can go to my bookmark server and save the url
> there.  Now for the part I can't figure out an easy way to do.  I want
> to have it so if I am looking at a page I want to save I can type in a
> nice short url for my bookmark server and it will some how be able to
> know where I just came from and have the form fields for URL and
> description already filled in for me.  Then I just have to tell it what
> category to save the bookmark in.
> First I thought the _SERVER["HTTP_REFERER"] variable, but that only
> works if you click on a link and since every web page I want to save
> won't have a link to my bookmark server that won't work.
> Then I thought I could use the history array with javascript, but that
> only works if your script is signed and I don't want to go there.
>
> So now I am out of ideas and was wondering if anyone here had any.

Why not just copy the url from the address bar, then go to your site and use
that text box (form field) you were talkin about having and paste the url
then click "submit".

Then it's saved in your nice little url holder / bookmark warehouse!  :)

Then your not trying to do anything "fancy". Like you know, cook you
breakfast in the morning, or say pull every email you have out and read them
and toss the ones you don't want while systematically forecasting your stock
market results of your IRA from the night before.

Wolf
HTH  >:-P

--- End Message ---
--- Begin Message ---
This is my first posting to this group, so I am not familiar
with any special etiquette for it, please bear with me. . .

I maintain the PHP code for the website for the murals of Winnipeg and
have found a situation where I have a session open with the state of
the user's search results saved in the session and link to a location
with the following link:

<A target="blank"
href="http://www.themuralsofwinnipeg.com/Mpages/index.php?action=gotomural&m
uralid=179">

so this opens a new browser window, but it is inheriting the session values
from the browser window that called it and is causing problems in the new
window. When I open a new browser window shouldn't it start a whole new
session and not get anything from the previous browser.

Thanks in advance for your help,

        Bob Bruce,
        Winnipeg, Manitoba
        Canada

--- End Message ---
--- Begin Message --- Sorry, the new window is part of the same session. You'll have to find some other way to distinguish between the two windows.

cheers,

Travis

Bob Bruce - Programmer wrote:
This is my first posting to this group, so I am not familiar
with any special etiquette for it, please bear with me. . .

I maintain the PHP code for the website for the murals of Winnipeg and
have found a situation where I have a session open with the state of
the user's search results saved in the session and link to a location
with the following link:

<A target="blank"
href="http://www.themuralsofwinnipeg.com/Mpages/index.php?action=gotomural&m
uralid=179">

so this opens a new browser window, but it is inheriting the session values
from the browser window that called it and is causing problems in the new
window. When I open a new browser window shouldn't it start a whole new
session and not get anything from the previous browser.

Thanks in advance for your help,

        Bob Bruce,
        Winnipeg, Manitoba
        Canada


-- Travis Low <mailto:[EMAIL PROTECTED]> <http://www.dawnstar.com>

--- End Message ---
--- Begin Message ---
> so this opens a new browser window, but it is inheriting the session
values
> from the browser window that called it and is causing problems in the new
> window. When I open a new browser window shouldn't it start a whole new
> session and not get anything from the previous browser.


A buddy of mine created a secure sessions tutorial that protects against
this exact issue.  He has a fantasy stocks site and needed to protect
against session hijacking.

http://tutorials.dotgeek.org/tutorial.php?action=view&id=58


--
Greg Donald
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
"Bob Bruce - Programmer" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> This is my first posting to this group, so I am not familiar
> with any special etiquette for it, please bear with me. . .
>
> I maintain the PHP code for the website for the murals of Winnipeg and
> have found a situation where I have a session open with the state of
> the user's search results saved in the session and link to a location
> with the following link:
>
> <A target="blank"
>
href="http://www.themuralsofwinnipeg.com/Mpages/index.php?action=gotomural&m
> uralid=179">
>
> so this opens a new browser window, but it is inheriting the session
values
> from the browser window that called it and is causing problems in the new
> window. When I open a new browser window shouldn't it start a whole new
> session and not get anything from the previous browser.

You can solve this problem by not working with cookies and instead
forwarding the sessionID with the URL:

<A target="blank"
href="http://www.themuralsofwinnipeg.com/Mpages/index.php?<?= SID;
?>&action=gotomural&muralid=179">

So if you open a new page WITHOUT forwarding the sessionID a new session
will be started.

See the part named "Passing the Session ID" on the following manual page to
see how to do it:
http://de2.php.net/session

Regards,

Torsten Roehr

>
> Thanks in advance for your help,
>
> Bob Bruce,
> Winnipeg, Manitoba
> Canada

--- End Message ---
--- Begin Message ---
Hi,

Saturday, April 17, 2004, 7:00:49 AM, you wrote:
FF> Hi

FF> I have i Problem i got a variable a=2351 now i need to create an array out of this 
variable
FF> a[0]=1
FF> a[1]=3
FF> a[2]=5
FF> a[3]=1

FF> I have an idea to use the modulo function an do some Math but
FF> im sure there is a nicer way of solving my prob

FF> thx Flavio


If you treat the variable as a string it is already an array of
characters

try echo $a{0};

-- 
regards,
Tom

--- End Message ---
--- Begin Message ---
On 16-Apr-2004 Flavio Fontana wrote:
> Hi
> 
> I have i Problem i got a variable a=2351 now i need to create an
> array out of this variable 
> a[0]=1
> a[1]=3
> a[2]=5
> a[3]=1
> 
> I have an idea to use the modulo function an do some Math but im sure
> there is a nicer way of solving my prob
> 

$a = preg_split('||', $a, -1, PREG_SPLIT_NO_EMPTY);

Regards,
-- 
Don Read                                     [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.

--- End Message ---
--- Begin Message ---
Hi,

I just finished reading Chris Shiflett's article in this months php|a
about SQL injection and have a question I can't seem to find answered
anywhere:

Does mysql_real_escape_string (or mysql_escape_string) do anything
extra that addslashes() doesn't? In the examples in the manual it is
just used to escape the ' character, but that is exactly what
addslashes() will do anyway.

Is mysql_real_escape_string tolerant of magic quotes? i.e. will you
end up with double-quoted strings like: "it\\'s a lovely day" if you
call it too many times?

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

--- End Message ---

Reply via email to