Re: [PHP] MySQL -- finding whether there's a transaction started

2009-04-24 Thread Bogdan Stancescu
On 24-Apr-09 03:45, Chris wrote:
 I don't think mysql has any way of finding that out. If you're using an
 abstraction layer, it's easy enough in code - though rollback's are a
 little harder - should they do a complete rollback or just to a savepoint?

Thank you for taking the time to sketch that mock-up -- yes, we were
also thinking about something similar as a last resort, but I just can't
believe you can't simply ask MySQL whether it's going to autocommit the
next query or not...

Bogdan

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



[PHP] MySQL -- finding whether there's a transaction started

2009-04-23 Thread Bogdan Stancescu
Hello list,

I'm developing a library and would need to know if the code calling my
library has already started a MySQL transaction or not. I want to know
whether I should start one or use savepoints instead -- starting a
transaction if one is already in progress commits the existing
transaction, and setting a savepoint silently fails outside
transactions. And I was unable to find any non-destructive way of
retrieving that information -- is there any?

Thank you,
Bogdan

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



[suspicious - maybe spam] [PHP] [suspicious - maybe spam] Re: Save page as text

2005-06-30 Thread Bogdan Stancescu

Hello Rafael,

You can try using output control functions (see 
http://ro.php.net/manual/en/function.ob-start.php) and, depending on 
whether you want to upload the file or save it on your server (I don't 
understand which from your message), serve the result with a 
Content-type: text/plain header (see function header()), or use 
fopen() and fwrite() to save it on your server.


Hope this helps,
Bogdan

[EMAIL PROTECTED] wrote:

Hi,
I have page with PHP and Javascript code and I need to a link or bottun in it 
to save its content to a plain text file. (I'm using an apache server in a 
machine running Windows 2003, and I want to be able to use this feature in IE 6 
and Mozilla 1.7)
I saw some information about how to do that with PHP, but I wasn't able to do 
it.
Can some one help me with that?
 
Thanks in advance,

Rafael Magrin


-
Yahoo! Acesso Grátis: Internet rápida e grátis. Instale o discador agora!


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



Re: [PHP] Finding current PHP sessions

2005-05-14 Thread Bogdan Stancescu
Ok, I went with the solution you recommended, by the way of a thank 
you to the list, here's the resulting function:

/**
* This function returns the IDs of the current PHP sessions.
* At this time, it only works with
* [EMAIL PROTECTED] http://www.php.net/manual/en/ref.session.php#AEN129461}
* PHP session.save_handler='files'
*
* @author Bogdan Stancescu
* @license http://opensource.org/licenses/lgpl-license.php GNU Lesser 
General Public License
*
* @return mixed false on error or the indexed array of the session IDs;
*   please note that the session IDs are 16-bit values represented as
*   32-character long hexadecimal strings; letters are in lower caps.
*/
function getCurrentSessionIDs()
{
  if (ini_get('session.save_handler')!='files') {
// sorry, we only know how to handle files at this time!
return(false);
  }
  $sessions=array();
  $session_path=session_save_path();
  $d = dir($session_path);
  while (false !== ($entry = $d-read())) {
if (
  ($entry=='.') ||
  ($entry=='..') ||
  (!is_file($session_path/$entry))
) {
  continue;
}
if (preg_match(/^sess_([0-9a-f]{32})$/,$entry,$matches)) {
  $sessions[]=$matches[1];
}
  }
  return($sessions);
}

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


Re: [PHP] Finding current PHP sessions

2005-05-14 Thread Bogdan Stancescu
Marek Kilimajer wrote:
Bogdan Stancescu wrote:
Ok, I went with the solution you recommended, by the way of a thank 
you to the list, here's the resulting function:

/**
* This function returns the IDs of the current PHP sessions.
* At this time, it only works with
* [EMAIL PROTECTED] http://www.php.net/manual/en/ref.session.php#AEN129461}
* PHP session.save_handler='files'
*
* @author Bogdan Stancescu
* @license http://opensource.org/licenses/lgpl-license.php GNU Lesser 
General Public License
*
* @return mixed false on error or the indexed array of the session IDs;
*   please note that the session IDs are 16-bit values represented as

16-bit. That's not very secure ;) Should be 256-bit
*   32-character long hexadecimal strings; letters are in lower caps.
*/
True, that should've read 16 byte, documentation error -- thanks for 
pointing it out!

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


[PHP] Finding current PHP sessions

2005-05-13 Thread Bogdan Stancescu
Hello all,
I guess this comes up once in a while, does anybody know how I can find 
the current PHP sessions' IDs? I don't mind if some have passed away, 
and the PHP gc hasn't run yet, because I'm doing a garbage collection of 
my own, for data identified by session ID -- it doesn't really matter if 
I keep a few obsolete files for a while, it only matters that I delete 
them at some point in the future.

I know I could read the session files themselves, but I'd very much 
rather use a proper way to retrieve the active sessions, which would 
work with alternate methods of storing session data, if there is any 
such proper way to do this.

I read the PHP documentation regarding sessions, and I checked out 
Google, with no luck. If you guys don't have a solution, it means that 
there is none -- in other words, you're my last hope, help! :-)

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


[PHP] Re: Strange comparison behaviour

2005-05-13 Thread Bogdan Stancescu
You probably mis-typed something:
[EMAIL PROTECTED] ~]$ php
?
if (info == 0) echo is 0\n; else echo not 0\n;
?
Content-type: text/html
X-Powered-By: PHP/4.3.11
is 0
Cheers,
Bogdan
Erwin Kerk wrote:
Hi All,
Can anyone explain me why the following code:
if (info == 0) echo is 0\n; else echo not 0\n;
Results in: not 0
Whereas:
if (inf == 0) echo is 0\n; else echo not 0\n;
Results in: is 0

Notice the difference: info in the first sample, inf in the second sample.
The used PHP version is PHP 4.1.2 (CLI version)
Erwin Kerk
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: in_array not operating as 'expected'

2004-11-09 Thread Bogdan Stancescu
Apart from Marek's reply, you should probably check the in_array() 
documentation (look at the third, optional parameter) and search for 
type casting on php.net.

Cheers,
Bogdan
Ing. Ivo F.A.C. Fokkema wrote:
Hi guys and gals,
I'm not screaming Bug! Bug! but this _does_ look 'illogical' to me. I've
searched the archives, but found no earlier conversation. Sorry if
I missed it. Consider the following code:
var_dump(in_array('test', array(0)));
What does this return? I expect bool(false), but it returns bool(true).
After some searching the web, I bumped into this:
http://www.phpdiscuss.com/article.php?id=67763group=php.bugs
Basically, it is said by derick [at] php.net that this behavior is
expected. The following code :
var_dump('test' == 0);
also returns bool(true). But my logic tells me, that if 'test' == 0, then :
if (0) {
  ...
}
should do the same as 

if ('test') {
  ...
}
but it doesn't! The first if-statement is _not_ executed, the latter is.
In my opinion, this is not correct. Any thoughts on this? Am I not seeing
the logic here?
Thanks for your thoughts.
Ivo Fokkema
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Pdfs getting corrupted during upload

2004-01-17 Thread Bogdan Stancescu
You didn't specify whether you and your client are using the same 
server. If not, make sure you have the same gpc slashing settings on 
both servers.

Bogdan

Binay wrote:
Hi all,

I m undergoing a very weird kind of file uploading problem. I m trying to upload an image file and a pdf file using HTTP Upload form. Now my client is complaining that pdf file is getting corrupted during uploading as they do not open once uploaded. But when i try to upload(using WinXp home, I.E 6+) from my end every thing works perfectly ... so its very surprising for me. 

Initially when client complained (using WinXp home editon , I.E 6+) , i thought it is some browser issue and hence instructed them to upload pdf using Win2K machine. But they are facing the same problem there also. I don know wht to do..

Any of u guys faced this sort of problem plz tell me where exactly is the problem? Why the pdf files are getting corrupted? is there some thing hidden which is causing the corruption?

Thanks in advance

Binay

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


Re: [PHP] Non American strtotime

2004-01-16 Thread Bogdan Stancescu
John W. Holmes wrote:

Tom wrote:

The end user gets to chose their date format, and so if I cannot 
reverse their arbitrary date format into a timestamp then I have no 
chance of ensuring that dates are correct.

This seems like a really fundamentally bad thing about PHP :(


Seems like a fundamental flaw in your program. If the user enteres 
01/02/03, what date is that? 2003? January? February? 1st or 2nd?
February. 1st. It's assumed in his environment that the format is 
dd/mm/yy, just like it's probably assumed in your environment that it's 
mm/dd/yy (I presume that based on your time zone). If you're developing 
for an intranet for instance, then you can work with such assumptions.

What I find upsetting in Tom's attitude is his generosity in harsh 
words: a really fundamentally bad thing about PHP would be not being 
able to cope with this problem at all, but let's be serious, writing a 
short function (as previously exemplified for free via e-mail by 
third-parties) is not /such/ a big deal. It may be just me, but I never 
considered copy/pasting such a nauseating experience.

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


[PHP] Re: Image Header Problems

2004-01-13 Thread Bogdan Stancescu
Bob Eldred wrote:
I'm wanting to serve images outside the docroot of apache, so that the
images can't be so easily hijacked.  However, I appear to be running into a
problem with (I think) the headers not being sent properly.  IE (v6) will
only save the images as BMPs, not as JPGs, even though they are JPG images.
Given that your purpose is for the images to be difficult to hijack, 
doesn't this serve your interest? :)

The problem with IE is that it's developed by Microsoft. The same way 
Microsoft didn't recognize magic for detecting the file type (and used 
extensions instead), it now doesn't use MIME types (and uses extensions 
instead). Never tried it, but I would assume that serving an image along 
with the proper headers and with a .txt extension to IE will result in 
saving it as text.

So basically it's an IE thing. What you can do, if you really need to, 
is serve the images as img src=/showpicture/xx.jpg and parse the 
xx out of it in showpicture.php.

HTH

Bogdan

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


Re: [PHP] Re: goto label

2003-12-10 Thread Bogdan Stancescu
Robert Cummings wrote:
On Tue, 2003-12-09 at 08:14, Bogdan Stancescu wrote:

Sorry if my message sounded melodramatic or something, I remembered the 
frustration feeling so strongly from your message that I wanted to 
reinforce the other people's messages with a personal testimonial if 
you wish.
U, I rarely use the goto statement, and I do not advocate it for
regular everyday coding. I do know the difference between well
structured code and otherwise. What I did say, is that goto label has
it's uses, and sometimes it IS the best solution. Just because someone
tells you something is bad, doesn't mean to say it is always bad. It's
like someone saying salt is bad for you, and so you never take salt
again and die from salt deficiency. People really need to change their
mindset about being sheeple (yes sheep people) and blindly following
preached dogma.
My message was in reply to the one in which you said you were 
disappointed PHP doesn't feature goto. *That* is what I was replying to. 
And the understatement in my reply was that PHP does good by not 
allowing goto statements because that way it coerces even unexperienced 
programmers into sane code. And there are quite a few unexperienced 
programmers using PHP out there, trust you me. Your reply's quite 
transparent understatement is calling me and everybody who doesn't agree 
with you sheep people. That's a tad curious, if not offensive.

I don't mind your message sounding melodramatic, but it doesn't explain
in any way why goto shouldn't be used. It just asserts that you found
May I point you to the last few lines in my message you're replying to, 
quoted at the top of this message for your convenience. I will highlight 
the key words in there for you here, so it's easier to follow: I wanted 
to reinforce the other people's messages with a personal testimonial.

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


Re: [PHP] Re: goto label

2003-12-09 Thread Bogdan Stancescu
Justin Patrin wrote:
Robert Cummings wrote:

Goto line number is a very broken way of coding. Goto label is a
very useful and structured way of coding especially when creating fast
FSMs for parsing. I was a little disappointed a few months ago when I
found that PHP didn't support  the goto label syntax since it would have
provided the most elegant solution.
goto anywhere is broken. For instance, goto-ing out of loops and 
functions, or into one function from another causes untold grief to the 
language developer and makes it very hard to read the code. Then there's 
using goto into and out of class functions, which is even worse.

In truth, goto has no place in a higher level programming language. 
Anything that can be done with goto can be done without it and (IMHO) 
more elegantly.
Robert, I know your grief, been there, I know how it feels. I started my 
childhood with BASIC, which was /the/ GOTO programming language, 
learned Turbo Pascal when I was a teenager, and continued to use GOTO's 
(Pascal discourages but doesn't disallow GOTO's, so I was still able to 
cheat when there was a need for it). Well, later on when I started 
finding out how major projects are being developed, what structured 
programming really means and so on, I felt the way you feel now: 
cheated. Why in God's name is GOTO bad? It's SO useful! They're mad! 
Well, it simply isn't true -- the problem is that you have to change 
your mindset about programming, try to really structure the way you see 
a program, break it into efficient stand-alone functions, group those in 
classes, etc, and you'll see that there *is* no need for GOTO, ever. You 
do need to break out of loops, you do need to short a loop when a 
condition is met, you do need to break out of switches, if branches and 
the lot - but those tools you have in PHP. GOTO is not needed and 
harmful. Even simply learning to program without GOTO will coerce you 
into saner code.

Sorry if my message sounded melodramatic or something, I remembered the 
frustration feeling so strongly from your message that I wanted to 
reinforce the other people's messages with a personal testimonial if 
you wish.

Bogdan

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


[PHP] Re: Building a query string

2003-12-03 Thread Bogdan Stancescu
Ed Curtis wrote:
 This list has helped me out alot and I hope it can do it one more time.

I need to build a MySQL query based on 11 different options from a form.
Some options will have values others will be checkboxes to say include in
the query.
How I thought about going at it was using a default query string and add
additional strings to the default string based on results of the form.
$query_str = SELECT * FROM listings WHERE id  0 ;

if ($garage != ) {

	$garage_str = AND garage = '$garage' ;

	//add $garage_str to $query_str//

	}

This would continue through all eleven options then produce a query string
with all included query options needed. Can this be done this way? If so,
how do I add a string to a string?
Thanks,

Ed
To answer the question, $query_str.= AND garage = '$garage' ;

BUT. If $garage is an id (numeric), then you should use 
$garage=abs($garage) first in order to defeat SQL injection. If it's a 
string, well, say so and we'll tell you what to do (a lot to explain, 
and not useful if it's an ID).

Bogdan

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


[PHP] Re: Capturing $_POST variables

2003-11-28 Thread Bogdan Stancescu
The only way you can send POST variables as POST variables in the next 
page is by using a form. That's obvious, you can't control the browser. 
So either use Wouter's suggestion to send them via sessions (if you 
don't HAVE to have them sent over via POST), or use Sophie's suggestion 
to build a list of hidden inputs in a form.

Bogdan

Shaun wrote:
Hi,

is it possible to capture $_POST variables sent from a previous page so i
can send them on to the next page?
Thanks for your help.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Important notice

2003-11-28 Thread Bogdan Stancescu
John Nichel wrote:
Chris W. Parker wrote:

[EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
on Wednesday, November 26, 2003 9:30 PM said:
If you feel this transaction was made
by our mistake, please press No.


I keep clicking No but nothing is happening. PLEASE HELP! Maybe it's a
bug with PHP??
Chris.


My keyboard doesn't have a 'No' key.

Hey! You're both in violation of Internal Rule #44.15/78 by following up 
on this thread! This is illegal! Or not. Or whatever. But anyway! I hope 
you're up to date with The Reg's last updates on Fermat's legal issues.

Anonymous

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


Re: [PHP] Regular Expression Help: genreate alphanumeric, 8 chars

2003-11-27 Thread Bogdan Stancescu
...as in...

?
  // Could've been done with ASCII sets, but this way
  // you can easily tweak the eligible characters.
  $eligible='abcdefghijklmnopqrstuvwxyz0123456789';
  $pwdLen=8;
  $password='';
  for($i=0;$i$pwdLen;$i++) {
$password.=$eligible[rand(0,strlen($eligible))];
  }
  echo(Your new password: $password\n);
?
Bogdan

David T-G wrote:
Shaun --

[No need to post twice...]

...and then Shaun said...
% 
% Hi,

Hi!

% 
% I need to generate a lowercase alphanumeric passwrord thats 8 characters
% long, has anyone got a function that can do this?

This isn't really a regular expression question, since you'd use an
expression to check if a string matched your requirements but not to
generate such a string.
A function should be easy: just loop 8 times over spitting out a random
char between a and z or 0 and 9 (use rand() to generate a number between
0 and 35 and then map that to the char).
% 
% Thanks for your help

Enjoy :-)

HTH  HAND

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


Re: [PHP] Important notice [talk]

2003-11-27 Thread Bogdan Stancescu
Curt Zirzow wrote:
Thank you very much for cleaning my money. Make sure it goes through the
drier before I get it back. I don't want my pockets to get web.
I do neither though. But you know. Some people slip and fall in the mud
and their money gets dirty. What can you do?


Why are you all replying to this?  I now have marked it as spam in
the subject so when someone is searching for credit card
information sometime in the future they know this isn't such an
important thread to read.
Don't even reply to this, just read it and say ok.. and move on

Curt
Why? Yes. No. Ok. Move along.

What's the matter with you? Did they ban humour in your state or what?

I now have marked it as spam--who cares? I now have marked *MY* reply 
as talk--will this make you talk to me forever? What if I marked it as 
undress, start swearing NOW, or even buy a new Windows license?

Also, don't even reply--I did. Now what? Will I get struck by 
lightning when I press Send? Let's see...

Bogdan

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


[PHP] Re: how to send entire php webpage content to another page?

2003-11-27 Thread Bogdan Stancescu
You didn't provide much help by not answering the very question in the 
title. _HOW_ would you want to send it? Via a POST variable? Internally, 
via a plain text file? Internally, via memory sharing? Via e-mail? Also, 
it would be interesting to know what exactly you're after, that could 
help people maybe suggest some alternate methods to what you're 
currently trying. Are you trying to back up data? Replicate? Synchronize?

Bogdan

Joffrey Leevy wrote:

Hi:

Does anyone have info on sending the contents of an
entire php webpage to another php page on the same
server?  A little code would be helpful.
Thanks

__
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: how to send entire php webpage content to another page?

2003-11-27 Thread Bogdan Stancescu
Well, you have three solutions. One, you finish it the way you started, 
in which case you'll need to use htmlspecialchars() on $out in the form 
(otherwise you'll almost certainly escape from the form tag sooner or 
later). Two, you store the data temporarily in a database or something 
(faster for the user, they don't get to download the data twice). Three, 
you re-generate this page on request. This is what I would do, 
personally: I would link to the same page, only sending some parameter 
(e.g. xls_output=true). Then, at the beginning of the page you can 
test for $xls_output and simply dump them headers in front of the whole 
shebang if needed.

HTH

Bogdan

Joffrey Leevy wrote:
Most humble apologies.  Trying to create an excel file
of the current php page which can be downloaded.  What
I've been doing is creating an output buffer and then
using ob_get_clean to retrieve the page contents.
for example, $out=ob_get_clean();

Now everything works up to there, but when I try to
post $out in a hidden form to another page it doesn't
work.
echo formaction='nextpage.php' method='post'
  input type='hidden' name='out' value='$out'
  input type='submit' value = 'save as xls file'
   /form\n;
   And on nextpage.php I have

?php
header(Content-type: application/vnd.ms-excel);
header(Content-Disposition: attachment;
filename=\test.xls\);
echo $out;
?
To make a long story short, this does not work. 
Grateful for any help.



--- Bogdan Stancescu [EMAIL PROTECTED] wrote:

You didn't provide much help by not answering the
very question in the 
title. _HOW_ would you want to send it? Via a POST
variable? Internally, 
via a plain text file? Internally, via memory
sharing? Via e-mail? Also, 
it would be interesting to know what exactly you're
after, that could 
help people maybe suggest some alternate methods to
what you're 
currently trying. Are you trying to back up data?
Replicate? Synchronize?

Bogdan

Joffrey Leevy wrote:


Hi:

Does anyone have info on sending the contents of
an

entire php webpage to another php page on the same
server?  A little code would be helpful.
Thanks

__
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


__
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Calculating difference between two timestamps

2003-11-27 Thread Bogdan Stancescu
Neil Freeman wrote:
Hi there,

Does anyone have any suggestions as to how I can calculate whether one 
timestamp is within one second of another timestamp.

e.g.

Timestamp 110:59:59
Timestamp 211:00:00
Essentially I need to create a function which'll take two parameters and 
return whether the two parameters are within one second of each other.

Any suggestions would be great.

Neil
Have you looked at http://www.php.net/manual/en/function.mktime.php?

Bogdan

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


[PHP] Re: PHP script that fills forms ?

2003-11-26 Thread Bogdan Stancescu
Check out curl, I think it does this. If it doesn't, you have one last 
shot to keep it simple by sending the data via GET instead of POST. If 
that fails too, you're practically going to have to emulate a browser. 
That wouldn't be SO tricky, sending a few POST variables is not *such* a 
big deal. But you're also going to have to take care of the cookies that 
site sends you for authentication, and so on (send it back with each page).

I'm not sure this is actually worth the trouble -- you could try 
checking out Lynx and wget. While wget knows about HTTP authentication, 
I don't think you can make it understand the cookies stuff. Maybe with 
some smart automation you could somehow make lynx du what you're after.

HTH

Bogdan

Anonymous wrote:
I was just wondering if it's possible to get a PHP script to fill a form for
you? You see, I'm trying to make PHP fetch a password protected website for
me and there's a form with username and password that protects it.
Can anyone help me? Perhaps give me another sollution?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: IE download problem

2003-11-26 Thread Bogdan Stancescu
I was thinking the same. But until we can squeeze some information about 
the actual error from Luis, I think we're stuck.

Bogdan

Warren Vail wrote:

Could the problem be the associations stored in the windows system registry?

I've had problems trying to download files whose name ends in a suffix that
is registered as being associated with a given program (i.e. .txt with
notepad, .doc with word).  I believe that IE tries to open the file in the
registered application and Netscape doesn't always do that (could be wrong
here, but that's how it seemed to me).
Warren

-Original Message-
From: Luis Lebron [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 26, 2003 8:54 AM
To: 'pete M'; [EMAIL PROTECTED]
Subject: RE: [PHP] Re: IE download problem
I tried your code. I'm still getting the same errors.

thanks,

Luis

-Original Message-
From: pete M [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 26, 2003 10:52 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: IE download problem
thsi si a nighmare area. and loast days on same problem

This works for me.. hope it does for you

$file = $_GET['file'];
$path = '/www/cgi-bin/docu/personal/'.$file;
 //force download dialog
 header(Content-type: application/octet-stream\n);
 header(Content-disposition: attachment; filename=\$file\\n);
 header(Content-transfer-encoding: binary\n);
 header(Content-length:  . filesize($path) . \n);

 //send file contents
 $fp=fopen($path, r);
 fpassthru($fp);


Luis Lebron wrote:

I am working on a script to force downloading a file. The script works
fine

with NS (4.8 and 7) but does not work correctly with IE 6.0
I have looked at examples on php.net and have googled for a solution, but
still can't find a solution. I think IE wants to download the script
instead

of the file.

Here's what the code I'm working on looks like:

?php 
$sender=$_GET[sender];
$filename=$_GET[filename];

//Data validation goes here

$filePath=../users/.$sender./.$filename;
if(file_exists($filePath))
{
 Header(Content-Length: .filesize($filePath));
 Header(Content-type: application/download);
 Header(Content-Disposition-type: attachment);
 Header(Content-Disposition: filename=\.$filename.\\n);
 Header(Content-Transfer-Encoding: binary);
 $fp = fopen($filePath,rb);
 fpassthru($fp);
} 
?

The funny thing is that I have a similar script that I use to download an
sql file and it works correctly.
Luis R. Lebron
Sigmatech, Inc


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


Re: [PHP] Re: IE download problem

2003-11-26 Thread Bogdan Stancescu
Oh, so you're actively trying to trick IE, are you? Why don't you 
provide the proper image/jpeg MIME type? And why do you add a newline 
character at the end of the MIME type? (As previously asked before.)

Bogdan

Luis Lebron wrote:

Here's the error I'm getting

Internet Explorer cannot download...?sender=171filename=.jpg from
somedomain.com. Internet Explorer was not able to open this Internet site.
The requested site is either unavailable or cannot be found. Please try
again later.
thanks,

Luis

-Original Message-
From: Bogdan Stancescu [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 26, 2003 11:14 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Re: IE download problem
I was thinking the same. But until we can squeeze some information about 
the actual error from Luis, I think we're stuck.

Bogdan

Warren Vail wrote:


Could the problem be the associations stored in the windows system
registry?

I've had problems trying to download files whose name ends in a suffix
that

is registered as being associated with a given program (i.e. .txt with
notepad, .doc with word).  I believe that IE tries to open the file in the
registered application and Netscape doesn't always do that (could be wrong
here, but that's how it seemed to me).
Warren

-Original Message-
From: Luis Lebron [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 26, 2003 8:54 AM
To: 'pete M'; [EMAIL PROTECTED]
Subject: RE: [PHP] Re: IE download problem
I tried your code. I'm still getting the same errors.

thanks,

Luis

-Original Message-
From: pete M [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 26, 2003 10:52 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: IE download problem
thsi si a nighmare area. and loast days on same problem

This works for me.. hope it does for you

$file = $_GET['file'];
$path = '/www/cgi-bin/docu/personal/'.$file;
//force download dialog
header(Content-type: application/octet-stream\n);
header(Content-disposition: attachment; filename=\$file\\n);
header(Content-transfer-encoding: binary\n);
header(Content-length:  . filesize($path) . \n);

//send file contents
$fp=fopen($path, r);
fpassthru($fp);


Luis Lebron wrote:


I am working on a script to force downloading a file. The script works
fine


with NS (4.8 and 7) but does not work correctly with IE 6.0
I have looked at examples on php.net and have googled for a solution, but
still can't find a solution. I think IE wants to download the script
instead


of the file.

Here's what the code I'm working on looks like:

?php 
$sender=$_GET[sender];
$filename=$_GET[filename];

//Data validation goes here

$filePath=../users/.$sender./.$filename;
if(file_exists($filePath))
{
Header(Content-Length: .filesize($filePath));
Header(Content-type: application/download);
Header(Content-Disposition-type: attachment);
Header(Content-Disposition: filename=\.$filename.\\n);
Header(Content-Transfer-Encoding: binary);
$fp = fopen($filePath,rb);
fpassthru($fp);
} 
?

The funny thing is that I have a similar script that I use to download an
sql file and it works correctly.
Luis R. Lebron
Sigmatech, Inc



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


Re: [PHP] Re: IE download problem

2003-11-26 Thread Bogdan Stancescu
Ok, the last resort solution would be to use Mozilla, download 
LiveHeaders (check on Google) and see what headers a regular Apache 
sends when serving a regular JPG file. That's what I do when I have 
header problems... HTH

Bogdan

Luis Lebron wrote:

I tried sending the correct mime type and still had the same problem. I did
get rid of the newline for the test code.
Luis

-Original Message-
From: Bogdan Stancescu [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 26, 2003 11:28 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Re: IE download problem
Oh, so you're actively trying to trick IE, are you? Why don't you 
provide the proper image/jpeg MIME type? And why do you add a newline 
character at the end of the MIME type? (As previously asked before.)

Bogdan

Luis Lebron wrote:


Here's the error I'm getting

Internet Explorer cannot download...?sender=171filename=.jpg from
somedomain.com. Internet Explorer was not able to open this Internet site.
The requested site is either unavailable or cannot be found. Please try
again later.
thanks,

Luis

-Original Message-
From: Bogdan Stancescu [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 26, 2003 11:14 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Re: IE download problem
I was thinking the same. But until we can squeeze some information about 
the actual error from Luis, I think we're stuck.

Bogdan

Warren Vail wrote:



Could the problem be the associations stored in the windows system
registry?


I've had problems trying to download files whose name ends in a suffix
that


is registered as being associated with a given program (i.e. .txt with
notepad, .doc with word).  I believe that IE tries to open the file in the
registered application and Netscape doesn't always do that (could be wrong
here, but that's how it seemed to me).
Warren

-Original Message-
From: Luis Lebron [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 26, 2003 8:54 AM
To: 'pete M'; [EMAIL PROTECTED]
Subject: RE: [PHP] Re: IE download problem
I tried your code. I'm still getting the same errors.

thanks,

Luis

-Original Message-
From: pete M [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 26, 2003 10:52 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: IE download problem
thsi si a nighmare area. and loast days on same problem

This works for me.. hope it does for you

$file = $_GET['file'];
$path = '/www/cgi-bin/docu/personal/'.$file;
   //force download dialog
   header(Content-type: application/octet-stream\n);
   header(Content-disposition: attachment; filename=\$file\\n);
   header(Content-transfer-encoding: binary\n);
   header(Content-length:  . filesize($path) . \n);

   //send file contents
   $fp=fopen($path, r);
   fpassthru($fp);


Luis Lebron wrote:



I am working on a script to force downloading a file. The script works
fine



with NS (4.8 and 7) but does not work correctly with IE 6.0
I have looked at examples on php.net and have googled for a solution, but
still can't find a solution. I think IE wants to download the script
instead



of the file.

Here's what the code I'm working on looks like:

?php 
$sender=$_GET[sender];
$filename=$_GET[filename];

//Data validation goes here

$filePath=../users/.$sender./.$filename;
if(file_exists($filePath))
{
Header(Content-Length: .filesize($filePath));
Header(Content-type: application/download);
Header(Content-Disposition-type: attachment);
Header(Content-Disposition: filename=\.$filename.\\n);
Header(Content-Transfer-Encoding: binary);
$fp = fopen($filePath,rb);
fpassthru($fp);
} 
?

The funny thing is that I have a similar script that I use to download an
sql file and it works correctly.
Luis R. Lebron
Sigmatech, Inc



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


[PHP] Re: Instant timeout

2003-11-05 Thread Bogdan Stancescu
Do you have this problem (your PHP page times out) or do is this the 
desired result? For the latter, you've been answered, for the former it 
might be a core error in your code which PHP can't handle -- in this 
case the results are unpredictable, I typically get a document contains 
no data error, but I guess you could also get a time out, depending on 
the web server and its version. If this is the case, make a copy of the 
script and start chopping out pieces from it until you don't get the 
error anymore. The last chunk you deleted contains the problem. :)

Bogdan

Mike Yrabedra wrote:
What would cause a php page to instantly prompt a timeout error when
loading?


++
Mike Yrabedra (President)
323 Incorporated 
Home of MacDock.com, MacAgent.com and MacShirt.com
++
W: http://www.323inc.com/
P: 770.382.1195
F: 734.448.5164
E: [EMAIL PROTECTED]
I: ichatmacdock
++
Whatever you do, work at it with all your heart,
as working for the Lord, not for men.
~Colossians 3:23 {{{
++
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Changing the php.ini file

2003-11-05 Thread Bogdan Stancescu
Oh, yes, this is a big one, you must reset the whole state power grid. :)

Simply restarting Apache should do it. Check if your problem doesn't 
come from somewhere else - how are you checking if the changes took 
effect? Also, are you sure you're editing the proper php.ini and not 
some older install's or a backup or something? Check by setting some 
self-evident setting in php.ini and restarting Apache. Also, if you're 
sending the data to a database, make sure it's not the database who's 
barfing due to its own config settings or limitations.

HTH

Bogdan

Mike At Spy wrote:

I changed a value for max uploads in my php.ini file (linux box); I
restarted apache, then the whole server, to get the new value to come up
and, generally, take affect.
Neither of those things did it.  Does anyone know what I need to do to get
the ini file re-read by the OS, or system, so that the new value goes into
effect?
Thanks,

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


[PHP] Re: Java JSP and PHP script relation..??

2003-11-05 Thread Bogdan Stancescu
PHP is interpreted at runtime, I don't think it stores any such 
pre-parsed files, even for caching, anywhere else but in the memory. I 
might be wrong, but I've got a pretty strong gut feeling that's the way 
it goes.

Bogdan

Ryan A wrote:

Hi,
Coming from a java JSP background I have a small question,
in Java when you make a JSP, a servlet is created during execution and if
you poke around the webserver
you can actually find this servlet and read exactly what java reads before
executing...is the same thing possible
with php?
In theory PHP must be doing pretty much the same thing right? it must be
having its own copy of the script
which strips out all the commens etc, any idea where i can find this file as
i need to know exactly what php is
seeing and rendering
Thanks,
-Ryan
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Adding a log file

2003-11-05 Thread Bogdan Stancescu
$Addcart() -- is Addcart() a function (in which case you should remove 
the dollar sign) or are you specifically trying to do some magic there 
by running a function whose name is stored in that variable?

Bogdan

Robert Sossomon wrote:

I am seeing some errors with a program I wrote and I need to write
everything to a log file that the program is doing.
The following syntax I KNOW is wrong, but not sure they are important to
put here correctly yet.
//script addtocart
$Addcart (info1, info2)
Mysqlquey($addcart)
I am seeing random items NOT being added to my shopping cart.  The
reason, I have no clue. I can pull another catgory of items and the
first 20 will do fine, I go back to the first category I have and the
script seems to work correctly but the data is not written to the
shopping cart.  Problem with the shopping cart???  I wouldn't think so.
Problem with the add page, I don't see how.  So where is the error
coming from?  No clue, which is why I want to log everything.  I use 3
different add pages so that each form uses a different way to add.  This
works for me, and seems to work rather well.  But I need to log
everything on the 3 forms to see where the errors are coming from.
TIA!

Robert
~~~
To rest is to rust. 
~~~
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: null values

2003-09-08 Thread Bogdan Stancescu
?
  function countNulls($array)
  {
if (!is_array($array)) {
  return(NULL);
}
reset($array);
$count=0;
while(list(,$val)=each($array)) {
  if ($val===NULL) {
$count++;
  }
}
return($count);
  }
?
Aris Santillan wrote:

hi

how to count null values in an array?

tnx

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


[PHP] Re: Beta Testers Needed - Free software opportunity

2003-09-08 Thread Bogdan Stancescu
I think you could adjust your business model a bit, there are quite a 
few GPL projects offering a lot more than what you do, in a better 
groupware environment. For instance you could check out 
http://www.guydavis.ca/opt/ for a demo of a GPL project at least a few 
orders of magnitude above the one you propose.

Just my 2c, obviously,
Bogdan
Matt Palermo wrote:

First, I would like to thank all of you who have helped me with my questions
in the past.  I am going to return the favor by giving you an opportunity to
receive a free copy of the latest version of a calendar program, called
TotalCalendar.  SweetPHP.com will be giving out free copies of this software
to the first 5 people who agree to help with the beta testing and half-price
copies to anyone else who helps beta test.  After the beta testing phase is
complete, all beta testers will receive the full, final version at no
additional cost. If you would like to know more about this software, please
visit:


http://sweetphp.com/



There, you will find all the information, as well as a running demo of the
software. If you would like to sign up and become a beta testing, please
contact us at:


[EMAIL PROTECTED]



and we will send you the necessary information needed.  Thanks again to
everyone who has helped me out.


Matt Palermo

[EMAIL PROTECTED]

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


[PHP] Re: URGENT: how to make a global server temporarily down page?

2003-09-05 Thread Bogdan Stancescu
Typing Apache custom 404 and clicking on I feel lucky would get you 
to this information:

Apache

Add the following directive to your httpd.conf file (this file should be 
edited by someone knowledgeable about configuring an Apache Web server) 
or to an .htaccess file in your root (top-level) Web document directory: 
ErrorDocument 404 /404.html.

ErrorDocument is a directive that tells Apache that you are specifying a 
custom error handler, and 404 tells Apache which error you are 
customizing. Finally, /404.html specifies the location of the Web page 
to be used as the custom 404 message--in this case a file named 404.html 
located in the top-level document directory for this site.

Good luck! :)

Bogdan

David T-G wrote:

Hi, all --

I thought I knew the trick for this, but I don't, and I have about an
hour to figure it out.
We're going to be taking down our web server for some unavoidable
maintenance and we want to put up a polite we're not here page rather
than just look like we went out of business.  We're going to bring up
httpd but leave all databases etcetc turned off.
How can i make a script, perhaps with an htaccess trick file, which will
take
  example.com/
  example.com/login.php
  example.com/index.php?someparamsetc
and always be found?  The trick I knew depended on looking in a
subdirectory so that I could fake the name, but this has to work from the
root.
TIA  HAND

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


[PHP] Re: URGENT: how to make a global server temporarily down page?

2003-09-05 Thread Bogdan Stancescu
Errr... that is, in Google. ;)

Bogdan

Bogdan Stancescu wrote:

Typing Apache custom 404 and clicking on I feel lucky would get you 
to this information:

Apache

Add the following directive to your httpd.conf file (this file should be 
edited by someone knowledgeable about configuring an Apache Web server) 
or to an .htaccess file in your root (top-level) Web document directory: 
ErrorDocument 404 /404.html.

ErrorDocument is a directive that tells Apache that you are specifying a 
custom error handler, and 404 tells Apache which error you are 
customizing. Finally, /404.html specifies the location of the Web page 
to be used as the custom 404 message--in this case a file named 404.html 
located in the top-level document directory for this site.

Good luck! :)

Bogdan

David T-G wrote:

Hi, all --

I thought I knew the trick for this, but I don't, and I have about an
hour to figure it out.
We're going to be taking down our web server for some unavoidable
maintenance and we want to put up a polite we're not here page rather
than just look like we went out of business.  We're going to bring up
httpd but leave all databases etcetc turned off.
How can i make a script, perhaps with an htaccess trick file, which will
take
  example.com/
  example.com/login.php
  example.com/index.php?someparamsetc
and always be found?  The trick I knew depended on looking in a
subdirectory so that I could fake the name, but this has to work from the
root.
TIA  HAND

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


[PHP] Re: using fwrite to create PHP files

2003-09-05 Thread Bogdan Stancescu
To answer your question, you probably can do 
$new_file_content=.?.php\n . [...] . ?.;

But why in the world do you need this complication?

Bogdan

Vince Lamonica wrote:

Hi all,

I wish to use fwrite() to create a small PHP file. So far, when I attempt
to do this, php parses the contents of the file that fwrite needs to
create. Eg, I have this:
$new_id = mysql_insert_id();
// create brand new file
$new_file = fopen(/var/www/html/$sitename/$submitted_url, w);
$new_file_content = \n
. ?php \n
. if ($_GET['preview'] == \y\) { \n
. 
readfile(\http://www.foo.bar/${'sitename'}.display?${'sitename'}id=$new_idpreview=y\); 
\n
. } else { \n
. readfile(\http://www.foo.bar/${'sitename'}.display?${'sitename'}id=$new_id\); \n
. } \n
. ?;
write($new_file, $new_file_content);
fclose($new_file);
Note that $sitename is defined earlier in the script.

I know that $new_id and $sitename get expanded, as I tried this:

$new_file_content = hello world. Look at my ${'sitename'}.display and my $new_id;

and the new file was created with the above text and the two vars
expanded. My problem lies in the fact that I need to put ?php tags
inside the contents of $new_file_content. I'm not sure how to do that w/o
generating lots of errors. As you can see in my above example, I've tried
to escape the double quotes, but that didn't seem to help. PHP insists on
processing the if line instead of ignoring it.
I'm running 4.3.3 under apache 1.3.28.

Any help would be most appreciated!

/vjl/

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


[PHP] Re: Header()

2003-09-05 Thread Bogdan Stancescu
I don't think you can using headers. Why not Javascript?

Bogdan

Mixmastr wrote:

How can i do so header opens a new page in a new browser, instead of opening
the page inside the current browser?
-kjetil
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Loading advise (no problem)

2003-08-29 Thread Bogdan Stancescu
Hi Ryan,

Looks good from here, you should try a traceroute to that host, I think 
that's actually your problem... Or are you on a local network with that 
machine? Try the traceroute nevertheless, who knows how your hub is 
acting up... :)

Bogdan

Ryan A wrote:
Hi,
No problem, Just need a little advise on improving my page display time, let
me explain:
I am using some ad software (written in php) which is giving me 5 ads
(banners) to display on a page dynamically (eg: they rotate, banner code is
given at the end of this mail)
I have put all 5 banners on a page my themselfes, renamed the file to
TestingAds.php and used a microtime function to see whats the script
execution time like so:
?php
function mtime() {
$time = explode( , microtime());
$micro = doubleval($time[0]);
$sec = doubleval($time[1]);
return $micro + $sec; }
$start = mtime();
?
html and banner code here
?php
  $end = mtime();
$total = $end - $start;
echo Total script execution time: $total;
  ?
I ran TestingAds.php 10 times and these are the numbers, you dont have to
take an averige to see they are pretty good:
 0.00024902820587158
 0.00027501583099365
 0.00025904178619385
 0.00027906894683838
 0.00043702125549316
 0.00036203861236572
 0.00045394897460938
 0.00024497509002686
 0.00025498867034912
 0.00025796890258789
then i took those ads and placed them exactly where they have to go on my
index.php page, then reloaded the page 10 times and got these numbers:
 0.00018906593322754
 0.00066602230072021
 0.00055098533630371
 0.00054502487182617
 0.00054800510406494
 0.00055789947509766
 0.00054597854614258
 0.00056195259094238
 0.00056302547454834
 0.00049996376037598
The numbers look pretty good (i think), but when i actually visit the page
it takes  a bit long to load...even though I am on a pretty fast connection,
any idea why this is the case? my page takes around 20 seconds to load and
there is a white screen till everything is loaded then BLAM its all done.
What can i do so that my page loads faster or atleast shows the page to the
visitor and then loads one ad after another so the visitor can see the page
loading instead of just a white screen?
This is the banner code:
SCRIPT LANGUAGE=JavaScript
SRC=http://jumac.com/ads/ads.php?jscript;zone=tower;/SCRIPTNOSCRIPTIF
RAME SRC=http://jumac.com/ads/ads.php?iframe;zone=tower; MARGINWIDTH=0
MARGINHEIGHT=0 HSPACE=0 VSPACE=0 FRAMEBORDER=0 SCROLLING=NO WIDTH=121
HEIGHT=601A
HREF=http://jumac.com/ads/ads.php?banner=NonSSI;page=01;zone=tower;
TARGET=_blankIMG SRC=http://jumac.com/ads/ads.php?page=01;zone=tower;
BORDER=0/A/IFRAME/NOSCRIPT
here is the TestingAds page:
http://bestwebhosters.com/TestingAds.php
I have not included the main page that i have already setup the ads because
right now its still be touched up and nothing on the page works but if you
still want to see it just write to me and tell me.
Thanks for your time.
Cheers,
-Ryan





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


[PHP] Re: Script Help

2003-08-14 Thread Bogdan Stancescu
Maybe you could provide a little more information? For instance, is that 
proprieraty code? If so, maybe you can post some relevant excerpts of 
code? If not, what package and what version are you trying to install? 
Can you identify and post some code? Have you tried contacting the 
authors of the software?

Bogdan

Rod wrote:

I am installing a new message board system for my website, I can get it to
run, but when I want to log in as admin, or register a new user on the
board I get the following error
ERROR! 
Nothing specified! 

This is the url of the register script

http://www.mywebsite.com/forum/member.php?Action=Register

The script did create the table like it was supposed to, but for some
reason I can not log on as admin to change things in the database, yet it
is connecting to the database
Rod



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


[PHP] Re: LDAP_connect()

2003-08-02 Thread Bogdan Stancescu
http://ro.php.net/manual/en/ref.ldap.php#ldap.requirements

Ron Allen wrote:
Everytime I try to run this function it says that it is an undefined
function LDAP_connection



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


[PHP] Re: eval

2003-08-01 Thread Bogdan Stancescu
You can put whatever you want in eval:

?
  $foo='foo';
  $bar='bar';
  echo(foo is $foo; bar is $bar);
  $myCode='$foo=checking eval statements; ';
  $myCode.='$bar=str_replace( ,--,$foo);';
  eval($myCode);
  echo(foo is $foo; bar is $bar);
?
You could even do this:

?
  $foo='$i++;';
  $bar='eval($foo);';
  $i=1;
  eval($foo);
  echo(i=$i);
  eval($bar);
  echo(i=$i);
?
HTH

Bogdan

Decapode Azur wrote:

Is it possible to put PHP code in eval ?
Or just vars ?
?php

$string = 'The result of ?php $a=2; $b=3; $c=$a+$b; echo $a + $b is $c; 
?';

eval ($string);

?


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


[PHP] Re: A long float number.

2003-08-01 Thread Bogdan Stancescu
Keeping it on one line doesn't affect the calculations (as it 
shouldn't). Try using either sprintf() or number_format() for this 
purpose (the latter is generally preferred, but I don't know exactlt 
what you're after).

Bogdan

Zavaboy wrote:

How do I prevent a long float number end up like this after/during a
calculation?
8.5E-05  //A number error occurs.

I even tried keeping the whole calculation in 1 line:

//Get the weight (in pounds) of a O-Ring.
$N = round((0.03613 * 1.85 * ((pow(pi(), 2) * pow(($iDia[$d] - $oDia[$d]),
2) * ($iDia[$d] + $oDia[$d])) / 32)), 6);
Thanks in advance!



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


[PHP] Re: How to you compare dates in a query in Mysql

2003-07-31 Thread Bogdan Stancescu
Depends on what exactly you're after, but for strict comparison 
arithmetic operators work as expected (, , =).

Bogdan

Safal Solutions wrote:

Dear friends,

Plesae help in finding the correct syntax for comparing two dates in a query
in MySql database
Thank you
Subodh Gupta



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


[PHP] Re: php-cli - Controlling external programs

2003-07-31 Thread Bogdan Stancescu
Have you checked out the -F option for tar? It may prove helpful:

If you want more elaborate behavior than this, give tar the 
--info-script=script-name (--new-volume-script=script-name, -F 
script-name) option. The file script-name is expected to be a program 
(or shell script) to be run instead of the normal prompting procedure. 
When the program finishes, tar will immediately begin writing the next 
volume.

Bogdan

Mike Maltese wrote:

I'm writing a script to be run from the command line. It controls my DAT
autoloader (tape changer) and runs tar so that I can automate my backups.
With the -M option, tar will prompt for a new tape when the current tape is
full. How can I get the signal from tar that the tape needs to be changed?
Is there another way to interact with external programs other than, exec,
backticks, etc.? I'm running 4.3.2-cli on FreeBSD with POSIX and pcntl
functions enabled.
Thanks,
Mike



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


[PHP] Re: Right Click Hyperlink

2003-07-31 Thread Bogdan Stancescu
If you were to somehow accomplish this, you'd do it client-side, not 
server-side (i.e. using JavaScript, Visual Basic or whatever other 
scripting you could have the browser run, not PHP). Which makes the 
question kinda OT. But I don't think you'll be able to do this, *maybe* 
you could use double-click + JavaScript; right-click is pretty much 
taken in all broswers...

HTH

Bogdan

Matt Palermo wrote:

Does anyone know if there is anything in PHP or any other language that would 
allow a specific action to occur if a visitor right-clicked on a link.  For 
example, they could left click on it an go to a specified page, and they could 
also right-click it to go to a different page.  Anyone know of anything that 
can do this?

Thanks,

Matt




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


Re: [PHP] load the PHP script last on the page

2003-07-31 Thread Bogdan Stancescu
...or use flush() just before that piece of code, if that's the case (if 
you don't need its output to complete the page). The page will be sent, 
the browser will remain in the page in progress state until the whole 
script is done, but that shouldn't bother your users, since they have 
the whole page to look at by that time.

Bogdan

John W. Holmes wrote:

DougD wrote:

I have a page with a particular PHP section that takes quite a time to 
load.
Is there a way I can delay that script to run after everything else has
loaded. I suppose it may need to use Javascript


You could use register_shutdown_function() to execute the code, 
providing you don't need any output sent to the browser. Do some testing 
as to whether PHP still waits for that function to finish or not, but I 
don't think it does.



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


[PHP] Re: Image resizing

2002-12-19 Thread Bogdan Stancescu
What platform are you running PHP on?

Shaun wrote:

Hi,

My webserver doesn't have the GD library installed, please can someone tell
me how I can resize uploaded images for thumbnails?

Thanks for your help





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




Re: [PHP] How to upload a file

2002-12-18 Thread Bogdan Stancescu
Are you sure it's PHP the one that fails? i.e. do you get the some 
error has occured while uploading the file $userfile_namebr message 
or some other message? I had this kind of problem when trying to store 
incoming files in a database, and the link to the database failed, not PHP.

Also, if you have a slow connection, PHP might time out? I'm not sure if 
this is possible though, because I expect Apache to handle the upload 
(well, technically the download) and only run your PHP script after it 
finished that, but who knows?

Bogdan

Somesh wrote:
Hi Jon,
	It is as follows
	; Maximum allowed size for uploaded files.
	upload_max_filesize = 8M

On Wed, 18 Dec 2002, Jon Haworth wrote:



Hi Somesh,



This works fine for small files of like some 
Kbs but fails to upload larger files near to 1MB.

What's your upload_max_size set to in php.ini?

Cheers
Jon







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




Re: [PHP] preventing sql injections

2002-12-18 Thread Bogdan Stancescu
Also, please note that if you're using MySQL you don't have to bother at 
all security-wise - MySQL won't accept more than one query per 
mysql_query(). You do have to bother about regular errors though - if 
$f_namn or $email contain quotes (which $email might well contain) then 
you're going to end up with a database ERROR - but no harm done.

Bogdan

1lt John W. Holmes wrote:
addslashes should be enough and put qoutes arround your strings in the


sql


 Meaning that a query like this one is safe, as long as I first have
$e_namn = addslashes($e_namn);?

$query = INSERT INTO addr (last_name, first_name, email)
VALUES(\$e_namn\,\$f_namn\,\$email\);



Yeah, as long as you do the same for $f_namn and $email.

---John Holmes...




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




Re: [PHP] preventing sql injections

2002-12-18 Thread Bogdan Stancescu
Thy words are wise, milord.

Bogdan

John W. Holmes wrote:

Also, please note that if you're using MySQL you don't have to bother


at


all security-wise - MySQL won't accept more than one query per
mysql_query(). You do have to bother about regular errors though - if
$f_namn or $email contain quotes (which $email might well contain)


then


you're going to end up with a database ERROR - but no harm done.



Why would you say that? While technically true that only one query can
be executed per mysql_query(), you still have to worry about SQL
Injection. Yes, they can't inject their own SQL queries, but they could
affect the ones you issue. They could add a OR 1 onto a select,
causing it to return all rows from a table and possibly let them view
data they shouldn't. Or, they can do the same thing on an UPDATE and
provide their own values. It's still something to be aware of and
program against. 

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/




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




[PHP] Re: writing uploaded file to another drive on another network?

2002-12-17 Thread Bogdan Stancescu
No, it's not stupid - I don't know why you may need this but as long as 
you need it...

Anyway. It would be interesting to know what OS you're using on both 
ends of the connection. If they're both *nix machines, it's rather 
simple. You typically copy the uploaded file from the temporary location 
to their final destination on upload. You might as well copy them to a 
remote location instead using system calls, such as scp. Setting up scp 
to not require command line authentication is done as follows:

web_serv$ ssh-keygen -t rsa
web_serv$ scp .ssh/id_rsa.pub remote_serv:
remote_serv$ cd ~; mkdir .ssh
remote_serv$ cat id_rsa.pub  .ssh/authorized_keys2
remote_serv$ chmod -R go-rwx .ssh; rm id_rsa.pub
web_serv$ ssh webserver

(running as apache on both machines)

This is the cleanest method I can think of. There are lots of in-between 
solutions, but I guess the last resort (ugliest) solution would be 
having an Apache server on the receivng end as well, and using whatever 
method to send the files via HTTP (Curl, home grown function to build a 
POST request or one of the zillions of similar libraries freely available).

After all, you could even have the form on the web server directed to 
your local machine running Apache, and upon receiving the file you could 
perform a redirect via HTTP back to the web server.

Just my 2c.
Bogdan

Kenn Murrah wrote:
admitting in advance that this may be a REALLY stupid question ..

i've created a page for uploading files using PHP, and it works fine ... is
it possible to write that uploaded file to another drive, on another
network?

for instance, my PHP pages are currently being hosted offsite ... would it
be possible to direct the uploaded pages to a box that's located at the
office? something like 192.168.100.41/home/mydirectory ???

thanks, and feel free to laugh at my question :-)






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




[PHP] Re: Print bgcolors in table

2002-12-16 Thread Bogdan Stancescu
As far as I can see, this is not even an HTML question - it's more of a 
user agent question.

Lars Espelid wrote:
Hello,

I have been looking for a newsgroup where I can post questions about
css/html. I did not find any. Any suggestions?

If you want a break from php, my problem is as follows:

Have got a table in html with different background colors on the rows. When
I print the page to my printer, the colors won't show. I have tried to
specify output media, but it won't work. Tried f.ex. this:

in print.css:
@media print {
TR.graaOver { BACKGROUND-COLOR: #E5E5E5; }
  }

in report.html:
.
link href=../print.css rel=stylesheet media=print, screen
type=text/css
/head

body

table
  tr class=graaOver
..


thanks,

Lars






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




[PHP] Re: Can php auto execute it's script in schedule without openinga webpage?

2002-12-16 Thread Bogdan Stancescu
The other replies you received are correct - but if you somehow DON'T 
have a CLI PHP (e.g. using PHP3 for some strange reason, or too lazy to 
upgrade), you can use the same crontab/scheduler to execute wget 
(recommended on *nix) or lynx (available for both Win and *nix) to 
retrieve the actual page via HTTP.

Bogdan

Jack wrote:
Dear all
I just wonder did anyone know if php can act as a scheduler rather than
execute script manually?
i want to set a schedule for php to run certain script at specify time, to
what i understood in php is : the script can only be process when a homepage
had been execute. but i want the script to be excute even no one open a
homepage contain php script in it!

is there anyway i can do that?

thx
Jack





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




[PHP] Re: php --with-gd support

2002-12-16 Thread Bogdan Stancescu
ok

[EMAIL PROTECTED] wrote:

Hello List,

I want to know all about copiling, installing and configuring php with gd-support.

Anybody knows a good site or book to read about?
Oliver Etzel




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




[PHP] Re: php --with-gd support

2002-12-16 Thread Bogdan Stancescu
Sorry, I only saw the first line in your message (I want to know all 
about...) - somehow assumed the 2nd to be part of the sig on first 
reading - and hurried to be cynical.

Can't help you with a good site/book. Why don't you RTFM instead? :)

Bogdan

[EMAIL PROTECTED] wrote:
Hello List,

I want to know all about copiling, installing and configuring php with gd-support.

Anybody knows a good site or book to read about?
Oliver Etzel




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




Re: [PHP] Re: File Upload

2002-12-14 Thread Bogdan Stancescu
Ok, have you tried
?
  echo(pre);
  print_r($_FILES);
  echo(/pre);
?

at the beginning of the 2nd script? What does it say?

Bogdan

Miro Kralovic wrote:

Hi Bodgan..

yes, I have globals On, Uploads On and SafeMode=off.. no luck... 

I did it exactly by the book, damn it..:-(


-Original Message-
From: Bogdan Stancescu [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 13, 2002 22:09
To: [EMAIL PROTECTED]
Subject: [PHP] Re: File Upload


Globals on? File uploads allowed? Safe mode off?




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




[PHP] Re: errorno error codes

2002-12-13 Thread Bogdan Stancescu
I guess that depends on what exactly you're executing?

If the return_var argument is present, the return status of the *Unix 
command* will be placed here.

Bogdan

[EMAIL PROTECTED] wrote:
In reality this is a linux question. If I use in PHP passthru or system, the
linux OS will return an error number. Somebody can provide me with a link
where they are listed and explained?

--
René
www.comunica2.net





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




Re: [PHP] What's the Difference?

2002-12-13 Thread Bogdan Stancescu
...therefore it's faster. Only use it when you really need regexp 
functionality - same with all other functions which are dual straight 
string/regexp matching.

Leif K-Brooks wrote:
str_replace() doesn't have regex.

Stephen wrote:


I can't quite figure this out... What exactly is the difference between
str_replace() and ereg_replace()? Don't they both do the exact same 
thing?

Thanks,
Stephen Craton
http://www.melchior.us

What is a dreamer that cannot persevere? -- http://www.melchior.us

 





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




Re: [PHP] What's the Difference?

2002-12-13 Thread Bogdan Stancescu
Ok, you get the meaning even though my mail is confusing: only use 
*regexp functions* when you need regexp [etc]

Bogdan Stancescu wrote:
...therefore it's faster. Only use it when you really need regexp 
functionality - same with all other functions which are dual straight 
string/regexp matching.

Leif K-Brooks wrote:

str_replace() doesn't have regex.

Stephen wrote:


I can't quite figure this out... What exactly is the difference between
str_replace() and ereg_replace()? Don't they both do the exact same 
thing?

Thanks,
Stephen Craton
http://www.melchior.us

What is a dreamer that cannot persevere? -- http://www.melchior.us

 







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




[PHP] Re: Fw: printf %d

2002-12-13 Thread Bogdan Stancescu
No big deal, mate. Here, let's take a look at the PHP printf() manual 
page. If you don't know how to reach it, go to http://www.google.com/, 
type php, click on I'm feeling lucky, and in the resulting page type 
printf in the search box (hint: top right) - complex, but not science 
rocket. Anyway, looking at the printf manual page, we notice it says

void printf ( string format [, mixed args])

Produces output according to format, which is described in the 
documentation for sprintf().

Hummm, not much to go on. BUT, upon closer inspection, we may notice a 
reference to this other function: sprintf. The PHP team is a bunch of 
nice guys, and they even spare us the effort of typing sprintf in the 
search box: they provide us with a direct link in the very text of the 
page! Should you miss that, they even provide a duplicate in the See 
also section. Try clicking on either - they take you to the same place, 
and, behold, the answer to your question is indeed there.

If you had the patience to go through this e-mail (took you MUCH longer 
to read this than actually do it yourself), then you should also take 
the time to read this piece: 
http://www.tuxedo.org/~esr/faqs/smart-questions.html - it'll save you 
time and ridicule in the future. If you're too busy to go through the 
whole piece, I would recommend this chapter in particular: 
http://www.tuxedo.org/~esr/faqs/smart-questions.html#rtfm

Regards,
Bogdan

William Martell wrote:
- Original Message - 
From: William Martell [EMAIL PROTECTED]
To: [EMAIL PROTECTED];
Sent: Friday, December 13, 2002 2:13 PM
Subject: printf %d



Hello All.

Can anyone tell me what this '%d' refers to?

A pointer would be great.  Thanks

[snip]
if (!$result)
die (Query Failed\n);
else
printf (Number of rows returned: %d\nbrbr,
-HERE '%d'
mysql_num_rows ($result));
while ($query_data = mysql_fetch_array ($result))
{

 echo Part#: .$query_data[holman_part].br;
 echo Description: .$query_data[part_desc].brbrbr;
}
[/snip]







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




[PHP] Re: Shared Memory in PHP

2002-12-13 Thread Bogdan Stancescu
Hi Krishnan!

I never tried using shared memory functions in PHP, but the problem is 
interesting in itself, and I do have a potential interest in the issue 
myself. So I went through the documentation on php.net and, since nobody 
else answered yet, I'll have a go at it.

Apparently the second option is better for not so complex stuff, based 
on user comments. Here, read this and the two subsequent replies: 
http://www.php.net/manual/en/ref.shmop.php##10524

Again, I never used these functions myself, so I may be speaking 
nonsense here - if anyone knows better, I'd also be glad to hear it! :)

Regards,
Bogdan

Krishnan wrote:
Hi all,
   I am new to PHP and would like the expert opinion of this forum on
something that I am trying to do
I have about 500K entries (name,value pairs) for which I want ti implement a
very fast lookup. I have access to an Oracle database server but I am afraid
that it does not have any power to handle the volume.
  Instead I am thinking of loading these entries in shared memory on
each (Apache) web server and look it up from my PHP script. (I have enough
memory on the server to set aside enough shared memory area to hold these
entries).
 Going through the PHP Documentation, I find 2 sets of functions:
  1.shm_attach,shm_put_var,shm_get_var etc.
  2. shmop_open,shmop_write,shmop_read etc.
   Which set of functions is the correct one to use (I am running PHP
4.1.x)
 Ideally, I'd like to implement a hash (to use a PERL term) in
shared memory that is accessible from PHP.
 Is this proposed approach too outrageous?
 Any thoughts on this would be greatly appreciated.

TIA
Krishnan





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




[PHP] Re: Fw: PHP script needs to timeout upon FOPEN to URL

2002-12-13 Thread Bogdan Stancescu
Try this:
while ((!($file = @fopen(http://www.myurl.com;, r)))  (time()  
$startTime + $time));

Here's why: http://www.php.net/manual/sk/language.operators.php

Regards,
Bogdan

Phil Powell wrote:
- Original Message - 
From: [EMAIL PROTECTED] [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, December 13, 2002 5:13 PM
Subject: PHP script needs to timeout upon FOPEN to URL


I have the following line:

while (!($file = @fopen(http://www.myurl.com;, r))  time() 
$startTime + $time);
if (!$file){
 echo Timed out, try again later;
} else {
 // do stuff
}

Problem is, when it attempts to connect to the remote server, it's supposed
to time out after 2-5 seconds, but it doesn't, it just locks up :(  Any
suggestions?

Phil


mail2web - Check your email from the web at
http://mail2web.com/ .





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




[PHP] Re: Using - to access hash elements

2002-12-13 Thread Bogdan Stancescu
http://www.php.net/manual/en/language.oop.php

William Martell wrote:

Can someone shed some light on the '-' syntax seen below.  Is this like
similar to Perl '=' syntax to access hash key value pairs?

Thank you one and all.

[snip]
// print mailing list
while($data = mysql_fetch_object($result)){
   print($data-name . ,  . $data-address . ,  . $data-city . ,  .
$data-state . ,  . $data-zip . \n);
}
[/snip]







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




[PHP] Re: File Upload

2002-12-13 Thread Bogdan Stancescu
Globals on? File uploads allowed? Safe mode off?

Miro Kralovic wrote:

Hi everybody,

I'm trying to upload a file using the following scripts, but it doesn't
work, it actually doesn't get through the first line of PHP script at all
and displays a problem has occured message. I'm running the script on RH
Linux/PHP4. Is there anything I'm missing here???

Many thanks in advance,
Miro.

-
[upload_file.html]

html
headtitleFile Upload/title/head

body
form id=data method=post action=input_file.php
enctype=multipart/form-data
p
Choose a file: br
input name=testfile type=file size=50 maxlength=10br
input name=submit type=submit
/p
/form

/body
/html

[input_file.php]

?php
if ($testfile)
{
	if (is_uploaded_file($testfile))
	{
	echo userfile: $testfilebr\n;
	echo userfile_name: $testfile_namebr\n;
	echo userfile_size: $testfile_sizebr\n;
	}
	else
	{
	echo no file updated;
	}
}
else
{
	echo a problem has occured;
}
?





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




[PHP] Re: lynx and crontab

2002-10-15 Thread Bogdan Stancescu

The syntax I use for this purpose is either:
lynx -source URL
or
wget -q -O - URL
depending on whether lynx or wget are installed.

HTH

Bogdan

Adrian Murphy wrote:
 my isp lets me control crontab so i've been trying to
 run a php script every 30 mins.
 
 the command is like this:
 lynx - dump http://www.mysite.com/test.php
 
 which gives the error
 
 lynx: Start file could not be found or is not text/html or text/plain
 
 what do i telll my isp to do to get lynx to supprt .php files?
 (i get a better response from them if i tell them exactly what to do ;-)  )
 
 tia 
 adrian
 


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




[PHP] Re: Fatal error: Cannot use [] for reading

2002-10-11 Thread Bogdan Stancescu

That piece of code works. Maybe you could be so kind as to post the 
exact piece of code which doesn't work? If it's not too much to ask, of 
course.

Bogdan

Leif K-Brooks wrote:
 Any idea what that error means?  I'm trying to do something like:
 $array[] = array(a = a value);
 


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




Re: [PHP] Fatal error: Cannot use [] for reading

2002-10-11 Thread Bogdan Stancescu

It works both with and without quotes around the key. Which is normal - 
you will be amazed at how forgiving PHP is - try this:

?
   echo(test);
?

Bogdan

Leif K-Brooks wrote:
 I am using quotes around the key, just a dumb mistake in the example...
 
 Leif K-Brooks wrote:
 
 Any idea what that error means?  I'm trying to do something like:
 $array[] = array(a = a value);

 


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




Re: [PHP] Re: Fatal error: Cannot use [] for reading

2002-10-11 Thread Bogdan Stancescu

Yup, that works as well. You could try a debugging echo after that line 
and see if it gets executed. You probably have a problem somewhere else.

Bogdan

Leif K-Brooks wrote:
 $actions[] = array(display = Discard);
 
 Bogdan Stancescu wrote:
 
 That piece of code works. Maybe you could be so kind as to post the 
 exact piece of code which doesn't work? If it's not too much to ask, 
 of course.

 Bogdan

 Leif K-Brooks wrote:

 Any idea what that error means?  I'm trying to do something like:
 $array[] = array(a = a value);



 


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




Re: [PHP] Re: site path

2002-10-11 Thread Bogdan Stancescu

If you really need to get picky, then I shall... well, point out the 
obvious:

echo a href='$theURL/'Go to some folder/a;

And since we got into this, there are some servers where you don't have 
control over http config, so you shouldn't want to link to directories 
at all - you'd want to specify the exact file to link to, as in

echo a href='$theURL/index.php'Go to some folder/a;

Bogdan

 Edwin wrote:
 Well, I agree about what you said
 
 
IMHO, the second comes more natural to write, is easier to understand at
a glance, is less prone to errors and, well, it's shorter!
 
 
 but remember the topic is about whether the trailing slash would create a
 problem or not.
 
 I think you're aware that there are some servers are not configured to
 understand that
 
   http://www.domain.com/somefolder
 
 is equal to http://www.domain.com/somefolder/ . So, NOT having the trailing
 slash might even create some problems.
 
 So, it's a matter of opinion (and use) whether adding a trailing slash would
 create a problem or not. So imagine how this code will work:
 
   echo a href='$theURL'Go to some folder/a;
 
 - E
 
 On Friday, October 11, 2002 2:28 PM
 Bogdan Stancescu wrote:
 
Ok, then I honestly don't understand why anyone would rather write this

echo a href=' . $myURL . home'Go home/a;

instead of this

echo a href='$myURL/home'Go home/a;

IMHO, the second comes more natural to write, is easier to understand at
a glance, is less prone to errors and, well, it's shorter!

Bogdan

 Edwin wrote:

Not exactly. Single quotes are fine. I missed the fact that the single
quotes here



echo(A HREF='$my_URLhome'Go home/A);


will be included in the source--sorry about that.

Well, then, to rewrite the code earlier,



echo 'a href=' . $my_URL . 'homeGo home/a';


this way:

  echo a href=' . $myURL . home'Go home/a;

that would still not give you the trailing slash problem. In other
 
 words,
 
it's just a matter of how you write the code... ;)

- E

On Friday, October 11, 2002 1:06 AM
Bogdan Stancescu wrote:



I'm not sure exactly what you're trying to point out - does XHTML
require double quotes?

Bogdan

 Edwin wrote:


Just a thought...

If you're going to write an XHTML compatible code, you wouldn't really

have


this problem --

 echo(A HREF='$my_URLhome'Go home/A);


since you'll probably write something like this:

 echo 'a href=' . $my_URL . 'homeGo home/a'; 
Of course, I didn't mean that you can't do that with HTML...

[snip]


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



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




[PHP] [Slightly OT] Using Mozilla? Here!

2002-10-11 Thread Bogdan Stancescu

Just created a Mozilla keyword for the php manual, after being too lazy 
for too long, so here it is, in case anyone else finds it useful:

http://www.php.net/search.php?show=quickrefpattern=%s

The keyword is obviously php (at least in my case). Since I already 
spammed you with this, here are a couple of others I use:

Dictionary
http://dictionary.com/search?q=%s

Google Feeling Lucky
http://www.google.com/search?btnI=1q=%s

And, in case you don't know about bookmarklets, here's a link: 
http://www.squarefree.com/bookmarklets/

Hope this helps somebody...

Bogdan


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




Re: [PHP] Re: Object methods - memory usage?

2002-10-10 Thread Bogdan Stancescu


Heh, I should probably be mad at your reply - but I'm not, I'm objective 
enough to realize I could've replied the same way to a whining message 
like mine below. What I AM mad about is the reply of rest of the people 
on this list. And that's not because nobody replied to this question 
alone, but because this is the third (or so) question I ask on this 
list, and it's the third time I get no reply.

And yes, I know I'm not paying for support so there's no guarantee for 
any, but c'mon, we're humans, you'd be annoyed as well if this happened 
to you, especially since there are few unanswered questions here.

Anyway, I don't expect this message to gain me a reply to my original 
question - just wanted to explain myself for whoever has the curiosity 
to find out why I reacted like that. There.

Bogdan

John W. Holmes wrote:
 OK.
 
 
-Original Message-
From: Bogdan Stancescu [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 09, 2002 4:30 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: Object methods - memory usage?

Well, I guess my questions are just too stupid to deserve an answer
anyway. Sorry for spamming you guys with my retarded questions! I'll
refrain from asking any more questions on this list in the future,
 
 since
 
I always seem to ask the wrong ones.

Humbly yours,
Bogdan

Bogdan Stancescu wrote:

Hello!

Ok, this is probably a very stupid question for someone who knows
 
 how
 
these things work internally - but I don't, therefore I ask. :)

When I instantiate an object, do the methods get instantiated as
 
 well?
 
The question is asked memory-wise, not functionality-wise. More to
 
 the
 
point, if I instantiate many identical objects with no class
 
 variables
 
of their own but with many methods, will I get memory used up for
 
 the
 
methods?

If I were to guess, I'd say no extra memory is used for the methods
since I don't think you can dynamically redefine class methods, so
 
 there
 
would be no reason for duplicating them instead of simply
 
 referencing
 
the class definition - but then again, I don't know how PHP works
internally...

Thank you!

Bogdan



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


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




[PHP] Re: site path

2002-10-10 Thread Bogdan Stancescu

I generally use both - the first for includes and the second for HTML links.

Do NOT include the trailing slash. The reason is simple:
?
   echo(A HREF='$my_URL/home'Go home/A);
?
is much simpler to write and follow than
?
   echo(A HREF='{$my_URL}home'Go home/A);
?
because you obviously can't write
?
   echo(A HREF='$my_URLhome'Go home/A);
?

Please remember that since the trailing slash will be included in every 
use of this var, if your URL is the root then the variable will have to 
be empty! (otherwise you'll end up with a double slash at the beginning 
of every URL)

Bogdan

Wilmar Perez wrote:
 Hello guys
 
 I'm just looking for some advise:  I've got a variable which I use to store 
 my site's main path.  Is it better to have it like this:
 
 $site_path = /my/web/path/
 
 or like this:
 
 $site_path = http://my_url.com/;
 
 ?
 
 What about the trailing slash?, should I use it or not?
 
 I know these are simple question but haven't been able to get to an answer on 
 my own.
 
 Thanks a lot
 
 ***
  Wilmar Pérez
  Network Administrator
Library System
   Tel: ++57(4)2105145
 University of Antioquia
Medellín - Colombia
   2002
 ***
  
  


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




Re: [PHP] Re: site path

2002-10-10 Thread Bogdan Stancescu

I'm not sure exactly what you're trying to point out - does XHTML 
require double quotes?

Bogdan

 Edwin wrote:
 Just a thought...
 
 If you're going to write an XHTML compatible code, you wouldn't really have
 this problem --
 
   echo(A HREF='$my_URLhome'Go home/A);
 
 
 since you'll probably write something like this:
 
   echo 'a href=' . $my_URL . 'homeGo home/a'; 
 Of course, I didn't mean that you can't do that with HTML...
 
 Anyway, for the original question, I think, you shouldn't really add
 http://; to every link that points to the same site. Most probably, the
 browser and the server can handle the request faster since *I think* it
 doesn't need to query a DNS server for each request. I'm not sure about this
 one though... :( Need more research...
 
 - E
 
 On Thursday, October 10, 2002 10:18 PM
 Bogdan Stancescu wrote:
 
 
I generally use both - the first for includes and the second for HTML
 
 links.
 
Do NOT include the trailing slash. The reason is simple:
?
   echo(A HREF='$my_URL/home'Go home/A);
?
is much simpler to write and follow than
?
   echo(A HREF='{$my_URL}home'Go home/A);
?
because you obviously can't write
?
   echo(A HREF='$my_URLhome'Go home/A);
?

Please remember that since the trailing slash will be included in every
use of this var, if your URL is the root then the variable will have to
be empty! (otherwise you'll end up with a double slash at the beginning
of every URL)

Bogdan

Wilmar Perez wrote:

Hello guys

I'm just looking for some advise:  I've got a variable which I use to
 
 store
 
my site's main path.  Is it better to have it like this:

$site_path = /my/web/path/

or like this:

$site_path = http://my_url.com/;

?

What about the trailing slash?, should I use it or not?

I know these are simple question but haven't been able to get to an
 
 answer on
 
my own.

Thanks a lot

***
 Wilmar Pérez
 Network Administrator
   Library System
  Tel: ++57(4)2105145
University of Antioquia
   Medellín - Colombia
  2002
***




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



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




Re: [PHP] Re: site path

2002-10-10 Thread Bogdan Stancescu

Ok, then I honestly don't understand why anyone would rather write this

echo a href=' . $myURL . home'Go home/a;

instead of this

echo a href='$myURL/home'Go home/a;

IMHO, the second comes more natural to write, is easier to understand at 
a glance, is less prone to errors and, well, it's shorter!

Bogdan

 Edwin wrote:
 Not exactly. Single quotes are fine. I missed the fact that the single
 quotes here
 
 
echo(A HREF='$my_URLhome'Go home/A);
 
 
 will be included in the source--sorry about that.
 
 Well, then, to rewrite the code earlier,
 
 
echo 'a href=' . $my_URL . 'homeGo home/a';
 
 
 this way:
 
   echo a href=' . $myURL . home'Go home/a;
 
 that would still not give you the trailing slash problem. In other words,
 it's just a matter of how you write the code... ;)
 
 - E
 
 On Friday, October 11, 2002 1:06 AM
 Bogdan Stancescu wrote:
 
 
I'm not sure exactly what you're trying to point out - does XHTML
require double quotes?

Bogdan

 Edwin wrote:

Just a thought...

If you're going to write an XHTML compatible code, you wouldn't really
 
 have
 
this problem --

  echo(A HREF='$my_URLhome'Go home/A);


since you'll probably write something like this:

  echo 'a href=' . $my_URL . 'homeGo home/a'; 
Of course, I didn't mean that you can't do that with HTML...
 
 [snip]


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




[PHP] Object methods - memory usage?

2002-10-09 Thread Bogdan Stancescu

Hello!

Ok, this is probably a very stupid question for someone who knows how 
these things work internally - but I don't, therefore I ask. :)

When I instantiate an object, do the methods get instantiated as well? 
The question is asked memory-wise, not functionality-wise. More to the 
point, if I instantiate many identical objects with no class variables 
of their own but with many methods, will I get memory used up for the 
methods?

If I were to guess, I'd say no extra memory is used for the methods 
since I don't think you can dynamically redefine class methods, so there 
would be no reason for duplicating them instead of simply referencing 
the class definition - but then again, I don't know how PHP works 
internally...

Thank you!

Bogdan


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




[PHP] Re: parts of sentences

2002-10-09 Thread Bogdan Stancescu

You might want to take a look at explode() and array functions - I don't 
understand exactly what you want (I want this -- or that), but those 
will probably solve the problem, whatever that is specifically.

Bogdan

Oliver Witt wrote:
 Hi,
 I have a problem that I don't know how to solve within php.
 I have the variable $x = How are you today and the variable $y. Now, I
 want the variable to be $y = are you today or $y = you today. How do
 I do that?
 Thanks,
 Oliver
 


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




[PHP] Re: parts of sentences

2002-10-09 Thread Bogdan Stancescu

Glad it helps - be sure to also check implode() for the reverse action!

Bogdan

Oliver Witt wrote:
 Bogdan Stancescu schrieb:
 
 
You might want to take a look at explode() and array functions - I don't
understand exactly what you want (I want this -- or that), but those
will probably solve the problem, whatever that is specifically.

Bogdan

Oliver Witt wrote:

Hi,
I have a problem that I don't know how to solve within php.
I have the variable $x = How are you today and the variable $y. Now, I
want the variable to be $y = are you today or $y = you today. How do
I do that?
Thanks,
Oliver

 
 
 Thanks, explode() is what i needed ^^
 Olli
 
 


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




[PHP] Re: Object methods - memory usage?

2002-10-09 Thread Bogdan Stancescu

Well, I guess my questions are just too stupid to deserve an answer 
anyway. Sorry for spamming you guys with my retarded questions! I'll 
refrain from asking any more questions on this list in the future, since 
I always seem to ask the wrong ones.

Humbly yours,
Bogdan

Bogdan Stancescu wrote:
 Hello!
 
 Ok, this is probably a very stupid question for someone who knows how 
 these things work internally - but I don't, therefore I ask. :)
 
 When I instantiate an object, do the methods get instantiated as well? 
 The question is asked memory-wise, not functionality-wise. More to the 
 point, if I instantiate many identical objects with no class variables 
 of their own but with many methods, will I get memory used up for the 
 methods?
 
 If I were to guess, I'd say no extra memory is used for the methods 
 since I don't think you can dynamically redefine class methods, so there 
 would be no reason for duplicating them instead of simply referencing 
 the class definition - but then again, I don't know how PHP works 
 internally...
 
 Thank you!
 
 Bogdan
 


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




[PHP] Re: Inheritance Question

2002-10-08 Thread Bogdan Stancescu

Hi!

I don't know about the memory, but I think the recommended way would 
be your first choice because you might want to redefine method jk() in 
class bar... I would suspect that would also be recommended 
performance-wise as well - since that's the typical way to call methods, 
I think it's better optimised.

Just my 2c, of course.

Bogdan

Jarrad Kabral wrote:
 Hi all,
 
 Was just wondering which is the better way to call an inherited method from
 a child class?
 
 Example:
 
 class foo {
 function jk() {
 echo In here!;
 }
 }
 
 class bar extends foo {
 function do_something() {
 //Either this one...
 $this-jk();
 
 //Or this one...??
 foo::jk();
 }
 }
 
 Which is the best way? Is one a way a less memory intensive way than the
 other?
 
 
 Thanks in advance
 Jarrad Kabral
 


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




[PHP] Re: Change user agent when using file() or fopen()

2002-08-29 Thread Bogdan Stancescu

You'll have to do it the hard way if you need that functionality - i.e. 
open a port on the remote machine (port 80), build a http query, send it 
and read from the port. That way you can control the whole process and 
send whatever browser identification, require certain languages, manage 
the transfer etc.

Bogdan

David Yee wrote:
 How do I change the browser name and version presented to the target web
 server when I use file() or fopen()?  E.g.
 
 ?php
 $content = file('http://foo.bar/foo.html');
 ?
 
 The access_log for the web server will show something like:
 
 127.0.0.1 - - [29/Aug/2002:00:08:59 -0700] GET /foo.html HTTP/1.0 404 45
 - PHP/4.2.2
 
 I want to change PHP/4.2.2 to something like Mozilla/4.0 (compatible;
 MSIE 5.01; Windows NT).
 
 I looked in php.ini but couldn't find a setting for this.  Anyone know where
 to set this?  Thanks.
 
 David
 



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




[PHP] Re: PHP - Chat?

2002-08-27 Thread Bogdan Stancescu

Check freshmeat - there are a couple of more than reasonable such 
projects (unfortunately I don't remember the names, but I checked some 
out and they seemed ok).

Bogdan

Andy wrote:
 HI there,
 
 I am wondering if a Chat coded in PHP would be sufficiant for a medium sized
 site. Maybe someone has a working example online. It would be no problem to
 get a ircdeamon working, just the client is in question.
 
 Thank you for your suggestions,
 
 Andy
 
 
 
 
 
 
 


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




[PHP] Re: Tricky question - referrer from ousite, or from intern?

2002-08-27 Thread Bogdan Stancescu

Justin is right, there's no guarantee the referrer will be set. What you 
can do however is have a common pre-registration page you link to from 
everywhere on the site - and set some variable there to acknowledge they 
came from the site - and give members the direct address to the 
registration page.

What I wonder is how could a non-referred user be confused with a 
referred one - doesn't the referred one have some kind of variable in 
the URL which identifies the referer (i.e. isn't each referer being 
given a customized URL to pass to his/her referees?!).

Bogdan

Andy wrote:
 Hello Justin,
 
 I just saw that you have been faster than me :-)
 
 However.. you think it might be not sure that this workes for every browser?
 PUh... thats bad. Do u have examples for that? It workes with IE on PC.
 
 Cheers Andy
 
 
 
 Andy [EMAIL PROTECTED] schrieb im Newsbeitrag
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 
All righty! I found the solution:

It might be for help to some other folkes. Here is the code which solves
 
 the
 
problem:


#make sure he is not referred by our  one website
if (!ereg($HTTP_HOST, $_SERVER[HTTP_REFERER])){
#set referer cookie
setcookie('referrer', $user_id, 0);
}
#redirect


Cheers,

Andy



Andy [EMAIL PROTECTED] schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

Hi there,

I have a tricky problem which I honestly think is not possible to solve.
However maybe I am wrong.

As you all know it is possible on php.net to pass a function name just
behind the adress (e.G. php.net/function-name) this will redirct to the
propper page. I did the same thing with member sites (e.G
server.com/member-name) Now I am starting a referrer programm. Every

member

who follows a link like from anywhere on the net and registeres will be
tracked and the referrer gets a point. Now I did forget that I do have
several of this links on my site itself :-) Which means that they have

been

aquired on my site by accident :-)

My question is how can I make sure that they do come from outside and

 are
 
not surfing my site already. I do set a coockie as soon as someone

 enteres
 
this adress, but it would be fantastic if I could do a if statement on
something to make sure he does not come from my own site. I would like

 to
 
keep all the links like that, just to find a way to track the origin of

the

user.

Thank you so much for any idea on this tricky task,

Andy








 
 


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




[PHP] Re: People's Opinion

2002-08-27 Thread Bogdan Stancescu

Christopher J. Crane wrote:
 This is a little off topic, but I am desperate. I am looking for a good
 PHP/MySQL chat that is not in a bunch of frames. I have from WebChat
 (http://www.webdev.ro/) but it has a bunch of runtime erros. If anyone has
 this working or they know of another that works well please send me a link
 or something anything
 
 Thank you in advance for your time and support.
 
 


http://freshmeat.net/browse/22/?filter=183%2C15topic_id=22


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




[PHP] Re: Image library

2002-08-21 Thread Bogdan Stancescu

The answer I would give at this moment would be a variant of your A) 
version where the hash directories would further contain directories 
limited to, say 300 images. Found it out after a painfully slow 
experience with MySQL blobs. I did not however implement this solution 
yet (still using the blobs due to lack of time), so I can't give you an 
actual comparison (hence the format of my first sentence).

HTH

Bogdan

Scott Houseman wrote:
 Hi there.
 
 Which way would be the most efficient/fastest to access images from an image
 library.
 A) Store image files in a hash directory structure AND storing each file's
 information in a mysql table
 OR
 B) Storing image information in mysql table AND storing the image in a BLOB
 field in that table.
 
 The way I see it, considerations to be taken into acount:
 - Is it quicker/better to retrieve image from table  then stream out to
 browser OR simply direct the browser to the file?
   i.e IMG SRC=/imagelib/image.php?iImageID=10 OR IMG
 SRC=/imagelib/5/f/10
 - Will a database OR filesystem be more scalable i.e. which wil perform
 better when there are 1 images in the libary?
 
 Thanks in advance
 
 Regards
 
 -Scott
 
 --
 Scott Houseman
 Jam Warehouse http://www.jamwarehouse.com/
 Smart Business Innovation
 +27 21 4477440 / +27 82 4918021
 



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




Re: [PHP] Image library

2002-08-21 Thread Bogdan Stancescu

I've seen this kind of random approach several times and I keep 
wondering why not counting the files instead. Yes, it may take a little 
longer when uploading but I personally think the safety of the approach 
is worth the insignificant speed sacrifice.

Bogdan

Scott Houseman wrote:
 Hi all.
 
 This confirms what I suspected.
 
 The hash algrithm:
 
 I have a directory structure: dirs 0 - f, and within each of these, the same
 dir structure 0 - f.
 When an image gets uploaded into the library, do an md5sum of the file, take
 the first 2 chars of that hash
 and there's your path. e.g
 $PICDBPATH.'/a/7/a7b8be10b0e69fe3decaa538f1febe84'
 
 I'm not sure what the mathematical randomness of this is, but I'm sure it's
 pretty random, and the chances
 of collision should be virtually null, the only time you should overwrite a
 file is if you upload the exact same file(?)
 Is there a better way of doing this?
 
 Cheers
 
 -Scott
 
 
-Original Message-
From: Justin French [mailto:[EMAIL PROTECTED]]
Sent: 21 August 2002 03:25
To: [EMAIL PROTECTED]; PHP General
Subject: Re: [PHP] Image library


on 21/08/02 9:45 PM, Scott Houseman ([EMAIL PROTECTED]) wrote:



Which way would be the most efficient/fastest to access images

from an image

library.
A) Store image files in a hash directory structure AND storing

each file's

information in a mysql table
OR
B) Storing image information in mysql table AND storing the

image in a BLOB

field in that table.

From all accounts I've read on this list, a database is not
usually faster
than a filesystem.  And for large amounts of files, like 1000's,
a hash will
speed it up more.



The way I see it, considerations to be taken into acount:
- Is it quicker/better to retrieve image from table  then stream out to
browser OR simply direct the browser to the file?
i.e IMG SRC=/imagelib/image.php?iImageID=10 OR IMG
SRC=/imagelib/5/f/10
- Will a database OR filesystem be more scalable i.e. which wil perform
better when there are 1 images in the libary?

Filesystem should be quicker.  You need to think about how you hash the
files up for the most even spread of files in each directory I guess.


Justin


 
 



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




[PHP] Re: PHP Site Mirror

2002-08-21 Thread Bogdan Stancescu

Seems to be down - I can't reach it either.

Bogdan

Jay Blanchard wrote:
 Can someone give me a URL for a php.net mirror? I am having trouble with
 access...
 
 Thanks!
 
 Jay
 
 ***
 * Texas PHP Developers Conf  Spring 2003  *
 * T Bar M Resort  Conference Center  *
 * New Braunfels, Texas*
 * San Antonio Area PHP Developers Group   *
 * Interested? Contact [EMAIL PROTECTED] *
 ***
 
 



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




[PHP] Re: Best way to check for some certain text in a string

2002-08-21 Thread Bogdan Stancescu

If you don't need regexps, use strpos. Make sure you read the 
documentation though - if $nav-userAgent starts with search for this, 
your code will return false.

Bogdan

José Jeria wrote:
 I want to find a certain text in a string and i want it to return me a
 boolean.
 What is the best thing to do this?
 
 a) ereg(search for this, $string);// returns
 int(1) if true, bool(false) if not
 b) strpos($nav-userAgent, search for this)  0// gives me a boolean
 directly
 
 Any tips of which one I should use?
 
 /José Jeria
 
 



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




[PHP] Re: mysql_query() ERROR

2002-08-21 Thread Bogdan Stancescu

It's not the ) characters, it's the quotes - make sure you 
addslashes() to all the variables. Also make sure you don't double-slash 
- depending on your php.ini settings, PHP may automatically slash 
incoming variables.

Bogdan

Mike Fifield wrote:
 This is a query that I am sending to mysql. The problem is that sometimes in
 the variable $message characters like ) will get posted and when they do
 it makes mysql die. I can only assume that mysql thinks that the ) in the
 $message variable is meant to close the sql query, but I am having trouble
 figuring out how to avoid this. I suppose I could use a regex to replace all
 special characters with something more sql friendly but I am hoping there is
 a better way to do this. Thanks for any help.  
 
  
 
 mysql_query(insert into guestbook
 (gb_entry_id,date,name,email,website_name,website_url,message) values
 ('',CURDATE(),'$name','$email','$website_name','$website_url','$message'))
 or die (mysql_error());
 
 
 
 



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




[PHP] Re: Best way to check for some certain text in a string

2002-08-21 Thread Bogdan Stancescu

José Jeria wrote:
 Bogdan Stancescu [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 
If you don't need regexps, use strpos. Make sure you read the
 
 
 Can you give me any particular reason why strpos is better?
http://php.weblogs.com/discuss/msgReader$1838

 
 
documentation though - if $nav-userAgent starts with search for this,
your code will return false.
 
 
 Yeah, that was a typo when i copy and pasted.
 
 
Bogdan

José Jeria wrote:

I want to find a certain text in a string and i want it to return me a
boolean.
What is the best thing to do this?

a) ereg(search for this, $string);//

 returns
 
int(1) if true, bool(false) if not
b) strpos($nav-userAgent, search for this)  0// gives me a

 boolean
 
directly

Any tips of which one I should use?

/José Jeria




 
 



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




[PHP] Re: Adding shadow effects to Images

2002-08-21 Thread Bogdan Stancescu

If you need real shadow effects (i.e. if the image data itself should 
contain the shadow), you can follow the suggestion below but using GD to 
achieve the effect by concatenating images.

If you're looking for a solution to *display* the thumbnails in the 
page, then this is what I would do: I'd create the shadow of a rectangle 
in any imaging software, with the appropriate blur size and transparency 
for the given situation (depending on thumbnail size and background 
color/pattern, respectively). Then I'd create a new layer to mask the 
undesired portion of the shadow (a placeholder for the actual thumbnail 
in effect), select it and use the selection to trim the shadow. I'd now 
have a mirrored L-shaped shadow mask. I would now determine where 
exactly do the corners   end and where the continous linear parts begin 
(to the pixel, by deeply zooming in). Now all I'd have to do would be to 
trim the five areas which are different (three corners, a vertical and a 
horizontal patch) and I'd save those as five distinct files - and then 
use tables to display them around each thumbnails. The corners would be 
TDIMG SRC=top_right.png/TD and the vertical and horizontal ones 
would be TD BACKGROUND=horizontal.pngIMG SRC=spacer.gif/TD. 
You'll obviously have to make sure that the corner images match their 
width/height with the respective backgrounds.

HTH

Bogdan

Steph wrote:
 I'm trying to auto-add shadow effects to my image thumbs using PHP or the GD Library 
if that's even possible. Any ideas where I start?
 
 Thanks,
 
 Steph
 



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




Re: [PHP] Re: SeparatingWords

2002-08-21 Thread Bogdan Stancescu

Just to make a fool of myself, I'd explode the string, parse each item 
and implode. I'm sure it can be done through some regexp wizardry as 
well - probably matching something along the lines of (^\ [A-Z]) but 
I'm way too retarded regexp-wise. BTW, any good online tutorials? I read 
through PHP's reference docs (which are probably excellent if you 
already know what it's all about), but only reached a limited 
understanding of how to approach problems...

Bogdan

Dl Neil wrote:
 Philip,
 What about SoftwareVersion Thingy?
 Won't that end up as Software Version  Thingy - with two spaces before the
 T?
 Can the RegEx be 'turned off' if the u/case letter is already preceded by a
 space?
 (sorry, may not be Hessu's requirement = my curiosity)
 Regards,
 =dn
 
 
 
This works.

$word = SoftwareVersionThingy;
$word = ereg_replace(([A-Z]),  \\1, $word);
$word = ltrim($word);

-philip

On Thu, 22 Aug 2002, Hessu wrote:


Hi,

I have strings like FileName, SoftwareVersion etc.
How can I add space between words? Somehow with preg_replace perhaps?
First letter of each word is capitalized.

-Hessu-

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



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


 
 



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




Re: [PHP] Web Site

2002-08-21 Thread Bogdan Stancescu

Just for the record, I'm sure you can Google out quite a few nasty 
comments on PayPal - I remember reading some along the lines of dear 
all, I know it was much easier for you to send money via PayPal, I know 
that giving up on using it will considerably decrease my income, but 
after my [...] experience I want to have nothing to do with them 
anymore. Never used PayPal myself, and problems are inherent for such a 
large system, so don't take this as an anti-PayPal message - just try 
searching for some user comments before starting to use it.

Bogdan

Roger Lewis wrote:
 On Wednesday, August 21, 2002 6:41 PM
 Peter Goggin wrote
 
   2. I need to set up credit card payments. Has anyone any experience with
  PayPal? Are there any other providers I should consider.
   Nothing but good to say about PayPal
   Roger
 
 
  
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 



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




Re: [PHP] Image library

2002-08-21 Thread Bogdan Stancescu

That was my original idea - and to take things to extremes, you might 
even want to recurse directories: using only a couple of recursiveness 
levels (1-1000/1-1000/1-1000.jpg) would ensure 1 bil. files without 
getting more than 1000 in any singe directory. The really nice thing 
about this approach is that you can start with a single level and in the 
unlikely event you get more than 1 mil. (you wish! :)) then you can add 
another in no time, with a down time of probably ten minutes.

In a slightly different train of thoughts, since this approach is so 
flexible, I'd recommend going for 500 files per directory - that's a 
limit which guarantees no slowdown. (And yes, I've read Jay's argument, 
but I have heard so many counter-arguments throughout time that I 
personally prefer to stay on the safe side - it's no big deal after all).

Just my 2c, obviously.

Bogdan

Justin French wrote:
 So hash them into groups of 1000 images
 
 1-1000
 1001 - 2000
 2001 - 3000
 
 etc etc, and just name the files 1.gif, 2.jpeg, etc etc
 
 Justin French
 
 
 
 on 22/08/02 12:41 AM, Scott Houseman ([EMAIL PROTECTED]) wrote:
 
 
Hi there.

So what you are suggesting is using an AUTO_INCREMENT field, possibly the
image's Primary Key as an identifier
for that image file., which is fine by me, but surely one should store files
across directories, as 1 images
in a single directory might slow down access to those images in the
filesystem, or not so?

Thanks for your input.

Regards

-Scott


-Original Message-
From: DL Neil [mailto:[EMAIL PROTECTED]]
Sent: 21 August 2002 04:31
To: [EMAIL PROTECTED]; Bogdan Stancescu
Subject: Re: [PHP] Image library


Scott (confirming Bogdan),

Libraries of all types have had this concern for years - even though books
are uniquely identified by ISBN, that is still not good enough for library
purposes (eg multiple copies of a single title). So they, exactly
as Bogdan
suggests, use an Accession number sequence - which can be
implemented very
neatly in MySQL (from PHP) as an AUTO_INCREMENT field.

Regards,
=dn


I've seen this kind of random approach several times and I keep
wondering why not counting the files instead. Yes, it may take a little
longer when uploading but I personally think the safety of the approach
is worth the insignificant speed sacrifice.

Bogdan

Scott Houseman wrote:

Hi all.

This confirms what I suspected.

The hash algrithm:

I have a directory structure: dirs 0 - f, and within each of

these, the
same

dir structure 0 - f.
When an image gets uploaded into the library, do an md5sum of

the file,
take

the first 2 chars of that hash
and there's your path. e.g
$PICDBPATH.'/a/7/a7b8be10b0e69fe3decaa538f1febe84'

I'm not sure what the mathematical randomness of this is, but I'm sure

it's

pretty random, and the chances
of collision should be virtually null, the only time you should

overwrite a

file is if you upload the exact same file(?)
Is there a better way of doing this?

Cheers

-Scott



-Original Message-
From: Justin French [mailto:[EMAIL PROTECTED]]
Sent: 21 August 2002 03:25
To: [EMAIL PROTECTED]; PHP General
Subject: Re: [PHP] Image library


on 21/08/02 9:45 PM, Scott Houseman ([EMAIL PROTECTED]) wrote:




Which way would be the most efficient/fastest to access images

from an image


library.
A) Store image files in a hash directory structure AND storing

each file's


information in a mysql table
OR
B) Storing image information in mysql table AND storing the

image in a BLOB


field in that table.

From all accounts I've read on this list, a database is not

usually faster
than a filesystem.  And for large amounts of files, like 1000's,
a hash will
speed it up more.




The way I see it, considerations to be taken into acount:
- Is it quicker/better to retrieve image from table  then stream out

to

browser OR simply direct the browser to the file?
i.e IMG SRC=/imagelib/image.php?iImageID=10 OR IMG
SRC=/imagelib/5/f/10
- Will a database OR filesystem be more scalable i.e. which

wil perform

better when there are 1 images in the libary?

Filesystem should be quicker.  You need to think about how

you hash the

files up for the most even spread of files in each directory I guess.


Justin






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




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



 



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




[PHP] Re: How retrieve database data from email?

2002-08-16 Thread Bogdan Stancescu

I'm not very proficient with e-mail configuration, so if someone finds 
I'm saying something wrong, don't think twice before correcting it. 
AFAIK, you can create an alias typically in /etc/aliases - or 
/etc/sendmail/aliases, as I've heard for newer versions of sendmail. In 
any case, the file has to be there already because that's where you have 
the root/webmaster/postmaster aliases defined.

Add a line reading
stocks: 
| /usr/bin/php /path/to/your/script.php

I'm not sure if sendmail should be restarted after this, so you'd better 
do it just to make sure.

You'll obviously need root access to do these. After this point, you 
don't anymore.

In /path/to/your/script.php, you'll receive the whole e-mail message 
from standard input, so you'll have to check out those functions here 
http://www.php.net/manual/en/features.commandline.php

Then all you have to do is parse the incoming mail message - I'm sure 
you'll be able to google out plenty of functions/classes to do that - 
drop me an e-mail if you don't find any and I'll send you mine.

Bogdan

Lallous wrote:
 How and where can I add an alias and associate PHP with that alias?
 
 
 Elias
 Bogdan Stancescu [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 
You can set up php to run from console if it doesn't already, and add an
alias to your mail server (stocks) which would parse the incoming mail
and do the appropriate deeds.

Bogdan

M wrote:

Hello People:

I have my pages built in PHP / Mysql, all working ok, but now I need
solve a problem I don't know how to solve or even how search about. Case
this problem was already discussed in this list, I would be grateful if
someone pass to me correct date so I can search about.

My problem is very simple: I have customers who dont want enter into
html pages to retrieve some info (suppose info are stock values), but
rather they want to send email with formatted query into mail subject
(or at least in body) , and then receive response again by email.

For instance, customer could send this for [EMAIL PROTECTED]

to: [EMAIL PROTECTED]
subject: name=ibm, year=2001
body: (empty)

In response, he should receive an email with all IBM stock prices day by
day.

That't all, I hope this will have solution, but I can't figure how email
could communicate automatically with PHP/Mysql.

Thanks

Miguel




 
 



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




[PHP] Re: How retrieve database data from email?

2002-08-16 Thread Bogdan Stancescu

Bogdan Stancescu wrote:
 Add a line reading
 stocks: | /usr/bin/php /path/to/your/script.php

Sorry, it should be
stocks: | /usr/bin/php /path/to/your/script.php

Also, first make sure php works from command line and check its location.

Bogdan


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




[PHP] Re: ###PLEASE HELP### - delete a line from a text file

2002-08-16 Thread Bogdan Stancescu

Hi Nick!

First off, *please* read a netiquette guide before posting -- I hate 
seeing a conational of mine posting a message like yours (###PLEASE 
HELP### and I am waiting for an answer are extremely rude - you're 
not paying for support on this mailing list, so you can't demand 
anything). Other than that, I'd point out cleaning up your code before 
posting because we don't have to read through your slickiness -- but 
that may be a matter of personal opinion.

Your problem resides exactly in your code's slickiness - which 
incidentally doesn't make it any faster. Try this conventional code instead:

function delete_user($sterge_user, $path) {
   [1]
   $fisierul=$orig=file($path);
   for($i=0;$isizeOf($fisierul);$i++) {
 list($uname)=explode(:,$fisierul[$i]);
 if ($uname==$sterge_user) {
   $fisierul=array_splice($fisierul,$i,1);
   $i--;
 }
   }
   if ($fisierul!=$orig) {
 [...]
   }
   [2]
}

[...] contains the trivial task of imploding $fisierul (using \r\n or 
\n, depending on the OS) and writing it. Make sure you check for and 
create a lock file at [1] and respectively unlink it at [2] -- or simply 
use a database instead, for that matter.

Anyway, just in case you *really* want to use your original code, the 
problem is that the code (probably) finds the line to delete but doesn't 
go any further than that - plus it's consuming unnecessary resources by 
rewriting the file line by line.

Bogdan

Radio X wrote:
 i have a text file with some of this elements:
  
 name:adress:telephone:email:password
 
 i want to delete this line using for identifier the 'name' only.
 
 // $sterge_user=name; this is the value sent by form witch will be the identifier
 // $path=some_of_my_files; the file used here allready set with 777 chmod
 
 function delete_user($sterge_user, $path){
 $i = 0;
 $fisierul = file($path);
 $fp = fopen($path, w);
 while (!sizeof($fisierul))
  {
 $data = fgetcsv ($fisierul, 4096, :);
  if ($data[0]==$sterge_user)
 {
for ($i=0; $i=sizeof($data);){$data[i]=;++$i;}
 }
  fwrite($fp, $data);
   }
 fclose($fp);
 }
 
 I am waiting for an answer, please
 
 Nick
 



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




[PHP] Re: Replace

2002-08-16 Thread Bogdan Stancescu

Have you tried searching string functions on http://www.php.net ?

Bogdan

Alexander Lindstedt wrote:
 If i want to find just a word in a variable, and then replace just that
 specific word... is there any simple way to do this?
 
 


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




[PHP] Re: quick question

2002-08-15 Thread Bogdan Stancescu

http://www.php.net/manual/en/ref.classobj.php

Chris Barnes wrote:
 hey people,
 I have been seeing something in a few php scripts i've been playing with and
 i really dont know what it means or does. I'm only new to php so maybe
 someone could explain.
 
 i have been seeing -...e.g. while($file = $dir - read())
 what does the - mean and do.
 
 thanks heaps
 



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




[PHP] Re: A Question about PHP upload file

2002-08-15 Thread Bogdan Stancescu

http://www.php.net/manual/en/configuration.php#ini.memory-limit
http://www.php.net/manual/en/configuration.php#ini.post-max-size
http://www.php.net/manual/en/configuration.php#ini.upload-max-filesize

Mintbaggio wrote:
 Is there is a volume limitted for PHP upload file
 using HTTP?
 I heard of there is a 8-9Mb limitted,is it true?
 Is there a method to solve it?



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




[PHP] Re: Can anyone help me out? I am really getting frustrated!

2002-08-15 Thread Bogdan Stancescu

Hi Mike!

Mike wrote:
 Hello all,
 I am very confused. This script that I have been working on for a while
 is giving me a hard time...
 
 $string = Current song: 01. DJ Nightflight - The first flight (original
 \
 mix) (D I G I T A L L Y - I M P O R T E D - European Trance, Techno,
 Hi-\
 NRG... we can't define it!);
 
 if(substr($string,0,1) = C){

You have to use == instead of =

   print made it past substr!br\n;
   $TrackName = trim(substr($string,strpos($string,.)+1));
 }
 The problem is that it never gets past the substr in the if(...)
 statement, therefore never setting $TrackName.
 
 I am really lost on what to do, any help would be appreciated.
 
 Thank You,
 Mike
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]
 
 



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




[PHP] Re: Can someone explain this please...

2002-08-15 Thread Bogdan Stancescu

Hi!

I don't know why it doesn't because it really should ALWAYS evaluate 
true with your code, regardless of absolutely anything.

The reason is that the quoteless 777 you're comparing to is in decimal 
and it would defy math if you were ever able to get $perms==777. Anyway, 
it does evaluate true on my computer and does delete that dir.

You might want to try this:

?
  $newpath = ./uploads/newdir/;
  if (!is_dir($newpath)) mkdir($newpath, 0666);
  $perms = fileperms($newpath)  0777;

  if ($perms != 0777)
  {
rmdir ($newpath);
  }
?

Please be aware though that in typical conditions your permissions are 
masked, therefore you're not going to be able to create directories with 
0777 permissions via PHP without tweaking your PHP config.

HTH

Bogdan

Gandalf wrote:
 
 
 Hello!
 
 I am doing this
 
 $newpath = ./uploads/newdir/;
 if (!is_dir($newpath)) mkdir($newpath, 0666);
 $decperms = fileperms($newpath);
 $octalperms = sprintf(%o,$decperms);
 $perms=(substr($octalperms,2));
 echo $perms;
 
 if ($perms != 777)
 {
 rmdir ($newpath);
 }
 
 This will not delete the dir created with $newpath.
 It will only work if i change this
 
 if ($perms != 777)
 into this
 if ($perms != '777' ) // Please note the single quotes around 777
 
 Could someone tell me why it behaves like this?
 Cause if for example i do this
 
 $foo = 1;
 if ($foo == 1) //will evaluate as true, so why not with the above?
 
 Thanks a lot in advance for your time and help!
 
 Best regards from Vienna,
 Jürgen
 
 
 



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




[PHP] Re: Can someone explain this please...

2002-08-15 Thread Bogdan Stancescu

Hummm, sorry, you're right, you're converting it do a fake octal via 
strings, I was wrong in my first paragraph. In any case, if it helps, on 
my comp it really does evaluate true.

Bogdan

Gandalf wrote:
 
 
 Hello!
 
 I am doing this
 
 $newpath = ./uploads/newdir/;
 if (!is_dir($newpath)) mkdir($newpath, 0666);
 $decperms = fileperms($newpath);
 $octalperms = sprintf(%o,$decperms);
 $perms=(substr($octalperms,2));
 echo $perms;
 
 if ($perms != 777)
 {
 rmdir ($newpath);
 }
 
 This will not delete the dir created with $newpath.
 It will only work if i change this
 
 if ($perms != 777)
 into this
 if ($perms != '777' ) // Please note the single quotes around 777
 
 Could someone tell me why it behaves like this?
 Cause if for example i do this
 
 $foo = 1;
 if ($foo == 1) //will evaluate as true, so why not with the above?
 
 Thanks a lot in advance for your time and help!
 
 Best regards from Vienna,
 Jürgen
 
 
 



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




  1   2   3   4   >