Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP






SuperbHosting.net & Arvixe.com have generously sponsored dedicated servers and web hosting to ensure a reliable and scalable dedicated hosting solution for BigResource.com.







Funny Session Behavior


I am writing a foto upload site. A PHP page displays the uploades
fotos an the customer can choose several things. The data of the fotos
are kept in an array called bilder. I keep the data in a session. When
the customer send the data the following code will be run:

if (isset($sendorder_x))
{
session_start();
$nachricht = $bemerkungen;
session_register(nachricht);
// echo "1.: ";
// print_r($bilder); // The array still exists in the session file
// echo "<br>
2.: ";
for ($i = 1; $i <= $bildanzahl; $i++)
{
$formatname = "formate" . substr("00" . $i, -2);
$copyname = "copy" . substr("00" . $i, -2);
$bilder[$i]->format = $$formatname;
$bilder[$i]->anzahl = $$copyname;
}
// print_r($bilder); // bilder[] exists with the changed data in the
session file
// echo "<br>
3.: ";
$briefporto = $porto;
session_register(briefporto);
// session_register(bilder);
// print_r($bilder);
// exit(); // bilder[] exists with the changed data in the session
file
// echo "<br>
";
header("Location: datenupdate.php");
}

The page datenupdate.php starts with the fololwing code:

<?php
session_start();
// print_r($bilder);
// exit(); // all data is in the session file, but the array bilder[]
is empty now!
include ("database.php");
$dbid = connect();
.....

You can read in the comments, what happens. The lines, which start
with commenst, are for debugging.

Has anyone an idea, what the reason for tis behavior is? BTW, I use
PHP 5.1.4, Apache Server 2 on WinXP prof. SP2

And: This is no Easter Egg :-).


View Complete Forum Thread with Replies
Sponsored Links:

Related Messages:
Strange Session Behavior, Are Session Cookies Server Dependant
I'm having a strange problem with session variables. I am trying to access one of my site from two different systems. Sessions work fine on my system and I'm able to login but I cannot login from the other system because sessions are not working on it.

On printing session ID i found out that my system keeps 1 session ID but the other systems doesn't, everytime I refresh it fetches a new session id. I have tried all browser settings but all goes in vain.

Now heres the strange bit. We do have another server and we've got some sites running on it using the same session code for login. Sessions work fine for that server on both systems. Code:

View Replies !   View Related
Date Function Acting Funny
I'm using the date() function to generate each month name, but it's doing something really wierd!!

It all works fine apart from 'February', it doesn't seem to like Feb v.much, and it just generates 'March' instead. I thought it might be my local server so I made a little file with that bit in it and uploaded it to my server, exactly the same screwy result. Code:

View Replies !   View Related
SQL INSERT Query Acting Funny
I feel like I've seen this before, but I can;t remember what the problem was...

Anyway, I have the following INSERT query:

$query = "INSERT INTO reference_no (month) VALUES ('" . $this_month . "')";
$result = mysql_query($query);

The problem is that INSERT is not creating a new row -- instead it is writing over the last row in the table....

The SQL table should look something like this:

ref_num month
1 3
2 3
3 3
4 3

...and on in on in that pattern....ref_num is an auto-incrementing column, and I am repeatedly inserting a new row in which month is this numbered month (in this case, 3 = March)...

My SQL table, on the other hand, looks like this:

ref_num month
25 3

The ref_num indicates that there should be 25 rows in the table, but instead there is only one row, and the INSERT query writes over the previous row every time a new row is added...thus, leaving me with only the one row..

View Replies !   View Related
Odd Mt_srand Behavior
Apparently seeding mt_srand with different integers can produce identical
series of mt_rand results. Specifically, every pair of consecutive even and
odd numbers produces the same series - see below. This is a nuisance for
me. Am I doing something wrong? I'm using PHP 4.3.4 on a windows box.

mt_srand(0); echo " 0 new rnd =" . mt_rand() . " rnd =" . mt_rand() . " rnd
=" . mt_rand() . "<BR>";

mt_srand(1); echo " 1 new rnd =" . mt_rand() . " rnd =" . mt_rand() . " rnd
=" . mt_rand() . "<BR>";

mt_srand(2); echo " 2 new rnd =" . mt_rand() . " rnd =" . mt_rand() . " rnd
=" . mt_rand() . "<BR>";

mt_srand(3); echo " 3 new rnd =" . mt_rand() . " rnd =" . mt_rand() . " rnd
=" . mt_rand() . "<BR>";

mt_srand(4); echo " 4 new rnd =" . mt_rand() . " rnd =" . mt_rand() . " rnd
=" . mt_rand() . "<BR>";

mt_srand(100000); echo " 100000 new rnd =" . mt_rand() . " rnd =" .
mt_rand() . " rnd =" . mt_rand() . "<BR>";

mt_srand(100001); echo " 100001 new rnd =" . mt_rand() . " rnd =" .
mt_rand() . " rnd =" . mt_rand() . "<BR>";

mt_srand(100002); echo " 100002 new rnd =" . mt_rand() . " rnd =" .
mt_rand() . " rnd =" . mt_rand() . "<BR>";

mt_srand(100003); echo " 100003 new rnd =" . mt_rand() . " rnd =" .
mt_rand() . " rnd =" . mt_rand() . "<BR>";

mt_srand(100004); echo " 100004 new rnd =" . mt_rand() . " rnd =" .
mt_rand() . " rnd =" . mt_rand() . "<BR>";

produces

0 new rnd =1898087491 rnd =2091264893 rnd =1090025303
1 new rnd =1898087491 rnd =2091264893 rnd =1090025303
2 new rnd =1309289693 rnd =1266233749 rnd =2011030501
3 new rnd =1309289693 rnd =1266233749 rnd =2011030501
4 new rnd =265425943 rnd =110448983 rnd =1971643347
100000 new rnd =863778341 rnd =827028059 rnd =1038256368
100001 new rnd =863778341 rnd =827028059 rnd =1038256368
100002 new rnd =1020061831 rnd =477025457 rnd =1071505930
100003 new rnd =1020061831 rnd =477025457 rnd =1071505930
100004 new rnd =2050501876 rnd =406342065 rnd =79708900

View Replies !   View Related
Browser Like Behavior
What is the easiest way to use jakarta HttpClient 3.0 , to behave like
browser executing methods with sequential URLs?

View Replies !   View Related
Odd Fsockopen Behavior
Any IP address I try to open with fsockopen on a particular server
seems to use another IP address instead.

eg. I open a socket connection to 192.168.1.1 but the remote_addr that
the other server sees is 192.168.1.255. It's as if, like I said, the
IP address I supply to fsockopen is being replaced with another one.

Anyway, this is breaking a script of mine. I don't think I can really
do a lot in PHP to fix this but is there perhaps some way that I can
detect it? Is there some command line parameter that I can pass to
passthru or something that'll tell me whether or not such a thing is
happening?

Also, how is this even being done? Could a firewall do this? If so,
I'm still not even sure how it'd be done...

View Replies !   View Related
Countinue Behavior
Is that a normal behavior of countinue?
Shouldn't it skip the echo?

-------------------------------------
<?
for ($i=0; $i < 10; $i++) {
countinue;
echo "bla";
}
?>
-------------------------------------

View Replies !   View Related
Odd Cookie Behavior
I'm processing a form, and on the target posting page, I'm setting
cookies for the name/value pairs like this:

while (list($name, $value) = each($HTTP_POST_VARS))
{
if ( $value <> NULL ) {
setcookie($name,$value,time()+3600*24*30*12*10);
$mystring = "<input type="hidden" value="$value" name="$name">

$mystring";
}
}

Now after posting when I go back to my original form with the same URL
path,

www.mydomain.com/mypath,

I can see that the cookies are there because the values appear in the
fields like we'd expect. However if I put the very same form in a
different directory, eg: www.mydomain.com/secondpath then the cookied
values no longer appear.

I knew that cookies could be domain specific, but is there a setting
that makes them somehow directory specific??

View Replies !   View Related
Array Behavior
I am trying to create a dropdown menu with options pulled from a MySQL database. I count the number of entries in the database, assign that to a variable, and then insert each entry into an array.

I then try to echo the HTML for each option using this loop(where $numdisplayed is the number of times the loop has run, and $quotees is the array that the options for the dropdown menu are stored in.):

while($numdisplayed < $numquotees){
echo '<option value="'
echo"$quotees[$numdisplayed]";
echo'">'
echo"$quotees[$numdisplayed]";
echo"</option>";
$numdisplayed++;
}

It seems as though you can't use a variable to refer to an array key. Any alternatives?

View Replies !   View Related
$PHP_SELF A Strange Behavior!?
As we know $PHP_SELF is a PHP predifined variable. It handles the current file name and extension. I have a file contains commonly used functions. it's named func.php. Inside some of these functions, I use $PHP_SELF. I perform include for this file in another file called index.php.The strange behavior is, in some code area $PHP_SELF does not return any value, in other word,
it does not return index.php. However, in other areas it works properly!

So What's the cause of this problem?
Is it bug in my PHP?
I use PHP Ver 4.2.3 on Apache, and windows ME. All this from phpdev423 package.

View Replies !   View Related
Strange Behavior With PHP Over HTTPS, On IE
I have a login.php and register.php inside our httpsdocs directory, that is the root of https:// path.

login.php and register.php both require_once a global.php file located inside httpdocs, the root of http://.

In Firefox and IE, viewing the page certificate of https://pathtosite/login.php will show our Equifax provider.

But, only on Firefox does it show the 256 bit-encryption lock icon in the status bar of the browser. For some reason this isn't showing in IE.

I created a blank index.php inside of httpsdocs, and accessed it at https://pathtosite/index.php, and in IE it shows the lock icon in the status bar.

Very strange. Is it because the files are referencing to global.php, which is located outside of https? I wouldn't think so... or is this just an IE issue?

View Replies !   View Related
Lack Of Suexec Behavior
suexec on old perl cgi processes was useful:
A cgi process (run by the apache process)
could create files that belonged to me.

Php usually runs as an '.so' library, owned by
the apache process, which is more efficient.
But it means all files (even in my filesystem
space) created by php/apache end up owned
by apache. This is an enormous pain the butt,
particularly when complicated by 'safe_mode'
restrictions.

Why can't the php kernel be hacked to fork
a full-fledged, separate process, that
uses setuid owner for certain key file system
chores: perhaps only for certain newly created functions,
like "mkUserOwnedDir() or openUserOwnedFile()"

View Replies !   View Related
Classes: Strange Behavior
I have a problem with code like this (PHP 5.1.4):

fila A.php:
=======
include(B.php);
class document extends obj {
.........
}

file B.php:
=======
$GLOBALS['x']->new we();
function __autoload($class_name) {
...here is the code to load classes...
}

file C.php
=======
class we extends obj {
private $document;
function __construct() {
$this->document = new document();
}
}

The problem is that after loading A.php into browser, PHP cannot find
document class which is defined in the A.php file! The problem is even
more strange - if document class doesnt extends obj class than
everything is ok.

(The problem exact is that __autoload special function is called when
in file C.php constructor of class we try to make the document object
(all other classes like obj has been already loaded).

Do you have any idea what is wrong with that?


View Replies !   View Related
What Is Php's Behavior When Connect To A Db?
What is php's behavior when connect to a db?

I've been told that php was once a dominant web programing language.
I've read a few chapters of a php book.

I was wonder what's php's performance.

Perl was once for a while a popular programming language for cgi.
But start very process per one web visit cause serioius problem to
system performance.

And then FASTCGI born.
I was impressed by its performance.

But recently i learn to do some php program which connect a mysql db.
It seems that the program run's very slow.

So, I have 2 questions:
1. does the os need to fork a php interpreter for every single web
request?
2. does the php connects to mysql all the time? that is does it need to
connect mysql
100 times when a user request the url 100 times?

If the answer if yes, i think that php's performance is unacceptable.

View Replies !   View Related
Strange Strtotime() Behavior
I'm trying to use the strtotime() function to manage sessions. But I
get the following

<?php
print(time() . " - " . strtotime("+1 hour"));
?>

outputs:

1097380666 - 1097308800

Strange strtotime("+1 hour") produced a time stamp less than the
current time. It also never changes. In other words strtotime("+1
hour") always results in the time stamp 1097308800.

I have also tried strtotime("+1 hour", time()) with the same result

Is this correct, have I misunderstood the strtotime() function?

I'm running Gentoo with kernal 2.6.8.1, php 5.0.1, apache2

View Replies !   View Related
Strange Class OOP Behavior
Anyone ever experienced this problem.

When i pass a mysql result to the constructor of a class and use that
resultset inside that class the original resultset outside the class gets
affected too. That is not right i think because my result inside my class is
private. Is this a bug? Can someone look at my code below please:

<?php

require_once('includes/connect.php');

class test {

private $_result;
private $_record;

public function __construct($result) {

$this->_result = $result;

}

public function show() {

while($this->_record = mysql_fetch_array($this->_result)) {

echo $this->_record['name'].'<br />'

}

}

}

# usage
# sql statement dat artikels ophaald uit cartal database
$SQL = "SELECT * FROM test_table";

# uitvoeren van dit statement
$RESULT = mysql_query($SQL,$conn);

$t = new test($RESULT);

$t->show();

// mysql_data_seek($RESULT,0);..

View Replies !   View Related
Strange Mysql_query Behavior
I have the following query:

$query = "select * from $tablename where lname like '$lname' order by lname" ;

Then I have:

$result = mysql_query($query);

The $lname is formed properly. I have an lname that is "Marshall". If the $lname is "Mar%" the select works. If the $lname is "Marsha%" it doesn't.

View Replies !   View Related
Strange PHP_SELF Behavior
I am migrating a self-made CMS app from one linux server to another and
i am getting very strange PHP_SELF behavior on the new server.

This app uses SEF URLs like http://domain.com/index.php/title/4/ (4
being the id)

When i use PHP_SELF in all the server but the new one i get as an
answer "/index.php/title/4/".

When i use it on the new server, i get "/title/4/"!!!!!!!
I am at a loss here. What could be triggering such a change? What
parameter should i change in the new server's config?

For info purposes, i'll attach the PHPInfo for both servers: the
working one and the new, not working one:

NOT working server:
http://new.microcar.es/phpinfo.php (PHP v4.3.11, Apache 1.3)

working server:
http://www.microcar.es/phpinfo.php (PHP v4.3.10, Apache 2.0)

Hint: You could try http://new.microcar.es/phpinfo.php/title/4/ and see
the result for yourself.

last info: i tried under another 1.3 server and it works well.

View Replies !   View Related
Php Equivalent To Perl's || Behavior?
one feature of perl I'm desparately missing in php is using || to assign
the first non-empty value in a list to a variable. For example,

# perl example 1
$a = 1;
$b = 2;
$c = $a || $b;
print $c; # displays 1

# perl example 2
$a = 1;
$b = 2;
$c = $d || $b;
print $c; # displays 2, since $d is empty

# perl example 3
$a = 'apple'
$b = 'banana'
$c = 'cherry'
$d = $a || $b || $c;
print $d; # displays 'apple'

# perl example 4
$a = ''
$b = ''
$c = 'cherry'
$d = $a || $b || $c;
print $d; # displays 'cherry'

This is such a handy language construct. Is there any such php
equivalent that accomplishes this? I've already written a function to do
it. (Like this: $d = value($a, $b, $c). But making value() visible
everywhere is something I'd rather avoid if there's something built-in
to php.)

View Replies !   View Related
How To Tell If Escape Behavior Is Turned On
Is there a programmatic way in PHP (using PHP 4) to tell if the
escaping apostraphes behavior is turned on when a request is submitted?
What I would like to do is insert a value into my db table, but only
apply escaping if PHP hasn't applied it for me ...

$v = $_REQUEST['val'];

if (escaping_disabled()) {
$v = escape($v);
}

insertIntoDB($v);

View Replies !   View Related
How To Save User's Behavior
I would like to record in a session (or in any other way) some array with user's behavior. But I need to save it on my machine in the moment the user is leaving, for I don't want to do it every time page is loaded. Is there any way to realize it?

View Replies !   View Related
Confusing POST Behavior -- Doing It Twice?
I am confused about what goes on with method POST. Here is an overview of a
my code, sketching it out:

<?php
if (isset($_POST['Submit']) && $_POST['Submit']=="Submit") {
---Do a bunch of stuff---
if (isset($_SESSION['Error'])) unset($_SESSION['Error']);
if (strcmp($A, "any") {
// Verify that a Zip code is numeric and is five digits
If (!is_numeric($_POST($zip)) strlen($_POST($zip)) != 5) then {
$_SESSION['Error'] = "an error description";
header("Location: thisSite.php:);
}
}
}
header("Location: anotherSite.php:);
?>

...... in the form description I have an
<?php if (isset(($_SESSION['Error'])) echo $_SESSION['Error']; ?>
(Note: The form is type POST).

So here is the problem:
1 - When I start, there is no error message.
2 - I deliberately put in a bad zip code and have a value other than "any"
in the A control and click to submit it.
3 - Instead of going back to thisSite.php and displaying the error message,
it goes to anotherSite.php.
4 - If I then hit the back arrow on the browser, it displays with the error
message on thisSite.php

It seems that
1 - on the submit it goes through the logic and sets the error.
2 - It then must be going through a second time, but this time taking on the
default setting of "any" for control A and so bypass the logic on the zip
code and so goes to anotherSite.php.

View Replies !   View Related
Text File Behavior
I have a question about the behavior of a text file thats being written and
read to.

Say Im using an XML file as the database for my little application. Users
come to my site and the file is read and parsed and coverted to some display
in html. On another page users can add information that updates this XML
file.

Is there any risk in this approach? While the XML file is being written to,
what is its readabililty? And vise-versa. Assuming Im using the standard
read write functions for files in PHP, will the read wait for a write to
finish, etc.

View Replies !   View Related
Odd Behavior Installing Extension
I've set up PHP 5.0.5.5 on an Windows 2003 system running IIS (yes yes,
have I considered Apache? Unable, other factors at play).

I wrote a simple test PHP that does nothing but phpinfo(), and it works
great. The moment I activate mysql support, trying to execute the
script results in a perpetual wait until timeout.

I have read http://www.php.net/manual/en/instal....extensions.php

My libmysql.dll is accessible to paths (copied to Windows as
experiment to make sure.

My extensions_dir is pointed at my ext dir, and if I insert gibberish
into it, launching PHP gives an error, so I know PHP has found and
parsed the file.

The crux is that things go to heck when I uncomment
extension=php_mysql.dll. Trying to run the test.php halts and goes no
further. If I comment that out again, everything works fine (except,
of course, for mysql).

View Replies !   View Related
Stumped By This Php Database Behavior
Consider:

while ($j < $num2) {
$parent_id=mysql_result($result2,$j,"parent_id");
$fam_first_name=mysql_result($result2,$j,"fam_first_name");
$fam_age=mysql_result($result2,$j,"fam_age");
echo "it is $parent_id";
echo "<tr id=$parent_id>";
echo "<td></td>";
echo "<td >$fam_first_name</td>";
echo "<td>$fam_age</td>";
echo "</tr>";
++$j;
}

The line that says "it is $parent_id" will print the variable.
The next parent id will skip one if it has two of the same values. I
know this may not make sense, but:

it is 1
it is 3
it is 3
it is 6

but the second three from above will never be in the tr id= tag. i
hope this makes sens. It just doesn't print in the tag if it has two
rows.

View Replies !   View Related
Wierd Login Behavior
I have a registration script that allows someon to register to my site. After the register they are taken to a login script which consists of a username and password field. Simple enough.

Here's the weird thing. They can login just fine. But only once!?! The next time they try and login in it fails to execute the query. Does this sound familiar to anyone?

View Replies !   View Related
Strange Date() Behavior
we are using date() in several contexts in our development. Now we get a quie strange looking error message. Can someone tell me, where it comes from? Code:

View Replies !   View Related
Weird Variable Behavior
I'm having an issue with some weird variable behavior. I could be overlooking something simple, but I figured I'd throw it out there since I can't seem to figure it out.

I have a page that takes a variable in from GET called $pageview, it basically decides whether or not you want your results, or everyones.

You load the page in view 1, your results, and if I echo $pageview at the top of the page, it displays "pageview: 1", ok all good. Code:

View Replies !   View Related
Inconsistant Cookie Behavior
The idea is that the cookie should write the referrer information on whatever page the user lands on. The include for writing the cookie is included on every page of the site and has a conditional wrapper that essentially says don't write the cookie if the cookie exists.

Thus should preserve the value of the first page the user lands on so that I can retrieve the information later. Unfortunately, sometimes the page written is not the first page of landing .. but rather the last page prior to the page that requests the cookie.

View Replies !   View Related
Strnge Function Behavior
I have a simple function (show.php) that resizes & displays images onto a page. Code:

View Replies !   View Related
Different Behavior Between Desktop And BlackBerry
I can't seem to figure this one out. On my site, I have a real estate listing form. One of the fields is for the user to be able to upload a picture.

Now, when I access this page on my PC at home, I have no problems. The error handling and security checks work fine. Regardless of whether I input info for this picture field, the form processor works. Code:

View Replies !   View Related
Strange Include() Behavior
I'm building a php site which uses axaj for navigation. it basically goes: Code:

View Replies !   View Related
Normal Behavior W/ Slashes
Before anything is inserted into my site's DB, I run addslashes() on it. When the function is used, data in the DB looks exactly like it did when it was submitted. For example, if a user enters O'Reilly in a form, it will appear as O'Reilly in the database (when viewed in phpmyadmin, at least.) This seems to negate the need for stripslashes() when displaying text from the database, as there are no slashes in the string.

View Replies !   View Related
$_SERVER['HTTP_REFERER'] Strange Behavior.
I'm having trouble with referring a page across my site.

My php uses a switch statement to see which action to use (if any):

if(!empty($action_get)) {
switch ($action_get) {
case 'student_unassign':
header('Location: ' . ERROR_FILE . '?error_id=2');
exit;
break;
default:
header('Location: ' . ERROR_FILE . '?error_id=2');
exit;
break;
}
}


These two cases produce different results on the error.php page (defined as a constant for ERROR_FILE)

I split out the referer array:

$ref = $_SERVER['HTTP_REFERER'];
$ref_arr = explode("/", $ref);
$ref_count = count($ref_arr);
$ref_url = $ref_arr[$ref_count-1];

and use $ref_url to display the referring page.

case 'student_unassign':

correctly displays where it's from (students.php)

default:

all the values are blank.

Any idea what is causing this / how to fix it?

Effectively I'm trying to positively validate the $action_get variable, and if it's not 'student_unassign', then redirect to the error.php page, creating a link for the user to return to the correct ("students.php") page.

View Replies !   View Related
Strange File Upload Behavior
I was having permission problems, so I'm using a test file to make
sure uploading works.

upload.php successfully uploads a file to the images/bookcovers dir:

<html>
<form method="post" enctype="multipart/form-data" action="upload.php">
<input type="file" name="userfile">
<input type="submit" value="submit">
<input type="text" name="eh" value='meh&lt;'>
</form>

<?php
$source = $_FILES['userfile']['tmp_name'];
$dest = 'images/bookcovers/' . $_FILES['userfile']['name'];
if ( ($source != 'none') && ($source != '' )) {
move_uploaded_file( $source, $dest );
}
?>

</html>

Now, I use the same code in another php file. The file is in the same
dir as the file above, and has the same permissions. The pertinent
code is:

$source = $_FILES['small_image']['tmp_name'];
if ( ($source != 'none') && ($source != '' )) {
$dest = explode(".", $_FILES['small_image']['name']);
$dest = './images/bookcovers/' . $isbn . "_small." . $dest[1];
move_uploaded_file( $source, $dest );
$smallimg = 1;
chmod($dest,0644);
}

When I try to upload a file using the second php script, I get
permission errors:

Warning: move_uploaded_file(./images/bookcovers/0679728759_small.jpg):
failed to open stream: No such file or directory in
/home/chucknet/public_html/bookclub/addBook.php on line 120

Warning: move_uploaded_file(): Unable to move '/tmp/phpw93I5U' to
'./images/bookcovers/0679728759_small.jpg' in
/home/chucknet/public_html/bookclub/addBook.php on line 120

I'm really at a loss as to what could be causing this. Both scripts
have the same permissions and the same owner.

View Replies !   View Related
DomDocument::loadHTML - Expected Behavior?
Quick question about DomDocument::loadHTML (http://www.php.net/manual/en/functio...t-loadhtml.php) Why does this not create a parse-tree? Code:

View Replies !   View Related
LOGIN USER SERVER BEHAVIOR
In dreamweaver mx 2004 I used LOG IN USER SERVER BEHAVIOR [USER AUTHENTICATION] to built a login page, well, how I define webpages under this coverage that a user can access after login or can not access[define other pages out of this login coverage or in another login coverage can not access by first] ?

View Replies !   View Related
OOP Mysql Result Strange Behavior
When i pass a mysql result to the constructor of a class and use that
resultset inside that class the original resultset outside the class gets
affected too. That is not right i think because my result inside my class is
private. Code:

View Replies !   View Related
Strange Behavior With Phpmyadmin And Innodb Tables
I recently converted all my existing MyISAM tables to InnoDB tables
through phpmyadmin. I noticed some strange behavior whenever I would
refresh the screen, as phpmyadmin would report different numbers for the
cardinality of the primary key (i.e. one minute it would say cardinality
388, then 244 on refresh, then something else), and it would report
different values for the number of rows when mousing over the table
names on the left menubar. This behavior only seems to exist on tables
with a "larger" number of rows, and by larger I only mean ~100 or more
rows (tables with fewer rows always report the correct number of rows).

Whenever I do a SELECT *, I get the correct number of rows returned, so
I know they are actually there.

View Replies !   View Related
Unexpected Behavior When Creating Xhtml Documents
The following has been posted before (2 years ago) but no response was
added. Therefor again, the following code for creating xhtml file:

<?php

error_reporting(6143);

$xmlns = "http://www.w3.org/1999/xhtml";
$lang = "en";

$xhtml_1_strict = new DomImplementation();

$dtd_xhtml_1_strict = $xhtml_1_strict->createDocumentType("html", "-//
W3C//DTD XHTML 1.0 Strict//EN", "http://www.w3.org/TR/xhtml1/DTD/
xhtml1-strict.dtd");

$xhtml_1_strict_document = $xhtml_1_strict->createDocument("", "",
$dtd_xhtml_1_strict);
$xhtml_1_strict_document->encoding = "UTF-8";
$xhtml_1_strict_document->standalone = "no";


View Replies !   View Related
Function Exhibits Bizarre Behavior In Windows XP
function getResponse() {
  $responseID = @fopen('php://stdin', 'r') or die('Cannot read from stdin');
   while (($response = @fgets($responseID, 1024)) !== false) {
     @fclose($responseID);
     return $response;
   }
}

This function works just fine if using CLI PHP in a Unix platform. But this same function is required to be used in an application that is housed within a Windows XP platform, and in that platform, this function seems to ignore user input and returns null every time.

Does anyone have any idea why this would specifically happen only in Windows XP using CLI PHP and nowhere else? Is there some issue involving XP's version of stdin?

View Replies !   View Related
Strange Behavior When Loading MySQLi Extension On Win32
I have come to love the ease of updating PHP, since getting used to
using it these past few years. Recently, however, when I upgraded from
PHP 5.1 to PHP 5.2.0 and again when moving to 5.2.1, I noticed strange
behavior when trying to load php_mysqli.dll. I am using Apache 2.2.3
on Windows XP Pro (32-bit). I use the php5apache2_2.dll to load PHP as
an Apache module. The PHPIniDir directive in httpd.conf points to the
correct directory. I also have the older php_mysql.dll extension
loaded simultaneously, which works fine. However, in phpinfo(), MySQLi
is nowhere to be found, and trying to use any mysqli functions or its
class will yield an error saying that they're undefined. In php.ini,
the extension_dir directive points to "C:php5ext".

As for the environment, I have my PHP install dir in the _System_ PATH
(it's been there for a long time): C:php5. When I install, I just
move new release into the php5 directory, so necessary DLLs for
extensions do not need to be moved, and older versions can be
overwritten for newer releases. In fact, mb_string, mcrypt, GD2, cURL,
php_mysql, and many other extensions load just fine. However, the only
way I can get MySQLi to load correctly is by moving libmysql.dll into
my C:WINDOWSsystem or C:WINDOWSsystem32 folders.

I simply can't understand why the problem lies only with MySQLi. Also,
when I restart Apache, there are no errors. The MySQLi extension
directive in php.ini is also uncommented, by the way. :-)

This has only started to happen since my past couple upgrades, so I'm
not sure exactly what to make of that.

View Replies !   View Related
Question About The Behavior Of String Associative Array Keys
I am trying to use an associative array to pass names and scores to a JPgraph but I believe I may misunderstand something about associative arrays. Say I have an array called $kidscores where:

$kidscores=(Johnny_Jones => 50, Sally_Smith => 100, Tommy_TheCat =>75)

When I pass the $kidscores variable to JPgraph, and try to....

PHP Code:

View Replies !   View Related
Strange Behavior Of Class: Lose Data On Throw Exception.
I use a class vith a vaiables.
When a function throws an exception it seems to loose data:

....
$c=new myclass();
try{
$a->var1=1;
$a->function_throw_exception(); <--- this throws an exception
...
}
catche(exception $e)
{
$a->var1; <--- is empty ?!?!
}

The code is more complex but the idea is this.
it is possible?
what do you think?

View Replies !   View Related
Warning: Session_start() [function.session-start]: Cannot Send Session Cookie - Problems With The Session Variables.
I am have a form on the page registration.html the content is posted to a page called registration.php Although the database is getting populated, i am having problems with the session variables. I get the following errors:

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /usr/shared/web/intocore/registration.php:10) in /usr/shared/web/intocore/registration.php on line 41 Code:

View Replies !   View Related
$_POST Behavior From Input=submit Vs Input-type=button
I have been trying to solve an annoying behavior with PHP (I think).
Maybe some of you have encountered the same and have some ideas.

I have an html form and I use an <input type="button"> element with
the onClick event that calls a javascript funtion. Once the script's
content has been processed, I execute the form.submit() directive.

I would like to combine the html form and the PHP script into one, and
use action="<?php echo($PHP_SELF) ?>".

When the html form has <input type="button" name="theButton"
value="thisisthetrigger" onclick="doThis(this.form)">but PHP cannot
'read' the value of $_POST["theButton"] after form.submit().

If I substitute the <input type="button"> for <input type="submit">
then PHP reads the value just fine. Some may argue to just use the
latter option, but that will cost me a trip back to the server to
basically do a lot of validation that can be very easily accomplished
on the client side.

View Replies !   View Related
Session Problem: Session Exists, But Session Variables Don't Lasts
I have some troubles with session variables. I can easily create a session,
but the variable I append to global session array ( $_SESSION) lasts only
until the end of current function.

I prepared an example that can demonstrate the problem (see code bellow):
The program flow is this:
(1) It starts with "session_start()" and displays "login_form()".
(2) When user enters his username and password, it goes to "login()"
function which sets $_SESSION variables.
(3) This function also "Echoes" session_id and user name to the screen.
(4) Then it goes to "MyProgram()" function. It only "Echoes" the same
variables to the screen.

Strange is, that the session_id is the same in (3) and (4), but the user
name ($_SESSION["username"]) is only in (3), but not in (4). By other
words - $_SESSION["username"] variable filled up by "login()" function is
immediately cleared.

I don't know why.

There must be something missing, but after 3 days of watching it, I can not
find a problem here.

===========================================
<?
Function login($uzivatel, $heslo)
{
$_SESSION["username"] = $uzivatel;
$_SESSION["pass"] = $heslo;
$U_Name=$_SESSION['username'];
echo "Login username: $U_Name<BR>";
echo "Login session ID: ";
echo session_id();
echo "<BR>";
}

Function login_form()
{
echo ("<DIV ALIGN='center'>
<H1>Test</H1>
<P>Please enter your username and password:</P>
<form action='test.php' method='get'>
<INPUT TYPE='HIDDEN' NAME='login' VALUE=TRUE>
<TABLE BORDER=&#390;'>
<TR>
<TD ALIGN='right'><U>U</U>ser name:</TD>
<TD><INPUT NAME='uzivatel' SIZE=25 ACCESSKEY='U' TYPE='TEXT'></TD>
</TR>
<TR>
<TD align='right'><U>P</U>assword:</TD>
<TD><INPUT NAME='heslo' SIZE=25 ACCESSKEY='P' TYPE='PASSWORD'></TD>
</TR>
<TR>
<TD COLSPAN=2 ALIGN='RIGHT'><INPUT NAME='OK' ACCESSKEY='O' TYPE='SUBMIT'
VALUE='OK' TABINDEX=3></TD>
</TR>
</TABLE>
</FORM></DIV></HTML>");
}

Function MyProgram()
{
$U_Name=$_SESSION['username'];
echo "Program username: $U_Name<BR>";
echo "Program session ID: ";
echo session_id();
echo "<BR>";
}

{
session_start();
if ($_SESSION['username']):
MyProgram();
else:
{
if (!$login):
login_form(0);
else:
login($uzivatel, $heslo);
MyProgram();
endif;
}
endif;
}
?>
===========================================

View Replies !   View Related
Code Is Secure Enough To Hold Of The Majority Of Session Fixation And Session Hijacking Attempts.
I am having a few problems dealing with the aspects of security on php pages, having read several books and looked at several web pages about it I am still having a few problems bringing it all together or finding a practical example...

the following is what I am using, and would be very grateful if someone with the knowledge of such things could look at what I have used and tell me if the code is secure enough to hold of the majority of session fixation and session hijacking attempts. Code:

View Replies !   View Related
Warning: Session_start() [function.session-start]: Cannot Send Session Cache Limiter
I upgraded from PHP 4 to PHP 5 recently, and this code was working on PHP 4 but it isnt anymore. It came up with this error:

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/jonoc33/public_html/clansolutions/members/inc/top.php:5) in /home/jonoc33/public_html/clansolutions/members/menu.php on line 3

Warning: Cannot modify header information - headers already sent by (output started at /home/jonoc33/public_html/clansolutions/members/inc/top.php:5) in /home/jonoc33/public_html/clansolutions/members/menu.php on line 6

The code that contains line 3 and 6 is this:

<?
include("inc/top.php");

Should I ask to downgrade to PHP 4?

View Replies !   View Related
Warning: Session_start() [function.session-start]: Cannot Send Session Cookie
I've wrote a login script thats self contained, in other words all the checking etc.. is contained in the same file, i.e password checking etc...

I keep getting the following error...

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at d:inetpubwwwrootac-kreationsadminauthadmin.php:1) in d:inetpubwwwrootac-kreationsadminauthadmin.php on line 4

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at d:inetpubwwwrootac-kreationsadminauthadmin.php:1) in d:inetpubwwwrootac-kreationsadminauthadmin.php on line 4

Here's the start of the code. PHP Code:

View Replies !   View Related
Warning: Session_start() [function.session-start]: Cannot Send Session Cache Limiter - Session_destory();
I'm getting this error: Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent ... output started at blah blah blah.... on line 1.

Line one is <?php session_start();

This page is a login and logout page. I use session_destory(); to log the user out when a link is clicked. It redirects them to this page, with a ?action=logout in the url. I use $_GET to test if action == logout, and if it does, it calls session_destory(); and then uses javascript to redirect the user after 5 seconds to the homepage.

what does the error mean, I've seen it before, but for some reason it's not comming to me.

View Replies !   View Related
Warning: Session_start(): Cannot Send Session Cookie - Verify That The Current Setting Of Session.save_path Is Correct
Warning: session_start(): open(/tmpsess_526e492c7e6fbe4887e4c52821b34be7, O_RDWR) failed: No such file or directory (2) in C:Program FilesApache GroupApache2htdocsTempMgtindex.php on line 15

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at C:Program FilesApache GroupApache2htdocsTempMgtindex.php:15) in C:Program FilesApache GroupApache2htdocsTempMgtindex.php on line 15

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at C:Program FilesApache GroupApache2htdocsTempMgtindex.php:15) in C:Program FilesApache GroupApache2htdocsTempMgtindex.php on line 15

Warning: Unknown(): open(/tmpsess_526e492c7e6fbe4887e4c52821b34be7, O_RDWR) failed: No such file or directory (2) in Unknown on line 0

Warning: Unknown(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0

View Replies !   View Related

Copyright © 2005-08 www.BigResource.com, All rights reserved