[PHP] PHP reading wrong Linux folder
Hello! I'm running PHP 4.2.3 on a Linux web-hosting server. Right now I am trying to work with a PHP script (MLM Multi List Manager, in case it matters) to handle mailing lists. It works terrific on one server, but on another one it has a very strange problem that I was hoping someone would know how to solve. The script is running from a directory, let's call it "phproot". 1) The script first opens up a filename in "subdirectoryA," reads the contents, and closes the file. 2) Then the script does some business, opens ANOTHER file, this time in "subdirectoryB," makes some changes, and closes that file. (It does all this using variables. So, the script in the "phproot" directory does the first bit of business with "$folder1/$file1", then does the second bit of business with "$folder2/$file2".) So what's the problem? The problem is that when the script does the stuff in step 2, instead of just reading and writing the file in "subdirectoryB," it for some reason creates a new subdirectory UNDERNEATH "subdirectoryA"--so now the file I *wanted* to access remains untouched, and instead I have a brand-new directory, "phproot/subdirectoryA/subdirectoryB"! Why is this happening? It's like the script somehow got "stuck" in "subdirectoryA" and now treats it as the root directory from which the script is running. Is there some sort of php.ini setting that's wrong here, some environment setting that causes this weird behavior? Like I said, the script itself worked fine under another setup, so it's not a fundamental script flaw. Any ideas? Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP reading wrong Linux folder
Never mind, I solved it--behavior was caused by a script call to a UNIX function which didn't exist on the new server. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How do I call a CGI script from PHP?
I'm new to PHP and want to build a basic page. The one thing I cannot find any documentation on is the seemingly simplistic question of how to run a Perl script. I just want to execute a site-tracking script from my PHP page, nothing fancy. .In SSI, I just use the "#exec cgi=" line--is there an analogous command in PHP? Thank you for your help! Matthew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] blank
subscribe [EMAIL PROTECTED] matthew de Jongh president the spa! internet voice (413) 539-9818 www.the-spa.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Kerberos authentication
Well, UC Santa Cruz uses a Kerberos server to authenticate students and faculty onto their network. We need to create a login form that will allow various departments to use a web-based-interface to log into their websites, and they'd all like to use the pre-existing Kerberos server to do so. That way, people could use their existing accounts. Any ideas? --Matthew http://www.quabbo.com Quoting Justin Patrin <[EMAIL PROTECTED]>: > On Thu, 12 Aug 2004 21:15:40 -0700, Matthew Runo <[EMAIL PROTECTED]> wrote: > > -BEGIN PGP SIGNED MESSAGE- > > Hash: SHA1 > > > > Hello- > > > > I am working on a project that requires Kerberos authentication, > > however - we are unable to use the apache module that one would > > normally use [sys admin.. *grumble*]. > > > > I searched the archives to find a script that would authenticate a user > > against a Kerberos server, and found very little. Does anyone have any > > ideas? I'd bow down and be very, very, excited if someone did... > > > > What exactly are you trying to authenticate against? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Newbie needs help with MySQL and multiple databases
Hi, im fairly new to php and mysql and need a little help. im running a forum community and would like to have it run on multiple databases because of performance issues others have encountered using the same software on on database. My question is is it possible to have the software connect to 2 different databases depending on which is needed? and if so will users need to login again when accessing the second database (their user info will only be on the second database.) Thank You -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] code not working...help?
Hi guys im pretty new at this and cant seem to get this going I want the code to query the database for the number of messages posted within the last month this is the code i have but its not working... I might even have it all wrong, can someone point me in the right direction? $lastmonth = date("YmdHis", mktime(date("H"), date("i"), date("s"), date("m")-1, date("d"), date("Y"))); $countResult = db_query("SELECT count(*) AS msgCount FROM messages WHERE uid = '". $userID ."' AND fid = '". $fid ."' AND post_date <= '". $lastmonth ."'"); $countRow = db_fetch_array($countResult); im then using $countRow as my variable but it keeps returning a value of zero. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: creating objects by reference?
Jonathan Sharp wrote: > Is it better to do: > $obj = &new object(); > > verses: > $obj = new object(); > > thanks, > -js If you are looking to the future: I don't believe the ability to return objects by reference will be an option in Zend Engine 2. Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: is there php equiv left() and right() functions?
Jeff Bluemel wrote: > I have a string that will look like the following; > > data1|data2 > > now - I need to put data1 in a variable, and data2 in another variable. > I've found the functions strlen, and strpos, but I can't figure how to > grab this data. > > thanks, > > Jeff Try list($var1, $var2) = explode('|', 'data1|data2'); Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Getting https-page
Look into the CURL libraries. http://www.php.net/manual/en/ref.curl.php They essentially allow you to emulate the behavior of a browser. Where I work, we use them to make SSL connections to payment processing gateways. Matthew -Original Message- From: Martin Thoma [mailto:[EMAIL PROTECTED]] Sent: Monday, January 20, 2003 7:47 AM To: [EMAIL PROTECTED] Subject: [PHP] Getting https-page Hello! You can easily get an webpage with: $fp = fopen("http://www.mydomain.com/";, "r"); if ($fp) exit; while(!feof($fp)) { $line .= fgets($fp, 4096); } fclose($fp); print $line; But this doesn't work with https (SSL). How can I get an https-page? Martin -- 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] setting phprc
hi i need to set one directory on my server with global_variables turned on. i'm running apache i've read that by setting the environment variable PHPRC, I can point a directory to a different php.ini file. however, i'm having trouble finding out how to go about doing this. is this something i set within php? or is this an apache variable that i set? any suggestions? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to :: multi select
Hi Thomas. You need to name each checkbox a different name. alternatively, you can name them with array naming convention. i.e. 1-1 1-2 2-1 2-2 Checking off 1-1 and 2-2 would create the following variables (assuming register_globals is on) in the target php script for the form: $array1=array("value1"=>"Y","value2"=>""); $array2=array("value1"=>"","value2"=>"Y"); Hope this helps Matt On Fri, 2003-07-04 at 17:20, Thomas Hochstetter wrote: > Hi guys, > > This might just be off the topic, but here it goes anyway: > > How can one multi select check boxes and pass them through in php, > without getting mixed up with variables (email multi select style). > > Thomas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Escaping nasty quotes
On Thu, 2003-07-31 at 14:31, Roy W wrote: > I have this: > > $query = "LOAD DATA LOCAL INFILE '/home/data.txt' INTO TABLE mytable FIELDS > TERMINATED BY ',' ENCLOSED BY '" . '"' . "' "; > $result = MYSQL_QUERY($query); > PRINT "$query2"; > > The query doesn't take ... but if I cut and paste the printed response into > the mysql server manually ... works like a charm > > :-( Try this: $query = "LOAD DATA LOCAL INFILE '/home/data.txt' INTO TABLE mytable FIELDS TERMINATED BY ',' ENCLOSED BY '\"' "; It'll get rid of your parse error Matt signature.asc Description: This is a digitally signed message part
[PHP] Re: [PHP-DB] subtracting dates...
> In mySQL, I store dates as -MM-DD, a standard DATE type. It stores users > date of births. I need to calculate in a PHP script, the users age from this > DOB. I get a PHP date in the same format as the mySQL and subtract, which > returns the year rounded off. ie, it doesnt matter if your birthdays in june > of 1983 and the date is januray 2003, your age is still returned as 20, when > it should be 19. > > Does anyone know how can i get the right age? Okay, so you just want to know the age in years. Must you use php? Here is a solution using mysql : SELECT name, dob, CURDATE() as today, ( YEAR(CURDATE()) - YEAR(dob) ) + LEAST( SIGN( DAYOFYEAR(CURDATE()) - DAYOFYEAR(dob) ), 0) as age_in_years FROM test_age; Here is the output : +--+++--+ | name | dob| today | age_in_years | +--+++--+ | jim | 1990-08-02 | 2003-08-03 | 13 | | paul | 1990-08-03 | 2003-08-03 | 13 | | tom | 1990-08-04 | 2003-08-03 | 12 | | matt | 1990-09-01 | 2003-08-03 | 12 | | sam | 1990-12-31 | 2003-08-03 | 12 | | sam | 1991-01-01 | 2003-08-03 | 12 | | sam | 1991-07-02 | 2003-08-03 | 12 | | sam | 1991-08-02 | 2003-08-03 | 12 | | sam | 1991-09-02 | 2003-08-03 | 11 | +--+++--+ 9 rows in set (0.01 sec) Here is how I generated my test data : DROP TABLE IF EXISTS test_age; CREATE TABLE test_age ( id int(6) NOT NULL auto_increment, name varchar(20) default NULL, dob date default NULL, PRIMARY KEY (id) ) TYPE=MyISAM; INSERT INTO test_age (id, name, dob) VALUES ('', 'jim', '1990-08-02'); INSERT INTO test_age (id, name, dob) VALUES ('', 'paul', '1990-08-03'); INSERT INTO test_age (id, name, dob) VALUES ('', 'tom', '1990-08-04'); INSERT INTO test_age (id, name, dob) VALUES ('', 'matt', '1990-09-01'); INSERT INTO test_age (id, name, dob) VALUES ('', 'sam', '1990-12-31'); INSERT INTO test_age (id, name, dob) VALUES ('', 'sam', '1991-01-01'); INSERT INTO test_age (id, name, dob) VALUES ('', 'sam', '1991-07-02'); INSERT INTO test_age (id, name, dob) VALUES ('', 'sam', '1991-08-02'); INSERT INTO test_age (id, name, dob) VALUES ('', 'sam', '1991-09-02'); > -Original Message- > From: John Ryan [mailto:[EMAIL PROTECTED] > Sent: Saturday, August 02, 2003 2:31 PM > To: [EMAIL PROTECTED]; [EMAIL PROTECTED] > Subject: [PHP-DB] subtracting dates... > > > Hi, > > In mySQL, I store dates as -MM-DD, a standard DATE type. It stores > users date of births. I need to calculate in a PHP script, the users age > from this DOB. I get a PHP date in the same format as the mySQL and > subtract, which returns the year rounded off. ie, it doesnt matter if > your birthdays in june of 1983 and the date is januray 2003, your age is > still returned as 20, when it should be 19. > > Does anyone know how can i get the right age? > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.506 / Virus Database: 303 - Release Date: 01/08/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Simple cookie question
This may be a stupid question, but I'm trying to set up a system where I can take a poll from visitors to my website and then set a cookie so that they can't vote more than once (until they clear their cookies at least). Problem is, I don't want to put it at the top of my page, because what if somebody opens up a poll but decides not to vote, then later changes his mind. The cookie will prevent him from voting. I want the cookie to be set right after the user clicks the vote button, but every time I do that, I get an error about headers already being sent. Is there any way around this? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Looking for Genies of the Lamp (London only)
VideoIsland.com is looking for genies of LAMP to who can hit the ground running and work with a fast-moving team based in London over a 1-2 month period and possibly longer if required. You will have played a leading role in all aspects of the development of Object orientated e-commerce services using PHP 4.*, Mysql, Linux and Apache 2.* Experience with C++, Samba networking, Unix/Apache2/Mysql Admin, multi-tier web farms, change control management, CVS, Zend and Systems integration would also be an advantage. If you are a genie of the LAMP and a high-octane professional, self motivated and adaptable to a dynamic startup environment - please contact [EMAIL PROTECTED] with detials, of background, experience, availabilitya nd cost. Thanks, mat _ Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help with msql_fetch_array()
I have a couple of scripts that fail with the error of: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in... I'm new to both SQL and PHP and I'm wondering if I have some setting turned off or what. Here's the piece of code that is failing (the second line fails): $result = mysql_db_query($dbname, "SELECT * FROM tablename ORDER BY id"); $row = mysql_fetch_array($result); Thanks for your help in advance!!
Re: [PHP] Help with msql_fetch_array()
Well I think you were correct about not connecting to the db, but I don't understand why. I wrote another little script just to test the connection. FALSE) { echo "got the db..yea!"; echo $link; } else { echo "didnt get db...bo"; echo $link; } ?> This returns "didnt get db...booResource id #1 I don't understand how I can get a resource ID but then not be able to use the "news" database. Like I described earlier, this happens with my other db as well. I can connect to the db through the console or any other client I have on the physical server and do whatever I want with the db's, I'm just having problems with php. Thanks again for your help!! PHPCoder <[EMAIL PROTECTED]> 07/24/02 01:50 PM To: Matthew Bielecki <[EMAIL PROTECTED]> cc: php-general <[EMAIL PROTECTED]> Subject:Re: [PHP] Help with msql_fetch_array() I can almost guarantee that it's not the second line that is "failing", the problem here is that $result is not containing naything, and that is normally due to the fact that you are not connecting to the db, or the table "tablename" is not there. I use the following format as my "standard" MySQL connect and query snippet: $link = @mysql_connect("localhost",$username,$password) or die ('Could not connect!'); //@ suppresses the default error message generated by this function and the "or die()" bit kills the script right then and there should it not be able to connect. mysql_select_db("YOUR_DB_NAME",$link); $sql = "select * from your_table_name"; if ( $result = mysql_query($sql)) { // checks to see if $result contains anything before it even tries to fetch an associative array from it. $row = mysql_fetch_assoc($result); } else { echo "Empty result set!"; Note also that I use mysql_fetch_assoc and NOT mysql_fecth_array, as 9 out of 10 times, you don't need the array element id's that is returned by mysql_fetch_array. Matthew Bielecki wrote: >I have a couple of scripts that fail with the error of: >Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result >resource in... > >I'm new to both SQL and PHP and I'm wondering if I have some setting >turned off or what. > >Here's the piece of code that is failing (the second line fails): > >$result = mysql_db_query($dbname, "SELECT * FROM tablename ORDER BY id"); >$row = mysql_fetch_array($result); > > >Thanks for your help in advance!! >
Re: [PHP] Help with msql_fetch_array() FIXED ! Now cookie problems :(
Hello again, I got the fetch_array problems fixed. I was using the actual server name, when I switched back to localhost everything worked!! Now I have a question about how to make cookies work on a Windows machine. This is what I have these parameters set to but it's not working. Do I have slashes/backslashes wrong, or is there something else I have to do in Apache??: session.save_path = "C:/Program Files/Apache Group/Apache/web/php/dir/files/temp" ; Whether to use cookies. session.use_cookies = 1 ; Name of the session (used as cookie name). session.name = PHPSESSID ; Initialize session on request startup. session.auto_start = 0 ; Lifetime in seconds of cookie or, if 0, until browser is restarted. session.cookie_lifetime = 0 ; The path for which the cookie is valid. session.cookie_path = "c:/Program Files/Apache Group/Apache/web/php/dir/files/temp" ; The domain for which the cookie is valid. session.cookie_domain = www.mydomain.com As always, thanks for your help. PHPCoder <[EMAIL PROTECTED]> 07/24/02 01:50 PM To: Matthew Bielecki <[EMAIL PROTECTED]> cc: php-general <[EMAIL PROTECTED]> Subject:Re: [PHP] Help with msql_fetch_array() I can almost guarantee that it's not the second line that is "failing", the problem here is that $result is not containing naything, and that is normally due to the fact that you are not connecting to the db, or the table "tablename" is not there. I use the following format as my "standard" MySQL connect and query snippet: $link = @mysql_connect("localhost",$username,$password) or die ('Could not connect!'); //@ suppresses the default error message generated by this function and the "or die()" bit kills the script right then and there should it not be able to connect. mysql_select_db("YOUR_DB_NAME",$link); $sql = "select * from your_table_name"; if ( $result = mysql_query($sql)) { // checks to see if $result contains anything before it even tries to fetch an associative array from it. $row = mysql_fetch_assoc($result); } else { echo "Empty result set!"; Note also that I use mysql_fetch_assoc and NOT mysql_fecth_array, as 9 out of 10 times, you don't need the array element id's that is returned by mysql_fetch_array. Matthew Bielecki wrote: >I have a couple of scripts that fail with the error of: >Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result >resource in... > >I'm new to both SQL and PHP and I'm wondering if I have some setting >turned off or what. > >Here's the piece of code that is failing (the second line fails): > >$result = mysql_db_query($dbname, "SELECT * FROM tablename ORDER BY id"); >$row = mysql_fetch_array($result); > > >Thanks for your help in advance!! >
Re: Re[2]: [PHP] Help with msql_fetch_array() FIXED ! Now cookie problems:(
OH MY GOSH...I ACTUALLY GOT A REAL PROGRAM TO RUN! Thanks a ton x 1,000,000 Alexander Thanks, Matthew J. Bielecki, MCP, A+ Certified Technician Hobart Corporation Field Engineer - Weighing & Network Systems Phone (937) 332-7163Fax (937) 332-3222 Email [EMAIL PROTECTED] Alexander Kuznetsov <[EMAIL PROTECTED]> 07/25/02 10:15 AM Please respond to Alexander Kuznetsov To: "Matthew Bielecki" <[EMAIL PROTECTED]> cc: php-general <[EMAIL PROTECTED]> Subject:Re[2]: [PHP] Help with msql_fetch_array() FIXED ! Now cookie problems :( Hello Matthew, Thursday, July 25, 2002, 5:06:09 PM, you wrote: MB> Hello again, MB> I got the fetch_array problems fixed. I was using the actual server name, MB> when I switched back to localhost everything worked!! MB> Now I have a question about how to make cookies work on a Windows machine. MB> This is what I have these parameters set to but it's not working. Do I MB> have slashes/backslashes wrong, or is there something else I have to do in MB> Apache??: MB> session.save_path = "C:/Program Files/Apache MB> Group/Apache/web/php/dir/files/temp" MB> ; Whether to use cookies. MB> session.use_cookies = 1 MB> ; Name of the session (used as cookie name). MB> session.name = PHPSESSID MB> ; Initialize session on request startup. MB> session.auto_start = 0 MB> ; Lifetime in seconds of cookie or, if 0, until browser is restarted. MB> session.cookie_lifetime = 0 MB> ; The path for which the cookie is valid. MB> session.cookie_path = "c:/Program Files/Apache MB> Group/Apache/web/php/dir/files/temp" MB> ; The domain for which the cookie is valid. MB> session.cookie_domain = www.mydomain.com try something like this session.save_path = c:/Program Files/Apache Group/Apache/web/php/dir/files/temp i mean without "..." i had that problem - deleted "" and all is working now -- Best regards, Alexander Kuznetsov
[PHP] Session woes
Hi All, I have a bit of a problem using the session management functions in PHP4. (PHP 4.1.2 in fact) I have a "order wizard" system on my website that is using PHP sessions to track values entered on the various forms across all pages of the wizard. at the start of each page i am issuing the "session_start();" command. Session ID's are passed in the GET string as part of the URL, and form values are posted.. each page submits the user data back onto itself (I have all my validation etc at the top of the document) - thus if the user fails to enter certain values, the page doesnt move into the next step, but instead alert them to their errors. if the form values pass, the form will move on to the next page using a header(location: nextpage.php) command. the problem I have, however, is that on the third page of my wizard, if the user submits only some of the required fields, it submits back onto itself and displays an error as required, but the problem is that when you fill in the missing fields and move on to the next page (in effect back onto itself first, then on to the next page) the fields that had their values missing, are not passed along... Does this all make sense? I can provide all the code samples if need be. I have tested this scenario using a PC running apache under Win2K, and also on a Unix box with Apache - same problem. Thanks for any help. M@ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] reading email from stdin
I am working on code that will allow me to read email that is directed to a PHP script (via .forward files) for various purposes, as part of an integrated Intranet project. I have hacked a bit at it and came up with code that "works" for the tests I can throw at it, but I'm not confident enough with my understanding of SMTP to put my code into live use. The most difficult part I've had is preserving the headers so that they can be individually edited but also reconstructed to forward the mail to another address. My question then, is: - does anyone know of any code libraries that exhibit the kind of functionality I'm talking about (the ability to read a mail message from stdin and store it in variables or as an object) Or, if there is no such code already written - is there anyone on this list who is very familiar with SMTP and would be willing to look over my code and point out all the things I am probably to be missing? Thanks - Matt Miller [EMAIL PROTECTED] PS - Having posed that question, I decided to go look at the source for Mailman and Majordomo before I sent it. It seems they both use a C wrapper for running the scripts that receive mail. Does anyone know why that is - security? Performance? Or something else... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP and Microsoft Office
Can you use PHP to add appts to my microsoft outlook calendar or open up a document in ms word? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Returning non-references still allows access to membervariables?
Regarding the earlier behavior I noticed regarding references: now I've come across something REALLY weird. Check this out: myString = 'hello'; // Test function function testObject() { global $object; // Make a copy of the member variable (no '&') $newString = $object->myString; // Return the COPY return $newString; } // Grab the return from the function (notice the '&') $copiedString = &testObject(); // Modify it $copiedString = 'goodbye'; // Print the original and the copy out echo "=== array ===\n"; echo $object->myString . "\n"; ?> Here's the output: === array === goodbye Huh?! I even made a copy inside the function! Note that just as before (see original message), the following change "fixes" things: function testObject() { global $object; // Create a reference to the member variable $newString = &$object->myString; // Return the reference return $newString; } Now the output is as expected(?): === array === hello Can anyone tell me what's going on here? I don't think this is at all the correct behavior. On Sun, 2002-10-20 at 05:02, Matthew Bogosian wrote: > Howdy all, > > I have stumbled onto a reference behavior I cannot explain. Here's my > problem: I'm trying to return a copy of a member variable. The function > is not declared to return a reference, but it seems as if the user can > override this. Here's a non-object example: > > > // Create an array > $array = array('foo', 'bar', 'baz'); > > // This function merely returns a copy of the array > function testArray() > { > global $array; > > return $array; > } > > // Grab the return from the function (notice the '&') > $copiedArray = &testArray(); > > // Modify it > $copiedArray[] = 'quux'; > > // Print the original and the copy out > echo "=== array ===\n"; > var_dump($array); > echo "=== copiedArray ===\n"; > var_dump($copiedArray); > > ?> > > Running this yields exactly what you would expect: > > === array === > array(3) { > [0]=> > string(3) "foo" > [1]=> > string(3) "bar" > [2]=> > string(3) "baz" > } > === copiedArray === > array(4) { > [0]=> > string(3) "foo" > [1]=> > string(3) "bar" > [2]=> > string(3) "baz" > [3]=> > string(4) "quux" > } > > So far, so good. This is as expected (even if the caller tries to use > the '&', he's getting the reference to the copy). Now instead of a > global array, let's try the exact same thing with a member of a global > object: > > > // Dummy class > class Test > { > var $array; > } > > // Instantiate it > $object = &new Test(); > // Create a member that is an array > $object->array = array('baz', 'bar', 'foo'); > > // Same function as before, only it's returning a member variable > function testObject() > { > global $object; > > return $object->array; > } > > // Grab the return from the function (notice the '&') > $copiedArray = &testObject(); > // Modify it > $copiedArray['lyx'] = 'quux'; > > // Print the original and the copy out > echo "=== array ===\n"; > var_dump($object->array); > echo "=== copiedArray ===\n"; > var_dump($copiedArray); > > ?> > > Here, I would expect that the results would be exactly the same > (remember, there are absolutely no references in the declaration of > testObject() or in the body; everything *should* be a copy). Here's what > gets printed when this is run: > > === array === > array(4) { > [0]=> > string(3) "baz" > [1]=> > string(3) "bar" > [2]=> > string(3) "foo" > ["lyx"]=> > string(4) "quux" > } > === copiedArray === > array(4) { > [0]=> > string(3) "baz" > [1]=> > string(3) "bar" > [2]=> > strin
[PHP] Returning non-references still allows access to member variables?
Howdy all, I have stumbled onto a reference behavior I cannot explain. Here's my problem: I'm trying to return a copy of a member variable. The function is not declared to return a reference, but it seems as if the user can override this. Here's a non-object example: Running this yields exactly what you would expect: === array === array(3) { [0]=> string(3) "foo" [1]=> string(3) "bar" [2]=> string(3) "baz" } === copiedArray === array(4) { [0]=> string(3) "foo" [1]=> string(3) "bar" [2]=> string(3) "baz" [3]=> string(4) "quux" } So far, so good. This is as expected (even if the caller tries to use the '&', he's getting the reference to the copy). Now instead of a global array, let's try the exact same thing with a member of a global object: array = array('baz', 'bar', 'foo'); // Same function as before, only it's returning a member variable function testObject() { global $object; return $object->array; } // Grab the return from the function (notice the '&') $copiedArray = &testObject(); // Modify it $copiedArray['lyx'] = 'quux'; // Print the original and the copy out echo "=== array ===\n"; var_dump($object->array); echo "=== copiedArray ===\n"; var_dump($copiedArray); ?> Here, I would expect that the results would be exactly the same (remember, there are absolutely no references in the declaration of testObject() or in the body; everything *should* be a copy). Here's what gets printed when this is run: === array === array(4) { [0]=> string(3) "baz" [1]=> string(3) "bar" [2]=> string(3) "foo" ["lyx"]=> string(4) "quux" } === copiedArray === array(4) { [0]=> string(3) "baz" [1]=> string(3) "bar" [2]=> string(3) "foo" ["lyx"]=> string(4) "quux" } Whoa! $copiedArray is now a reference for the member variable! But look what happens if I redefine the function slightly: function testObject() { global $object; $array = &$object->array; return $array; } Now I get what I expect again ($copiedArray doesn't point to the member variable after calling testObject()). So what gives? Why is "return $object->member;" exempt from the return declaration of the function? This is an interesting "feature". Not very intuitive...I'd call it a bug. Has anyone else noticed this? The above behavior happens with scalars (e.g., strings, numbers) too, not just arrays. By the way, I'm using PHP 4.2.3. --Matt -- Please do not sell or give away my information. signature.asc Description: This is a digitally signed message part
[PHP] PHP (CLI) + CURL + SSL Problem...
I have PHP installed both as a module, and as a CLI. When I use CURL from inside the module, it works fine for all connections, including SSL. When I use the CLI, I can't make SSL connections with CURL. It just returns 'false'. Anyone know why? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP (CLI) + CURL + SSL Problem...
It was definately included. I know this two ways. 1. Non-SSL curl sessions work. 2. I used the exact configure string I used for the module version, minus the --with-apxs option. On Fri, 2002-06-07 at 14:30, Mark Heintz PHP Mailing Lists wrote: > Are you sure curl was included with the CLI installation? Try running > this through the CLI to check... > > if(extension_loaded('curl')){ > echo 'curl support present'; > } else { > echo 'curl not found'; > } > > mh. > > > On 7 Jun 2002, Matthew Walker wrote: > > > I have PHP installed both as a module, and as a CLI. When I use CURL > > from inside the module, it works fine for all connections, including > > SSL. When I use the CLI, I can't make SSL connections with CURL. It just > > returns 'false'. Anyone know why? > > > -- > 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
Re: [PHP] mysql_num_rows()
It's 1 based. It returns the number of rows. Not the index of the last row. (Which would be 0 based.) On Fri, 2002-06-07 at 19:23, William_dw -- Sqlcoders wrote: > Hiya!, > Does anyone know whether mysql_num_rows is zero or one based? > > that is, if I have 5 records will mysql_num_rows() return 4 or 5? > > Thanks in advance!, > Dw. > > (I did check the php.net and MySQL manual for mysql_num_rows, > php.net dosent say and MySQL only gives a one line description, which is how > to call mysql_num_rows). > > > -- > 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] Crontabs
I want to set up a crontab using my hosts control panel, and when i go to set one up there are boxes for how frequently you want the task to run, and one labelled "Command". Basically, I want to get a PHP script to run every set amount of time, so what do I have to type in the "Command" box to get a PHP script to run? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Perl inside PHP
See here: http://www.php.net/manual/en/function.virtual.php "Chris Knipe" <[EMAIL PROTECTED]> wrote in message news:064401c21654$310e4d40$[EMAIL PROTECTED]... > Yeah, urgh, not exactly what I was hoping on, but I'll give executing perl a > try... I want to stay as far away as possible from mod_perl (It's a long > story)... > > I was maybe hoping there would have been some kind of perl extension... > Maybe in a year or two - who knows what people may come up with. > > - Original Message - > From: "Al Baker" <[EMAIL PROTECTED]> > To: "Chris Knipe" <[EMAIL PROTECTED]> > Cc: <[EMAIL PROTECTED]> > Sent: Tuesday, June 18, 2002 12:35 AM > Subject: Re: [PHP] Perl inside PHP > > > > You can do system calls to perl scripts, and if apache is setup I > > believe you can do mod_perl and php in the same page. > > > > On Mon, 2002-06-17 at 18:43, Chris Knipe wrote: > > > Can perl be executed inside PHP as part of the code? > > > > > > For example, can I load perl Modules via a PHP script, and execute > functions > > > and procedures that's written in Perl from PHP scripts? > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > -- > > This email was sent with Ximian Evolution. > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Crontabs
What do you mean by "appropriate #! at the top"? "Analysis & Solutions" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Matthew: > > On Tue, Jun 18, 2002 at 08:48:19PM +0100, Matthew Ward wrote: > > > > Basically, I want to get a PHP script to run every set amount of time, so > > what do I have to type in the "Command" box to get a PHP script to run? > > If your script has the appropriate #! at the top, you can type in the path > and name of the script. Say, "/usr/home/username/dir/script.php" for > example. > > Make sure the script has it's owner executable permission set (chmod 700, > for example). > > --Dan > > -- >PHP classes that make web design easier > SQL Solution | Layout Solution | Form Solution > sqlsolution.info | layoutsolution.info | formsolution.info > T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y > 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP 4.2.1 reading PAM/Shadowed password
Hi All, I am trying to build a "client interface" for each of my web-hosting customers, and would like to have them log into the system using the same username/password combinations that are used for FTP, email etc. ie: those stored in the Unix system's passwd and shadow passwd files. I have seen a number of different methods for doing this, all of which seem a little messy. Obviously, the system allows you to do it - i have seen apache work with this file for example. Any tips on where to look for info/help etc? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP 4.2.1 reading PAM/Shadowed passwords?
Hi All, I am trying to build a "client interface" for each of my web-hosting customers, and would like to have them log into the system using the same username/password combinations that are used for FTP, email etc. ie: those stored in the Unix system's passwd and shadow passwd files. I have seen a number of different methods for doing this, all of which seem a little messy. Obviously, the system allows you to do it - i have seen apache work with this file for example. Any tips on where to look for info/help etc? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Convert a grayscale value to a #RRGGBB hex value
If you know its grayscale... function GrayScaleToHex( $val ) { $norm = $val * 2.55 + $val/100; $hex = sprintf("%02X", $norm); return '#' . $hex . $hex . $hex; } Should get you close enough. Matt René fournier wrote: > Anyone know how I might convert a grayscale value, from between 0 to > 100, to hex, such that 0 (black) would be returned as #00, and 100 > (white) as #FF? For example... > > function grayscaletohex ($val) { > $hex = $val ... [ a simple operation ] > return $hex; > } > > Thanks. > > ...Rene > > --- > René Fournier, > [EMAIL PROTECTED] > > Toll-free +1.888.886.2754 > Tel +1.403.291.3601 > Fax +1.403.250.5228 > www.smartslitters.com > > SmartSlitters International > #33, 1339 - 40th Ave NE > Calgary AB T2E 8N6 > Canada > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] function echo ' '
my understanding is that you could write it like this: -Original Message- From: Martin Johansson [mailto:[EMAIL PROTECTED]] Sent: Tuesday, 25 June 2002 5:25 PM To: [EMAIL PROTECTED] Subject: [PHP] function echo ' ' Is there a way to express php variables inside an echo ' '. I want something like this to work: echo ''; I know I can write it like this: echo ''; But Its to hard to read the code like this. /Martin -- 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] Re: Classes Constructor syntax
PHP does not support multiple constructors. But, It does support variable argument lists, so you can fake it with func_get_args() and func_get_num_args(): function issue() { if( func_get_num_args() > 0 ) { $args = func_get_args() } else { // do something else... } } Matt David Russell wrote: > Hi all, > > I am finally spending some time converting a million and one functions > into a class - this is for a software issue tracking system. > > I have: > > class issue { > var > var > ... > > function issue() { //default constructor > //initialise all variables to defaults, and start getting the > stuff from forms > } > > function issue($number) { //1 variable constructor > // Query database and populate variables accordingly > } > } > > My question is: will this work? does PHP OOP support more than one > constructor? If my syntax is wrong, please let me know the correct > syntax. > > Thanks > > David R > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] reboot pc with PHP
On Thu, Aug 28, 2003 at 03:35:59PM +0200, Javier Tacon wrote: > > A more easy solution is that: > > Make a cron that executes every minut /tmp/rreboot.sh for user root > crontab -e > Add the line: > * * * * * /tmp/rreboot.sh > > The script is: > /tmp/rreboot.sh > --- > #!/bin/sh > if [ -f "/tmp/rreboot" ]; then > rm -f /tmp/rreboot > shutdown -r now > fi > --- > Make executable the file with chmod +x /tmp/rreboot.sh > just one little point (i'm glad i don't have to give a setuid lecture) personally i would make sure that the location of the check file is extremely secure. under normal circumstances, any user could write the rreboot file and cause a reboot also, remember to remove the file again in rc.local before cron starts etc. but i like the idea. its much more secure (from a web perspective). > And a simple PHP like: > exec("echo rreboot > /tmp/rreboot"); > echo "Ok, i'll reboot in a few seconds"; > ?> > > > So, when anyone calls to this PHP, creates a file, that if its detected by > rreboot.sh, the root will reboot the machine. > > > > -Mensaje original- > De: Javier Tacon > Enviado el: jueves, 28 de agosto de 2003 15:07 > Para: Petre Agenbag; [EMAIL PROTECTED] > Asunto: RE: [PHP] reboot pc with PHP > > > > You can write a little script with expect (man expect) and execute it from php with > exec(). > > Other solution its to write a .procmailrc in root that executes the reboot when > coming a mail with some text in subject or boyd, so, from php you only need to send > a mail. > > > -Mensaje original- > De: Petre Agenbag [mailto:[EMAIL PROTECTED] > Enviado el: jueves, 28 de agosto de 2003 14:48 > Para: [EMAIL PROTECTED] > Asunto: [PHP] reboot pc with PHP > > > Hi List > > I've gone through the list for previous questions and the only one that > seems to be a solution is to use sudo, however, I cannot seem to get it > right. > > Just as background: > > I want to make a small "admin" utill for an intranet machine, so the > security risks don't bother me at all. > > Instead of myself having to ssh into the box to reboot or do other > "routine" commands, I'd like to make a simple password protected webpage > that would have simple links on them like "reboot", "redial" etc, so > that someone with some sort of responsibility can do it themselves. > > Obviously these command(s) need to be run as root, so I looked at the > /etc/sudoers and added apache , BUT, in the error log it prompts for a > password. > > I tried to add the option NOPASSWD: ALL to the file, but it says there's > a syntax error. > > What am I missing? > > Any other ways of doing this? PS, I don't even want to consider Webmin, > it's way too complicated, I just want a handfull of predefined commands > to be run, nothing else) > > Thanks > > > -- > 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 General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- Mat Harrison Technical Developer 3d Computer Systems Ltd. [EMAIL PROTECTED] - ASCII ribbon campaign ( ) - against HTML email X & Usenet posts / \ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] reboot pc with PHP
of course, i've only just seen that the script removes it. it's been a long day, my apologies. just out of curiosity, why would you want the ability to reboot your box like that? On Thu, Aug 28, 2003 at 04:06:25PM +0200, Javier Tacon wrote: > > Exactly .. > Well, the script removes the rreboot file before the shutdown. > > For security choose a directory for rreboot file placed in a directory that only can > be readed/writed by apache, and the php file in the example its very simple, but you > can ask for a password, create a log, etc .. > > chown 700 /directory/for/rrebootfile > chown apache.nobody /directory/for/rrebootfile > > > -Mensaje original- > De: Matthew Harrison [mailto:[EMAIL PROTECTED] > Enviado el: jueves, 28 de agosto de 2003 15:49 > Para: Javier Tacon > CC: Petre Agenbag; [EMAIL PROTECTED] > Asunto: Re: [PHP] reboot pc with PHP > > > On Thu, Aug 28, 2003 at 03:35:59PM +0200, Javier Tacon wrote: > > > > A more easy solution is that: > > > > Make a cron that executes every minut /tmp/rreboot.sh for user root > > crontab -e > > Add the line: > > * * * * * /tmp/rreboot.sh > > > > The script is: > > /tmp/rreboot.sh > > --- > > #!/bin/sh > > if [ -f "/tmp/rreboot" ]; then > > rm -f /tmp/rreboot > > shutdown -r now > > fi > > --- > > Make executable the file with chmod +x /tmp/rreboot.sh > > > > just one little point (i'm glad i don't have to give a setuid lecture) personally > i would make sure that the location of the check file is extremely secure. > > under normal circumstances, any user could write the rreboot file and cause a reboot > > also, remember to remove the file again in rc.local before cron starts etc. > > but i like the idea. its much more secure (from a web perspective). > > > And a simple PHP like: > > > exec("echo rreboot > /tmp/rreboot"); > > echo "Ok, i'll reboot in a few seconds"; > > ?> > > > > > > So, when anyone calls to this PHP, creates a file, that if its detected by > > rreboot.sh, the root will reboot the machine. > > > > > > > > -Mensaje original- > > De: Javier Tacon > > Enviado el: jueves, 28 de agosto de 2003 15:07 > > Para: Petre Agenbag; [EMAIL PROTECTED] > > Asunto: RE: [PHP] reboot pc with PHP > > > > > > > > You can write a little script with expect (man expect) and execute it from php > > with exec(). > > > > Other solution its to write a .procmailrc in root that executes the reboot when > > coming a mail with some text in subject or boyd, so, from php you only need to > > send a mail. > > > > > > -Mensaje original- > > De: Petre Agenbag [mailto:[EMAIL PROTECTED] > > Enviado el: jueves, 28 de agosto de 2003 14:48 > > Para: [EMAIL PROTECTED] > > Asunto: [PHP] reboot pc with PHP > > > > > > Hi List > > > > I've gone through the list for previous questions and the only one that > > seems to be a solution is to use sudo, however, I cannot seem to get it > > right. > > > > Just as background: > > > > I want to make a small "admin" utill for an intranet machine, so the > > security risks don't bother me at all. > > > > Instead of myself having to ssh into the box to reboot or do other > > "routine" commands, I'd like to make a simple password protected webpage > > that would have simple links on them like "reboot", "redial" etc, so > > that someone with some sort of responsibility can do it themselves. > > > > Obviously these command(s) need to be run as root, so I looked at the > > /etc/sudoers and added apache , BUT, in the error log it prompts for a > > password. > > > > I tried to add the option NOPASSWD: ALL to the file, but it says there's > > a syntax error. > > > > What am I missing? > > > > Any other ways of doing this? PS, I don't even want to consider Webmin, > > it's way too complicated, I just want a handfull of predefined commands > > to be run, nothing else) > > > > Thanks > > > > > > -- > > 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 General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > -- > Mat Harrison > Technical Developer > 3d Computer Systems Ltd. > [EMAIL PROTECTED] > - > ASCII ribbon campaign ( ) > - against HTML email X >& Usenet posts / \ -- Mat Harrison Technical Developer 3d Computer Systems Ltd. [EMAIL PROTECTED] - ASCII ribbon campaign ( ) - against HTML email X & Usenet posts / \ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multiple Forms
Process Forms Matt On Tue, 2003-09-09 at 20:11, Dan Anderson wrote: > Is it possible to tell a browser to send form a to URL a and form b to > URL b? > > (i.e. post to two different URLS) > > Thanks, > > -Dan signature.asc Description: This is a digitally signed message part
[PHP] New to PHP form attributes
Hi, I am new to PHP and am more used to JSP. My question is - if I submit a form to a php3 page using action=="" for some processing all is well I can see that form data. After the processing the page is redisplayed - but the data originally sent persits (in the request) this can be a pain if the user was to hit the refresh button then the data is submitted to the server again and if for example the php page does an insert into a database then a new row would be created etc... Is this normal behaviour of php and jsp ? I am not sure but I am noticing it now with php ? Should I be clearing the data from the request somehow after I have done my processing? Thanks Matt _ It's fast, it's easy and it's free. Get MSN Messenger today! http://www.msn.co.uk/messenger -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Vacancy
Hi guys Sorry to 'hijack' this newsgroup. I am currently looking for a PHP programmer for a client of mine based in Central London. They are ultimately looking for someone on a permanent basis but would take someone on a contract with a view to going permanent. They would be paying £25 - 27K per annum. If you are interested please reply to [EMAIL PROTECTED] with a Word copy of your CV. Kind Regards Matthew Harvey 020 7938 1333 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Newbie scope revisited
I posted a couple of days ago inquiring as to why some inhierited PHP code was not working. I determined that scope was the issue. The overwhelming response I got back pertained to register_globals. I have read up on register_globals and realize that it is not considered good practice to use it. Still investigating I run phpinfo(), it turns out that register_globals is set to ON (both places). However the server does not act this way. I searched for an htaccess file, which I belive (not sure) can override settings in the ini file. I could not find one. So now I am stuck in the same place I started. My client doesn't want to pay for me to "scope" all of the variables in the application, but it doesn't appear to work without the proper scoping. Any suggestions on further research will be appreciated. Matthew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Newbie scope revisited
"Matthew Morvant" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I posted a couple of days ago inquiring as to why some inhierited PHP code > was not working. I determined that scope was the issue. The overwhelming > response I got back pertained to register_globals. I have read up on > register_globals and realize that it is not considered good practice to use > it. Still investigating I run phpinfo(), it turns out that register_globals > is set to ON (both places). However the server does not act this way. I > searched for an htaccess file, which I belive (not sure) can override > settings in the ini file. I could not find one. So now I am stuck in the > same place I started. My client doesn't want to pay for me to "scope" all > of the variables in the application, but it doesn't appear to work without > the proper scoping. Any suggestions on further research will be > appreciated. > > Matthew To clarify "both" places are the Local value and the Master value. An example of code that doesn't work follows asume a user follows this link http://test/test.php?adduser=1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Forms
Hi, This is probably more of a javascript question but thought someone here might have an answer. I have a form in a pop up windoe I want this form data to be submited to the window that opened the popup - how can I do this? I have tried setting the target attribute on the form tag to window.opener() but that just opens a new window. Any ideas? Thanks _ Tired of 56k? Get a FREE BT Broadband connection http://www.msn.co.uk/specials/btbroadband -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mulitple selects from form drop down box
On Thu, 2003-11-20 at 17:12, CPT John W. Holmes wrote: > > > Now $_POST['D1'] will be an array of all the items that were chosen. > > ---John Holmes... > > ps: wouldn't it be easier to select multiple items if you had a size larger > than "1"?? The 'size=1' in a select doesn't mean there is only one object in the select, it means only show one object, or one row. 'size=3' would show three rows at a time. Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Opening large file problem - fopen
Do you have long lines? If not try this: $file = "error_log.txt"; if (($fp = fopen($file,'r+') !== 0) { // Increment the 1024 sufficiently to read enough data, fgets automatically stops at \n while ($line = fgets($fp,1024)) { if ($line != "") echo($line.""); } } Alternatively, do you know what the last char or the first char in each line is? (i.e. an end-of-record or start-of-record identifier) Try this: $file = "errors.txt"; $file_size = filesize($file); $byte_count = 0; $fp = fopen($file,"r+"); $last_char = ""; while ($byte_count < $file_size) { $chr = ""; $eol = ""; $line = $last_char; while ($eol == 0) { //Use this for EOR checking, replace the $EOR with your EOL/EOR char) if (($chr = fread($fp,1)) === 0 || $chr == $EOR) $eol = 1; else $line .= $chr; /** Use this for SOR checking if (($chr = fread($fp,1)) === 0 || $chr == $SOR) $eol = 1; else $line .= $chr; $last_char = $chr **/ $byte_count = $byte_count + 1; } if (trim($line) != "") { //Do Something echo($line.""); } } this will need to be modified if you have a multi-byte EOR/SOR, but hopefully this will give you a good base. Matt On Tue, 2003-12-16 at 08:46, Kim Steinhaug wrote: > Attached is a little textfile on 4 lines, it will choke afte 1 line > due to the "\n\n" problem. > > I use this loop to parse it : > > $file= "error_log.txt"; > if($fp=fopen($file, "r+")) > { > while($line=trim(fgets($fp))) > { > echo $line . ""; > } > > } > > -- > Kim Steinhaug > --- > There are 10 types of people when it comes to binary numbers: > those who understand them, and those who don't. > --- > > > "Kim Steinhaug" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > Hello, > > > > Thanks for you reply. The first approach works, I succesfully > > imported 1.903.541 entries into my mySQL database, phew! > > Problem was that as mentioned I had to "massage" the data > > beforehand, which with TextPad didnt take to much time but > > again I love my scripts to be complete and be "standalone". > > > > Back to the 2) option, I tried another approach, just to see > > how far the script woul accually go. There are ~2,1 million lines > > in the error_log so I would like to see a result for the $i in this > > range. But this script also chokes. > > > > $file= "error_log"; > > $handle = fopen ($file, "rb"); > > $contents = ""; > > do { > >$data = fread($handle, 8192); > >if (strlen($data) == 0) { > >break; > >} > >$contents = $data; > > $temp = explode("\n",$contents); > > $i = $i + count($temp); > > if($i%1000==0) // Spit out every 1000 lines count > > echo $i . ""; > > } while(true); > > fclose ($handle); > > echo $count; > > exit; > > > > Do you have an example, or link to a site discussing the issue, of > > buffering the data? > > > > -- > > Kim Steinhaug > > --- > > There are 10 types of people when it comes to binary numbers: > > those who understand them, and those who don't. > > --- > > > > > > "Eugene Lee" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > On Tue, Dec 16, 2003 at 01:30:14PM +0100, Kim Steinhaug wrote: > > > : > > > : I found out that what the script accually does is choke on "\n\n", > > > : empty lines. I havnt found a way to solve this with the script, > > > : > > > : What I do now is use TextPad and just replace all occurencies > > > : of "\n\n" with "\n-\n" or something and it works all nice. But this > > > : is a bad way of doing it, since the script still doesnt accually > work... > > > > > > You have two options: > > > > > > 1) massage your data beforehand so that your script works properly > > > > > > 2) buffer your input lines so that you process them only after you have > > > read a complete "entry", since one entry may span multiple lines in your > > > error_log. signature.asc Description: This is a digitally signed message part
Re: [PHP] looking for a PHP editor
Has anyone mentioned Bluefish? I was using code crusader till I tried it yesterday. It blows away both jcc, emacs, xemacs, and gvim. ---Matt On Wed, 10 Jan 2001, Toby Miller wrote: > The editors that I usually use are Textpad and Jedit. I usually use Textpad > as it's my favorite editor. Jedit is very similar to Textpad which is why > it's my second favorite editor. The bonus of using Jedit is that it's > written entirely in Java so it also runs in Linux (quite well too). You can > download them both here: > > http://www.textpad.com/ > http://jedit.sourceforge.net/ > > They both provide color syntax highlighting for PHP (as well as just about > everything else) and both have loads of extra features (much like those of > UltraEdit). So if this is the sort of editor you're looking for these are > both worth a look see. > > As far as Linux goes, Jedit is the only editor I've been able to find that > compares against something like Textpad or UltraEdit. > > -Toby > > - Original Message - > From: "Miles Thompson" <[EMAIL PROTECTED]> > To: "defender of the protocol" <[EMAIL PROTECTED]>; > <[EMAIL PROTECTED]> > Sent: Wednesday, January 10, 2001 9:50 AM > Subject: Re: [PHP] looking for a PHP editor > > > > Editors are like hammers - once you get used to one, well that's what you > > use because you know how it behaves. For a Windows environment I'll > endorse > > jeremy's recommendation of Ultraedit -- my hammer of choice. It offers > some > > neat features: tons of macros and word files for various languages, > > multiple windows into same document, an easily used column mode that just > > great for picking a list of fields from one file and inserting into > another. > > > > Need hex? Click on the "H" button on the toolbar. > > > > Need wordwrapping? There's a wrap button, and wraps can be soft or hard. > > > > Need to change formatting between DOS and Unix/MAC? Click of a button. > > > > For Linx, etc.? I don't have a hammer yet. I feel obligated to use VIM, > but > > I cut my teeth on WordStar for CP/M so Joe is comfortable, but I'm leaning > > towards Jed. I find VIM very arcane, but if it's your hammer of choice, go > > for it. > > > > And if you have the horsepower, in the Linux GUI there's Bluefish -- looks > > quite nice. > > > > Finally, don't forget AMAYA, but you won't find and PHP add-ons. > > > > Now, can we pick one and get back to work? > > > > Cheers - Miles > > > > PS I really liked yesterday's comment that " Real Programmers cat > > /dev/audio > myprog and hiss machine code into the mic". Kewl!! //mt > > > > At 08:35 AM 01/10/2001 -0500, defender of the protocol wrote: > > >the specialized editors for php are bs, you don't need an IDE to script > > >your web page or anything else for that matter > > > > > >http://www.ultraedit.com > > > > > >go get a copy of UltraEdit, download the wordfile for php syntax so it > > >highlights properly, and you're set > > > > > >http://www.ultraedit.com/downloads/additional.html > > > > > >i'm sure someone on this list has said this before > > > > > >- jeremy > > > > > >At 07:49 PM 1/9/2001, you wrote: > > > > > >> > I went to their homepage, and couldn't find a link to download > > >> > the actual program, just some example stuff, and it says "coming > > >> > soon"... Is it out there somewhere and I'm just retarded, or are > > >> > you mob on a beta list or something??? > > >> > > >>www.codecharge.com/download > > >> > > >>Their homepage is sort of hidden because it's still in beta. > > >>Like in the version i downloaded the generated code gave a lot of PHP > errors. > > >>I understand they are working on it every day, sometimes it works, > sometimes > > >>not. > > >> > > >>Also my trial period was only 1 day due to some error. > > >> > > >> > > >>Chris > > >> > > >> > > >> > > >> > > >>-- C.Hayes Droevendaal 35 6708 PB Wageningen the Netherlands -- > > >> > > >> > > >> > > >> > > >>-- > > >>PHP General Mailing List (http://www.php.net/) > > >>To unsubscribe, e-mail: [EMAIL PROTECTED] > > >>For additional commands, e-mail: [EMAIL PROTECTED] > > >>To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > > > > > > >-- > > >PHP General Mailing List (http://www.php.net/) > > >To unsubscribe, e-mail: [EMAIL PROTECTED] > > >For additional commands, e-mail: [EMAIL PROTECTED] > > >To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -
[PHP] Is there a function to subtract dates
I need to find the number of days between a date in the past and todays date. Does PHP have a function to do this, or do I need to write my own? -- Random (non-anti-Microsoft) fortune -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Sorting an array
I have a 2-d array: $list[$ctr]["username"] $list[$ctr]["county"] $list[$ctr]["age"] $list[$ctr]["id"] $list[$ctr]["days"] I need to sort by days, which is an integer. What function should I use? E.g., $list[0][mark] $list[0][somewhere] $list[0][12] $list[0][1] $list[0][200] $list[1][andy] $list[1][somewherefurther] $list[1][18] $list[1][2] $list[1][100] $list[2][sam] $list[2][somewhereelse] $list[2][15] $list[2][3] $list[2][150] should sort to: $list[0][mark] $list[0][somewhere] $list[0][12] $list[0][1] $list[0][100] $list[1][andy] $list[1][somewherefurther] $list[1][18] $list[1][2] $list[1][150] $list[2][sam] $list[2][somewhereelse] $list[2][15] $list[2][3] $list[2][150] -- Random (non-anti-Microsoft) fortune -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] I love/hate FrontPage - need another HTML editor.
Have any of you tried using EditPlus? (www.editplus.com) This is a great little editor for HTML, JavaScript, and PHP. You can download extra modules for color syntax hilighting of practically any language you can think of including many different databases. It has some nice useful HTML features and good handling of multiple documents... and most importantly, you don't have to worry about it mangling your code. It is helpful while also staying out of your way. The more I use it, the more I like it. It is simple, elegant, and it gives me all the control that I want. Its inexpensive and comes with a thirty day trial. Check it out. BTW, I do not work for EditPlus or have any association with them other than that of a satisfied customer. Matthew Aznoe -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] I love/hate FrontPage - need another HTML editor.
Sadly, no. As far as I know, it is a completely windows product. I am currently developing on a Windows box using Samba to access the files on my UNIX box from windows. Its not necessarily the best way of doing things and it requires two computers, but it seems to get the job done, and since I need to use Windows anyway for my company's standards of MS Office and Outlook, its tolerable. When running exclusively in UNIX, I run Elvis, a graphical vi with syntax hilighting. XEmacs also is not a bad option, but Elvis is much faster. Matthew Aznoe -Original Message- From: Scott Gerhardt [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 17, 2001 9:54 AM To: [EMAIL PROTECTED]; Php-General-Digest; Chris Aitken Subject: RE: [PHP] I love/hate FrontPage - need another HTML editor. > It is NOT ported to Linux is it? > I couldn't find any information on the website indicating weather it was > compiled for *NIX or not. > > - Scott >> Have any of you tried using EditPlus? (www.editplus.com) This is a great >> little editor for HTML, JavaScript, and PHP. You can download >> extra modules >> for color syntax hilighting of practically any language you can think of >> including many different databases. It has some nice useful HTML features >> and good handling of multiple documents... and most importantly, you don't >> have to worry about it mangling your code. It is helpful while >> also staying >> out of your way. The more I use it, the more I like it. It is simple, >> elegant, and it gives me all the control that I want. Its inexpensive and >> comes with a thirty day trial. Check it out. >> >> BTW, I do not work for EditPlus or have any association with them >> other than >> that of a satisfied customer. >> >> Matthew Aznoe >> >> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Clearing a variable
unset($var) On Thu, 18 Jan 2001, Brandon Orther wrote: > Hello, > > How can I clear a variable? > > Thank you, > > > Brandon Orther > WebIntellects Design/Development Manager > [EMAIL PROTECTED] > 800-994-6364 > www.webintellects.com > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Any good way ?
maybe I'm over simplifying... my apologies if I am but it looks like you're testing each variable as a boolean value i.e. if(TRUE) so why not use a switch/case statement... easier to write and saved on extraneous curly syntax... look here http://www.php.net/manual/en/control-structures.switch.php -Original Message- From: TV Karthick Kumar [mailto:[EMAIL PROTECTED]] Sent: Friday, January 19, 2001 10:40 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: [PHP] Any good way ? Hi all I have written the following code, but I dont' think it's a good way to write like this. Is there some other way to do good programming for this ?! ** if ($f) { $SQL .= " (FIRST_NAME like '%$f%') AND "; } if ($l) { $SQL .= " (LAST_NAME like '%$l%') AND "; } if ($em) { $SQL .= " (HOME_EMAIL1 like '%$em%') OR (HOME_EMAIL2 like '%$em%') OR (WORK_EMAIL1 like '%$em%') OR (WORK_EMAIL2 like '%$em%') "; } ** Any help is appreciated very much. Thanks in adv. ~ Karthick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Waring message for FTP
try @ftp_mkdir($conn_id, $uploadtag); On Tue, 23 Jan 2001, Simon Chambers wrote: > Hi, > > I have developed a small php program which creates a directory on a remote > ftp site, which works fine. The problem is that when the directory is creted > it displays the message: > > Warning: ftp_mkdir: MKD command successful. > > How can i get rid of this warning message? > > Thanks > > Simon > > p.s. i dont know if it helps but the related code is > > $login_result = ftp_login($conn_id, "User", "Password"); > > // check connection > if ((!$conn_id) || (!$login_result)) { > echo "Ftp connection has failed!"; > echo "Attempted to connect "; > die; > } else { ># echo "Connected for user "; > } > > $temp = ftp_mkdir($conn_id, $uploadtag); > > _ > Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Ideas?? (OT- MySQL)
<[EMAIL PROTECTED]> wrote ... > I am creating a web site which allows users to post projects and then > others to place bids. I am setting up two tables in MySQL 'Projects' > & 'Bids' my problem is how best to cross reference. What I was > thinking of doing is creating a number of fields in the Projects table... > > and then inserting the BidID from the bids table into Bid1, and if > that is already used then it will go into Bid2. But how many Bid# > shall I create?? I`m sure there must be a faster method than this, > anyone have any suggestions?? This is a standard question where you have two tables that need to be linked in a many-to-many relationship. The answer is that you need a third table, called for example ProjectBids. It has two columns, one for Bid ID and one for Project ID. Each row links one bid to one project. You can enter as many rows as you like, so each bid can be linked to one or more projects, and each project can be linked to one or more bids. But are you sure you have a many-to-many relationship? It sounds like each bid might be associated with just one project. In that case you could just have a column in the Bid table that contains the Project ID. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] [newbie]subtracting date
I am working on a project where I need a function that will take the current date and subtract however many days off of it a client specifies. Would anybody know a way I can set this up? I pretty new at this so my vocabulary is very basic. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Submitting Form Information
Is there a way to simulate a form submission to a cgi-script using PHP? I am trying to write a script that will replace the frontend of another CGI script with a customized one of my own, but I need to be able to pass form data into the next page in the cgi (including a password). Matthew Aznoe Fuzz Technologies [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] get current events from mysql query by date?
I have a mysql database of events. It contains the following fields: - EventID - EventName - EventDescription - EventStartDate - EventEndDate I would like to query the database for the next 5 events from the current date (today). Any ideas? Regards, Matthew Delmarter Web Developer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Perl Libraries and PHP
Howdy All! I noticed in a FAQ somewhere that it is possible to call Java classes from PHP using the dl function. Is there anyway to make this work with Perl libraries? I work for a company that is moving to PHP. All their previous stuff are Perl scripts. We are bringing a lot of the Perl code to PHP but there are Perl libraries that we need but don't have the time to convert to PHP. It would call for some serious translating due to the bad programming technique used. Any advice would be tremendously appreciated. Matthew Hanna [EMAIL PROTECTED]
[PHP] Combining Perl and PHP
Has anyone heard of calling Perl libraries from PHP? I have seen it done with Java classes but it would be great if there was a way to do it with Perl. Thanks! Matthew Hanna [EMAIL PROTECTED]
[PHP] get name of file
How do I return the name of a file without any extensions or path info. Eg how do I return "about" from "http://www.domainz.com/about.htm". Regards, Matthew Delmarter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] PHP3 & PHP4 in apache?
Hi, Can anyone tell me if it is possible to statically build php3 and php4 modules into an apache binary? I tried, but kept getting all these errors from ld about multiply-defined functions such as: ld: fatal: symbol `second_arg_allow_ref' is multiply-defined: (file modules/php3/libphp3.a(internal_functions.o) and file modules/php4/libphp4.a(zend_builtin_functions.o)); Thanks for any help... Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] array_count_values
can someone give a quick hint as to why this does not work: $array = split ("\n", $contents); $stuff = array_count_values ($array); echo $stuff[nuts]; or even: $array = array (split ("\n", $contents)); $stuff = array_count_values ($array); echo $stuff[nuts]; thnx... matthew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] List Files
$path='/root/helpfiles/'; $dir_handle = opendir($path); while ($file = readdir($dir_handle)) { if ((ereg("help",$file)){ INCLUDE "$path$file"; OR echo ''.$file.' } } Matthew Luchak Webmaster Kaydara Inc. [EMAIL PROTECTED] -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 19, 2001 8:25 AM To: [EMAIL PROTECTED] Subject: [PHP] List Files Hi, Does anyone know how I can list all the files begining with help in one of my pages. So I have a dir which has various files, like so: help_me.php help_you.php help_us.php Is there some command I can use to select all the files and then print them out? TIA Ade -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Site Searchable function
there is a good starting point for walking a directory tree and printing out the names of the files at: http://www.php.net/manual/en/function.readdir.php it should be no mean feat to add a search file function and voila Matthew Luchak Webmaster Kaydara Inc. [EMAIL PROTECTED] -Original Message- From: Kevin A Williams [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 19, 2001 1:11 PM To: [EMAIL PROTECTED] Subject: [PHP] Site Searchable function Hi, I was wondering whether anyone could direct me in the direction of creating a search function like the one on php.net? I have tried looking rather fruitlessly to implement a system, would one possible implementation be to use reference files for the information and then use string matching to analyse the information, or search the source .php files (although security issues of revealing scripts). Thanks in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Advanced Help Needed
check the enctype of your form has not changed I had some inconsistencies using multipart... >when I post a file in the form I recieve an "Cannot Find Server". When >there isnt a file posted then the form works fine. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Site Searchable function
check php.ini file for "allow fopen" I think. ____ Matthew Luchak Webmaster Kaydara Inc. [EMAIL PROTECTED] -Original Message- From: ~~~LeoN~ [mailto:[EMAIL PROTECTED]] Sent: Friday, April 20, 2001 10:59 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Site Searchable function On 19 Apr 2001 13:25:09 -0700 impersonator of [EMAIL PROTECTED] ("Steve Lawson") planted &I saw in php.general: >fopen("http://localhost/name-of-file") will return the rendered page instead Sounds good (theoretically:). Hovever, in practical attempt on my remote server it gave: Warning: fopen("http://my.domain/file_name.htm","r") - A socket must be already connected. in ...etc on line 304 where it worked ok with 'filesystem open' (On my home window localhost, it worked though). Suggestions, how to go around this problem? Leon. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Posting to a form
you can't have whitespace in $valsI would replace the whitespace with _ and vice-versa when you want to ouput the $vals... ____ Matthew Luchak Webmaster Kaydara Inc. [EMAIL PROTECTED] I'm trying to do the following But when Aname is multiple words, such as "Wade Williams", everything from the whitespace on gets cut off. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] SVG & PHP
What about writting a gimp plug-in...? http://www.gimp.org Matthew Luchak Webmaster Kaydara Inc. [EMAIL PROTECTED] -Original Message- From: Nick Winfield [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 25, 2001 9:50 AM To: PHP General Mailing List Subject: [PHP] SVG & PHP Hi, This might be a bit of a long shot, but I'm willing to give it a go. :) Does anyone know of a server-side SVG parser that can be called via some kind of PHP extension? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] fsockopen question
I use: $fp = fsockopen("www.somewhere.com",80); fputs($fp, "GET http://www.somewhere.com/somedir/somepage.html HTTP/1.0\r\n\r\n"); to parse. Should be easily modified ________ Matthew Luchak Webmaster Kaydara Inc. [EMAIL PROTECTED] -Original Message- From: Michael Conley [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 26, 2001 12:37 PM To: '[EMAIL PROTECTED]' Subject: [PHP] fsockopen question How do I send the XML string to the above URL? When I use fsockopen, it doesn't like anything other than an IP address or a host name (ie www.myprovider.com). I don't even really see where to force this to go over HTTPS. I set the port to 443, but need to be sure that the data going across uses SSL. How do I send this XML string over HTTPS to https://www.myprovider.com/XMLSubmit/processtrans.asp? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] fsockopen question
$fp = fsockopen("www.somewhere.com",4096); here you have to check the syntax for POST and HTTPS but I THINK (hoo-boy am I ever risking ridicule) it should look something like this: fputs($fp, "POST https://www.somewhere.com/dir/app HTTPS/1.0\r\n\r\n", $xmlstring); then try the response.. ________ Matthew Luchak Webmaster Kaydara Inc. [EMAIL PROTECTED] -Original Message- From: Michael Conley [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 26, 2001 1:00 PM To: Matthew Luchak; [EMAIL PROTECTED] Subject: RE: [PHP] fsockopen question It looks like that is working, but I'm not getting a response. I created the XML string and set it as $xmlstring. Then, after the fputs that you provided below (except with the URL I'm sending to) I have: fputs($fp, "$xmlstring"); Then, to receive the response I enter: $RetValue=fgets($w_socket, ); echo $RetValue; I am not getting any response, so I have no idea if my XML string is accepted, rejected or what. Is this the right way for me to get the response? After I send the XML string, they will send me back some info that will let me know if the transaction is accepted. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] How to chop off a char off end?
$x = "yourtexthere."; $x = substr($x, 0, -1); $x will then equal = "yourtexthere" -m -Original Message- From: Dexter [mailto:[EMAIL PROTECTED]] Sent: Friday, April 27, 2001 6:45 PM To: [EMAIL PROTECTED] Subject: [PHP] How to chop off a char off end? Using Perl , I usually say $string=~s /,$//; to chop off a particualr char on end. How do you do this using PHP. Thanks, Dexter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Get the title from an HTML page
I'll be loading the contents of an HTML page into a variable and I need to get the title of the from that variable. Basically I need to ge the text from in between the tags. Any ideas? Thanks, Matt [EMAIL PROTECTED] < www.mralston.co.uk /> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] About MS SQL
Think you might need to enable the ms sql server module in the php.ini file. -- Thanks, Matt [EMAIL PROTECTED] < www.mralston.co.uk /> Hassan Arteaga <[EMAIL PROTECTED]> wrote in message 7F548E90E63BD1118E4600609707771F8BEFF9@goliath">news:7F548E90E63BD1118E4600609707771F8BEFF9@goliath... Hi all !! I'm trying to connecto to MS SQL Database I receive this error MSG "Fatal error: Call to undefined function: mssql_connect() in C:\Inetpub\wwwroot\myphp\sqltest.php on line 13 " The line 13 is $Conn=mssql_connect("","",""); Thanks in advanced !!! -- M. Sc. Hassan Arteaga Rodríguez Microsoft Certified System Engineer Network Admin, WEB Programmer FUNDYCS, Ltd [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] About MS SQL
from what i recall there is a line (to enable ms sql server support) in the php.ini file already that just needs uncommenting. have a look right through the file...there's one for sql server 6.5 and one for 7. -- Thanks, Matt [EMAIL PROTECTED] < www.mralston.co.uk /> Hassan Arteaga <[EMAIL PROTECTED]> wrote in message 7F548E90E63BD1118E4600609707771F8BF005@goliath">news:7F548E90E63BD1118E4600609707771F8BF005@goliath... > For example if my SQL installation files are in c:\MSSQL what is the right > configuration ? extension_dir=c:\MSSQL; > Now I just made the job with ODBC functions but I would like to use SQL > function !! > > thanks !!! > > -Original Message- > From: Romulo Pereira [mailto:[EMAIL PROTECTED]] > Sent: Monday, April 30, 2001 11:38 AM > To: [EMAIL PROTECTED] > Subject: RE: [PHP] About MS SQL > > > Hello, > > Your php.ini is not configured correctilly. That is what is doing the php to > do not include the MsSQL functions to the php api. Open your php.ini file > and find (and correct) the section below: > > ; > ; Paths and Directories ; > ; > ... > extension_dir=./extensions; > > Your scripts should work then. > > Have fun, > > Rom > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: RE: RE: [PHP] About MS SQL
you might have to restart your webserver/php if it's apache you might need to recompile it or something...i've not compiled php into apache before...am using it as a cgi...so i'm not sure -- Thanks, Matt [EMAIL PROTECTED] < www.mralston.co.uk /> Hassan Arteaga <[EMAIL PROTECTED]> wrote in message 7F548E90E63BD1118E4600609707771F8BF00A@goliath">news:7F548E90E63BD1118E4600609707771F8BF00A@goliath... > I did it ..But nothing > > Thanks !!! > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] split and array logic
I can't quite get the logic to create my own associative arrays: if: $stuff[0]="165.33.114.63 anonymous Mozilla/4.0" $stuff[1]="213.35.354.93 anonymous Mozilla/4.0" how do I end up with: $stuff[0][user]="165.33.114.63" $stuff[0][browser]="Mozilla/4.0" $stuff[1][user]="213.35.354.93" $stuff[1][browser]="Mozilla/4.0" I am hacking away at: foreach( $stuff as $cFile ) { list ($user, $junk, $browser) = split (' ', $cFile); } and it hurts.any hints ? TIA, Matthew Luchak Webmaster Kaydara Inc. [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Returning Lowest Number Not In Array
pseudo code: for($i=-1; $i < count($my_array); $i++) { if (!in_array($i,$my_array)){echo $i; exit;} } should do it. ____ Matthew Luchak Webmaster Kaydara Inc. [EMAIL PROTECTED] -Original Message- From: Mike Potter [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 03, 2001 9:28 AM To: [EMAIL PROTECTED] Subject: [PHP] Returning Lowest Number Not In Array Hi all: I'm hoping someone can help me out with this array problem. I'm trying to find the lowest number which is not in the array. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] session_register()
I would be very interested in hearing of any developments with session anomilies.. Netscape® Communicator 4.76 M$2000 PHP Version 4.0.4pl1 System Windows NT 5.0 build 2195 Server API CGI ZEND_DEBUG disabled Thread Safety enabled "works" using: Hello visitor, you have seen this page times. is necessary to preserve the session id # in the case that the user has disabled cookies ?> ____ Matthew Luchak Webmaster Kaydara Inc. [EMAIL PROTECTED] I would be very interested in hearing of any developments with session anomilies.. Netscape® Communicator 4.76 M$2000 "works" using: Hello visitor, you have seen this page times. is necessary to preserve the session id # in the case that the user has disabled cookies ?> ____ Matthew Luchak Webmaster Kaydara Inc. [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] preg vs ereg (performance)
I am in the process of writing an application that does a lot of parsing in which performance is the key. In the process, I performed some rudimentary speed testing that yielded some interesting results. Rather than keep them to myself, I thought I would share them. I am currently parsing out the contents of general webpages, so for the test case, I used a string that contained the html to generate a fairly standard select list (with 31 options). For the first test, I merely wanted to pull out the name of the select element. I used the following two parsing commands in a side-by-side timing comparison and ran each in a loop 5000 times to get a larger time value: preg_match( "/name=[ ]?(['\"])?((?(1)[^\\1]|[^\s\>])+?)(?(1)\\1|[\s>])/i", $string, $arr ); eregi( "name=[\"']{0,1}([_0-9a-zA-Z]+)[\"']{0,1}", $string, $arr ); Note: The preg_match expression is actually far more accurate that the eregi as well as complex. It handles the case of "name=34 multiple>" as well as "name='my select'". Both expressions were also case insensitive. The results: preg_match Timer: This page was generated in 0.26572799682617 seconds. eregi Timer: This page was generated in 1.2171900272369 seconds. The preg_match is considerably faster than ereg and much more powerful (the PHP homepage for the documentation), and while the syntax takes a little adjustment (if you have never used Perl before), it is not that difficult to convert to. When I replaced all of my eregi statements with their preg_match equivalents, I found that the parsing portion of my page went from .46 seconds to .23. When it comes to regular expression pattern matching, I have come to the conclusion that the only option is preg_match. Inspired by this revelation, I decided to test preg_split vs split vs explode. It was not nearly as interesting, but I thought I would post my results nonetheless. Using the same string as above, I decided to split the string by the ", $string, $arr ); explode( "", $string, $arr ); The results: preg_split Timer: This page was generated in 0.23138296604156 seconds. split Timer: This page was generated in 0.22009003162384 seconds. explode Timer: This page was generated in 0.14973497390747 seconds. This really is not too surprising when it comes to explode. If there is no complex pattern matching, always use explode. preg_split vs split was a little surprising given my findings above, but in general, it looks like while there is not much of a difference, split has the slight edge. Summary: * If you are doing regular expression matching in a string, use preg_match. Not only is it much faster, but it is much more powerful than ereg. * If you are splitting a string by a simple string pattern, use explode. * If you are splitting a string using regular expressions, use split unless you need the functionality of preg_split. Disclaimer: I have not done exhaustive performance study of all of the possible scenarios to find discrepancies, but from my observations so far, the above conclusions have held true. If anyone has any other information, please post it for us all to share. I hope some of you have found this useful. Matthew Aznoe Fuzz Technologies [EMAIL PROTECTED] (406) 587-1100 x217 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] nslookup function ?
I'm working on a email address verification script and need to do a DNS lookup given the IP number of a remote host. ie: is [EMAIL PROTECTED] a viable address? get IP gethostbyname(here.net); nslookup IP to get mail server address pfsockopen blah...blah..blah... sois there a nifty yet undocumented nslookup() function out there? ____ Matthew Luchak Webmaster Kaydara Inc. [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] URL redirection
http://www.somewhere.com/index.php";); exit; ?> ____ Matthew Luchak Webmaster Kaydara Inc. [EMAIL PROTECTED] > Hi, > > Is there a PHP function that will redirect the current page to another url? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] OT question..
Happiness is a warm gun. - John Lennon > > What luck for the rulers that men do not think. > > - Adolf Hitler Could you please remove that signature. Thanks. -Egon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PC MAG article
I think MS is worried. They send me the mag ever month for free, and I throw it away. I never understood how sending the mag for free to people that didn't want it made anyone a living. Now that I know MS owns them, I see that making money isn't the issue, they just want the spin. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] include("../file.inc");
How do you include or require a file that is above the current script in the directory hierarchy? For example how would I include or require a file whose path is "../file.inc" relative to the current script? I tried all of: include("../file.inc"); require("../file.inc"); include("/file.inc"); require("/file.inc"); include("..\file.inc"); require("..\file.inc"); include("\file.inc"); require("\file.inc"); but it doen't like any of them. :( I don't want to use a full path relative to the root of the drive or webserver folder because the included file and the script may move as the development server is setup differently to the real web server. Any ideas? -- Thanks, Matt [EMAIL PROTECTED] < www.mralston.co.uk /> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Get the string between custom delimiters
Is there a nice easy function that could be used to get a sub string that lies in between two other sub strings in one big string. For example... get the text that lies in between "" and "" (without the quotes) in the code of a web page. I'm after a function like: string getstring_between_customdelimiters(string source, string open_delimiter, sting close_delimiter) Or something that could be easily be used in that manner. Case insensitive if possible! Thanks, Matt [EMAIL PROTECTED] < www.mralston.co.uk /> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Online HTML Editors
Heya guys sorry to be posting on a PHP mailing list but it's the only one I'm subscribed to. For my latest project we're trying to do away with having to teach some of our (less technically-minded) staff HTML coding. But we still need them to be able to edit content out of a MySQL dbase. To achieve this we'd like to employ the use of a HTML editor (loaded with the content out of a dbase - that's easy). With the editor completely run through a web interface and *preferably* doesn't allow the people access to HTML code. Now I know that's a tall order so I'd settle for anyone out there to let me know any suggestions of completely online web editors (with or without HTML code access). Thanks in advance crew! ------- Matthew M. Boulter MB Productions, Pty Ltd. Brisbane, Queensland, Australia m: 0414-912-501 e: [EMAIL PROTECTED] icq: 14626936 ---
Re: [PHP] Uptime script?
Why would you want to advertise that? Seems like you would be leaking information to crackers ... - Original Message - From: Ryan Christensen <[EMAIL PROTECTED]> Sent: Wednesday, May 16, 2001 12:43 AM > does anyone know of a PHP script that echoes the uptime of a server (Linux) in > days,hour,minutes, etc? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Uptime script?
If you were trying to take a machine down, it might be useful to know it. Plus it's easily faked. > It's very difficult to imagine how 'uptime' information could be used to > cause mischief... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] dynamically naming arrays
any hints on dynamically naming arrays? ie: $stuff= explode ("!", $contents); //$stuff[3] is "foo" $stuff[3]=explode("&",$stuff[4]); print_r($foo); ____ Matthew Luchak Webmaster Kaydara Inc. [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Converting MySQL Date (2001-05-21) to Friendly Date (21 May 2001)
I've got a date stored in a MySQL database in a "DATE" field, so it is stored as "2001-05-21". How do I convert that into a more friendly date like "21 May 2001" or even "21st May 2001" for display on a web page? I've tried print date("jS F Y", $dbtable[date]); but I always get "1st January 1970" because I don't know how to convert the MySQL date into a PHP timestamp. Can someone tell me how to do it please? -- Thanks, Matt [EMAIL PROTECTED] < www.mralston.co.uk /> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Converting MySQL Date (2001-05-21) to Friendly Date (21 May 2001)
Thanks Papi, That works fine. Matt [EMAIL PROTECTED] < www.mralston.co.uk /> Pavel Jartsev <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Matthew Ralston wrote: > > > > I've got a date stored in a MySQL database in a "DATE" field, so it is > > stored as "2001-05-21". How do I convert that into a more friendly date like > > "21 May 2001" or even "21st May 2001" for display on a web page? > > > > I've tried > > > > print date("jS F Y", $dbtable[date]); > > > > but I always get "1st January 1970" because I don't know how to convert the > > MySQL date into a PHP timestamp. > > > > Can someone tell me how to do it please? > > > > Maybe it's not very nice, but it works: > list($y,$m,$d) = explode('-', $dbtable['date']); > print date("jS F Y", mktime(0, 0, 0, $m, $d, $y)); > ?> > > > Hope this helps. > > -- > Pavel a.k.a. Papi > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Licensing??
Welcome to the world of free software. Matthew Walker Ecommerce Project Manager Mountain Top Herbs -Original Message- From: Andrew V. Romero [mailto:[EMAIL PROTECTED]] Sent: Friday, December 28, 2001 9:36 PM To: [EMAIL PROTECTED] Subject: [PHP] Licensing?? I am looking into installing php on some of our hospital servers and was wondering about licensing issues. Are you suppose to purchase any type of license for installing php on a commercial server? It seems a little on the strange side that they (the php people) would just let you install and use their product for free, what do they get out of it? Thanks for any information, Andrew V. Romero -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.310 / Virus Database: 171 - Release Date: 12/19/2001 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.310 / Virus Database: 171 - Release Date: 12/19/2001 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] easy quickie..
_Your_ browser has a back button.. great.. There are many situations in which the back button may not be visible/available/appropriate. You may also not want to go back in your _history_, just back to the previous page - and possibly set some variables in the page request. It is far more than a "duplicate" of the back button. Matt. -Original Message- From: Seb Frost [mailto:[EMAIL PROTECTED]] Sent: 02 January 2002 19:21 To: Kelly Meeks; [EMAIL PROTECTED] Subject: RE: [PHP] easy quickie.. I've never understood why people do this? My browser has a back button. I know how to use it. It's only a centimetre of mouse travel away from the page I'm looking at, why do I need a duplicate? - seb -Original Message- From: Kelly Meeks [mailto:[EMAIL PROTECTED]] Happy New Year, Does php set a variable that tells you the url of the page that a user has just come from? So if I wanted to create my own 'Back' button in a pop up window, for instance? Thanks in advance, Kelly --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.307 / Virus Database: 168 - Release Date: 11/12/2001 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] XML Parsing Problem
Hi there, This is not a bug.. this is expected behaviour. The string would be chopped up into 3 parts because you have : 1. a string: "Follow-up To Critique of BeOS " 2. a predefined entity : "&" 3. a string: "amp; Mac OS X" There are not actually two ampersands.. you have & followed by amp; - this is so that once it has been parsed you end up with & which will display correctly in most HTML browsers. Note that & is a usually a predefined entity in XML and so will be replaced with "&". HTH Matt. -Original Message- From: Ben Gollmer [mailto:[EMAIL PROTECTED]] Sent: 01 January 2002 00:23 To: [EMAIL PROTECTED] Subject: [PHP] XML Parsing Problem Hi all - I'm experimenting with PHP's XML parser for an application that maps XML tags to MySQL database fields. As a test for my parsing program, I've been grabbing XML from the Slashdot news feed (http://www.slashdot.org/slashdot.xml) and inserting it into a database. This is very simple data - blah gets inserted into the 'title' field, etc. However, when there are some strange characters in the title field, the XML parser seems to choke. Here is an example. The title of a recent article from Slashdot looks like this in the XML file: Follow-up To Critique of BeOS & Mac OS X Don't ask my why they have a double ampersand in there... Anyway, the XML parser returns this as three sets of data, instead of one. The array that I get looks like this: $myArray[0] = "Follow-up To Critique of BeOS " $myArray[1] = "&" $myArray[2] = "amp; Mac OS X" This is the data I get back from the parser, BEFORE putting it into the database. I'm echoing each array field to the screen, just to make sure. So I know it has nothing to do with MySQL. The double ampersand shouldn't make a difference - the XML parser should not be interpreting HTML...right? Also, I don't get an error code or error string from xml_parse(). Anyone have any ideas? This is a subtle bug - in fact I had been satisfied with my XML parsing code, and was well into the rest of my application when I happened to notice this. Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Cookies In Images...
Can anyone give me a pointer on where to go to find out how to send cookies through images, preferably in PHP? Matthew Walker Ecommerce Project Manager Mountain Top Herbs --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.310 / Virus Database: 171 - Release Date: 12/19/2001 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Cookies In Images...
Thanks. That's what I suspected, but I needed to make sure. Matthew Walker Ecommerce Project Manager Mountain Top Herbs -Original Message- From: Bas van Rooijen [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 02, 2002 2:28 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Cookies In Images... On Wed, 2 Jan 2002 14:11:39 -0700, Matthew Walker wrote: >Can anyone give me a pointer on where to go to find out how to send >cookies through images, preferably in PHP? To do this you will have to point the HREF in your IMG tag to a PHP script. >From that script you should do this: - Pass the correct content-type header (default for PHP is text/html) for example: - Set the cookie as usual - Then send the contents of the image you would like to display, for example: bvr. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.310 / Virus Database: 171 - Release Date: 12/19/2001 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.310 / Virus Database: 171 - Release Date: 12/19/2001 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] XML Parsing Problem
well thats just the way XML parsers work, according to the parser, what you have there is not a single string element, you have three child elements (the parent node being the ).. two string nodes broken up by an entity node. In other circumstances, this behaviour can be very useful. Matt. -Original Message- From: Ben Gollmer [mailto:[EMAIL PROTECTED]] Sent: 02 January 2002 23:16 To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [PHP] XML Parsing Problem Ok, I can understand the predefined entity replacement. But why does it break the string up into 3 parts? I think it should just return "Follow-up To Critique of BeOS & Mac OS X". Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] More on images...
Related to my last question about the cookies in images, is there any way to get the referrer from the calling page without passing it as an argument to the image generation script? Matthew Walker Ecommerce Project Manager Mountain Top Herbs --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.310 / Virus Database: 171 - Release Date: 12/19/2001 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] More on images...
Buh. That's the problem. There's no assurance that in will be used from a PHP script, so I can't do that. Mrrr. Let me explain what I'm doing, and someone can pipe up if they have a better idea. I'm writing a tracking module for a shopping cart system, so that we can track where people came to our site from, and correlate that information with whether or not they ordered. Right now, I'm trying to do this with a php script in an image tag, so that I can set the cookies I need. However, I need to be able to get the referrer from the page that is calling the image, and I can't assume it's php. Any advice? Matthew Walker Ecommerce Project Manager Mountain Top Herbs -Original Message- From: Billy Harvey [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 03, 2002 3:25 PM To: Matthew Walker Subject: Re: [PHP] More on images... On Thu, 2002-01-03 at 16:51, Matthew Walker wrote: > Related to my last question about the cookies in images, is there any > way to get the referrer from the calling page without passing it as an > argument to the image generation script? > > Matthew Walker > Ecommerce Project Manager > Mountain Top Herbs Matthew, you're going to have to save it as a variable somewhere to be able to retrieve it. If you have session management then you could just register the variable and it would exist on the next page. Billy --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.313 / Virus Database: 174 - Release Date: 1/2/2002 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.313 / Virus Database: 174 - Release Date: 1/2/2002 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]