php-general Digest 26 Dec 2004 23:18:25 -0000 Issue 3192

Topics (messages 205174 through 205186):

Re: Help with code
        205174 by: Robby Russell
        205175 by: John Holmes
        205176 by: karl james

4.3.10  failure
        205177 by: PaulWB

4.3.7 array serialize problem
        205178 by: pf.sistemasdinamicos.com.ar
        205179 by: Jason Wong

Using PHP to send file through a http pipe?
        205180 by: Jack
        205185 by: Curt Zirzow

snmp nodes
        205181 by: arun parajuli

Re: getting home directory path
        205182 by: Greg Donald

Interfaces and Access Levels
        205183 by: Gerard Samuel

Re: [PHP-DB] what is wrong with my code.. please help
        205184 by: S Kumar

handling large files w/readfile
        205186 by: Sebastian

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 ---
karl james said:
>
> Team,
>
> Can you tell me why this code is not working?
> I get a query is empty at the moment.
>
> http://www.theufl.com/php/wrox_php/movie_details.phps

We need some information on the errors that you are getting.

-Robby

-- 
/***************************************
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting & Development
*    --- Now supporting PHP5 ---
****************************************/

--- End Message ---
--- Begin Message --- karl james wrote:
Can you tell me why this code is not working?
I get a query is empty at the moment.

http://www.theufl.com/php/wrox_php/movie_details.phps

Didn't we already see this once?

From File:
> $movie_query in mysql_query();

What kind of PHP code is that? You could really help yourself by telling us what query failed... what line it's on and only that line and a couple around it. Do you think a lot of other people are boring like me and going to read your code on Christmas? If you don't know what query is failing, then use more than mysql_error() in your die statements...

$review_result = mysql_query($review_query) or die('Query to pull reviews has failed. Reason: ' . mysql_error());

--

---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com
--- End Message ---
--- Begin Message ---
 
I have since updated it.
And I am having issues with a function I suppose.

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
resource in
/home/virtual/site38/fst/var/www/html/php/wrox_php/movie_details.php on line
119

http://www.theufl.com/php/wrox_php/movie_details.php



Karl James
(TheSaint)
[EMAIL PROTECTED]
http://theufl.com/
 

-----Original Message-----
From: John Holmes [mailto:[EMAIL PROTECTED] 
Sent: Sunday, December 26, 2004 1:09 AM
To: karl james
Cc: [email protected]
Subject: Re: [PHP] Help with code

karl james wrote:
> Can you tell me why this code is not working?
> I get a query is empty at the moment.
> 
> http://www.theufl.com/php/wrox_php/movie_details.phps

Didn't we already see this once?

 From File:
 > $movie_query in mysql_query();

What kind of PHP code is that? You could really help yourself by telling us
what query failed... what line it's on and only that line and a couple
around it. Do you think a lot of other people are boring like me and going
to read your code on Christmas? If you don't know what query is failing,
then use more than mysql_error() in your die statements...

$review_result = mysql_query($review_query) or die('Query to pull reviews
has failed. Reason: ' . mysql_error());

-- 

---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals - www.phparch.com

--- End Message ---
--- Begin Message ---


There is nothing on the website about the failed release of 4.3.10, I don't know how many of us have had to back out from this update but it is creating problems out in the wild.

The problems with 4.3.10 need to be identified and resolved, there is a critical bug in 4.3.10 that consumes large amounts of system resources.

My advise to everyone is not to install this version, the problems is creates are worse than the ones it fixed, a website with a few security wholes is better than no website.


read(6, "\1\0\0\r", 4) = 4
read(6, "\376", 1) = 1
--- SIGPROF (Profiling timer expired) @ 0 (0) ---
setitimer(ITIMER_PROF, {it_interval={0, 0}, it_value={120, 0}}, NULL) = 0
rt_sigaction(SIGPROF, {0xb7708830, [PROF], SA_RESTART}, {0xb7708830, [PROF], SA_RESTART}, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [PROF], NULL, 8) = 0
mmap2(NULL, 2097152, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0xb7249000
munmap(0xb7249000, 749568) = 0
munmap(0xb7400000, 299008) = 0
mprotect(0xb7300000, 135168, PROT_READ|PROT_WRITE) = 0
open("/local/logs/php", O_WRONLY|O_APPEND|O_CREAT, 0666) = 7
fstat64(7, {st_mode=S_IFREG|0777, st_size=58066806, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7448000
fstat64(7, {st_mode=S_IFREG|0777, st_size=58066806, ...}) = 0
_llseek(7, 58066806, [58066806], SEEK_SET) = 0
time([1103877334]) = 1103877334
write(7, "[24-Dec-2004 19:35:34] PHP Fatal"..., 142) = 142
close(7) = 0
munmap(0xb7448000, 4096) = 0
chdir("/") = 0
futex(0xb7e76620, FUTEX_WAIT, 2, NULL <unfinished ...>

--- End Message ---
--- Begin Message ---
Hi!
Have PHP 4.3.7, magic_quotes_gpc = On
Have a multidimensional array made from values from a POST form.
It addslashes() every field of the form as expected, like (') => (\'),
etc.
When I searialize the array to put it into a mysql db it seems to fail
to describe the string lenght of values with the (') character, like
this:
$arr['PestName']="a'cqua", it results the following in the serialized
string stored in the db:
a:1:{i:1;a:5:{s:8:"PestName";s:7:"a'cqua"....
note that "a'cqua" is not 7 chars lenght, but 6.
The problem is when I try to recover the array with unserialize(), it
fails, returning false. It is obvious that php is counting the (\)
character when serializing the string, but it stores it without it in
the db, so when it tries to recover the array, it fails.
Is this a known bug? Are there any workarounds you know?

Thanks a lot in advance.

Hernan

--- End Message ---
--- Begin Message ---
On Sunday 26 December 2004 16:41, [EMAIL PROTECTED] wrote:

> Have PHP 4.3.7, magic_quotes_gpc = On
> Have a multidimensional array made from values from a POST form.
> It addslashes() every field of the form as expected, like (') => (\'),
> etc.
> When I searialize the array to put it into a mysql db it seems to fail
> to describe the string lenght of values with the (') character, like
> this:
> $arr['PestName']="a'cqua", it results the following in the serialized
> string stored in the db:
> a:1:{i:1;a:5:{s:8:"PestName";s:7:"a'cqua"....
> note that "a'cqua" is not 7 chars lenght, but 6.
> The problem is when I try to recover the array with unserialize(), it
> fails, returning false. It is obvious that php is counting the (\)
> character when serializing the string, but it stores it without it in
> the db, so when it tries to recover the array, it fails.
> Is this a known bug? Are there any workarounds you know?

addslashes() is supposed to be applied to the value of the column (field). In 
this case the value is the finished serialized array. In other words 
serialize() then addslashes(). Also you ought to be using 
mysql_real_escape_string() rather than addslashes().

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Lonesome?

Like a change?
Like a new job?
Like excitement?
Like to meet new and interesting people?

JUST SCREW-UP ONE MORE TIME!!!!!!!
*/

--- End Message ---
--- Begin Message ---
I was wondering if I could get some help on a minor problem I have.
Here's the deal I have set up on my system.

http://ftp.brajah.com/ 

I created this simple little interface to list files and directories in the
public ftp folder. The only problem is, I had to move the whole directory to
my web site just to allow people to download the file. (ie:
(site)/ftp/atcommand.txt )

What I want to do is have a file (like get.php) which will read the file on
the drive, and then transfer it through to the client on the browser. (ie:
get.php?file=/atcommand.txt )

Is there a simple way to do this while reducing security concerns? (Ie:
reading ../../../../../etc/passwd )

--Jack

--- End Message ---
--- Begin Message ---
* Thus wrote Jack:
> 
> What I want to do is have a file (like get.php) which will read the file on
> the drive, and then transfer it through to the client on the browser. (ie:
> get.php?file=/atcommand.txt )
> 
> Is there a simple way to do this while reducing security concerns? (Ie:
> reading ../../../../../etc/passwd )

This will do the trick:

  http://php.net/realpath


$file = $_GET['file'];         /* ../../../etc/passwd */

/* make sure its absolute. */
if ($file{0} != '/') {
  $file = '/' . $file;         /* /../../../etc/passwd */
}

$file = realpath($file);       /* /etc/passwd */

/* just to be safe make it relative */
$file = substr($file, 1);      /* etc/passwd */


/* and prefix your ftp path: */
$thefile = '/path/to/ftp/root/' . $file;


Curt
-- 
Quoth the Raven, "Nevermore."

--- End Message ---
--- Begin Message ---
I am trying to get object data from a cisco AS5300 universal gateway
through snmp.
 i am using the getsnmp,walsnmp etc functions of php.
my proble is.
  i want to get cisco data using node address "1.3.6.1.4.1.9"( when we
start from the root of the tree)  but php starts  to look from the
"MIB" node and hence says " no object with the specified id exixts".

please suggest me a way to make php start from the root of the tree,
not theMIB node.

arun

--- End Message ---
--- Begin Message ---
On Sat, 25 Dec 2004 15:36:05 -0500, Sebastian
<[EMAIL PROTECTED]> wrote:
> how do i get the path to my home directory..
> 
> eg, /usr/home/

$_SERVER['home']


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

--- End Message ---
--- Begin Message --- I would like bar::do_something_internal() to have an access level of *private*
But this would fail, as the interface can only have *public* methods.
Is there a way to get bar::do_something_internal() to be private?
Or am I SOL, and it has be public?
Thanks


interface foo
{
    function do_something_internal();
}

class bar implements foo
{
   private function do_something_internal()
   {
       // I would like this to be private
   }
}

--- End Message ---
--- Begin Message ---

Dear group, 
 I am trying to query my db and print the results. 

 when i execute my script, i am not getting any
result
 except a blank page. can any one please help me what
 is going wrong with my script. 
 
 Script:
 
 $conn = pg_connect("user = $user dbname = $dbname
 host
 = $host password = $pass");
 if (!$conn)
 {
         echo('could not establish connection with
 database <br>');
         exit;
 }
 $sql = "select * from experiment;"
 $sth = pg_exec($connect,$sql)
 if (! $sth){
 die("Can't execute query".pg_errormessage());
 }
 
 for($i = 0,$j = pg_numrows($sth);$i < $j;$i++){
 $ar = pg_fetch_row($sth,$i);
 foreach($ar as $col){
 print "$col ";
 }
 print "\n";
 }
 
 ?>
 
 thank you in advance

 kumar



                
__________________________________ 
Do you Yahoo!? 
Send holiday email and support a worthy cause. Do good. 
http://celebrity.mail.yahoo.com

--- End Message ---
--- Begin Message ---
i'm working on a app which output files with readfile() and some headers..
i read a comment in the manual that says if your outputting a file php will
use the same amount of memory as the size of the file. so, if the file is
100MB php will use 100MB of memory.. is this true?

if it is, how can i work around this?

--- End Message ---

Reply via email to