Re: [PHP] PAGE TURNED BECOME SOURCE CODE VIEW..

2006-07-14 Thread Kim Christensen

On 7/9/06, BBC <[EMAIL PROTECTED]> wrote:

I don't know why every time the script run the syntax which uses GD, the page 
turned
becomes source code view. So when we need that page in normal view, we had
to push the 'back button' twice.


I guess we would need to see some code samples to get things going,
preferrably the GD part which seems to be the issue :-)

Best regards
--
Kim Christensen

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



Re: [PHP] regular expression to extract from the middle of a string

2006-07-14 Thread Kim Christensen

On 7/14/06, Steve Turnbull <[EMAIL PROTECTED]> wrote:

I have a string similar to the following;

cn=emailadmin,ou=services,dc=domain,dc=net

I want to extract whatever falls between the 'cn=' and the following
comma - in this case 'emailadmin'.



$pattern= "/[^=]+=([^,]+)/";
preg_match($pattern, $string, $matches);
print_r($matches);

Voila! (Untested for now, I'm pretty drunk so sorry if it ain't workin
out like you want to)

--
Kim Christensen

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



Re: [PHP] regular expressions or something else?

2006-04-12 Thread Kim Christensen
On 4/12/06, Chris Westbrook <[EMAIL PROTECTED]> wrote:
> I have a problem.  I'm trying to get a Google search results page via snoopy
> and then display the links of the results it returns in an application.  I
> know about the fetchlinks function in snoopy, but I'm having trouble getting
> the text between the  and  tags.  Yeah, I know, I should use the
> Google API, but my client doesn't want me doing that, probably because they
> might have to pay for that.  any suggestions?

Try this, and read up on regular expressions - it's an essential
knowledge if you're a programmer.

$text = "this is where the contents of your search result page goes";
preg_match_all('|]*href="([^"]+)"[^>]*>([^<]+)<\/a>|U', $text,
$links, PREG_SET_ORDER);
print_r($links);

--
Kim Christensen
[EMAIL PROTECTED]

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



[PHP] Recursive array_push?

2006-01-26 Thread Kim Christensen
Has anyone out there stumbled over the issue of making
multi-dimensional arrays out of bracket-separated strings? In a less
fuzzy way of putting it:

$str = "[layer1][layer2][layer3][layer4]"

would become

$str_array = Array( [layer1] => Array( [layer2] => Array( [layer3] =>
Array( [layer4] ) ) ) );

...or something similar. Passing values is not an issue at the moment,
it's just the recursive thinking that keeps bugging me right now, and
my temporary solution to this matter is not even mentionable!

I would really like PHP to have a function of building expressions
with strings, and then execute them through a function - but that's
just me it seems :-)

--
Kim Christensen
[EMAIL PROTECTED]

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



Re: [PHP] REGEX query

2006-02-08 Thread Kim Christensen
> > I have this bit of text:
> > (\(EX\) RV-6 )
> >
> > I want to remove the '\(EX\)' part of it
> > so leaving just: ( RV-6 )

$text = '(\(EX\) RV-6 )';
$str = str_replace('\(EX\)','',$text);

As Burhan put it, regex is not always the solution to your problem -
in most cases, using regex for this kind of operations will just hog
your scripts.

--
Kim Christensen
[EMAIL PROTECTED]

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



Re: [PHP] REGEX query

2006-02-08 Thread Kim Christensen
Alexis,

> Unfortunately, for what I'm trying to do, it is of little use. I
> probably should have mentioned that the bit of text I used is actually
> just part of a much bigger bit of text so exploding on a space would
> cause havoc with the rest of it. Hence the REGEX question.

$text = '(\(EX\) RV-6 )';
preg_match_all("/\([^\)]+\) ([^\)]+) \)/", $text, $result);
    echo $result[1][0];

Take care
--
Kim Christensen
[EMAIL PROTECTED]

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



Re: [PHP] XML parsing

2006-02-09 Thread Kim Christensen
On 2/9/06, Peter Lauri <[EMAIL PROTECTED]> wrote:
> Or maybe an function that create an array from the XML:
> $arr = xml_to_array($xml);
> Any one who can give a really SIMPLE example of this?

http://php.net/xml

Have you checked the user comments?

--
Kim Christensen
[EMAIL PROTECTED]

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



Re: [PHP] XML parsing

2006-02-09 Thread Kim Christensen
On 2/9/06, Peter Lauri <[EMAIL PROTECTED]> wrote:
> And the opposite way, creating XML, must be even easier. Any function that 
> take an array as input, and returns XML? If not, I just need to create a 
> recursive function that loops thru the array. If there is a standard function 
> I would be very happy.

Once again, check those user comments. There's some excellent examples
there, for two-way parsing XML files!

--
Kim Christensen
[EMAIL PROTECTED]

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



Re: [PHP] What's a Blog?

2006-02-14 Thread Kim Christensen
On 2/14/06, Duncan Hill <[EMAIL PROTECTED]> wrote:
> WordPress is free, has a neat WYSIWYG editor in version 2, and has a good
> support community.  5 minutes to install vs an hour to code a basic interface
> - I'd take the 5 minutes :p

That being said, get lost from the PHP user list! :-)

--
Kim Christensen
[EMAIL PROTECTED]

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



Re: [PHP] Finding out DPI using GD

2006-02-14 Thread Kim Christensen
On 2/15/06, Karuna <[EMAIL PROTECTED]> wrote:
> Thanks. I might give the new versions a try :)
>
> IIRC, I think the unix exif function returns dpi as well but I'm working on
> a windows machine without cygwin, so can't be certain.

You might want to check this package:
http://www.ozhiker.com/electronics/pjmt/index.html

--
Kim Christensen
[EMAIL PROTECTED]

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



Re: [PHP] HN CAPTCHA at http://www.phpclasses.org

2006-02-15 Thread Kim Christensen
On 2/16/06, Roger Thomas <[EMAIL PROTECTED]> wrote:
> I am currently testing HN CAPTCHA and noticed that the range of alphabets 
> that were produced ranges from A..F only. My PHP skill is quite limited to 
> change that to A..Z so if ppl here have any experience with that class, 
> appreciate your thoughts. TIA.

The reason this CAPTCHA class only returns letters between A-F is
because it uses the md5() function in php to get a (more or less)
random string. MD5 hashes contains of a 32-character hexadecimal
numbers, which in turn ranges from 0 to F.

To solve your problem, replace the generate_private() function in
hn_captcha.class.php - starting at row 756 - with this code:

   function generate_private($public="")
   {
  $letters = "1234567890abcdefghijklmnopqrstuvwxyz";
  $maxsize = strlen($letters)-1;
  for($i=0;$i<6;$i++){
$rstring .= $letters{mt_rand(0, $maxsize)};
  }
  return $rstring;
   }

This should yield a 6 char "random" string containing digits 0-9 and
letters a-z.

Good luck!

--
Kim Christensen
[EMAIL PROTECTED]

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



Re: [PHP] installing php 4.4.2 on windows system

2006-02-16 Thread Kim Christensen
On 2/16/06, Olaf Greve <[EMAIL PROTECTED]> wrote:
> Under Windows it didn't use to be necessary to make Apache explicitly
> point to the ini file (at least: for all Apache 1.3.x versions). Rather,
> the trick used to be to simply place the php.ini file somewhere in the
> path that has been set for all Windows applications.

It still ain'¨t necessary, but preferred. Either way works :-)

--
Kim Christensen
[EMAIL PROTECTED]

--
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 Kim Christensen
On 2/16/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> $filename =3D "c:data.txt";
> $contents =3D file($filename);
> echo $contents;
> ?>
> // data in text file is "1_2_3_4" < _ =3D blank>
> // output is "1 2 3 4"
> // I want fixed possition . please help me ?

I'm not really sure what you're trying to do, but I assume you want to
keep the four(?) spaces when you output the data. If you're going to
display it using HTML, you have to replace the spaces with   -
otherwise HTML truncates the excess whitespace. Try using REGEX:

$contents =3D file($filename);
echo preg_replace("/\s/", " ", $contents);

This regular expression will replace all whitespace
(spaces/newlines/carriage returns) with the character  , which in
HTML yields a blank space.

--
Kim Christensen
[EMAIL PROTECTED]

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



Re: [PHP] CSS Groups?

2006-02-16 Thread Kim Christensen
On 2/16/06, William Stokes <[EMAIL PROTECTED]> wrote:
> Anybody know any good CSS groups? I don't want to post here non PHP related
> stuff

http://www.css-discuss.org/

--
Kim Christensen
[EMAIL PROTECTED]

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



Re: [PHP] Clear POST variables

2006-02-16 Thread Kim Christensen
On 2/16/06, Mike Tuller <[EMAIL PROTECTED]> wrote:
> How do I clear out the POST variables, or the variables that I have
> set from the POST variables, so that when the page is refreshed it
> will not resubmit.  I have tried unset() and have tried to set it to and
> empty value, but it doesn't seem to work.

When needed, I usually loop through the entire $_POST array and
concatenate all the values to one (long?) string - then I take an MD5
hash of this string together with the form name and put in the
$_SESSION array. Now each time one of my scripts with a form action
loads, I include a script in the top which checks the MD5 hash of the
current $_REQUEST array with the one in the $_SESSION array using the
same name, if it exists - unset($_REQUEST) before the form is normally
parsed and action is taken.

(This idea of a script came from one of my co-workers)

--
Kim Christensen
[EMAIL PROTECTED]

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



Re: [PHP] menu Q

2006-02-16 Thread Kim Christensen
On 2/17/06, William Stokes <[EMAIL PROTECTED]> wrote:
> I have a  menu on a header bar on my page. The header bar is 20px
> high. The menu, code and style below, works ok on Opera but not in Ie6 or
> Firefox. In these browsers the menu 'streches' the bar height so that the bg
> image starts repeating itself. (looks nasty) It's almost like the menu
> prints one 'invisble' or empty row beneath the menu so that the header bar
> becomes about 30 or 35px high. Any ideas?

Try using defining the style as a class instead of ID, since ID makes
every child element inside the parent inheriting the style - seems
that different browsers handle this differently, but my guess is that
this is the case. So, remove the # in the style sheet and call upon
the style by using class="menu" instead of id="menu".

> This might not be a PHP related issue. I don't know. But this one is really
> bothering me.

http://www.css-discuss.org/ :-)

--
Kim Christensen
[EMAIL PROTECTED]

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



Re: [PHP] attaching MySQL 5.0.18 to PHP 4.4.2

2006-02-16 Thread Kim Christensen
On 2/17/06, Paul Goepfert <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I know the subject doesn't seem too clear so here is what I am talking
> aboukt.  I recently installed php on my windows machine.  The PHP
> compiler works great.  However upon looking through the phpinfo ()
> document I noticed that the MySQL client version was 3.23.49.  I
> assume that is the built in version of MySQL.  I also have installed
> MySQL 5.0.18 on my system.  I have my database in the 5.0.18 version
> of MySQL .  How do I asssociate the MySQL 5.0.18 version with php?

http://php.net/manual/en/ref.mysqli.php

This isn't really the answer to your question per se, but will
probably solve things along the way.

--
Kim Christensen
[EMAIL PROTECTED]

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



Re: [PHP] attaching MySQL 5.0.18 to PHP 4.4.2

2006-02-18 Thread Kim Christensen
On 2/17/06, Paul Goepfert <[EMAIL PROTECTED]> wrote:
> I forgot to mention that that php and mysql are installed on a windows
>  machine which means I didn't have to run the configure script that
> would associate mysql with php.  How do I do this on a windows
> machine?

Open up php.ini, check that you have extension_dir set to the
directory where all your PHP extensions reside (typically C:\php\ext
on PHP5, and C:\php\extensions on PHP4). If the path is OK, then
scroll to section where all the extensions are to be loaded and
uncomment the line with "php_mysql.dll" in it. Restart your web server
and you should be set to go - check phpinfo() afterwards to see if it
loads ok.

--
Kim Christensen
[EMAIL PROTECTED]

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



Re: [PHP] Clear POST variables

2006-02-18 Thread Kim Christensen
On 2/18/06, John Wells <[EMAIL PROTECTED]> wrote:
> That said, the unique token method is very interesting, I'll
> definitely check it out.  But I'm curious, if you check for an
> existing token and do find one (so the user has possibly refreshed the
> browser), don't you have to program a particular way to handle it? And
> might that handling method be different for each type of action being
> taken? Does this run the risk of overcomplicating the code as well?

In my particular case I normally just unset the $_REQUEST array, which
in turn makes my form handling code not run (i always check for
existing form values before processing them, but who doesn't...) and,
depending on where on the site everything takes place, redirect them
to a proper place.

--
Kim Christensen
[EMAIL PROTECTED]

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



Re: [PHP] Recursive permissions

2006-02-18 Thread Kim Christensen
On 2/18/06, tedd <[EMAIL PROTECTED]> wrote:
> Hi gang:
>
> Question: I know you can set a directory to have certain permissions,
> but how do you set the permissions to be recursive? In other words,
> for example, if you set the directory to be 755, then everything
> placed within that directory will also be 755.

http://php.net/manual/en/function.umask.php

--
Kim Christensen
[EMAIL PROTECTED]

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




Re: [PHP] Recursive permissions

2006-02-19 Thread Kim Christensen
On 2/19/06, tedd <[EMAIL PROTECTED]> wrote:
> Perhaps this is something limited to GoLive and not an option in
> setting chmod's via php's built-in functions.

This is clearly depending on the host OS/ftp daemon and what
permission is set on the upload folder. What GoLive! probably does
with that checkbox is setting permissions through chmod on the ftp
"automagically" after each file has been uploaded.

Do you have shell access to the particular host?

--
Kim Christensen
[EMAIL PROTECTED]

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



Re: [PHP] PHP/LDAP Authentication

2006-02-19 Thread Kim Christensen
On 2/19/06, Golden Butler <[EMAIL PROTECTED]> wrote:
> I'm currently running OpenLDAP with some users populated in the
> database.  I would like to use PHP to create a web page where my ldap
> users can enter their username and password credentials to log into our
> intranet.  Can someone point me to some expample scripts, articles, or
> sites.  Thanks.

http://php.net/ldap

As always, read the docs and check the user comments. You won't need
any more examples :-)

--
Kim Christensen
[EMAIL PROTECTED]

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



Re: [PHP] Re: need a php multiple/mysql choice quiz

2006-02-20 Thread Kim Christensen
On 2/20/06, Dan Parry <[EMAIL PROTECTED]> wrote:
> >> what kind of mushrooms?
> >>
> >rainbow colored ones =)
>
> Think they're illegal in the UK...

Then move out of there quicker than fast, they're too tasty to miss!

--
Kim Christensen
[EMAIL PROTECTED]

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



Re: [PHP] php+ ajax

2006-02-20 Thread Kim Christensen
On 2/20/06, blackwater dev <[EMAIL PROTECTED]> wrote:
> The problem is js seems to get confused trying to look this up by id
> and I don't think I can use an array like this with a GET, how can I
> use arrays for all this??

You have to escape the brackets with backslashes, so that the JS
really interprets it as an element ID - not an array. Something like
this might work:

[snip]
(HTML)


(JS)
var min_price= document.getElementById('search\[min_price\]').value  ;
[/snip]

--
Kim Christensen
[EMAIL PROTECTED]

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



Re: [PHP] php+ ajax

2006-02-21 Thread Kim Christensen
On 2/20/06, David Dorward <[EMAIL PROTECTED]> wrote:
> Element ids may not contain square brackets in HTML documents.

Get your facts straight, David. Square brackets works fine in HTML
documents as long as you escape the ID when you need to reference them
by JS.

--
Kim Christensen
[EMAIL PROTECTED]

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



Re: [PHP] HOSTNAME Environment variable

2006-02-21 Thread Kim Christensen
On 2/21/06, Ruben Rubio Rey <[EMAIL PROTECTED]> wrote:
> How to set "Hostname" environment variable? (It contains the servers
> name, not the servers domain)
> Its a Linux server.

Try the "hostname" command. Depending on your linux distro, you might
want to edit /etc/hostname manually afterwards to double-check.

--
Kim Christensen
[EMAIL PROTECTED]

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



[PHP] Re: JPG Compression [detached thread]

2006-02-21 Thread Kim Christensen
Julian, remember to send a new message when posting a thread for the
first time, instead of replying to an old one. I'm sure it was a
mistake, but most people won't bother to answer these kind of posts.

On 2/20/06, julian haffegee <[EMAIL PROTECTED]> wrote:
> Is there a php function that lets you compress the jpg?

http://php.net/manual/en/function.imagejpeg.php

--
Kim Christensen
[EMAIL PROTECTED]

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



Re: [PHP] HOSTNAME Environment variable

2006-02-21 Thread Kim Christensen
On 2/21/06, Ruben Rubio Rey <[EMAIL PROTECTED]> wrote:
> Strange. Its already set (in hostname and "echo $HOSTNAME"). I have
> realized that is working on version (in my servers) 5.0.5 and its not
> working in 5.0.4 version. Is it an old bug? Im updating, we ll see 

Have you rebooted your machine since you changed the hostname? I don't
know where PHP/Apache gets the hostname variable from - there are
quite a few places where that variable is stored on a linux system -
but most services reads the /etc/hostname file upon boot, therefor the
need for a restart after changing it.

You might want to check the contents of /proc/sys/kernel/hostname, and
even changing it by issuing:

echo your_hostname > /proc/sys/kernel/hostname

If it still doesn't work, reboot to be sure.

--
Kim Christensen
[EMAIL PROTECTED]

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



Re: [PHP] php+ ajax

2006-02-21 Thread Kim Christensen
On 2/21/06, Jochem Maas <[EMAIL PROTECTED]> wrote:
> Kim do the escaped sqaure brackets work in all majors browsers as
> far as you know?

"Major browsers" as in Firefox and IE for PC/Mac works great, yes -
haven't had the chance to try Opera or Konqueror yet, maybe someone
could shed a light on this?

Sorry for being rude, David - had a bad morning!

--
Kim Christensen
[EMAIL PROTECTED]

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