php-general Digest 22 Dec 2006 11:47:59 -0000 Issue 4528

2006-12-22 Thread php-general-digest-help

php-general Digest 22 Dec 2006 11:47:59 - Issue 4528

Topics (messages 246138 through 246145):

Re: Count empty array
246138 by: Robert Cummings
246139 by: Jon Anderson
246140 by: Martin Marques
246141 by: tg-php.gryffyndevelopment.com

Re: parsing objects
246142 by: Marcus
246144 by: Jochem Maas

Re: random selection from each subfolder
246143 by: chris smith

Re: RegExp
246145 by: WeberSites LTD

Administrivia:

To subscribe to the digest, e-mail:
[EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]

To post to the list, e-mail:
php-general@lists.php.net


--
---BeginMessage---
On Thu, 2006-12-21 at 13:31 -0800, Kevin Murphy wrote:
 I'm wondering why this is.
 
 $data = ;
 $array = explode(,,$data);
 $count = count($array);
 $count will = 1
 
 $data = Test;
 $array = explode(,,$data);
 $count = count($array);
 $count will = 1
 
 $data = Test,Test;
 $array = explode(,,$data);
 $count = count($array);
 $count will = 2
 
 Why doesn't the first one give me an answer of 0 instead of 1.

For the same reason the second one gives you a count of one. There are
no commas and so only one item exists. Whether that be an string with
content or the empty string itself is irrelevant.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'
---End Message---
---BeginMessage---

Kevin Murphy wrote:

I'm wondering why this is.

$data = ;
$array = explode(,,$data);
$count = count($array);
$count will = 1

$data = Test;
$array = explode(,,$data);
$count = count($array);
$count will = 1

$data = Test,Test;
$array = explode(,,$data);
$count = count($array);
$count will = 2

Why doesn't the first one give me an answer of 0 instead of 1.

This:
   var_dump(explode(',',''));
Returns this:
   array(1) {
 [0]=
 string(0) 
   }

And oddly, This:
   var_dump(explode(',',NULL));
Returns this:
   array(1) {
 [0]=
 string(0) 
   }

That explains the count() result. It seems to me that the first case 
could go either way (The part of  before the ',' is still ), but I'm 
unable to think of a logical reason why the second doesn't return an 
empty array.
I know I could do a IF $data ==  [empty] and then not count if its 
empty and just set it to 0, but am wondering if there was a better way.
$array = empty($data) ? array() : explode(',',$data);  /* That what 
you're looking for? */


jon
---End Message---
---BeginMessage---

On Thu, 21 Dec 2006, Kevin Murphy wrote:


I'm wondering why this is.

$data = ;
$array = explode(,,$data);
$count = count($array);
$count will = 1


$array has 1 element: An empty string.


$data = Test;
$array = explode(,,$data);
$count = count($array);
$count will = 1


$array has 1 element: The string Test


$data = Test,Test;
$array = explode(,,$data);
$count = count($array);
$count will = 2


$array has 2 elements:.

Why doesn't the first one give me an answer of 0 instead of 1. I know I could 
do a IF $data ==  [empty] and then not count if its empty and just set it 
to 0, but am wondering if there was a better way.


Because explode divides the string in n+1 elements, where n is the amount 
of , (or your favorite delimiter) found in the string. So if no , is 
found, explode will return 1 element: the whole string (even if it's 
empty).


--
 21:50:04 up 2 days,  9:07,  0 users,  load average: 0.92, 0.37, 0.18
-
Lic. Martín Marqués |   SELECT 'mmarques' ||
Centro de Telemática|   '@' || 'unl.edu.ar';
Universidad Nacional|   DBA, Programador,
del Litoral |   Administrador
End Message---
---BeginMessage---
Not sure why it does it, but doesn't seem to be a huge deal.  I'm guessing it's 
because an empty string is still a string. It's not null.

Anyway, it's documented at:

http://us3.php.net/manual/en/function.explode.php

A user writes:

If you split an empty string, you get back a one-element array with 0 as the 
key and an empty string for the value.

-TG

= = = Original message = = =

I'm wondering why this is.

$data = ;
$array = explode(,,$data);
$count = count($array);
$count will = 1

$data = Test;
$array = explode(,,$data);
$count = count($array);
$count will = 1

$data = Test,Test;
$array = explode(,,$data);
$count = 

php-general Digest 23 Dec 2006 00:01:15 -0000 Issue 4529

2006-12-22 Thread php-general-digest-help

php-general Digest 23 Dec 2006 00:01:15 - Issue 4529

Topics (messages 246146 through 246159):

sessions vs domain problem
246146 by: Reinhart Viane
246147 by: Vincent DUPONT
246148 by: Robert Cummings
246151 by: Colin Guthrie
246152 by: Reinhart Viane
246153 by: Stut

Excluding apostrophe's
246149 by: RAFMTD \(Ian\)
246150 by: Stut

Jump to a record when searching MYSQL with PHP Paging?
246154 by: T.J. Mahaffey
246155 by: tg-php.gryffyndevelopment.com
246158 by: Børge Holen
246159 by: Børge Holen

upload max error
246156 by: ibanex22
246157 by: David Giragosian

Administrivia:

To subscribe to the digest, e-mail:
[EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]

To post to the list, e-mail:
php-general@lists.php.net


--
---BeginMessage---
Hello,

 

I have the folowing problem :

Hosting of my site is at http://www.groep6049.ksjnet.be
http://www.groep6049.ksjnet.be/ 

My domainname is www.ksachiropoelkapelle.be
http://www.ksachiropoelkapelle.be/ 

 

I have forwarded www.ksachiropoelkapelle.be
http://www.ksachiropoelkapelle.be/  towards
http://www.groep6049.ksjnet.be/index.php

I use cloaked forwarding (so ksachiropoelkapelle stays in the address bar)

 

Now people can log in on that site:

 

$sql=select * from users where user_firstname='$firstname' and
user_password='$password';

$result=mysql_query($sql) or die(mysql_error());

$count=mysql_num_rows($result);

if ($count0) {

$row=mysql_fetch_array($result);

$userid=$row[user_id];

$gebruikersnaam=$row[user_firstname];

//set the session variables

$_SESSION['userid']=$userid;

$_SESSION['gebruikersnaam']=$gebruikersnaam; 



header(Location: http://www.ksachiropoelkapelle.be/index.php;);

}

 

The problem is:

When I surf directly to http://www.ksachiropoelkapelle.be
http://www.ksachiropoelkapelle.be/  and try to login nothing happens. The
script is executed successfully but it does not seem to recognize the
$_SESSION to show that I'm logged in.

When I surf to http://www.groep6049.ksjnet.be/index.php and try to login it
works perfectly.

 

Is it possible to set something extra in my php session variables to make it
work when surfing directly to http://www.ksachiropoelkapelle.be
http://www.ksachiropoelkapelle.be/  ?

Or do I have to disable the cloaking?

 

Thanks in advance,

 

Reinhart Viane

---End Message---
---BeginMessage---
Hello,

As far as I know, the session will use a cookie, and the cookies are linked to 
one domain name.
I don't know a way of using a cookie accross multiple domains, but I guess this 
should be possible.
The question is : will PHP allow you to do that? I guess no because this could 
be a security issue...

maybe someone in the list can help.

search the web for the cookie accross multipple domain.

Vincent
(greetings from Belgium !!)


-Original Message-
From: Reinhart Viane [mailto:[EMAIL PROTECTED]
Sent: Fri 22/12/2006 12:52
To: php-general@lists.php.net
Subject: [PHP] sessions vs domain problem
 
Hello,

 

I have the folowing problem :

Hosting of my site is at http://www.groep6049.ksjnet.be
http://www.groep6049.ksjnet.be/ 

My domainname is www.ksachiropoelkapelle.be
http://www.ksachiropoelkapelle.be/ 

 

I have forwarded www.ksachiropoelkapelle.be
http://www.ksachiropoelkapelle.be/  towards
http://www.groep6049.ksjnet.be/index.php

I use cloaked forwarding (so ksachiropoelkapelle stays in the address bar)

 

Now people can log in on that site:

 

$sql=select * from users where user_firstname='$firstname' and
user_password='$password';

$result=mysql_query($sql) or die(mysql_error());

$count=mysql_num_rows($result);

if ($count0) {

$row=mysql_fetch_array($result);

$userid=$row[user_id];

$gebruikersnaam=$row[user_firstname];

//set the session variables

$_SESSION['userid']=$userid;

$_SESSION['gebruikersnaam']=$gebruikersnaam; 



header(Location: http://www.ksachiropoelkapelle.be/index.php;);

}

 

The problem is:

When I surf directly to http://www.ksachiropoelkapelle.be
http://www.ksachiropoelkapelle.be/  and try to login nothing happens. The
script is executed successfully but it does not seem to recognize the
$_SESSION to show that I'm logged in.

When I surf to http://www.groep6049.ksjnet.be/index.php and try to login it
works perfectly.

 

Is it possible to set something extra in my php session variables to make it
work when surfing directly to http://www.ksachiropoelkapelle.be
http://www.ksachiropoelkapelle.be/  ?

Or do I have to disable the cloaking?

 

Thanks in advance,

 

Reinhart Viane
---End Message---
---BeginMessage---
On Fri, 2006-12-22 at 13:12 +0100, 

RE: [PHP] RegExp

2006-12-22 Thread WeberSites LTD
I'm not trying to pre-populate the text area.
I just want to get the input from the user and make sure he can
only insert chars that I allow. The only char I have a problem with
is the  (Quote). If I enter a  into the text area the regexp bellow
does not allow it in.

preg_match(/^[à-úA-Za-z0-9_():,@\/\.\s\- ]*$/i,$FieldValue) - Fails
preg_match(/^[à-úA-Za-z0-9_():,@\/\.\s\\- ]*$/i,$FieldValue) (This one gives 
a php error cause the \\ closes the opening )
preg_match('/^[א-תA-Za-z0-9_():,@\/\.\s- ]*$/i',$FieldValue) - Fails
preg_match('/^[א-תA-Za-z0-9_():,@\/\.\s\- ]*$/i',$FieldValue) - Fails
preg_match('/^[א-תA-Za-z0-9_():,@\/\.\s\\- ]*$/i',$FieldValue) - Fails

So how can I allow a quote () to be a valid char?

thanks
berber

-Original Message-
From: Richard Lynch [mailto:[EMAIL PROTECTED] 
Sent: Saturday, December 16, 2006 3:55 AM
To: WeberSites LTD
Cc: php-general@lists.php.net
Subject: Re: [PHP] RegExp

On Thu, December 14, 2006 11:47 pm, WeberSites LTD wrote:
 I'm trying to limit the text someone can submit in a text area with :


 Code:
 if(!preg_match(/^[à-úA-Za-z0-9_():,@\/\.\s\-\ ]*$/i,$FieldValue)) {

 }


 It works well but I'm having problems with the  (double quote).
 If there is a double quote () it fails.

Fails in what way?

Are you sure you are remembering to do http://php.net/htmlentities on the data 
you send out for the TEXTAREA to pre-populate it?

Does PCRE need  escaped inside the [] bit?  I think not, but I suppose \\ 
instead of \ couldn't hurt.

You may also want to move the - to the end of [] character set and lose the \, 
just to keep it simpler.

--
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

--
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] sessions vs domain problem

2006-12-22 Thread Reinhart Viane
Hello,

 

I have the folowing problem :

Hosting of my site is at http://www.groep6049.ksjnet.be
http://www.groep6049.ksjnet.be/ 

My domainname is www.ksachiropoelkapelle.be
http://www.ksachiropoelkapelle.be/ 

 

I have forwarded www.ksachiropoelkapelle.be
http://www.ksachiropoelkapelle.be/  towards
http://www.groep6049.ksjnet.be/index.php

I use cloaked forwarding (so ksachiropoelkapelle stays in the address bar)

 

Now people can log in on that site:

 

$sql=select * from users where user_firstname='$firstname' and
user_password='$password';

$result=mysql_query($sql) or die(mysql_error());

$count=mysql_num_rows($result);

if ($count0) {

$row=mysql_fetch_array($result);

$userid=$row[user_id];

$gebruikersnaam=$row[user_firstname];

//set the session variables

$_SESSION['userid']=$userid;

$_SESSION['gebruikersnaam']=$gebruikersnaam; 



header(Location: http://www.ksachiropoelkapelle.be/index.php;);

}

 

The problem is:

When I surf directly to http://www.ksachiropoelkapelle.be
http://www.ksachiropoelkapelle.be/  and try to login nothing happens. The
script is executed successfully but it does not seem to recognize the
$_SESSION to show that I'm logged in.

When I surf to http://www.groep6049.ksjnet.be/index.php and try to login it
works perfectly.

 

Is it possible to set something extra in my php session variables to make it
work when surfing directly to http://www.ksachiropoelkapelle.be
http://www.ksachiropoelkapelle.be/  ?

Or do I have to disable the cloaking?

 

Thanks in advance,

 

Reinhart Viane



RE: [PHP] sessions vs domain problem

2006-12-22 Thread Vincent DUPONT
Hello,

As far as I know, the session will use a cookie, and the cookies are linked to 
one domain name.
I don't know a way of using a cookie accross multiple domains, but I guess this 
should be possible.
The question is : will PHP allow you to do that? I guess no because this could 
be a security issue...

maybe someone in the list can help.

search the web for the cookie accross multipple domain.

Vincent
(greetings from Belgium !!)


-Original Message-
From: Reinhart Viane [mailto:[EMAIL PROTECTED]
Sent: Fri 22/12/2006 12:52
To: php-general@lists.php.net
Subject: [PHP] sessions vs domain problem
 
Hello,

 

I have the folowing problem :

Hosting of my site is at http://www.groep6049.ksjnet.be
http://www.groep6049.ksjnet.be/ 

My domainname is www.ksachiropoelkapelle.be
http://www.ksachiropoelkapelle.be/ 

 

I have forwarded www.ksachiropoelkapelle.be
http://www.ksachiropoelkapelle.be/  towards
http://www.groep6049.ksjnet.be/index.php

I use cloaked forwarding (so ksachiropoelkapelle stays in the address bar)

 

Now people can log in on that site:

 

$sql=select * from users where user_firstname='$firstname' and
user_password='$password';

$result=mysql_query($sql) or die(mysql_error());

$count=mysql_num_rows($result);

if ($count0) {

$row=mysql_fetch_array($result);

$userid=$row[user_id];

$gebruikersnaam=$row[user_firstname];

//set the session variables

$_SESSION['userid']=$userid;

$_SESSION['gebruikersnaam']=$gebruikersnaam; 



header(Location: http://www.ksachiropoelkapelle.be/index.php;);

}

 

The problem is:

When I surf directly to http://www.ksachiropoelkapelle.be
http://www.ksachiropoelkapelle.be/  and try to login nothing happens. The
script is executed successfully but it does not seem to recognize the
$_SESSION to show that I'm logged in.

When I surf to http://www.groep6049.ksjnet.be/index.php and try to login it
works perfectly.

 

Is it possible to set something extra in my php session variables to make it
work when surfing directly to http://www.ksachiropoelkapelle.be
http://www.ksachiropoelkapelle.be/  ?

Or do I have to disable the cloaking?

 

Thanks in advance,

 

Reinhart Viane

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



RE: [PHP] sessions vs domain problem

2006-12-22 Thread Robert Cummings
On Fri, 2006-12-22 at 13:12 +0100, Vincent DUPONT wrote:
 Hello,
 
 As far as I know, the session will use a cookie, and the cookies are linked 
 to one domain name.
 I don't know a way of using a cookie accross multiple domains, but I guess 
 this should be possible.
 The question is : will PHP allow you to do that? I guess no because this 
 could be a security issue...
 
 maybe someone in the list can help.
 
 search the web for the cookie accross multipple domain.

Fairly common to propagate a session using an embedded transparent pixel
that links to the remote site and contains the session ID.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



[PHP] Excluding apostrophe's

2006-12-22 Thread RAFMTD \(Ian\)
Dear Sir/madam,

I have a problem which I don't seem to be able to resolve, so I hope you
can.

I have a simple html form which 'posts' variables to the following
script...
---
?php
$username=***;
$password=***;
$database=***;

$name = ($_POST['name']);
$email = ($_POST['email']);
$comments = ($_POST['comments']);

mysql_connect(humbug,$username,$password);
@mysql_select_db($database) or die( Unable to select database);

$query = INSERT INTO remarks VALUES  ('','$name','$email','$comments');
mysql_query($query);

mysql_close();
?
--

This in turn sends the data to my database, everything works fine until
someone enters an apostrophe, then it fails to send the data.
I have searched for the answer and it appears to be to use
mysql_real_escape_string  but when I apply that like this
--
?php
$username=***;
$password=***;
$database=***;

$name = mysql_real_escape_string ($_POST['name']);
$email = mysql_real_escape_string ($_POST['email']);
$comments = mysql_real_escape_string ($_POST['comments']);

mysql_connect(humbug,$username,$password);
@mysql_select_db($database) or die( Unable to select database);

$query = INSERT INTO remarks VALUES  ('','$name','$email','$comments');
mysql_query($query);

mysql_close();
?
--
the script fails with the following report Warning:
mysql_real_escape_string(): Can't connect to local MySQL server through
socket '/var/run/mysqld/mysqld.sock' (2)

Any help would be appreciated.

Regards

Ian Scales


Re: [PHP] Excluding apostrophe's

2006-12-22 Thread Stut

RAFMTD (Ian) wrote:

Dear Sir/madam,

I have a problem which I don't seem to be able to resolve, so I hope you
can.

I have a simple html form which 'posts' variables to the following
script...
---
?php
$username=***;
$password=***;
$database=***;

$name = ($_POST['name']);
$email = ($_POST['email']);
$comments = ($_POST['comments']);

mysql_connect(humbug,$username,$password);
@mysql_select_db($database) or die( Unable to select database);

$query = INSERT INTO remarks VALUES  ('','$name','$email','$comments');
mysql_query($query);

mysql_close();
?
--

This in turn sends the data to my database, everything works fine until
someone enters an apostrophe, then it fails to send the data.
I have searched for the answer and it appears to be to use
mysql_real_escape_string  but when I apply that like this
--
?php
$username=***;
$password=***;
$database=***;

$name = mysql_real_escape_string ($_POST['name']);
$email = mysql_real_escape_string ($_POST['email']);
$comments = mysql_real_escape_string ($_POST['comments']);

mysql_connect(humbug,$username,$password);
@mysql_select_db($database) or die( Unable to select database);

$query = INSERT INTO remarks VALUES  ('','$name','$email','$comments');
mysql_query($query);

mysql_close();
?
--
the script fails with the following report Warning:
mysql_real_escape_string(): Can't connect to local MySQL server through
socket '/var/run/mysqld/mysqld.sock' (2)

Any help would be appreciated.


You need to connect to the database before using mysql_real_escape_string.

-Stut

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



[PHP] Re: sessions vs domain problem

2006-12-22 Thread Colin Guthrie
Reinhart Viane wrote:
 I have the folowing problem :
 
 Hosting of my site is at http://www.groep6049.ksjnet.be
 http://www.groep6049.ksjnet.be/ 
 
 My domainname is www.ksachiropoelkapelle.be
 http://www.ksachiropoelkapelle.be/ 
 
  
 
 I have forwarded www.ksachiropoelkapelle.be
 http://www.ksachiropoelkapelle.be/  towards
 http://www.groep6049.ksjnet.be/index.php

I think this is because the browser thinks it is working with the domain
name www.ksachiropoelkapelle.be and the server thinks it is working with
 the domain name www.groep6049.ksjnet.be.

I also assume that the forwarding is based on Apache mod_rewrite rather
than a simple frame.

If you don't ever really want to access the uglier domain directly
(e.g. you are doing this to get free/cheap hosting) then you should be
able to tell PHP to use the correct domain for cookie paths using:
http://uk2.php.net/manual/en/function.session-set-cookie-params.php

Something like:

?php
session_set_cookie_params(0, '/', 'ksachiropoelkapelle.be');
session_start();
...


Hope that works for you.

Col.

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



RE: [PHP] Re: sessions vs domain problem

2006-12-22 Thread Reinhart Viane
Something like:

?php
session_set_cookie_params(0, '/', 'ksachiropoelkapelle.be');
session_start();
...


I inserted this code at the top:
session_set_cookie_params(0, '/', '.ksachiropoelkapelle.be');

It did not solve the problem, still after logging in on
www.ksachiropoelkapelle.be the session is not recognized.
I know the line of code works cause when I surf directly to
http://www.groep6049.ksjnet.be/ it does not work anymore (appearently the
cookie domain is not recognized anymore).

Any other ideas?

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



Re: [PHP] sessions vs domain problem

2006-12-22 Thread Stut

Reinhart Viane wrote:

I have the folowing problem :

Hosting of my site is at http://www.groep6049.ksjnet.be
http://www.groep6049.ksjnet.be/ 


My domainname is www.ksachiropoelkapelle.be
http://www.ksachiropoelkapelle.be/ 


I have forwarded www.ksachiropoelkapelle.be
http://www.ksachiropoelkapelle.be/  towards
http://www.groep6049.ksjnet.be/index.php

I use cloaked forwarding (so ksachiropoelkapelle stays in the address bar)


That usually uses frames which means that...


header(Location: http://www.ksachiropoelkapelle.be/index.php;);


is wrong because you need to be redirecting to the cloaked domain not 
the actual domain. Change this to use $_SERVER['HTTP_HOST'] instead of 
www.ksachiropelkapelle.be and everything should be fine.



Or do I have to disable the cloaking?


Domain cloaking is evil for a variety of reasons. You'd be better off 
switching to a host that will let you use your domain name.


Incidentally, someone else suggested setting the cookie domain. This 
will not work because security restrictions prevent you from setting 
cookies on a different primary domain name.


-Stut

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



[PHP] Jump to a record when searching MYSQL with PHP Paging?

2006-12-22 Thread T.J. Mahaffey
I am working on a PHP/MySQL application where I am displaying and  
paging records from a MySQL database.
The search functionality needs to be a bit different than I'm used  
to. Instead of returning only the records matching the query, it  
needs to return ALL records, BUT take the user to the page where the  
first record matches the query. All other records should still be  
displayed.


Does someone know of an example or tutorial on how to accomplish this?

--
T.J. Mahaffey
[EMAIL PROTECTED]

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



Re: [PHP] Jump to a record when searching MYSQL with PHP Paging?

2006-12-22 Thread tg-php
I would guess this would depend highly on how you're displaying the data.

Let's set up a scenario:

1. Full results come out to say, 100 records.

2. Searched item is #53 in the result set.

Your choices for displaying the data could be one of the following:

* One big web page, jumping to the result.  In this case, you could use the a 
name=something anchor tag and jump to it with 
http://www.someurl.com/page.php#something
You'd use this same method if you were displaying the results in an iframe

* Display list in a scrollable frame like a select, select multi.  In which 
case just use the 'SELECTED' to highlight the result item. Don't know if it's 
possible (or easily possible) to move to the item if it's in a multi select.

* Display a 'window' of the full results.  Like items 33 to 73 (20 before and 
after 53, being the search result item) for instance.  In this case, you don't 
need to get all the results, just use the LIMIT command if you're using MySQL 
and pull that 'window' if you know it's position before-hand.  Or pull all the 
results and parse through the results and display just that segment.


The short answer really comes down to one of two things (I love lists):

1. Use HTML or something non-PHP to jump to the item.  the named anchor tag is 
one of the most common

or..

2. Use PHP to output a segmetn of the data and visually highlight (with color 
changes or whatever) the item.  But still you're going to rely on HTML and/or 
Javascript and/or CSS for the 'jumping to' bit.

Good luck however it works out.  I think if you keep searching, you'll find 
some examples or some mechanisms for doing what you want to do, but PHP is 
going to be secondary to what you're trying to do.

-TG

= = = Original message = = =

I am working on a PHP/MySQL application where I am displaying and  
paging records from a MySQL database.
The search functionality needs to be a bit different than I'm used  
to. Instead of returning only the records matching the query, it  
needs to return ALL records, BUT take the user to the page where the  
first record matches the query. All other records should still be  
displayed.

Does someone know of an example or tutorial on how to accomplish this?

--
T.J. Mahaffey
[EMAIL PROTECTED]



___
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

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



[PHP] upload max error

2006-12-22 Thread ibanex22

Hey all,

I am new to PHP and have been having issues on max filesize uploads.  I can
currently upload small files but I wish to make my max upload size huge. 
Here is what I have configured in php.ini:

max_execution_time = 3000
max_input_time = 6000
memory_limit = 8000M
post_max_size = 8000M
file_uploads = On
uplad_max_filesize = 5000M
default_socket_timeout = 600

I have also edited the upload script as well.
I am running Apache on OpenBSD, the PHP packages are hardened.
Any help or direction would be great!

Thanks,
Erik
-- 
View this message in context: 
http://www.nabble.com/upload-max-error-tf2872630.html#a8028989
Sent from the PHP - General mailing list archive at Nabble.com.

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



Re: [PHP] upload max error

2006-12-22 Thread David Giragosian

On 12/22/06, ibanex22 [EMAIL PROTECTED] wrote:



Hey all,

I am new to PHP and have been having issues on max filesize uploads.  I
can
currently upload small files but I wish to make my max upload size huge.
Here is what I have configured in php.ini:

max_execution_time = 3000
max_input_time = 6000
memory_limit = 8000M
post_max_size = 8000M
file_uploads = On
uplad_max_filesize = 5000M
default_socket_timeout = 600

I have also edited the upload script as well.
I am running Apache on OpenBSD, the PHP packages are hardened.
Any help or direction would be great!

Thanks,
Erik
--
View this message in context:
http://www.nabble.com/upload-max-error-tf2872630.html#a8028989
Sent from the PHP - General mailing list archive at Nabble.com.

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



Keep trying larger and larger file uploads, checking Apache and PHP error
logs when you hit a size or timeout limit.

David


Re: [PHP] Jump to a record when searching MYSQL with PHP Paging?

2006-12-22 Thread Børge Holen
On Friday 22 December 2006 20:11, T.J. Mahaffey wrote:
 I am working on a PHP/MySQL application where I am displaying and
 paging records from a MySQL database.
 The search functionality needs to be a bit different than I'm used
 to. Instead of returning only the records matching the query, it
 needs to return ALL records, BUT take the user to the page where the
 first record matches the query. All other records should still be
 displayed.

 Does someone know of an example or tutorial on how to accomplish this?

 --
 T.J. Mahaffey
 [EMAIL PROTECTED]

google
This yields quite a few topics on paging, of sorts: paging php

seen if any of these got any potential?


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

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



Re: [PHP] Jump to a record when searching MYSQL with PHP Paging?

2006-12-22 Thread Børge Holen
On Friday 22 December 2006 20:11, T.J. Mahaffey wrote:
 I am working on a PHP/MySQL application where I am displaying and
 paging records from a MySQL database.
 The search functionality needs to be a bit different than I'm used
 to. Instead of returning only the records matching the query, it
 needs to return ALL records, BUT take the user to the page where the
 first record matches the query. All other records should still be
 displayed.

 Does someone know of an example or tutorial on how to accomplish this?

 --
 T.J. Mahaffey
 [EMAIL PROTECTED]

on some thought... I think count to where yer record is within the table is 
needed.
then a perpage offset number followed by select with limit.

ARGH my neighbour is bogging down my line with torrents... cant get anything 
done here!.!

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

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



Re: [PHP] upload max error

2006-12-22 Thread ibanex22

Thanks guys, I boosted a bunch of values in my configuration files and got it
to work... unfortunetly it only worked once.  I'm sure it worked, but I have
tried to recreate it and I cannot get it to work again.  This is very
confusing to me.  If there is any value that fluxuates... or anything... I
have no idea what to do.



David Giragosian wrote:
 
 On 12/22/06, ibanex22 [EMAIL PROTECTED] wrote:
 

 Hey all,

 I am new to PHP and have been having issues on max filesize uploads.  I
 can
 currently upload small files but I wish to make my max upload size huge.
 Here is what I have configured in php.ini:

 max_execution_time = 3000
 max_input_time = 6000
 memory_limit = 8000M
 post_max_size = 8000M
 file_uploads = On
 uplad_max_filesize = 5000M
 default_socket_timeout = 600

 I have also edited the upload script as well.
 I am running Apache on OpenBSD, the PHP packages are hardened.
 Any help or direction would be great!

 Thanks,
 Erik
 --
 View this message in context:
 http://www.nabble.com/upload-max-error-tf2872630.html#a8028989
 Sent from the PHP - General mailing list archive at Nabble.com.

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


 Keep trying larger and larger file uploads, checking Apache and PHP error
 logs when you hit a size or timeout limit.
 
 David
 
 

-- 
View this message in context: 
http://www.nabble.com/upload-max-error-tf2872630.html#a8030902
Sent from the PHP - General mailing list archive at Nabble.com.

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



Re: [PHP] upload max error

2006-12-22 Thread ibanex22

I've got it... it looks like I had boosted something too high. Thanks for the
replies.



ibanex22 wrote:
 
 Thanks guys, I boosted a bunch of values in my configuration files and got
 it to work... unfortunetly it only worked once.  I'm sure it worked, but I
 have tried to recreate it and I cannot get it to work again.  This is very
 confusing to me.  If there is any value that fluxuates... or anything... I
 have no idea what to do.
 
 
 
 David Giragosian wrote:
 
 On 12/22/06, ibanex22 [EMAIL PROTECTED] wrote:
 

 Hey all,

 I am new to PHP and have been having issues on max filesize uploads.  I
 can
 currently upload small files but I wish to make my max upload size huge.
 Here is what I have configured in php.ini:

 max_execution_time = 3000
 max_input_time = 6000
 memory_limit = 8000M
 post_max_size = 8000M
 file_uploads = On
 uplad_max_filesize = 5000M
 default_socket_timeout = 600

 I have also edited the upload script as well.
 I am running Apache on OpenBSD, the PHP packages are hardened.
 Any help or direction would be great!

 Thanks,
 Erik
 --
 View this message in context:
 http://www.nabble.com/upload-max-error-tf2872630.html#a8028989
 Sent from the PHP - General mailing list archive at Nabble.com.

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


 Keep trying larger and larger file uploads, checking Apache and PHP error
 logs when you hit a size or timeout limit.
 
 David
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/upload-max-error-tf2872630.html#a8031085
Sent from the PHP - General mailing list archive at Nabble.com.

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



[PHP] How to Separate PHP Errors to a file different than Apache Errors

2006-12-22 Thread Shanon Swafford
Hi Guys,

I just cut my website over to Apache2 and PHP5 on FC5.

So now I'm clean up all the PHP Notices.

Does anybody know the config directives I can put in my /etc/php.ini or
etc/httpd/conf.d/php.conf or /etc/httpd/conf/httpd.conf so that I could
separate the php errors file from the apache errors file?



Thanks a bunch,
Shanon

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



Re: [PHP] Excluding apostrophe's

2006-12-22 Thread Paul Novitski



RAFMTD (Ian) wrote:

...

$name = mysql_real_escape_string ($_POST['name']);

...

mysql_connect(humbug,$username,$password);

...

the script fails with the following report Warning:
mysql_real_escape_string(): Can't connect to local MySQL server through
socket '/var/run/mysqld/mysqld.sock' (2)



At 12/22/2006 05:36 AM, Stut wrote:

You need to connect to the database before using mysql_real_escape_string.



Ian, this is a perfect example of when it comes in handy to consult 
the documentation:



http://ca.php.net/manual/en/function.mysql-real-escape-string.php

string mysql_real_escape_string ( string unescaped_string [, resource 
link_identifier] )


Escapes special characters in the unescaped_string, taking into 
account the current character set of the connection

...
link_identifier

The MySQL connection. If the link identifier is not specified, 
the last link opened by mysql_connect() is assumed. If no such link 
is found, it will try to create one as if mysql_connect() was called 
with no arguments. If by chance no connection is found or 
established, an E_WARNING level warning is generated.



Remember, my son, PHP-general helps those who help themselves.

Piously,

Poop Paul 


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



[PHP] Apache 2.2 + PHP5.2 + php_oci8.dll

2006-12-22 Thread james tanhs

Hi,

I saw numerous posting on this type of posting and no one seems to have a
consistent solution to it.

Lately, I am quite disapointed with the pain of going thru this
configuration and testing.
I need to access the oracle 8i server db using XP + Oracle client 8i +
Apache 2.2 + PHP5.2 and I have tried
the following without success.  What is the error ? not sumething special
but common
PHP Warning:  PHP Startup: Unable to load dynamic library
'c:\\php52\\ext\\php_oci8.dll' - The specified procedure could not be
found.\r\n in Unknown on line 0
1.  download the php_oci8.dll from
http://pecl4win.php.net/ext.php/php_oracle.dll (you name the version, tried
everythign doesn't work)
2.  assign ORACLE_HOME, NSL_LANGUAGE...nope...doesn't work.
3.  use old php4.1.xx + Apache 1.3xx on XP with Oracle client 8i...nope
doesn't work ( I use this in my NT4, it works like charm)
4.  Zendcore for oracle...no no...it doesn't support Oracle 8i connectivity.
5.  anyone know where to look for oracle 8i/9i clients for linux ? not
available at oracle website :(

Anyone can help ?

Tq


Re: [PHP] How to Separate PHP Errors to a file different than Apache Errors

2006-12-22 Thread chris smith

On 12/23/06, Shanon Swafford [EMAIL PROTECTED] wrote:

Hi Guys,

I just cut my website over to Apache2 and PHP5 on FC5.

So now I'm clean up all the PHP Notices.

Does anybody know the config directives I can put in my /etc/php.ini or
etc/httpd/conf.d/php.conf or /etc/httpd/conf/httpd.conf so that I could
separate the php errors file from the apache errors file?


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

Specifically 'error_log'.

This will be commented out in a default php.ini file, search for it
there, enable it and restart your webserver.

Also the webserver user has to 'own' this file (as with it's other
logs), so check permissions.
--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Excluding apostrophe's

2006-12-22 Thread Casey Chu

It should be like this:

?php
$username=***;
$password=***;
$database=***;


mysql_connect(humbug,$username,$password);
@mysql_select_db($database) or die( Unable to select database);

$name = mysql_real_escape_string($_POST['name']);
$email = mysql_real_escape_string($_POST['email']);
$comments = mysql_real_escape_string($_POST['comments']);
/*
if (!$name || !$email || !$comments) die();

(or something like that)
*/

$query = INSERT INTO remarks VALUES  ('','$name','$email','$comments');
mysql_query($query);

mysql_close();
?

On 12/22/06, Paul Novitski [EMAIL PROTECTED] wrote:


RAFMTD (Ian) wrote:
...
$name = mysql_real_escape_string ($_POST['name']);
...
mysql_connect(humbug,$username,$password);
...
the script fails with the following report Warning:
mysql_real_escape_string(): Can't connect to local MySQL server through
socket '/var/run/mysqld/mysqld.sock' (2)


At 12/22/2006 05:36 AM, Stut wrote:
You need to connect to the database before using mysql_real_escape_string.


Ian, this is a perfect example of when it comes in handy to consult
the documentation:


http://ca.php.net/manual/en/function.mysql-real-escape-string.php

string mysql_real_escape_string ( string unescaped_string [, resource
link_identifier] )

Escapes special characters in the unescaped_string, taking into
account the current character set of the connection
...
link_identifier

 The MySQL connection. If the link identifier is not specified,
the last link opened by mysql_connect() is assumed. If no such link
is found, it will try to create one as if mysql_connect() was called
with no arguments. If by chance no connection is found or
established, an E_WARNING level warning is generated.


Remember, my son, PHP-general helps those who help themselves.

Piously,

Poop Paul

--
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] New User Sign up Notification

2006-12-22 Thread JMCS Niagara \(Jeff\)
hi there. I'm looking to create a new user signup. So when someone signs up, it 
emails admin the Username, Real Name, and IP address.

I have this code called newusersignupnotification.php

?php
$to = '[EMAIL PROTECTED]'; // The email address you want the notification sent 
to
$subject = 'Member has registered on YoS'; // What do you want the subject line 
of your notification to be?
$memberSpecs = 
hr size=2 width=300 align=left.
bUsername:/b .$_SESSION['username'].
br.
bReal Name:/b .$_SESSION['firstname'].  .$_SESSION['lastname'].
br.
bDate/b .date('l dS \of F Y h:i:s A').
br. 
bIP address:/b .$_SERVER['REMOTE_ADDR'].
br.
bSystem Specs:/b .$_SERVER['HTTP_USER_AGENT'].
br;
$headers = Content-type: text/html \nFrom: [EMAIL PROTECTED];
$body = body
br
table cellspacing=1 cellpadding=2 align=center
tr
td
bfont face=arial size=2A new member has registered! /font/b

/td/tr
tr
td
font face=arial size=2 .$memberSpecs. /font
/td/tr/table
/body;
mail($to,$subject,$body,$headers);
?

When I place this in the join.php file .. When someone goes to join.php it 
automatically emails it .. and I get date, time, ip, etc etc everything except 
for the username and first name.. Obviously, because the person hasn't typed in 
anything.

When they filled out the sign up form, There's a button that says Sign Up .. 
Basically, when they click this button, NOW is when I want it to email me the 
details.

Any ideas?

Thanks guys