Re: [PHP] Re: fsockopen on ssl://
Hi Apache is serving php correctly and i can see this from a and everything else works fine just this one call to fsockopen using ssl://. Is there some sort of extra configuration required for apache to be able to do this that i am not aware of? Bob - Original Message From: Ólafur Waage <[EMAIL PROTECTED]> To: php-general@lists.php.net Sent: Monday, 19 May, 2008 10:26:58 AM Subject: Re: [PHP] Re: fsockopen on ssl:// Are you doing the command line on the same machine as the server? Have you checked out the apache configuration? Since phpcli runs alone. (iirc) 2008/5/18 bob pilly <[EMAIL PROTECTED]>: > Hi Manuel > > Thanks for the reply. I have tested it with a timeout of 20 seconds and the > same thing occurs. It works as before from the command line and not form > within apache.. Any more ideas? > > Cheers > > Bob > > > - Original Message > From: Manuel Lemos <[EMAIL PROTECTED]> > To: bob pilly <[EMAIL PROTECTED]> > Cc: php-general@lists.php.net > Sent: Wednesday, 14 May, 2008 4:26:41 PM > Subject: Re: fsockopen on ssl:// > > Hello, > > on 05/13/2008 04:37 PM bob pilly said the following: >> Hi all >> >> I have tried researching this issue but havent come up with any solution so >> im hoping someone has seen it before and can help. I have the following test >> script that uses fsockopen to connect to a https site, get the contents and >> outputs it. >> >> > $host = "www.microsoft.com"; >> $path = "/"; >> $fh = fsockopen("ssl://".$host, 443, $errno, $errstr, 5);//opens url for >> reading with a timeout of 2 seconds >> >> if (!$fh){ >> echo "FAIL: $errno $errstr "; >> } >> else{ >> $out = "GET $path HTTP/1.1\r\n"; >> $out .= "Host: $host\r\n"; >> $out .= "Connection: Close\r\n"; >> $out .= "\r\n"; >> fwrite($fh, $out); >> stream_set_timeout($fh,2); >> $info = stream_get_meta_data($fh); >> if($info['timed_out']){ >> echo "TIMEOUT\n"; >> } >> else{ >> $haystack = ""; >> while (!feof($fh)) { >> $haystack.= fgets($fh, 4096); >> } >> } >> print $haystack; >> fclose($fh); >> } >> ?> >> >> if i run this script using php -f test.php it works fine. However if i try >> and run this on my loca apache server i get the following error: >> >> Warning: fsockopen() [function.fsockopen]:unable to connect to >> ssl://www.microsoft.com:443 (A connection attemptfailed because the >> connected party did not properly respond after aperiod of time, or >> established connection failed because connected hosthas failed to respond.) >> in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\test.php on >> line 4 >> FAIL: 10060 A connection attempt failed because the connected party didnot >> properly respond after a period of time, or established connectionfailed >> because connected host has failed to respond. >> >> As you can see from that error i am using windows and apache 2.2. My php >> version is 5.25. I have Registered Stream Socket Transports tcp, udp, ssl, >> sslv3, sslv2, tlsin my config. > > I suspect that you are giving a very short timeout but then you are not > handling the timeout error properly. > > Anyway, before reinventing the wheel, you may to try this HTTP client > class that supports many options including establishing SSL corrections > and setting and handling timeouts correctly. > > http://www.phpclasses.org/httpclient > > -- > > Regards, > Manuel Lemos > > PHP professionals looking for PHP jobs > http://www.phpclasses.org/professionals/ > > PHP Classes - Free ready to use OOP components written in PHP > http://www.phpclasses.org/ > > > > __ > Sent from Yahoo! Mail. > A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Sent from Yahoo! Mail. A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html
[PHP] Re: fsockopen on ssl://
Hi Manuel Thanks for the reply. I have tested it with a timeout of 20 seconds and the same thing occurs. It works as before from the command line and not form within apache.. Any more ideas? Cheers Bob - Original Message From: Manuel Lemos <[EMAIL PROTECTED]> To: bob pilly <[EMAIL PROTECTED]> Cc: php-general@lists.php.net Sent: Wednesday, 14 May, 2008 4:26:41 PM Subject: Re: fsockopen on ssl:// Hello, on 05/13/2008 04:37 PM bob pilly said the following: > Hi all > > I have tried researching this issue but havent come up with any solution so > im hoping someone has seen it before and can help. I have the following test > script that uses fsockopen to connect to a https site, get the contents and > outputs it. > > $host = "www.microsoft.com"; > $path = "/"; > $fh = fsockopen("ssl://".$host, 443, $errno, $errstr, 5);//opens url for > reading with a timeout of 2 seconds > > if (!$fh){ > echo "FAIL: $errno $errstr "; > } > else{ > $out = "GET $path HTTP/1.1\r\n"; > $out .= "Host: $host\r\n"; > $out .= "Connection: Close\r\n"; > $out .= "\r\n"; > fwrite($fh, $out); > stream_set_timeout($fh,2); > $info = stream_get_meta_data($fh); > if($info['timed_out']){ > echo "TIMEOUT\n"; > } > else{ > $haystack = ""; > while (!feof($fh)) { > $haystack.= fgets($fh, 4096); > } > } > print $haystack; > fclose($fh); > } > ?> > > if i run this script using php -f test.php it works fine. However if i try > and run this on my loca apache server i get the following error: > > Warning: fsockopen() [function.fsockopen]:unable to connect to > ssl://www.microsoft.com:443 (A connection attemptfailed because the connected > party did not properly respond after aperiod of time, or established > connection failed because connected hosthas failed to respond.) in C:\Program > Files\Apache Software Foundation\Apache2.2\htdocs\test.php on line 4 > FAIL: 10060 A connection attempt failed because the connected party didnot > properly respond after a period of time, or established connectionfailed > because connected host has failed to respond. > > As you can see from that error i am using windows and apache 2.2. My php > version is 5.25. I have Registered Stream Socket Transports tcp, udp, ssl, > sslv3, sslv2, tlsin my config. I suspect that you are giving a very short timeout but then you are not handling the timeout error properly. Anyway, before reinventing the wheel, you may to try this HTTP client class that supports many options including establishing SSL corrections and setting and handling timeouts correctly. http://www.phpclasses.org/httpclient -- Regards, Manuel Lemos PHP professionals looking for PHP jobs http://www.phpclasses.org/professionals/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ __ Sent from Yahoo! Mail. A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html
[PHP] fsockopen on ssl://
Hi all I have tried researching this issue but havent come up with any solution so im hoping someone has seen it before and can help. I have the following test script that uses fsockopen to connect to a https site, get the contents and outputs it. if i run this script using php -f test.php it works fine. However if i try and run this on my loca apache server i get the following error: Warning: fsockopen() [function.fsockopen]:unable to connect to ssl://www.microsoft.com:443 (A connection attemptfailed because the connected party did not properly respond after aperiod of time, or established connection failed because connected hosthas failed to respond.) in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\test.php on line 4 FAIL: 10060 A connection attempt failed because the connected party didnot properly respond after a period of time, or established connectionfailed because connected host has failed to respond. As you can see from that error i am using windows and apache 2.2. My php version is 5.25. I have Registered Stream Socket Transports tcp, udp, ssl, sslv3, sslv2, tlsin my config. Thanks for any help in advance and it is greatly appreciated, this problem is driving me nuts!! Cheers Bob __ Sent from Yahoo! Mail. A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html
[PHP] fsockopen on ssl://
Hi all I have tried researching this issue but havent come up with any solution so im hoping someone has seen it before and can help. I have the following test script that uses fsockopen to connect to a https site, get the contents and outputs it. if i run this script using php -f test.php it works fine. However if i try and run this on my loca apache server i get the following error: Warning: fsockopen() [function.fsockopen]:unable to connect to ssl://www.microsoft.com:443 (A connection attemptfailed because the connected party did not properly respond after aperiod of time, or established connection failed because connected hosthas failed to respond.) in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\test.php on line 4 FAIL: 10060 A connection attempt failed because the connected party didnot properly respond after a period of time, or established connectionfailed because connected host has failed to respond. As you can see from that error i am using windows and apache 2.2. My php version is 5.25. I have Registered Stream Socket Transports tcp, udp, ssl, sslv3, sslv2, tlsin my config. Thanks for any help in advance and it is greatly appreciated, this problem is driving me nuts!! Cheers Bob __ Sent from Yahoo! Mail. A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html
[PHP] newbie question
Hi all Can anyone tell me what '&' means before a var? e.g function(&$var) Thanks for any help in advance ___ What kind of emailer are you? Find out today - get a free analysis of your email personality. Take the quiz at the Yahoo! Mail Championship. http://uk.rd.yahoo.com/evt=44106/*http://mail.yahoo.net/uk
Re: [PHP] Mail reply-path
Hi Richard this is exactly what i was after and works perfectly! Cheers Bob Richard Lynch <[EMAIL PROTECTED]> wrote: On Tue, August 15, 2006 6:54 am, bob pilly wrote: > Im trying to send emails using the mail() function but im having a > problem. Because the box that the scripts sit on is a shared > web-hosting package the Reply-path part of the header always comes up > as [EMAIL PROTECTED] but i have set the from part of the > header to [EMAIL PROTECTED] A lot of people are not getting the > emails (most are) and im picking that its because the domains on the 2 > header parts are different and they have some sort of antispam policy > which blocks these. Apart from changing the domains or email addresses > to be the same has anyone seen this problem before and if so can you > give advice or point me to some relevant docs on it? I have tried to > change the Replay-path: part of the header with code but it seems to > default to the above. The Reply-path: you want to change is not a normal header, so you can cross off the idea of fixing it with the 4th arg to mail(). If you are using current PHP, there is yet another bonus argument, the 5th one, for this specific purpose, documented in the manual: http://php.net/mail If you are NOT using a version of PHP that has that 5th arg, then you could maybe use ini_set on the sendmail_path to add the -f there. (see man mail). That, however, would require that the user PHP runs as, which is what Apache runs as, be a trusted user in sendmail.cf, which your webhost may or may not have decided is a Good Idea, based on how much they trust their clients. Going farther afield, you could attempt to find an SMTP host/server/setup that would allow you to set these values to what you want -- I *think* that's do-able... I never had to go that far, personally, so can't be certain. You may also want to convince the recipients to white-list your address, so that the From/Reply-path/etc are all irrelevant for spam filtering. This has the advantage of being a long-term solution, for any reasonable implementation of spam-filtering that allows whitelisting by the recipient, no matter what spam-filtering "rules" are brought to bear in the future. -- Like Music? http://l-i-e.com/artists.htm - All new Yahoo! Mail "The new Interface is stunning in its simplicity and ease of use." - PC Magazine
[PHP] Mail reply-path
Hi all Im trying to send emails using the mail() function but im having a problem. Because the box that the scripts sit on is a shared web-hosting package the Reply-path part of the header always comes up as [EMAIL PROTECTED] but i have set the from part of the header to [EMAIL PROTECTED] A lot of people are not getting the emails (most are) and im picking that its because the domains on the 2 header parts are different and they have some sort of antispam policy which blocks these. Apart from changing the domains or email addresses to be the same has anyone seen this problem before and if so can you give advice or point me to some relevant docs on it? I have tried to change the Replay-path: part of the header with code but it seems to default to the above. Thanks in advance for any help!! Cheers Bob - Try the all-new Yahoo! Mail . "The New Version is radically easier to use" The Wall Street Journal
[PHP] Dynamically assigning var namesi
Hi all Does anyone know if you can assign a new variable name based on the contents of another variable in PHP? If so whats the syntax to do this? I am parsing a text file that has tens of preset attributes and some of these have hundreds of sub attributes. For example the text file contains flight details, on every flight there can be up to 500 passengers but there are generally only 50 so i dont want to have declare 500 vars when i hardly ever use them. What i am trying to do is count the amount of pasengers present and dynamically create the variables based on this.$surname1,$surname2 etc... Im not sure whether this is a sane way to approach this problem or not. Any advice or pointing to relevant documentation about either syntax for this or ways of tackling this sort of problem (im sure it must be a regular occurance in the coding world??) would be greatly appreciated!! Thanks in advance for any help or advice. Cheers Bob - All new Yahoo! Mail "The new Interface is stunning in its simplicity and ease of use." - PC Magazine
[PHP] multiple BCC addresses with mail() function
Hi All I am trying to take a list of email addresses from my database and email them all in one email but not allow them to see individual email addresses. Im not sure of the best way to do it but im thinking that just having a large BCC: string made of the addresses. If anyone has dealt with this problem before any advice would be greatly appreciated! thanks for any advice in advance! Cheers Bob Send instant messages to your online friends http://uk.messenger.yahoo.com
[PHP] Variable within a Variable
Hi All Im trying to store a document template in mysql that has php var names within it and then find it in the datebase and print it out with the var names replaced with the var values. e.g i have this stored Dear $title $name we would like to.. I declare the vars $title and $name $title = 'Mr'; $name = 'Test'; //retrieve the stored template $query = "select template from letters"; $result = mysqli_query($dblink,$query); if($row = mysqli_fetch_array($result)){ print $row['template']; } i would expect that to print: Dear Mr Test we would like to.. but it doesnt it prints out Dear $title $name we would like to.. can someone point out where i am going wrong? Is this actually possible and if so im picking ive go the syntax wrong? Thanks for any help in advance! Cheers Bob - To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre.
[PHP] Var within a var
Hi All Im trying to store a document template in mysql that has php var names within it and then find it in the datebase and print it out with the var names replaced with the var values. e.g i have this stored Dear $title $name we would like to.. I declare the vars $title and $name $title = 'Mr'; $name = 'Test'; //retrieve the stored template $query = "select template from letters"; $result = mysqli_query($dblink,$query); if($row = mysqli_fetch_array($result)){ print $row['template']; } i would expect that to print: Dear Mr Test we would like to.. but it doesnt it prints out Dear $title $name we would like to.. can someone point out where i am going wrong? Thanks for any help in advance! Cheers Bob - Yahoo! Photos NEW, now offering a quality print service from just 8p a photo.
[PHP] debugging dl()
Hi All Im having problems using dl() to load an extension that someone has given me. I get the following output from this simple script: //script //output PHP Warning: dl(): \u?\u: Unable to initialize module Module compiled with module API=20020429, debug=0, thread-safety=0 PHPcompiled with module API=20041030, debug=0, thread-safety=0 These options need to match Has anyone seen this before? If not does anyone know how i can trace this further? Thanks in advance for any help!! Cheers Bob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP and COM+ prob
Hi all! I am trying to start word using com and php and having problems. I am running php 5.04 and apache 2.054 on windows. I have used a simple example from the php site but cant get it working. |Version}\n"; //bring it to front $word->Visible = 1; //open an empty document $word->Documents->Add(); //do some weird stuff $word->Selection->TypeText("This is a test..."); $word->Documents[1]->SaveAs("Useless test.doc"); //closing word $word->Quit(); //free the object $word = null; ?> i have called this page testcom.php but when i try and view it with a clients browser i get this error: [client xxx.xxx.xxx.xxx] PHP Fatal error: Uncaught exception 'com_exception' with message 'Failed to create COM object `Word.application': Invalid syntax\r\n' in C:\\Program Files\\Apache Group\\Apache2\\htdocs\\testcom.php:3\nStack trace:\n#0 C:\\Program Files\\Apache Group\\Apache2\\htdocs\\testcom.php(3): com->com('Word.applicatio...')\n#1 {main}\n thrown in C:\\Program Files\\Apache Group\\Apache2\\htdocs\\testcom.php on line 3 | Has anyone seen this error before or know what it means? Or if possible does anyone know of any good docs on using com with php? Thanks in advance for any help!! Cheers Bob ___ Yahoo! Messenger - want a free and easy way to contact your friends online? http://uk.messenger.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php and com
I am trying to start word using com and php. I am running php 5.04 and apache 2.054 on windows. I have used a simple example from the php site but cant get it working. |Version}\n"; //bring it to front $word->Visible = 1; //open an empty document $word->Documents->Add(); //do some weird stuff $word->Selection->TypeText("This is a test..."); $word->Documents[1]->SaveAs("Useless test.doc"); //closing word $word->Quit(); //free the object $word = null; ?> i have called this page testcom.php but when i try and view it with a clients browser i get this error: [client xxx.xxx.xxx.xxx] PHP Fatal error: Uncaught exception 'com_exception' with message 'Failed to create COM object `Word.application': Invalid syntax\r\n' in C:\\Program Files\\Apache Group\\Apache2\\htdocs\\testcom.php:3\nStack trace:\n#0 C:\\Program Files\\Apache Group\\Apache2\\htdocs\\testcom.php(3): com->com('Word.applicatio...')\n#1 {main}\n thrown in C:\\Program Files\\Apache Group\\Apache2\\htdocs\\testcom.php on line 3 | Has anyone seen this error before or know what it means? Or if possible does anyone know of any good docs on using com with php? Thanks in advance for any help!! Cheers Bob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] POST method to php page from php page
Hello all Does anyone know if its possible to post data using the http POST method to another form using php? I know its possible to use: header( "Location: somelocation.php?" .SID&somevar=$somevar ); But this uses the GET method any help or pointing me to any relevant documentation would be greatly appreciated. Cheers Bob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Dynamic Class Name Assignments
Hi All, im new to classes in PHP. Im trying to create several instances of a very basic class but i want each name to be based on number values in an array and im not sure if it is allowed and if so how to do it. I assume that im not allow to have a var starting with a number so what i am trying to do is add the word case to the front of the class instance name so i would have $case100,$case101 etc. Im am using PHP 5.02. Heres my code caseid=$caseid; } function addmember($membername,$value){ $this->$membername=$value; } } $names=array("100","101","102","104"); $numnames=count($names); for($i=0;$i<$numnames;$i++){ *** below is the syntax im missing *** $case.$names[$i] = new Test($names[$i]); } var_dump($case100); ?> Thanks for any help in advance! Cheers Bob Pilford ___ ALL-NEW Yahoo! Messenger - all new features - even more fun! http://uk.messenger.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Class Syntax Help or Globals issue
Hi All I am new to classes and are trying to work out whether they will make my coding experience easier. I have written the following test class which is trying to take three variables from a mssql query and add them as variables in a new class. This isnt working as i keep getting an error that says ; Warning: Missing argument 1 for app() in /var/www/htdocs/temp3.php on line 13 Warning: Missing argument 2 for app() in /var/www/htdocs/temp3.php on line 13 Warning: Missing argument 3 for app() in /var/www/htdocs/temp3.php on line 13 the code . //a basic class to store basic appointment details in class App { var $name; var $the_date; var $result; //add values to the variables function App($app1name,$appdate,$appresult){ $this->name=$app1name; $this->the_date=$appdate; $this->result=$appresult; } } $query="select app1name,appdate,appresult from appresult where appdate > 'jun 01 2004'"; $qresult=mssql_query($query,$numero);//get the number of rows returned $numrow=mssql_num_rows($qresult); if($row=mssql_fetch_array($qresult)){ $i=0; do{ $j=$i; $j= new App; $j->App($row[app1name],$row['appdate'],$row['appresult']); } while($row=mssql_fetch_array($qresult)); } ?> Is there a syntax problem with the way im trying to pass the value of the $row array cells into the class function? I have looked at the online manual for classes but find it a bit confusing on how to input and extract variables data in classes. Any help or pointing in the direction of some good docs would be greatly appreciated! thanks for any help in advance. Yahoo! Messenger - Communicate instantly..."Ping" your friends today! Download Messenger Now http://uk.messenger.yahoo.com/download/index.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] query returns 0 when it shouldnt
Hi All Im having trouble with a query that runs fine when i cut and paste it to freetds and run against the database. code as follows: $query ="select count(phonenum) from callrslt where (dateofcall = '$today') and (callresultcode ='9' or callresultcode ='12' or callresultcode ='14')"; $result=mssql_query($query,$numero); $contacts=mssql_fetch_row($result); print_r($contacts); This returns Array ( [0] => 0 ) select count(phonenum) from callrslt where (dateofcall = 'Feb 17 2004') and (callresultcode ='9' or callresultcode ='12' or callresultcode ='14') If i cut and paste this to freetds i get a result of 5120. Can anyone spot why i am getting a zero with php? There are no problems with any of my other queries in my scripts. Thanks in advance for any help. Cheers Bob Yahoo! Messenger - Communicate instantly..."Ping" your friends today! Download Messenger Now http://uk.messenger.yahoo.com/download/index.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] syntax help
Hi all I have a problem that is probably just a lack of php syntax knowledge on my part and hopefully someone can help me out. I have an array and i want to query a database for each value in that array. I then want to store that result as a new variable called $array[value]total. see code below $array=array("Flyer","Email","Phone"); $array_len=count($array); for($i=0;$i<$array_len;$i++){ $query="select count(score) from test_table where source = '$array[$i]'"; $result=mssql_query($query,$numero); $row=mssql_fetch_row($result); $array[$i].total=$row[0];<-- problem here } so for the above code i would like to create three variable $flyertotal,$emailtotal & $phonetotal and have the result of the count(score) query stored in them. Any help or pointing to documentation would be greatly appreciated! Cheers Bob Yahoo! Messenger - Communicate instantly..."Ping" your friends today! Download Messenger Now http://uk.messenger.yahoo.com/download/index.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Storing MS Word documents
Have sorted this out now. Theres a bit about storing binary data in the mssql docs: http://uk.php.net/function.mssql-query Just in case anyone wanted to know. --- Stuart <[EMAIL PROTECTED]> wrote: > bob pilly wrote: > > It seems to me that the addslashes isnt working > and > > the query is failing because of this? Has anyone > seen > > this before or know what i am doing wrong? Ive > been on > > this for ages and are not getting anywhere.. > Thanks > > for any help in advance! > > You don't escape single quotes with MSSQL you repeat > them. Try this > instead... > > $data = str_replace("'", "''", $filecontent); > > -- > Stuart > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > BT Yahoo! Broadband - Free modem offer, sign up online today and save £80 http://btyahoo.yahoo.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Storing MS Word documents
Thanks Stuart. I tried that and i still get this error: Warning: mssql_query(): message: Unclosed quotation mark before the character string 'ÐÏࡱá'. (severity 15) in /var/www/htdocs/searches3.php on line 23 Warning: mssql_query(): message: Line 1: Incorrect syntax near 'ÐÏࡱá'. (severity 15) in /var/www/htdocs/searches3.php on line 23 Warning: mssql_query(): Query failed in /var/www/htdocs/searches3.php on line 23 Couldn't add file to database --- Stuart <[EMAIL PROTECTED]> wrote: > bob pilly wrote: > > It seems to me that the addslashes isnt working > and > > the query is failing because of this? Has anyone > seen > > this before or know what i am doing wrong? Ive > been on > > this for ages and are not getting anywhere.. > Thanks > > for any help in advance! > > You don't escape single quotes with MSSQL you repeat > them. Try this > instead... > > $data = str_replace("'", "''", $filecontent); > > -- > Stuart > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > BT Yahoo! Broadband - Free modem offer, sign up online today and save £80 http://btyahoo.yahoo.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Storing MS Word documents
Hi all Im having problems storing a MS word document as an image data type in a MS SQL Server 2000. Im getting as far as the query but i am getting the following error: Warning: mssql_query(): message: Unclosed quotation mark before the character string 'ÐÏࡱá'. (severity 15) in /var/www/htdocs/searches3.php on line 23 Warning: mssql_query(): Query failed in /var/www/htdocs/searches3.php on line 23 Couldn't add file to database Here is the code leading up to it //lets open the file and read the contents $filehandle = fopen($tmpfilename, "r"); $filecontent = fread($filehandle, $filesize); //addslashes so that it can be stored in the database $data = addslashes($filecontent); //now we need to do the query to insert the word doc into the database $query = "insert into temp1 (id,leadsheet) values ('$phonenum','$data')"; mssql_query($query,$numero) or die("Couldn't add file to database"); .. It seems to me that the addslashes isnt working and the query is failing because of this? Has anyone seen this before or know what i am doing wrong? Ive been on this for ages and are not getting anywhere.. Thanks for any help in advance! Bob BT Yahoo! Broadband - Free modem offer, sign up online today and save £80 http://btyahoo.yahoo.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with mssql_query
Thanks! Cheers Bob --- Jason Wong <[EMAIL PROTECTED]> wrote: > On Tuesday 11 November 2003 23:07, bob pillford > wrote: > > Hi all i have the following code which isnt > working correctly and i cant > > work out why. Any help would be greatly > appreciated as its sending me > > crazy! > > > > $query = "select refno from campaign where appdate > between 'nov 07 2003' > > and 'nov 08 2003' "; > $result=mssql_query($query,$numero); > > $numrows=mssql_num_rows($result); > > $row=mssql_fetch_row($result); > > echo $numrows; > > print_r($row); > > > > > > Now this returns: 23 > > Array ( [0] => 1044998 ) > > > > which is 23 for number of rows the query returns > but it only ever stores > > the 1st element of the returned array in $row.. > Can someone tell me where i > > am going wrong as i need access to the other 22 > rows that this query > > returns I have echoed the query and run the > out put under freetds tsql > > and get the correct result (this is what i use to > access the ms sql server > > 2000). > > mssql_fetch_row() only gets *one* row. To get the > rest use something like a > while-loop. For examples refer to the similar > mysql_* functions. > > -- > Jason Wong -> Gremlins Associates -> > www.gremlins.biz > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet > Applications Development * > -- > Search the list archives before you post > http://marc.theaimsgroup.com/?l=php-general > -- > /* > You will pay for your sins. If you have already > paid, please disregard > this message. > */ > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > Want to chat instantly with your online friends? Get the FREE Yahoo! Messenger http://mail.messenger.yahoo.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] printing values from a 2 dimension array
Yes it is what i expect to be stored in the array. Array ( [0] => Array ( [0] => 0 [1] => 4 [2] => 1 [3] => 1 [4] => 0 [5] => 2 [6] => 0 [7] => 0 [8] => 0 [9] => 0 ) [1] => Array ( [0] => 0 [1] => 5 [2] => 3 [3] => 5 [4] => 3 [5] => 3 [6] => 0 [7] => 13 [8] => 0 [9] => 1 ) ) That is one array stored in $rslt[0] and another in $rslt[1] (perhaps i am not understanding arrays correctly?) The thing that confuses me is if i assign the contents of an array member to a variable, and then print it, i get the result i am after,for example $avar = $rslt[0][1];print $avar; will return '4' as i would expect from the output of print_r. Cheers Bob Jason Wong <[EMAIL PROTECTED]> wrote: On Wednesday 15 October 2003 21:02, bob pilly wrote: > print $rslt[0][1]; What does print_r($rslt) give you? Is it what you expected? -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* %DCL-MEM-BAD, bad memory VMS-F-PDGERS, pudding between the ears */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php - Want to chat instantly with your online friends? Get the FREE Yahoo!Messenger
Re: [PHP] printing values from a 2 dimension array
here you go: Cheers Bob Jason Wong <[EMAIL PROTECTED]> wrote: On Wednesday 15 October 2003 17:44, bob pilly wrote: > Im having problems printing values from a 2 dimensional array: > If i have: > temp[0]=array(0,10,11); > temp[1]=array(a,b,c); > print $temp[0][1]; > > i expected the output to be '10' instead i get 'Array[1]', however if i > use: > > $var=$temp[0][1];print $var; i get '10' as the output. This is fine but it > defeats the purpose of what i am trying to do, can anyone tell me why this > is happening? Im new to arrays and its fairly confusing. Thanks for any > help in advance! Try posting your *real* code. The above should not even run. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Chairman of the Bored. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php - Want to chat instantly with your online friends? Get the FREE Yahoo!Messenger
[PHP] printing values from a 2 dimension array
Hi all Im having problems printing values from a 2 dimensional array: If i have: temp[0]=array(0,10,11); temp[1]=array(a,b,c); print $temp[0][1]; i expected the output to be '10' instead i get 'Array[1]', however if i use: $var=$temp[0][1];print $var; i get '10' as the output. This is fine but it defeats the purpose of what i am trying to do, can anyone tell me why this is happening? Im new to arrays and its fairly confusing. Thanks for any help in advance! Cheers Bob - Want to chat instantly with your online friends? Get the FREE Yahoo!Messenger
[PHP] datediff in php
Hi all Does anyone know if there is a date difference function in php? I have searched the manual but found none. What im after is a function that will return the number of days or seconds between a start date and a second date. Much like DATEDIFF in ms sql. Any help or pointing to relevant docs would be greatly appreciated. Thanks in advance. Bob - Want to chat instantly with your online friends? Get the FREE Yahoo!Messenger
[PHP] POST security
Hi all, i know this isnt strictly a php question but thought you would be a good group to ask because of your experience. Is there any security issues with passing data via the POST method from a webserver to a different webserver running ssl. For example: webserver1 and then just using on webserver 2 to retrieve the data? Thanks for any help in advance. Want to chat instantly with your online friends? Get the FREE Yahoo! Messenger http://mail.messenger.yahoo.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] syntax error using header and SID
Hi all Can someone tell me what the correct syntax is to pass a Session ID via the header redirect is? Im trying: header( "Location: page2.php?" ) but it isnt working for me and all the docs i can find just deal with tagging it to the end of a hyperlink. Any help would be greatly appreciated! Want to chat instantly with your online friends? Get the FREE Yahoo! Messenger http://mail.messenger.yahoo.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Filling a text field
Hi all Is there anyway in php to fill a HTMl text input field with a php variable? Or do i have to use javascript? Thanks for any help in advance! Want to chat instantly with your online friends? Get the FREE Yahoo! Messenger http://uk.messenger.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] reading in files
Hello all I have a page where a user uses a browse button in html to upload a file from there client pc. They then click upload which submits the form to the second page: example I am then wanting to read the info in that file in the test2.php page but are struggling. At the moment im trying to use: $file=file($_GET[file]); echo $file[0]; which i thought would output the first line of the file but it doesnt. Can someone point me to some good docs on how php deals with files and how i can readthrough the file uploaded from a user please? Thanks for any help in advance! - Want to chat instantly with your online friends? Get the FREE Yahoo!Messenger
[PHP] £ outputting £ signs
Hello all Can someone tell me where i am going wrong here. I am trying to echo a '£' to the screen which has come from a database field. I get the field by: $notes=%row["notes"]; and the feild contains the data £25000, however when i echo this to the screen i get £25000. I have tried htmlentities() but obviously that outputs £ as it should. html_entity_decode() makes no diference either. Any suggestions or pointing me to the right function docs etc would be greatly appreciated! Thanks in advance for any help! - Want to chat instantly with your online friends? Get the FREE Yahoo!Messenger
[PHP] outputting a carriage return
Hi all Can someone tell me why if i echo a line like this: echo "this is a \n newline"; the output is: this is a newline. But if i do this: $text="this is a \n newline"; echo $text; the output is: this is a newline? Is there something i have to do to a variable in order for echo or print to treat special chars like '\n' correctly? Thanks for any answers in advance! - Want to chat instantly with your online friends? Get the FREE Yahoo!Messenger
Re: [PHP] variable sized arrays & global vars - another newbie question
Thanks for the reply! I must admit i and confused by the answer to the global variables question. Can i ask another question? What if i want to increment a global counter from within a function. at the moment i am trying to declare the variable normally: $counter=0; then within the function: function (){ global $counter; $counter++; } but then when i go to echo $counter outside of the function its value hasnt changed? Yet again any help would be appreciatted! Dirk Kredler <[EMAIL PROTECTED]> wrote: Am Dienstag, 15. Juli 2003 14:39 schrieb bob pilly: > Can i declare an array that doesnt have a fixed size? Basically i want to > assign the results of a query to the array but obviously the query results > can change. Something along the lines of: $myarray= array(); > while($temp=mssql_fetch_array($tmresult)){ > brandnew array = $temp["fieldname"]; $myarray[]= $temp["fieldname"]; > } > this doesnt work for me, any ideas? > Also is it possible to have global variables within php? I have noticed > that if i create a function i cant write to what i thought were global > variables(declared outside the function). Im not trying to pass variables > between pages, just use a global counter within a single page? $globalvar= 'Hi there'; function afunction() { global $globalvar; echo($globalvar); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php - Want to chat instantly with your online friends? Get the FREE Yahoo!Messenger
[PHP] variable sized arrays & global vars - another newbie question
Hi all, yet again im struggling with php syntax after to many years with c. If anyone can help or point me to some good doc's i'd would really appreciate it! My two questions are: Can i declare an array that doesnt have a fixed size? Basically i want to assign the results of a query to the array but obviously the query results can change. Something along the lines of: while($temp=mssql_fetch_array($tmresult)){ brandnew array = $temp["fieldname"]; } this doesnt work for me, any ideas? Also is it possible to have global variables within php? I have noticed that if i create a function i cant write to what i thought were global variables(declared outside the function). Im not trying to pass variables between pages, just use a global counter within a single page? Thanks for any help in advance! - Want to chat instantly with your online friends? Get the FREE Yahoo!Messenger
[PHP] newbie array question
Hi All Im new to php and are getting a bit confused about the sybase_fetch_array function (i think that this is the same as mysql_fetch_array?). If i have a valid sql query that returns three the records 'john','jack' and 'mary' and i want to put that into an array where array[0]->john,array[1]->jack etc how do i do this? Im trying to use sybase_fetch_array as follows: $query = "select name from names (where age <'23'')"; $numero= sybase_connect("database" , "user" , "password" ) or die ("Unable to connect to database server"); $result=sybase_query($query,$numero ); $names=sybase_fetch_array($result); I then try and do something like print $names[0]; but it doesnt work. Sorry if this is really basic any help would be greatly appreciated! - Want to chat instantly with your online friends? Get the FREE Yahoo!Messenger
[PHP] HTMLENTITES(); & the pound sign
I am using PHP Version 4.3.2-RC1 Can someone please clarify the htmlentities() function for me? I have a variable called $notes2 that is pulled from a database that has a pound sign in it. When i echo that do the screen i get the following output: echo $notes; output= £5,000 Instead of £5,000 I thought that if i did $notes=htmlentities($notes); or echo htmlentities($notes); then the output would be £5,000 but this isnt the case. Can someone see where i am going wrong? Thanks for anyhelp in advance! Want to chat instantly with your online friends? Get the FREE Yahoo! Messenger http://uk.messenger.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] using % and £ in strings
Hello I am trying to let a user enter notes about an appointment but are having errors when trying to write their input to a database. The users input goes into string $appnotes $query2="update appresult set appresult = '$appointmentresult',product='$product',fees='0',appnotes='$appnotes' where refno ='$refno'"; This gives the following error if the user inputs special characters like % & or £. Warning: Sybase message: Unclosed quotation mark before the character string 'To p'. (severity 15) in updaterecord.php on line 81 Any help or pointing me to some good documentation on this would be greatly appreciated! __ Yahoo! Plus - For a better Internet experience http://uk.promotions.yahoo.com/yplus/yoffer.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] sybase error
Hi all I have installed php 4.3.2 RC1 with the --with-sybase=/pathtomysysbase dir configure switch. I have had no installation problems but now when i go to load a page with the sybase_connect() function call in it i get the following error: Fatal error: Call to undefined function: sybase_connect() I take it this means that the sybase_connect function is not available but am wondering why this would be if i have used the --with-sybase configure option? I have also tried --with-sybase-ct and get the same problem. Thanks for any help in advance! __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Installation Problem
Hi Im trying to install php-4.3.1 as a dynamic module in apache-2.0.44 but are having problems. I install and compile both with no problems using the --with-apxs=pathto in the ./configure command for php. I can see that it has created the libphp4.so in pathtoapache/modules/ and i have added AddType application/x-httpd-php .php LoadModule php4_module modules/libphp4.so Into the httpd.conf file and copies php.ini-dist to /usr/local/lib/php.ini as well. I have done a apachectl configtest and restart and now when i try and load a php page i get a pop up box on my browser saying: 'The URL HTTP://pathtoserver/test.php has mime type application/x-httpd-php What do you want to do with it?' and i can either save or run it from that location. Does anyone know what i may be missing or where i have gone wrong? __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] module php4_module is already loaded
No i have searched my httpd.conf file and i dont. --- Marek Kilimajer <[EMAIL PROTECTED]> wrote: > You might have LoadModule libphp4.so somewhere > before where you added it > > bob pilly wrote: > > >Hello > > > >Recently i have installed apache 2.0.40-11 that > comes > >with Redhat 8.0 Linux, i have tried installing php > >4.2.2-8.0.7 with it but when i put the LoadModule > >php4_module modules/libphp4.so i get the following > >error when running apache. > > > >[warn] module php4_module is already loaded, > skipping > > > >And php isnt functional. Has anyone seen this > problem > >before? I have searched for an answer for it but so > >far havent found any reason why this is happening. > >Thanks for any help in advance! > > > > > >__ > >Do You Yahoo!? > >Everything you'll ever need on one web page > >from News and Sport to Email and Music Charts > >http://uk.my.yahoo.com > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] module php4_module is already loaded
Hello Recently i have installed apache 2.0.40-11 that comes with Redhat 8.0 Linux, i have tried installing php 4.2.2-8.0.7 with it but when i put the LoadModule php4_module modules/libphp4.so i get the following error when running apache. [warn] module php4_module is already loaded, skipping And php isnt functional. Has anyone seen this problem before? I have searched for an answer for it but so far havent found any reason why this is happening. Thanks for any help in advance! __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Failed php module load
Hello all Im trying to load php 4.2.3 as a dynamic module into apache server 2.0.43 but am running into problems. Everytime i run the configtest or try and start the apache server i get the following error. Cannot load /usr/lib/apache/libphp4.so into server: /usr/lib/apache/libphp4.so: undefined symbol: ap_block_alarms I have spent some time trying to find a solution to this problem and have seen on the help pages of php.net that it is to do with the apache DSO sharing. I followed the suggestion and recompiled apache with the --enable-shared=max --enable-rule=SHARED_CORE but this still doesnt make any difference. Has anyone else out there seen this problem and maybe know how to fix it? Thanks for any help in advance!! __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php