Re: [PHP] Get the shortened browser / HTTP_USER_AGENT

2007-01-20 Thread Sergiu Voicu

You have several options:
1. using regular expressions


2. using arrays


3. using substrings


Sergiu

Wikus Moller wrote:

Hi.

I want to strip everything after a / in the HTTP_USER_AGENT for
example: Opera 9.10/blah/blah would become only Opera 9.10

Lets say
$user = $_SERVER["HTTP_USER_AGENT"];
$browser = ("/", $user);

Is this correct?
Isn't something needed in the browser variable?

Thanks
Wikus



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



Re: [PHP] non-blocking request to a url (via curl or file_get_contents or whatever)...

2007-01-20 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-20 00:33:10 +0100:
> I have a tradedoubler webbug to implement in site

Pardon my ignorance, what's "a tradedoubler webbug"?

> I have an order processing page that is requested *directly* by an online 
> payment service
> in order to tell the site/system that a given order has successfully 
> completely,
> this occurs prior to the online payment service redirecting the user back to 
> my site...
> 
> at the end of the order processing the order (basically the order is marked 
> as completed)
> is removed from the session in such a way that there is no longer anyway to 
> know details
> about the order, so by the time the user comes back to the site I don't have 
> the required
> info to create the required webbug url...

Wou should still have the order id, or how do they tell you *which*
order was it? What data do you need? I'm having trouble understanding
your email at all. Could you try again, using shorter sentences? :)
 
-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



Re: [PHP] Need tool to graphically show all includes/requires

2007-01-20 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-19 16:52:49 -0800:
> We have a fairly complex product that is all PHP based GUI.
> 
> We're in need of some kind of "graphical tool" (web, stand alone, windows,
> linux, osx whatever) that will take a directory tree, recursively traverse
> all the files, look for 'includes' and 'requires' (and the _once versions
> too) and then map them out so we can see what files are calling what and
> where.

That's impossible to tell exactly without running the software you're
studying. What would you map this to?

function include_($file) { include $file; }

Or this?

define('FOO_INLCUDE_DIR', '/some/path');
include FOO_INLCUDE_DIR . '/file.php';

The recursive part is easy:

find $topsrcdir -name \*.php -print0 | xargs -0n1 processing-script-for-one-file

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



[PHP] Re: Need tool to graphically show all includes/requires

2007-01-20 Thread Colin Guthrie
Daevid Vincent wrote:
> We have a fairly complex product that is all PHP based GUI.
> 
> We're in need of some kind of "graphical tool" (web, stand alone, windows,
> linux, osx whatever) that will take a directory tree, recursively traverse
> all the files, look for 'includes' and 'requires' (and the _once versions
> too) and then map them out so we can see what files are calling what and
> where.
> 
> Anyone suggest something?
> 

My colleague wrote a script that used dot to generate such a pattern but
this is more or less useless for us now that we use the autoloading
features of PHP5...

If I can fid the script I'll post it, but not sure where it went.

Also if you use variables in the include/require, then it will fail most
horribly.

Col.

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



RE: [PHP] email validation string.

2007-01-20 Thread tedd

At 5:54 PM +0200 1/19/07, WeberSites LTD wrote:

Top Ajax :
I meant that at the top of WeberDev.com there is an Ajax search box that you
can use
to search for "email validation" and see many related code examples to
choose from.

berber


berber:

Your original post was clear enough for me to understand. Probably 
something else going on.


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

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



Re: [PHP] email validation string.

2007-01-20 Thread tedd

On Thu, Jan 18, 2007 at 01:40:36PM -0700, Don wrote:

 I'm trying to get this line to validate an email address from a form and it
 isn't working.

 if (ereg("[EMAIL PROTECTED]",$submittedEmail))




 The book I'm referencing has this line

 if (ereg("[EMAIL PROTECTED]",$submittedEmail))

 Anyway.. I welcome any advice as long as it doesn't morph into a political
 debate on ADA standards and poverty in Africa. :-)

 Thanks

 Don



Don:

I picked this up in my travels.

function validate_email($email)
{

   // Create the syntactical validation regular expression
   $regexp = 
"^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$";


   // Presume that the email is invalid
   $valid = 0;

   // Validate the syntax
   if (eregi($regexp, $email))
   {
  list($username,$domaintld) = split("@",$email);
  // Validate the domain
  if (getmxrr($domaintld,$mxrecords))
 $valid = 1;
   } else {
  $valid = 0;
   }

   return $valid;

}

$email = "[EMAIL PROTECTED]";

if (validate_email($email))
   echo "Email is valid!";
else
   echo "Email is invalid!";

hth's

tedd


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

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



Re: [PHP] Re: Need tool to graphically show all includes/requires

2007-01-20 Thread Andre Dubuc
On Saturday 20 January 2007 07:35 am, Colin Guthrie wrote:
> Daevid Vincent wrote:
> > We have a fairly complex product that is all PHP based GUI.
> > 
> > We're in need of some kind of "graphical tool" (web, stand alone, windows,
> > linux, osx whatever) that will take a directory tree, recursively traverse
> > all the files, look for 'includes' and 'requires' (and the _once versions
> > too) and then map them out so we can see what files are calling what and
> > where.
> > 
> > Anyone suggest something?
> > 
> 
> My colleague wrote a script that used dot to generate such a pattern but
> this is more or less useless for us now that we use the autoloading
> features of PHP5...
> 
> If I can fid the script I'll post it, but not sure where it went.
> 
> Also if you use variables in the include/require, then it will fail most
> horribly.
> 
> Col.
> 

Just a thought following on Colin's idea. YIf you can't find anything to do the 
job, you should be able to modify 'staviz' that uses dot to graphically 
show log files - clickthroughs to various pages. The code should at least give 
you the structure you could fool around with.

Hth,
Andre

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



Re: [PHP] email validation string.

2007-01-20 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-20 08:53:32 -0500:
> I picked this up in my travels.
> 
> function validate_email($email)
> {
> 
>// Create the syntactical validation regular expression
>$regexp = 
> "^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$";

One of my email addresses is
[EMAIL PROTECTED]

Also, "[" ip-address "]" is a valid right hand side of an email address,
e. g.:

[EMAIL PROTECTED]

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



[PHP] os php scheduler?

2007-01-20 Thread blackwater dev

Does anyone have recommendations for an open source php based,
'lightweight', scheduling app?  I just want something clean that I can use
to schedule trainings within our company.  I need to be able to put in
details for each training and then see a synopsis on a calender.  Just a
basic scheduler but clean and useful.

Thanks!


Re: [PHP] email validation string.

2007-01-20 Thread tedd

At 3:04 PM + 1/20/07, Roman Neuhauser wrote:

# [EMAIL PROTECTED] / 2007-01-20 08:53:32 -0500:

 I picked this up in my travels.

 function validate_email($email)
 {

// Create the syntactical validation regular expression
$regexp =
 "^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$";


One of my email addresses is
[EMAIL PROTECTED]



Thanks, I'll add that to my kill list.

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

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



[PHP] Request for...

2007-01-20 Thread Wikus Moller

Hi.

Since this is a mailing list for web developers, I thought I might as
well post an o f f  t o p i c request.
Does anyone know of any website where I can get a exe or jar sitemap
generating software? Particularly not GsiteCrawler as it uses too much
system resources. A java applet would be nice. And, if possible, free
of charge ^.^

And does anyone know how and if a j a v a applet can be extracted from
a webpage?(also a class)

Thanks
Wikus

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



Re: [PHP] email validation string.

2007-01-20 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-20 09:22:00 -0500:
> At 3:04 PM + 1/20/07, Roman Neuhauser wrote:
> >One of my email addresses is
> >[EMAIL PROTECTED]
> 
> Thanks, I'll add that to my kill list.

Vietnam vet... Old habits don't go away easily huh?

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



Re: [PHP] Going back with multiple submits to the same page

2007-01-20 Thread tedd

At 8:43 PM +0100 1/18/07, Otto Wyss wrote:

Paul Novitski wrote:

At 1/15/2007 01:52 PM, Otto Wyss wrote:
When values are entered on one of my page I submit the result back 
to the same page (form action=same_page). Unfortunately each submit

adds an entry into the history, so history back doesn't work in a
single step. Yet if the count of submits were known I could use
goto(n). What's the best way to get this count? PHP or Javascript?



What you're suggesting doesn't sound easy.


I know, but what's a better way to to go back?



Apparently you didn't get/read my post -- try:

location.replace('');

The location object has two methods: a) reload; b) replace. This is 
where the back button get's it's value. Replace that value and I 
think you'll find a solution, or at least that's where I would look.


As for how to keep your entries "sticky", then I would look to sessions.

tedd

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

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



Re: [PHP] email validation string.

2007-01-20 Thread tedd

At 3:47 PM + 1/20/07, Roman Neuhauser wrote:

# [EMAIL PROTECTED] / 2007-01-20 09:22:00 -0500:

 At 3:04 PM + 1/20/07, Roman Neuhauser wrote:
 >One of my email addresses is
 >[EMAIL PROTECTED]

 Thanks, I'll add that to my kill list.


Vietnam vet... Old habits don't go away easily huh?


I didn't think of it that way, but that's a thought. Let's hope that 
you never run into a Vietnam vet who thinks that way (they do exist). 
As for me, I figure that you've never had any adversity to confront, 
so you just don't know any better -- however, I'm sure life 
experience and maturity will help you understand. Good luck with that.


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

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



Re: [PHP] Security Question

2007-01-20 Thread Al
Here is part of my proxie tags to html tags translation array. Looks pretty safe 
to me. There is other code to recognize paragraphs and lists, etc.


$translate_array= array(
''  => ''=> '',
'' => '" target="_blank">',
""   => '  => "\">",
''=> '',
'' => "'=> '">',
'' => "\n",
'' => "\n",
''=> "",
''   => "\n",
'' => '',
''   => '',
''		=> "href=\"$request_url\">Return to previous page\n",

 );

Jochem Maas wrote:

Al wrote:

Good point about the ' evil haxor code here; '.  That's
bad for our users, not the site, per se.


what is bad for your users is bad for your site, on top of that
the script is running in the context of your domain - all sorts of
nasty possibilities that could affect your site.


Raw text to html is primarily done with a series of preg_replace()
operations.


what/how [exactly] the transformation is done determines
whether your safe.


No include() or exec() allowed near the text.

Sounds like I'm in pretty good shape.


maybe, maybe not - see above.

(do you practice any sports? ;-P)

...


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



RE: [PHP] Script to generate a site thumbnails

2007-01-20 Thread tedd

At 10:58 AM +0200 1/19/07, WeberSites LTD wrote:

If you can get the image to your server, try using one of these examples :

http://www.weberdev.com/AdvancedSearch.php?searchtype=title&search=thumb

berber

-Original Message-
From: Pablo L. de Miranda [mailto:[EMAIL PROTECTED]
Sent: Thursday, January 18, 2007 12:56 AM
To: php-general@lists.php.net
Subject: [PHP] Script to generate a site thumbnails

Hi People,

I'm needing a script that generate a site thumbnail from a given URL.
Anybody can help me?


berber:

I think the poster's request was how do you get the browser's image 
of a URL and then make a thumbnail from it.


The problem of course being, which browser?

There are SE's (ask.com for example) that include an tool-tip 
thumbnail image of the url. I've often wondered how they did that.


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

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



Re: [PHP] non-blocking request to a url (via curl or file_get_contents or whatever)...

2007-01-20 Thread Jochem Maas
Roman Neuhauser wrote:
> # [EMAIL PROTECTED] / 2007-01-20 00:33:10 +0100:
>> I have a tradedoubler webbug to implement in site
> 
> Pardon my ignorance, what's "a tradedoubler webbug"?

http://www.tradedoubler.com/pan/public should explain;
a webbug is merely an  tag with a src pointing to some
kind of tracking script.


> 
>> I have an order processing page that is requested *directly* by an online 
>> payment service
>> in order to tell the site/system that a given order has successfully 
>> completely,
>> this occurs prior to the online payment service redirecting the user back to 
>> my site...
>>
>> at the end of the order processing the order (basically the order is marked 
>> as completed)
>> is removed from the session in such a way that there is no longer anyway to 
>> know details
>> about the order, so by the time the user comes back to the site I don't have 
>> the required
>> info to create the required webbug url...
> 
> Wou should still have the order id, or how do they tell you *which*
> order was it? What data do you need? I'm having trouble understanding
> your email at all. Could you try again, using shorter sentences? :)

I think that probably the whole story is a bit superfluous, essentially the 
question is
simply: how do I make a non-blocking http request and let the script continue 
immediately
without ever caring about what response/content is returned by the http request.

nonetheless here is 'flow' of what I was describing.

1. user stuffs things into shopping basket on [my] site (data stored in session)
2. user goes to check out.
3. user chooses online payment.
4. user is redirected to online payment provider site
5. user completes payment successfully
6. online payment provider site contacts [my] site/server directly with 
transaction status/details
7. user is shown 'thank you' page on online payment provider site
8. user is redirected back to [my] site and shown 'real' 'thank you' page.

step 6 does not involve the user or the browser *at all* it's a direct server 
to server
communication. the request the online payment provider makes to my server 
causes the
order to be completed, saved to a database and the relevant data to be removed 
from
the users session. (completed orders 'disappear' from the website - this was a 
'security'
requirement of the client).

normally in step 8 the webbug would be placed on the 'thank you' page, but in 
this case
the data needed to craft the webbug's url is no longer available - the solution 
is
to perform the request the the webbug's url represents directly from my server 
during the
code that runs as a result of the request made by the online payment provider 
in step 6.

this is easy if I merely do this:

file_get_contents($webbugURL);

BUT this means the http request this entails would block further processing
of my script until the request returns it's content, what I would like to do is
make the request without waiting for *any* kind of communication from the server
reference in the $webbugURL.

does this make sense?


>  

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



Re: [PHP] Request for...

2007-01-20 Thread Jochem Maas
Wikus Moller wrote:
> Hi.
> 
> Since this is a mailing list for web developers, I thought I might as
> well post an o f f  t o p i c request.
> Does anyone know of any website where I can get a exe or jar sitemap
> generating software? 

php.

> Particularly not GsiteCrawler as it uses too much
> system resources. A java applet would be nice. And, if possible, free
> of charge ^.^
> 
> And does anyone know how and if a j a v a applet can be extracted from
> a webpage?(also a class)

yes is can. scrap the relevant page, find the relevant url and
make a request for that resource. bingo~

> 
> Thanks
> Wikus
> 

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



Re: [PHP] Request for...

2007-01-20 Thread Stut

Wikus Moller wrote:

Since this is a mailing list for web developers, I thought I might as
well post an o f f  t o p i c request.
Does anyone know of any website where I can get a exe or jar sitemap
generating software? Particularly not GsiteCrawler as it uses too much
system resources. A java applet would be nice. And, if possible, free
of charge ^.^

And does anyone know how and if a j a v a applet can be extracted from
a webpage?(also a class)


1) You state that you know it's off-topic.
2) For some reason you felt the need to make excessive use of spaces 
(while offtopic and java are considered dirty words in some places, 
they're not here, and even then you didn't "obfuscate" all instances).
3) This is not a mailing list for web developers, it's a mailing list 
for PHP developers. The fact that most PHP development happens in a web 
context does not make it exclusively for web development.

4) You would prefer a java applet yet you ask on a PHP mailing list.

My question... just how dumb are you?

Sorry, didn't mean that. I meant to ask... have you tried searching one 
of the many excellent search engines that are available? If so, and you 
didn't find a ton of relevant results, just how dumb are you?


-Stut

Easily annoyed today. Must be a Saturday, I never could get the hang of 
Saturdays.

[Doug is dead, long live Doug!!]
Ramble ramble ramble.

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



Re: [PHP] nuSoap -method '' not defined in service

2007-01-20 Thread Martin Alterisio

Try the following:

$server->register('getColumns', array(), array());

The second argument is an array containing an entry for each argument of the
webservice call, and the third argument is an array for the return value.
Since you don't have either arguments nor return value, empty arrays should
be provided.

Also I think you should call $server->configureWSDL(), before
registering anything.

2007/1/18, blackwater dev <[EMAIL PROTECTED]>:


I have the following code but when I hit the page, I get the xml error of
method '' not defined in service.  I don't have a wsdl or anything
defined.
Is there more I need to do to get the SOAP service set up?

Thanks!

include("nusoap/nusoap.php");

$server=new soap_server();
$server->register('getColumns');

function getColumns(){

$search= new carSearch();

return $search->getSearchColumns();

}
$server->service($HTTP_RAW_POST_DATA);




Re: [PHP] Request for...

2007-01-20 Thread Børge Holen
On Saturday 20 January 2007 17:09, Stut wrote:
> Wikus Moller wrote:
> > Since this is a mailing list for web developers, I thought I might as
> > well post an o f f  t o p i c request.
> > Does anyone know of any website where I can get a exe or jar sitemap
> > generating software? Particularly not GsiteCrawler as it uses too much
> > system resources. A java applet would be nice. And, if possible, free
> > of charge ^.^
> >
> > And does anyone know how and if a j a v a applet can be extracted from
> > a webpage?(also a class)
>
> 1) You state that you know it's off-topic.
> 2) For some reason you felt the need to make excessive use of spaces
> (while offtopic and java are considered dirty words in some places,
> they're not here, and even then you didn't "obfuscate" all instances).
> 3) This is not a mailing list for web developers, it's a mailing list
> for PHP developers. The fact that most PHP development happens in a web
> context does not make it exclusively for web development.
> 4) You would prefer a java applet yet you ask on a PHP mailing list.
>
> My question... just how dumb are you?
>
> Sorry, didn't mean that. I meant to ask... have you tried searching one
> of the many excellent search engines that are available? If so, and you
> didn't find a ton of relevant results, just how dumb are you?
>
> -Stut
>
> Easily annoyed today. Must be a Saturday, I never could get the hang of
> Saturdays.

ah,,... you say, I'm just ackin' to get rid of Tuesdays.
Saturdays is quite alright, in fact... this is the 
dontwannadonothingandgetsawaywithitday!


> [Doug is dead, long live Doug!!]
> Ramble ramble ramble.

-- 
---
Børge
Kennel Arivene 
http://www.arivene.net
---

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



Re: [PHP] Storing values in arrays

2007-01-20 Thread tedd

At 3:33 PM -0800 1/18/07, Ryan A wrote:

tedd <[EMAIL PROTECTED]> wrote:

At 7:15 AM -0800 1/17/07, Ryan A wrote:

True, but thats not the most important part... I guess I wrote it
wrong, I meant that it should not write to disk before 1 minute...
anyway... about the "array saving" any ideas?

Thanks!
R


Why?

Hey Tedd,

Aww, nothing serious... just had a few ideas running in my head that 
needs something like this... and was wondering if it would save on 
server processing time and resources if done like this rather than 
writing to disk on every login...


Cheers!
R


Ahhh, I see. But isn't everything written somewhere?

If you did it client-side and used a javascript timer in the browser 
to delay the user's input from being submitted, that might work. But, 
I think it might also piss users off when they couldn't do anything 
in the interim.


If you did it server-side, then you would defeat what you wanted to 
accomplish with the server by it attending to a delay waiting to do 
something.


In the end, something has to attend to the delay and that probably 
would take more time than just writing the values to the disk. But, I 
may be wrong.


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

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



Re: [PHP] preg_match problem

2007-01-20 Thread Martin Alterisio

Double slash to prevent PHP interpreting the slashes. Also using single
quotes would be a good idea:

if (preg_match('/[\\w\\x2F]{6,}/',$a))


2007/1/19, Németh Zoltán <[EMAIL PROTECTED]>:


Hi all,

I have a simple checking like

if (preg_match("/[\w\x2F]{6,}/",$a))

as I would like to allow all "word characters" as mentioned at
http://hu2.php.net/manual/hu/reference.pcre.pattern.syntax.php
plus the '/' character, and at least 6 characters.

But it throws

Warning: preg_match(): Unknown modifier ']'

and returns false for "abc/de/ggg" which string should be okay.
If I omit the "\x2F", everything works fine but "/" characters are not
allowed. Anyone knows what I'm doing wrong? Maybe "/" characters can not
be put in patterns like this?

Thanks in advance,
Zoltán Németh

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




RE: [PHP] Request for...

2007-01-20 Thread Jay Blanchard
[snip]
Since this is a mailing list for web developers
[/snip]

This is a mailing list for PHP developers who might also do web
development. Evolt.org has a great list for w e b d e v e l o p e r s
 

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



Re: [PHP] preg_match problem

2007-01-20 Thread Arpad Ray

Martin Alterisio wrote:

Double slash to prevent PHP interpreting the slashes. Also using single
quotes would be a good idea:

if (preg_match('/[\\w\\x2F]{6,}/',$a))



Just switching to single quotes would do the trick - you don't need to 
escape anything but single quotes, and backslashes if they are the last 
character.


Arpad

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



Re: [PHP] non-blocking request to a url (via curl or file_get_contents or whatever)...

2007-01-20 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-20 01:30:55 +0100:
> > I definitely give a hoot about the content returned ... all I want
> > is for the request to go out on the wire and then have my script
> > immediately continue with what it should be doing.
> > 
> > I believe this would require creating a non-blocking connection in
> > some way, but I'm stuck as to the correct way to tackle this. I've
> > been reading about non-blocking sockets/streams etc but I'm just
> > becoming more and more confused really, anyone care to put me out of
> > my misery?
> 
> did more reading, still unsure of the whole thing, this is what I have
> right now:
> 
>   $url = array('', 'tbs.tradedoubler.com', '/report?blablablabla');
> $isSSL = true;
> $proto = $isSSL ? 'ssl://' : 'http://';
> $port  = $isSSL ? 443 : 80;
> $errno = $errstr = null;
> if ($sock = fsockopen($proto.$url[1], $port, $errno, $errstr, 
> 10)) {
> stream_set_blocking($sock, 0);
> fwrite($sock, "GET {$url[2]} HTTP/1.0\r\n");
> fwrite($sock, "Host: {$url[1]}\r\n");
> //fwrite($sock, "Content-length: 0\r\n");
> //fwrite($sock, "Accept: */*\r\n");
> fwrite($sock, "\r\n");
> fclose($sock);
> }
> 
> does this make any sense, will this work at all?
> would the 10 second timeout [potentially] negate all the hard work?

Yes, you need to wait for the socket to connect, and that's synchronous
in all cases.  I don't know enough about sockets in PHP to help further
here, but if the semantics follows write(2) behavior in C, then what you
have is broken. Non-blocking IO means the fwrite() could return before
it could write all you gave it (it returns how many bytes it's written).


-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



Re: [PHP] non-blocking request to a url (via curl or file_get_contents or whatever)...

2007-01-20 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-20 16:50:48 +0100:
> Roman Neuhauser wrote:
> 1. user stuffs things into shopping basket on [my] site (data stored in 
> session)
> 2. user goes to check out.
> 3. user chooses online payment.
> 4. user is redirected to online payment provider site
> 5. user completes payment successfully
> 6. online payment provider site contacts [my] site/server directly with 
> transaction status/details
> 7. user is shown 'thank you' page on online payment provider site
> 8. user is redirected back to [my] site and shown 'real' 'thank you' page.

That was perfect, thanks a lot!
 
> normally in step 8 the webbug would be placed on the 'thank you' page,
> but in this case the data needed to craft the webbug's url is no
> longer available - the solution is to perform the request the the
> webbug's url represents directly from my server during the
> code that runs as a result of the request made by the online payment
> provider in step 6.

Is it important that the callback gets called synchronously?  Is the
order reconstructible from the callback url?  If not I'd write
a small script to fetch urls from a database table and feed them to
wget or similar. 

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



RE: [PHP] Request for...

2007-01-20 Thread Jay Blanchard
[snip]
Since this is a mailing list for web developers, I thought I might as
well post an o f f  t o p i c request.
Does anyone know of any website where I can get a exe or jar sitemap
generating software? Particularly not GsiteCrawler as it uses too much
system resources. A java applet would be nice. And, if possible, free
of charge ^.^

And does anyone know how and if a j a v a applet can be extracted from
a webpage?(also a class)
[/snip]

Wikus my dear fellow, are their Java mailing lists? Would you like me to
find one for you? Are you familiar with Google?

Better yet, how about one in PHP for free? I went to Google and typed in
'site map generator PHP' and the first result was
http://www.softswot.com/sitemapinfo.php. Not only is the web site done
in PHP, but the application is as well. How cool is that?

Listen up butt-bite. Next time, before you respond off list to those who
tried to give you even the teeniest bit of help please demonstrate that
you tried to help yourself get the answer or showed a modicum of
initiative. Hundreds will attempt to help you when you have shown that
you tried to help yourself.

 

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



Re: [PHP] non-blocking request to a url (via curl or file_get_contents or whatever)...

2007-01-20 Thread Jochem Maas
Roman Neuhauser wrote:
> # [EMAIL PROTECTED] / 2007-01-20 01:30:55 +0100:
>>> I definitely give a hoot about the content returned ... all I want
>>> is for the request to go out on the wire and then have my script
>>> immediately continue with what it should be doing.
>>>
>>> I believe this would require creating a non-blocking connection in
>>> some way, but I'm stuck as to the correct way to tackle this. I've
>>> been reading about non-blocking sockets/streams etc but I'm just
>>> becoming more and more confused really, anyone care to put me out of
>>> my misery?
>> did more reading, still unsure of the whole thing, this is what I have
>> right now:
>>
>>  $url = array('', 'tbs.tradedoubler.com', '/report?blablablabla');
>> $isSSL = true;
>> $proto = $isSSL ? 'ssl://' : 'http://';
>> $port  = $isSSL ? 443 : 80;
>> $errno = $errstr = null;
>> if ($sock = fsockopen($proto.$url[1], $port, $errno, $errstr, 
>> 10)) {
>> stream_set_blocking($sock, 0);
>> fwrite($sock, "GET {$url[2]} HTTP/1.0\r\n");
>> fwrite($sock, "Host: {$url[1]}\r\n");
>> //fwrite($sock, "Content-length: 0\r\n");
>> //fwrite($sock, "Accept: */*\r\n");
>> fwrite($sock, "\r\n");
>> fclose($sock);
>> }
>>
>> does this make any sense, will this work at all?
>> would the 10 second timeout [potentially] negate all the hard work?
> 
> Yes, you need to wait for the socket to connect, and that's synchronous
> in all cases.  I don't know enough about sockets in PHP to help further
> here, but if the semantics follows write(2) behavior in C, then what you
> have is broken. Non-blocking IO means the fwrite() could return before
> it could write all you gave it (it returns how many bytes it's written).

ah yes, I did read that, you pointing it out has made it become clearer.
that would mean the 'fastest' I could push out the http request is
probably by doing:

if ($sock = fsockopen($proto.$url[1], $port, $errno, $errstr, 4)) {
fwrite($sock, "GET {$url[2]} HTTP/1.0\r\n");
fwrite($sock, "Host: {$url[1]}\r\n");
fwrite($sock, "\r\n");
fclose($sock);
}

but I'd have to check with tradedoubler if they could indicate what their
'report' server's maximum response time could be (hopefully very low) for the
timeout AND find out whether their 'report' server does something similar
to ignore_user_abort().

anyway thanks for your input!

> 
> 

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



Re: [PHP] non-blocking request to a url (via curl or file_get_contents or whatever)...

2007-01-20 Thread Jochem Maas
Roman Neuhauser wrote:
> # [EMAIL PROTECTED] / 2007-01-20 16:50:48 +0100:
>> Roman Neuhauser wrote:
>> 1. user stuffs things into shopping basket on [my] site (data stored in 
>> session)
>> 2. user goes to check out.
>> 3. user chooses online payment.
>> 4. user is redirected to online payment provider site
>> 5. user completes payment successfully
>> 6. online payment provider site contacts [my] site/server directly with 
>> transaction status/details
>> 7. user is shown 'thank you' page on online payment provider site
>> 8. user is redirected back to [my] site and shown 'real' 'thank you' page.
> 
> That was perfect, thanks a lot!
>  
>> normally in step 8 the webbug would be placed on the 'thank you' page,
>> but in this case the data needed to craft the webbug's url is no
>> longer available - the solution is to perform the request the the
>> webbug's url represents directly from my server during the
>> code that runs as a result of the request made by the online payment
>> provider in step 6.
> 
> Is it important that the callback gets called synchronously?  

dunno - definitely going to ask though!
in fact I feel stupid for not contemplating it myself,
I have a nasty suspicion that the script behind the url that the
tradedoubler webbug points to does stuff with the info the user's
browser would normally provide ...

in which case I would need to do something else - like generate the
webbug url at the point that I can (during order finalization) and store the
generated url in the relevant user's session and then use/place the webbug with
that url at the first opportunity to

> Is the
> order reconstructible from the callback url? 

to some extent but I don't think that is relevant to my current little puzzle.

> If not I'd write
> a small script to fetch urls from a database table and feed them to
> wget or similar. 

you've got me thinking about it from a totally different angle, and I've
got to understanding sockets/streams a little too! I now have enough ammo
to 'kill' the problem.

thank you very much for lending me your brain :-)

> 

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



Re: [PHP] Request for...

2007-01-20 Thread Jochem Maas
Børge Holen wrote:
> On Saturday 20 January 2007 17:09, Stut wrote:
>> Wikus Moller wrote:

...

>> -Stut
>>
>> Easily annoyed today. 

dunno - I reckon the OP was trying pretty hard ;-)

>> Must be a Saturday, I never could get the hang of
>> Saturdays.
> 
> ah,,... you say, I'm just ackin' to get rid of Tuesdays.
> Saturdays is quite alright, in fact... this is the 
> dontwannadonothingandgetsawaywithitday!

I'm with Garfield - f*** mondays :-)

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



[PHP] PHP Warning: session_destroy

2007-01-20 Thread Andre Dubuc
Hi,

To stop bots from accessing secured pages, I've added the following code to a 
banner page that is called by every page. Furthermore, each page starts with 
 and includes the banner page:

'top1.php' [banner page]

http://localhost/logout.php";);
}
}
?>

I'm testing on localhost with the browser set to 'Googlebot/2.1' - and the 
code works great. Any page that is set for https is not served, and if https 
has been set by a previous visit, it goes to http://somepage.

However, checking the live version, I get an secure-error_log entry:

"PHP Warning:  session_destroy() [function.session-destroy]: Trying to 
destroy uninitialized session"

Question is: didn't the session_start(); on the calling page take effect, or 
is this some other problem?

Is there something like 'isset' to check whether 'session_destroy(); is 
needed? [I've tried isset, it barfs the code.]

Tia,
Andre

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



Re: [PHP] Request for...

2007-01-20 Thread Jochem Maas
Jay Blanchard wrote:
> [snip]
> Since this is a mailing list for web developers, I thought I might as
> well post an o f f  t o p i c request.
> Does anyone know of any website where I can get a exe or jar sitemap
> generating software? Particularly not GsiteCrawler as it uses too much
> system resources. A java applet would be nice. And, if possible, free
> of charge ^.^
> 
> And does anyone know how and if a j a v a applet can be extracted from
> a webpage?(also a class)
> [/snip]
> 
> Wikus my dear fellow, are their Java mailing lists? Would you like me to
> find one for you? Are you familiar with Google?
> 
> Better yet, how about one in PHP for free? I went to Google and typed in
> 'site map generator PHP' and the first result was
> http://www.softswot.com/sitemapinfo.php. Not only is the web site done
> in PHP, but the application is as well. How cool is that?
> 
> Listen up butt-bite. Next time, before you respond off list to those who
> tried to give you even the teeniest bit of help please demonstrate that
> you tried to help yourself get the answer or showed a modicum of
> initiative. Hundreds will attempt to help you when you have shown that
> you tried to help yourself.
> 

and otherwise you risk getting "Blanch'ed" (like what they do with vegetables)

so for the rest of the list here's 2 new 'verbs' in honour of 2 fine members
(I can't help if their names 'fit'):

to be Lynched   - to receive a 2000 word essayon the topic of your 
choice followed by a *shrug*
to be Blanched  - to be told (in one of many, many ways) to 
RTFM/STFW/get-your-head-out-of-your-arse

>  
> 

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



Re: [PHP] Request for...

2007-01-20 Thread Børge Holen
On Saturday 20 January 2007 22:54, Jochem Maas wrote:
> Børge Holen wrote:
> > On Saturday 20 January 2007 17:09, Stut wrote:
> >> Wikus Moller wrote:
>
> ...
>
> >> -Stut
> >>
> >> Easily annoyed today.
>
> dunno - I reckon the OP was trying pretty hard ;-)
>
> >> Must be a Saturday, I never could get the hang of
> >> Saturdays.
> >
> > ah,,... you say, I'm just ackin' to get rid of Tuesdays.
> > Saturdays is quite alright, in fact... this is the
> > dontwannadonothingandgetsawaywithitday!
>
> I'm with Garfield - f*** mondays :-)

BAH, now I'm with Stut on this;(

I rewrote one of the first large database handling asswipe*"#$%&% file I made, 
and right at the *"#$"#%"# end, everything went astray... before uploading... 
gone with a wind, fart or whatever!

thats 20K of lost bytes

I'll neverever rewrite php4 to php5. F**K THIS

-- 
---
Børge
Kennel Arivene 
http://www.arivene.net
---

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



Re: [PHP] PHP Warning: session_destroy

2007-01-20 Thread Paul Novitski

At 1/20/2007 02:14 PM, Andre Dubuc wrote:

However, checking the live version, I get an secure-error_log entry:

"PHP Warning:  session_destroy() [function.session-destroy]: Trying to
destroy uninitialized session"

Question is: didn't the session_start(); on the calling page take effect, or
is this some other problem?



I've gotten the distinct impression from the documentation and from 
my own experiences that session_start() is required at the beginning 
of every page/script that references the session.  See 
http://ca3.php.net/session_start including Examples 1 and 2.


Paul

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



Re: [PHP] PHP Warning: session_destroy

2007-01-20 Thread Andre Dubuc
On Saturday 20 January 2007 05:33 pm, Paul Novitski wrote:
> At 1/20/2007 02:14 PM, Andre Dubuc wrote:
> >However, checking the live version, I get an secure-error_log entry:
> >
> >"PHP Warning:  session_destroy() [ >href='function.session-destroy'>function.session-destroy]: Trying to
> >destroy uninitialized session"
> >
> >Question is: didn't the session_start(); on the calling page take effect,
> > or is this some other problem?
>
> I've gotten the distinct impression from the documentation and from
> my own experiences that session_start() is required at the beginning
> of every page/script that references the session.  See
> http://ca3.php.net/session_start including Examples 1 and 2.
>
> Paul

That would tend to make sense despite that the calling page has arleady 
initiated one. Worth a try . . 

Thanks,
Andre

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



Re: [PHP] Security Question

2007-01-20 Thread Jochem Maas
Al wrote:
> Here is part of my proxie tags to html tags translation array. Looks
> pretty safe to me. There is other code to recognize paragraphs and
> lists, etc.

any 'real' html in the content your 'translating' is still going to
be there after translation - and therefore sent to the client,
quite impossible to say, with out know the code or the realiability of the
content source (e.g. the people that generate the content files)
how safe it actually is.

I would suggest you go to http://phpsec.org - chances are you learn something
that you have yet to consider at this point in time :-)


> 
> $translate_array= array(
> ''=> ' ''=> '',
> ''=> '" target="_blank">',
> ""=> '=> "\">",
> ''=> '',
> ''=> " ''  => '">',
> ''=> "\n",
> ''=> "\n",
> ''=> "",
> ''=> "\n",
> ''=> '',
> ''=> '',
> ''=> " style=\"text-decoration:underline\" href=\"$request_url\">Return to
> previous page\n",
>  );
> 
> Jochem Maas wrote:
>> Al wrote:
>>> Good point about the ' evil haxor code here; '.  That's
>>> bad for our users, not the site, per se.
>>
>> what is bad for your users is bad for your site, on top of that
>> the script is running in the context of your domain - all sorts of
>> nasty possibilities that could affect your site.
>>
>>> Raw text to html is primarily done with a series of preg_replace()
>>> operations.
>>
>> what/how [exactly] the transformation is done determines
>> whether your safe.
>>
>>> No include() or exec() allowed near the text.
>>>
>>> Sounds like I'm in pretty good shape.
>>
>> maybe, maybe not - see above.
>>
>> (do you practice any sports? ;-P)
>>
>> ...
> 

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



Re: [PHP] PHP Warning: session_destroy

2007-01-20 Thread Jochem Maas
Andre Dubuc wrote:
> Hi,
> 
> To stop bots from accessing secured pages, I've added the following code to a 
> banner page that is called by every page. Furthermore, each page starts with 
>  and includes the banner page:
> 
> 'top1.php' [banner page]
> 
>if((eregi("((Yahoo! Slurp|Yahoo! Slurp China|.NET CLR|Googlebot/2.1|
> Gigabot/2.0|Accoona-AI-Agent))",$_SERVER['HTTP_USER_AGENT'])))
>   { 
>   if ($_SERVER['HTTPS'] == "on")
>   {
>   session_destroy();
>   header("Location: http://localhost/logout.php";);
>   }
>   }
> ?>
> 
> I'm testing on localhost with the browser set to 'Googlebot/2.1' - and the 
> code works great. Any page that is set for https is not served, and if https 
> has been set by a previous visit, it goes to http://somepage.
> 
> However, checking the live version, I get an secure-error_log entry:
> 
> "PHP Warning:  session_destroy() [ href='function.session-destroy'>function.session-destroy]: Trying to 
> destroy uninitialized session"

which page is causing the error? is it logout.php perhaps? does that page
call session_destroy too?

your browser making a request with the user-agent set to 'GoogleBot Blabla'
is not the same as an actual googlebot that's making a request - in the 
difference
could lie the problem

is session_start() actually returning true we you call it in script run as a 
result of
a request initialized by a bot?

btw: do you need to send the bot to logout.php if you've just destroyed the 
session?
also, why not just redirect to an http url if it's a bot connecting via https
and forget trying to destroy the session?

> 
> Question is: didn't the session_start(); on the calling page take effect, or 
> is this some other problem?
> 
> Is there something like 'isset' to check whether 'session_destroy(); is 
> needed? [I've tried isset, it barfs the code.]
> 
> Tia,
> Andre
> 

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



Re: [PHP] I lied, another question / problem

2007-01-20 Thread Jochem Maas
Roman Neuhauser wrote:
> # [EMAIL PROTECTED] / 2007-01-17 16:59:26 +0100:
>> Roman Neuhauser wrote:
>>> re_format(7) on FreeBSD:
>>>
>>>  A bracket expression is a list of characters enclosed in `[]'.
>>>  (...)
>>>  If two characters in the list are separated by `-', this is
>>>  shorthand for the full range of characters between those two
>>>  (inclusive) in the collating sequence, e.g. `[0-9]' in ASCII
>>>  matches any decimal digit.
>>>  (...)
>>>  Ranges are very collating-sequence-dependent, and portable programs
>>>  should avoid relying on them.
>> one other thing ...
>>
>> wouldn't it be fair to assume (safety through paranoia) that
>> ctype_alnum() would suffer the same problem? (given the manual's
>> indication that ctype_alnum() and the offending regexp are equivalent?)
> 
> isalnum(3) uses isalpha(3) and isdigit(3), so yes, their results are
> locale-dependent (LC_CTYPE, see setlocale(3)), but don't depend on
> collating sequence. 

so really the doc's are slightly misleading or even incorrect,
I will try to formulate a succinct question for internals@ to ask whether
this should be reported as documentation bug.

as a side note: do you have any real world example of where this
collation issue might actually bite someone making use of the aforementioned
regexp range?

> isdigit(3):
> 
>  The isdigit() function tests for a decimal digit character.  Regardless
>  of locale, this includes the following characters only:
> 
>  ``0'' ``1'' ``2'' ``3'' ``4''
>  ``5'' ``6'' ``7'' ``8'' ``9''
> 

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



[PHP] most powerful php editor

2007-01-20 Thread Vinicius C Silva

hi everyone!

i'd like to ask something maybe commonly asked here. what is the most
powerful php editor?


Re: [PHP] most powerful php editor

2007-01-20 Thread Stut

Vinicius C Silva wrote:

hi everyone!


Hi everybody!


i'd like to ask something maybe commonly asked here. what is the most
powerful php editor?


Definitely the chainsaw. Lets you slice your PHP scripts up into iddy 
biddy pieces so you can try different combinations. It's also a hell of 
a lot of fun!!


Or did you mean a different kind of powerful?

-Stut

PS: If you think it's a common question, search the list archives before 
posting. Actually, before you post any question you should search the 
list archives. And Google. And your brain. And down the back of the sofa 
(you wouldn't believe the things I've found back there!!)


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



[PHP] Re: most powerful php editor

2007-01-20 Thread Gregory Beaver
Vinicius C Silva wrote:
> hi everyone!
> 
> i'd like to ask something maybe commonly asked here. what is the most
> powerful php editor?

I am

Yours,
Greg

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



[PHP] Help With Inventory

2007-01-20 Thread Brandon Bearden
Can anyone help me figure out how to solve my inventory listing problem?

I am using php_5 and mysql_5.0 w/apache on fbsd.

I need to figure out a way to make a subtitle for every category (genre)
in the inventory so when I list the entire inventory on a sheet (at
client's request), it is organized by category (genre) and each category
(genre) has a title line above it. So the there is not just one big list
rather a neat list with titles for each category THEN all the rows in that
category etc. I can't figure out the loop to make the titles.

I have them sorted as you can by genre, the list is formatted fine There
are alternating colors on the rows to make it read easier. I just want to
keep from having to make a statement for EACH genre. I will eventually
make the genre list dynamic too, so I need to figure out how to
dynamically generate this inventory list.

This is the output I have now:

DVD ID  TITLE GENRE 1  GENRE 2   GENRE 3ACT QTY
BCK   HLDINC OG USR   OUT DATE   OUT USRIN DATE IN USR
  CY
20860003Movie name action 1  1 0
 1000-00-00 00:00:00  -00-00 00:00:000
20860020Move Name   COMEDY   11   0
  1000  -00-00 00:00:00  -00-00 00:00:00
 0
20860006Movie name COMEDY 1  1 0
 1000-00-00 00:00:00  -00-00 00:00:000


What I WANT to see is:
I will fix the background colors, I just want to see the "GENRE: ACTION -
1 TITLES and GENRE: COMEDY - 2 TITLES"

DVD ID  TITLE GENRE 1  GENRE 2   GENRE 3ACT QTY
BCK   HLDINC OG USR   OUT DATE   OUT USRIN DATE IN USR
  CY

GENRE: ACTION - 1 TITLES
20860003Movie name ACTION 1  1 0
 1000-00-00 00:00:00  -00-00 00:00:000

GENRE: COMEDY - 2 TITLES
20860023Movie name  COMEDY1   1
  0   1000 -00-00 00:00:00-00-00 00:00:00
0
20860006Movie name COMEDY 1  1 0
 1000-00-00 00:00:00  -00-00 00:00:000







This is the code:
1.  function invlistONE(){
2.  dbconnect('connect');
3.  $invlist = mysql_query("SELECT * FROM sp_dvd ORDER BY dvdGenre");
4.
5.
6.  ?>
7.  
10. DVD ID
11. TITLE
12. GENRE 1
13. GENRE 2
14. GENRE 3
15. ACT
16. QTY
17. BCK
18. HLD
19. INC
20. OG USR
21. OUT DATE
22. OUT USR
23. IN DATE
24. IN USR
25. CY
26. 
27. 
28. "); }
56. else { echo ("");}
57.
58. echo ("");
59. echo (" $dvdId ");
60. echo ("$dvdTitle");
61. echo ("$dvdGenre");
62. echo ("$dvdGenre2");
63. echo ("$dvdGenre3");
64. echo ("$active");
65. echo ("$dvdOnHand");
66. echo ("$back");
67. echo ("$hold");
68. echo ("$incoming");
69. echo ("$ogUserId");
70. echo ("$outDate");
71. echo ("$outUserId");
72. echo ("$inDate");
73. echo ("$inUserId");
74. echo ("$cycles");
75. echo ("");
76. echo ("");
77.
78. $count++;
79. if ( $count == 2 ) { $count = 0; }
80. }
81. ?>http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] most powerful php editor

2007-01-20 Thread Jay Blanchard
[snip]
i'd like to ask something maybe commonly asked here. what is the most
powerful php editor?
[/snip]

What is power when regarding a PHP editor? My team uses Eclipse but we
are all comfortable with VI or PICO.

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



Re: [PHP] Php coding help - Newbie question

2007-01-20 Thread Ramdas

On 1/18/07, Ramdas <[EMAIL PROTECTED]> wrote:

On 1/17/07, Jochem Maas <[EMAIL PROTECTED]> wrote:
> Ramdas wrote:
> > Hi Group,
> >
> > A very newbie question. Might be discussed earlier, please forgive.
>
> Are so much of a noob that STFW is not within your capabilities?
> (just thought I'd ask, given that you admit to realising the info *might*
> be out there already)
>
> >
> > I am having a site in PHP ( not very great design ) which I need to
> > convert/modify to use functions. Such the code for connecting /
> > binding to Ldap is not repeated & scripts are more readable.
> >
> > The site deals with modifying / adding / deleting entries in a LDAP dir.
> >
> > In each of the pages following is done:
> >
> >  >
> > require 'validate.php' ;// validate.php checks if the user is loged in
> >
> > $connect = ldap_connect(ldapserver);
> > if ($connect) {
> >
> > bind ...
> > do the things
> >
> > }else { echo erro..}
> >
> > ?>
> >
> >
> > Also please advice what is a correct method of checking the user's
> > session. Currenlty I use a "HTTP_SESSION_VARS" variable to store the
>
> recommended to use the $_SESSION superglobal instead and stuff values
> directly into (after having called session_start()) instead of using 
session_register()
> et al.
>
> > user's login & passwd . Each time the user hits the page these vars
>
> you only need to store *whether* they are logged in - and set that value when 
you
> actually handle a login attempt (obviously storing their username could be 
handy)
>
> I don't see any reason to store the passwd and validate against ldap on
> every request ... in fact I believe that storing the pwd in such a way is 
essentially less
> secure.
>
> > are checked with the existing values in the LDAP (this is done by
> > validate.php).
> >
> > Please suggest me some good starting point where I can start a fresh
> > with more compact/cleaner Code.
>
> that question is about as vague as 'how long is a chinaman?'
> (the answer to that question being 'yes he is')
>
> here are some very vague ideas/functions:
>
> an include file ...
> === 8< =
>  function sessionCheck()
> {
>if (!isset($_SESSION['loggedin']) || !$_SESSION['loggedin']) {
>/* show login page then .. */
>exit;
>}
> }
>
> function doLogin($username, $passwd)
> {
>$_SESSION['loggedin'] = false;
>if (/* given $username+$passwd check outs in ldap*/)
>$_SESSION['loggedin'] = true;
>
>return $_SESSION['loggedin'];
> }
> ?>
>
> an 'init' include file
> === 8< =
> 
> require 'your-include-file.php'; // see above
>
>
> session_start();
>
> if (isset($_POST['uname'], $_POST['pwd'])) {
>doLogin($_POST['uname'], $_POST['pwd']);
> }
>
> sessionCheck();
>
> ?>
>
> any other file (other than the login 'page')
> === 8< =
> 
> require 'your-init-file.php';
>
> // we are logged in - it's magic
>
> // do some shit
>
> // the end, congrats go get laid :-)
>
> ?>
>

Thanx for the all responses.

Regards
Ram



Hi all,

Sorry for troubling all again.
I am trying to use the Pear DB_ldap for the above scripts.

Does any one have any sample code for ldap_connect () ldap_search etc.

Thanx once again.

Regards
Ram

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



RE: [PHP] most powerful php editor

2007-01-20 Thread Tom Cruickshank
I use Quanta when doing PHP development. Used to use vi, but Quanta won me.
Sorry vi.

Is Quanta powerful in my opinion? Yes. Why? Because it fits all requirements
And then some. 

Just my 2 cents.

Tom




-Original Message-
From: Jay Blanchard [mailto:[EMAIL PROTECTED] 
Sent: January 20, 2007 10:31 PM
To: Vinicius C Silva; php-general@lists.php.net
Subject: RE: [PHP] most powerful php editor

[snip]
i'd like to ask something maybe commonly asked here. what is the most
powerful php editor?
[/snip]

What is power when regarding a PHP editor? My team uses Eclipse but we
are all comfortable with VI or PICO.

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

-- 
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.17.2/641 - Release Date: 20/01/2007
10:24 AM
 

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.17.2/641 - Release Date: 20/01/2007
10:24 AM
 

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



[PHP] wierd slash

2007-01-20 Thread Don
I have a line of code that validates form info for some POST vars, but not
others.

 

 

 

if (!ereg("^[A-Za-z' -]{1,50}$",$_POST[$field]) )

 

 

when I put O'Toole in the form to test, my script kicks the page back (I
thought this entry would be OK)

 

but moreover, when it redisplays the form and populates the new form with
the entries previously entered, O'Toole becomes O\

 

when I put similar entries into fields that are not run through this line,
they go to the DB as typed.

 

Any advice? 

 

Thanks again

 

Don

 



[PHP] Forced File Downloads

2007-01-20 Thread Don
I've been having my forced downloads sometimes finish prematurely using
readfile(). I'm downloading a Windows .exe file.

I've read several posts that have suggested the substitution of a fread/feof
loop to write out the download in smaller chunks. I tried using a function
(readfile_chunked) I found in the user comments on php.net.

But for some odd reason, every time the downloaded file is one byte larger
than the original file, and it's not being recognized as a valid Windows 
file.

I'm using PHP 4.4.4 on a shared Linux server running Apache.
IE and FireFox both exhibit the problem on the Windows end. I'm
using WinXP SP2.

I've listed relevant snippets below. $file_name is the fully qualified
path to the (.exe) file.

Any ideas?
#=

# Download the File

#=

header("Pragma: public");

header("Expires: 0");

header("Cache-Control: must-revalidate, post-check=0, pre-check=0");

header("Cache-Control: private", false);

header("Content-Description: File Transfer");

header("Content-Type: application/octet-stream");

header("Accept-Ranges: bytes");

header("Content-Disposition: attachment; filename=" . $file_name . ";");

header("Content-Transfer-Encoding: binary");

header("Content-Length: " . @filesize($file_path));

header ("Connection: close");

@ignore_user_abort();

@set_time_limit(0);

// @readfile($file_path);

readfile_chunked($file_path, FALSE);

exit();

..

function readfile_chunked($filename, $retbytes = true) {

 $chunksize = 8 * 1024; // how many bytes per chunk

 $buffer = '';

 $cnt = 0;

 $handle = fopen($filename, 'rb');

 if ($handle === false) {

 return false;

 }

 while (!feof($handle)) {

 $buffer = fread($handle, $chunksize);

 echo $buffer;

 ob_flush();

 flush();

 if ($retbytes) {

 $cnt += strlen($buffer);

 }

 }

 $status = fclose($handle);

 if ($retbytes && $status) {

 return $cnt; // return num. bytes delivered like readfile() does.

 }

 return $status;

}

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