php-general Digest 23 Dec 2006 00:01:15 -0000 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:
[email protected]
----------------------------------------------------------------------
--- Begin Message ---
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 ($count>0) {
$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 ---
--- Begin Message ---
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: [email protected]
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 ($count>0) {
$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 ---
--- Begin Message ---
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. |
`------------------------------------------------------------'
--- End Message ---
--- Begin Message ---
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.
--- End Message ---
--- Begin Message ---
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?
--- End Message ---
--- Begin Message ---
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
--- End Message ---
--- Begin Message ---
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
--- End Message ---
--- Begin Message ---
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
--- End Message ---
--- Begin 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]
--- End Message ---
--- Begin Message ---
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.
--- End Message ---
--- Begin Message ---
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
---
--- End Message ---
--- Begin Message ---
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
---
--- End Message ---
--- Begin Message ---
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.
--- End Message ---
--- Begin Message ---
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
--- End Message ---