[PHP] mod rewrite urls

2004-08-12 Thread Maris
Hi,

struggling with the following:

I have an URL

www.mycompany.com/index.php?id=10a=1b=2c=3

What I want to do is using mod_rewrite have

www.mycompany.com/10/?a=1b=2c=3

Have tried the following rewrite rules in .htaccess

RewriteEngine on

RewriteCond%{REQUEST_FILENAME}  !-d
RewriteCond%{REQUEST_FILENAME}  !-f
RewriteCond  %{REQUEST_URI} ^/([0-9]*)/\?(.+)$
RewriteRule  ^([0-9]*)/\?(.+)$ get.php?id=$1$2  [L]

But this doesnt work, something's wrong with ?, because if
I put in rule any alphabetical character, for example Z then
www.mycompany.com/10/Za=1b=2c=3 works fine

Thanks,
Maris 

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



[PHP] HTML and PHP output to PHP variable

2004-07-12 Thread Maris
Hi!

Let's say my index.php consists of the following:

? include(header.inc); echo pPHP says Hello World/p; ?
pHTML says Hello World/p
?  //..  some other php code that generates output... ?
..some other HMTL output..

My question is:
how can I make the whole index.php generated output put in one PHP variable?
It is also important that it is done from the same index.php file.

Thanks,
Maris

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



Re: [PHP] HTML and PHP output to PHP variable

2004-07-12 Thread Maris
Thanks a lot Miroslav,
will try this construction! :)


Miroslav Hudak [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 hello!

 use output buffering...

 ?php
ob_start();
//... your code here
$_contents = ob_get_contents();
ob_end_clean();
 ?

 regards,
 m.

 Maris wrote:

  Hi!
 
  Let's say my index.php consists of the following:
 
  ? include(header.inc); echo pPHP says Hello World/p; ?
  pHTML says Hello World/p
  ?  //..  some other php code that generates output... ?
  ..some other HMTL output..
 
  My question is:
  how can I make the whole index.php generated output put in one PHP
variable?
  It is also important that it is done from the same index.php file.
 
  Thanks,
  Maris
 

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



[PHP] Function that creates a class instance with a given name

2004-06-29 Thread Maris
Hi there!

I am trying to make a PHP function create_object that would allow me to
create a class instance with supplied name

Here's the Smarty code snipset I would like to use my function in:

{* Let's create a new class object with name car *}
{create_object id=$id_car name=car}

{* When it is created, we can print out its properties or do whatever we
need to *}
The brand is: {$car-brand}
and car's color is: {$car-color}



Any ideas how to create PHP function that would allow to create the instance
so I can
operate with it in Smarty as shown above?

function create_object($id, $name){
   //help needed
}


Thanks,
Maris

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



[PHP] Re: Function that creates a class instance with a given name

2004-06-29 Thread Maris
Found the solution:

function create_car($params){
 global $smarty;
 $car = new Car(Jeep sWrangler,black);
 $smarty-register_object($params[id], $car);

}




Maris [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi there!

 I am trying to make a PHP function create_object that would allow me to
 create a class instance with supplied name

 Here's the Smarty code snipset I would like to use my function in:

 {* Let's create a new class object with name car *}
 {create_object id=$id_car name=car}

 {* When it is created, we can print out its properties or do whatever we
 need to *}
 The brand is: {$car-brand}
 and car's color is: {$car-color}



 Any ideas how to create PHP function that would allow to create the
instance
 so I can
 operate with it in Smarty as shown above?

 function create_object($id, $name){
//help needed
 }


 Thanks,
 Maris

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



[PHP] cookies

2003-12-04 Thread Maris Kalnins
Let's assume that we have an html page where we plant a call
to cookie registering php script. This is done by
the following html line which is placed on that page
we would like to have cookies stats for:


html
...
body
..
img nocache border=0 width=2 height=1
src=http://www.cookiedomain.com/cookies/cookies.php
..
/body

/html


Php cookie registering script has the following
cookie set operation:

setcookie(test, 1, time() + 3600, /, );


The problem is that when executing HTML above, everything
works fine as long as page and php script are on
the same domain

But as soon as page is for example www.pagedomain.com and
cookie script is still on www.cookiedomain.com
No cookies are set no more.

My  understanding is that with line
img nocache border=0 width=2 height=1
src=http://www.synchrodat.com/sdcookies/cookies.php
we simply execute php script the same way as it would be typed
in url line and executed, why there's a difference?

Could you share with your experience and point out where
is the problem here. I tried different variations for
domain parameter in setcookie command but it didnt help

Is this construction usable in this case with different
domains at all?

Thanks

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



[PHP] opening msword files outside the browser

2003-06-15 Thread Maris Kalnins
Hi!

I am using:

?php
header('Content-Type: application/msword');
header('Content-Disposition: attachment; filename=test.doc');
readfile(test.doc);
?

What changes should be made to this code to skip the dialog box
asking Open, Save, Cancel and go right to the opening the MSWord file
outside the browser?

Thanks,
Maris



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



Re: [PHP] opening msword files outside the browser

2003-06-15 Thread Maris Kalnins
Adrian, thanks for the clue!

.. but this is opening word document inside the web browser which is not
acceptable in my case :(



Adrian [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 you could try
 header('Content-Disposition: inline; filename=test.doc');





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



Re: [PHP] opening msword files outside the browser

2003-06-15 Thread Maris Kalnins
yeah, i guess you're right!
then there's no such possibility :(

Adrian [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 oops, i thougt you wanted it opening in the browser.
 i don't think there is a way to open it directly outside the browser,
 because if this would be possible someone could do so with a virus
 .exe, too.

  .. but this is opening word document inside the web browser which is not
  acceptable in my case :(





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



[PHP] how to fight backslash in char variable???

2002-08-20 Thread Maris Kalnins

Hi guys!

Situation:

$intext = blablabla ' blablabla;
then this $intext is passed to out.php (as parameter out.php?intext=...)

the problem is that from out.php I need to echo this $intext but I get:

blablabla \' blablabla

the question is.. how to fight this backslash out of there?


Thanks, Maris



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




[PHP] parameters not seen

2002-08-20 Thread Maris Kalnins

Hi!

just installed latest php and apache on windows nt!

to my big surprise when i am executing test.php?abc=testvalue
where test.php =

? echo $abc ?

I get empty string

can somebody say what's wrong?

Thanks, Maris



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




[PHP] extensions

2002-05-07 Thread Maris Kalnins

Hi!

Configuration - windows XP, PHP4 (not in CGI mode), Apache

I am experiencing difficulty to add sybase_ct support into php

php is installed in C:/PHP4
in php.ini file:

extension_dir = C:/PHP4/extensions
extension=php_sybase_ct.dll

after restarting Apache it says:
Unable to load library 'C:/PHP4/extensions/php_sybase_ct.dll' - The
specified module could not be found

the interesting part is that in C:/PHP4/extensions there is a file
php_sybase_ct.dll

What am I doing wrong?

Thanks



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




[PHP] $php_self doesnt work in netscape like it should!

2002-04-08 Thread Maris Kalnins

Hi guys!

$php_self and $php_referrer doesnt work the same in IE and Netscape

When opening a page with
IE they return for example http://localhost/directroy/index.php
but in Netscape Navigator - http://localhost/directory/

Why?
And how to solve this problem?

Thanks




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




Re: [PHP] odbc_pconnect doesnt reuse connection

2002-04-03 Thread Maris Kalnins

because odbc_connect takes some time to establish connection
while odbc_pconnect establishes it once after that it suppose to
give faster access through already existing connection!

that's what I got from php manual..
the bad thing is .. that in reality it works a little bit different..
so I am wondering .. why?



Eric Coleman [EMAIL PROTECTED] wrote in message
026b01c1db1c$860b2890$0201a8c0@devstation">news:026b01c1db1c$860b2890$0201a8c0@devstation...
 Why won't you just use odbc_connect ?
 - Original Message -
 From: Maris Kalnins [EMAIL PROTECTED]
 To: 
 Sent: Wednesday, April 03, 2002 3:07 AM
 Subject: [PHP] odbc_pconnect doesnt reuse connection


  Hi!
 
  Configuration: WinXP, the latest Apache, PHP4
 
  The problem is that every time the script runs and the following command
 is
  executed
  $cx=odbc_pconnect($G_dbname, $G_dblogin, $G_dbpassw);
  it happens very often that a new connection is created instead of
reusing
  the old one!
 
  Is there any idea what's wrong... ?
 
  And another question - when user hits reload or submit button at the
 moment
  when
  actually this odbc_pconnect is in progress - it generates another
 connection
  leaving the old one
  (half opened or whatever) still alive..
 
  So if you will click on submit button more than 10 times with a little
 short
  interval -
  we will get ODBC error - Database server connection limit exceeded
 
  I tried to set in PHP config file
  odbc.max_persistent = 1
 
  but it still overgoes more than 1 connection to the same database, user
 and
  password..
 
  What's  wrong?
 
 
 
 
 
 
 
  --
  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] odbc_pconnect

2002-04-02 Thread Maris Kalnins

Hi All!

I have a situation where I need to keep connection still active after php
script is done and page displayed!
I tried to use

$cx=odbc_pconnect($G_dbname, $G_dblogin, $G_dbpassw);

But unfortunately connection closes automatically when script is done!
What must I do to keep connection alive and be able to use $cx again and
again without connectign?

Thanks!



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




[PHP] odbc vs mysql

2002-04-02 Thread Maris Kalnins

When connecting to database (Sybase) through ODBC it takes some time to
establish odbc connection with:

$cx=odbc_pconnect($G_dbname, $G_dblogin, $G_dbpassw);

And only after that I am able to access data through SQL Selects

The problem is that every time the script is finished this connection is
automatically closed,
how to keep it open after displaying a page - no idea ...

How about using MySql in this situation?
There will be no need to waste time connecting to ODBC every time,
is it really so? could this be faster?

is there any idea how to keep ODBC connections open after script is
finished?

Any other solutions?

Thanks

P.S. I tried to use Sybase funcitons.. but it says - that they're not
defined or something like that..




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




Re: [PHP] odbc_pconnect

2002-04-02 Thread Maris Kalnins

Yes I am using CGI...
So that means under Windows using Apache Server it is impossible to do that?




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




Re: [PHP] odbc_pconnect

2002-04-02 Thread Maris Kalnins

thanks, I configured php under apache as a module
now connection doesn't disappear after script is done
it stays alive..

now another problem:
first time I open connection this way..

if (empty($cx)){
 $cx=odbc_pconnect($G_dbname, $G_dblogin, $G_dbpassw);
}

if next time i will use the same construction it will not reuse my existing
connection
but it generates another one which stays alive like the first one..

after a while i get an odbc message
Database server connection limit exceeded

The question is:
how can I determine if connection is already active and how can I reuse it
then?

Thanks



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




[PHP] odbc_pconnect doesnt reuse connection

2002-04-02 Thread Maris Kalnins

Hi!

Configuration: WinXP, the latest Apache, PHP4

The problem is that every time the script runs and the following command is
executed
$cx=odbc_pconnect($G_dbname, $G_dblogin, $G_dbpassw);
it happens very often that a new connection is created instead of reusing
the old one!

Is there any idea what's wrong... ?

And another question - when user hits reload or submit button at the moment
when
actually this odbc_pconnect is in progress - it generates another connection
leaving the old one
(half opened or whatever) still alive..

So if you will click on submit button more than 10 times with a little short
interval -
we will get ODBC error - Database server connection limit exceeded

I tried to set in PHP config file
odbc.max_persistent = 1

but it still overgoes more than 1 connection to the same database, user and
password..

What's  wrong?




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




[PHP] odbc_pconnect doesnt reuse connection

2002-04-02 Thread Maris Kalnins

Hi!

Configuration: WinXP, the latest Apache, PHP4

The problem is that every time the script runs and the following command is
executed
$cx=odbc_pconnect($G_dbname, $G_dblogin, $G_dbpassw);
it happens very often that a new connection is created instead of reusing
the old one!

Is there any idea what's wrong... ?

And another question - when user hits reload or submit button at the moment
when
actually this odbc_pconnect is in progress - it generates another connection
leaving the old one
(half opened or whatever) still alive..

So if you will click on submit button more than 10 times with a little short
interval -
we will get ODBC error - Database server connection limit exceeded

I tried to set in PHP config file
odbc.max_persistent = 1

but it still overgoes more than 1 connection to the same database, user and
password..

What's  wrong?







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




Re: [PHP] eating mySQL result rows 1 by 1.. a better way?

2002-03-21 Thread Maris Kalnins

Hmm.. but if it's not MySql .. but Sybase for instance?
What then?.. there is no such thing like LIMIT in SQL




Joffrey Van Wageningen [EMAIL PROTECTED] wrote in message
014801c1d0f2$fd59ac20$[EMAIL PROTECTED]">news:014801c1d0f2$fd59ac20$[EMAIL PROTECTED]...
 - Original Message -
 From: Steve Clay [EMAIL PROTECTED]
 To: PHP-GENERAL [EMAIL PROTECTED]
 Sent: Thursday, March 21, 2002 4:54 PM
 Subject: [PHP] eating mySQL result rows 1 by 1.. a better way?


  On my site I paginate query results by limiting rows output to a
  value, say LIMIT, and then the 2nd, 3rd pages run the same query with
  $skip=LIMIT, $skip=(LIMIT*2) value posted back.  I use the following
  code to skip these result rows, which is just fetching the next row
  to an unused array.
 
  //if there are rows to skip
  if ($result_rows  $rows_to_skip) {
 while ( $rows_to_skip ) {
// eat a row
mysql_fetch_array($result);
$rows_to_skip--;
$total_results_shown++;
 }
  }
 
  Can I make this more efficient?  Is there a way to eliminate this data
  before it leaves the mySQL server (and would it be faster)?

 try 'LIMIT' :)

 http://www.mysql.com/doc/S/E/SELECT.html

 The LIMIT clause can be used to constrain the number of rows returned by
the
 SELECT statement. LIMIT takes one or two numeric arguments. If two
arguments
 are given, the first specifies the offset of the first row to return, the
 second specifies the maximum number of rows to return. The offset of the
 initial row is 0 (not 1):
 mysql select * from table LIMIT 5,10;  # Retrieve rows 6-15
 if one argument is given, it indicates the maximum number of rows to
return:
 mysql select * from table LIMIT 5; # Retrieve first 5 rows
 In other words, LIMIT n is equivalent to LIMIT 0,n.

 Rod Kreisler wrote a nice article on Building Next/Prev Buttons for Query
 Results:
 http://www.phpbuilder.com/columns/rod20001214.php3

 hope it helps :)

 mvgr,
 Joffrey van Wageningen

 --
 .-[ Joffrey van Wageningen | WoLFjuh | [EMAIL PROTECTED] ]--
 | Networking Event 2000 - www.ne2000.nl - IRCnet:#ne2000, Undernet:#clue
 | PGP:1024D/C6BA5863 - 3B93 52D3 CB91 9CB7 C50D FA79 865F 628A C6BA 5863
 | * We demand guaranteed rigidly defined areas of doubt and uncertainty.
 |   -- Douglas Adams




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




[PHP] User's IP Address

2002-03-20 Thread Maris Kalnins

Hi!

Is there any possibility to get PHP page viewer's ip address..
for example

$addr=some_function_that_returns_viewer's_address()

or something like that?

Thanks,
Maris



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