[PHP] Re: New to PHP, and stuck
Markus JäNtti wrote: I'm working myself through Julie C. Meloni's book PHP and now I'm stuck at chapter 12. My script gives me this error: You have an error in your SQL syntax near '()' at line 1 even tho I've even tried replacing my own work with the file from the book's companion-files. I'd be very happy if someone would take the time to look through this and tell me what the problem might be. Hard to move forward when I don't understand this. The $_POST array exists of keys and values. The keys are strings (in the case of $_POST), so you'll have to access them like strings. Use $_POST['table_name'] instead of $_POST[table_name]. The same goed also for $_POST[field_name], $_POST[field_type] and $_POST[field_length]. HTH Erwin ? //indicate the database you want to use $db_name =testDB; //connect to database $connection = mysql_connect(localhost,john,doe99) or die(mysql_error()); $db = mysql_select_db($db_name,$connection) or die(mysql_error()); //start creating the SQL statement $sql =CREATE TABLE $_POST[table_name] ((; //continue the SQL statement for each new field for ($i =0;$i count($_POST[field_name]);$i++){ $sql .= $_POST[field_name][$i]..$_POST[field_type][$i]; if ($_POST [field_length][$i] != ) { $sql .= (.$_POST [field_length][$i].),; } else { $sql .= ,; } } //clean up the end of the string $sql = substr($sql,0,-1); $sql .= ); //execute the query $result = mysql_query($sql,$connection) or die(mysql_error()); //get a good message for display upon success if ($result) { $msg =P.$_POST[table_name]. has been created!/P; } ? HTML HEAD TITLECreate a Database Table:Step 3/TITLE /HEAD BODY h1Adding table to ? echo $db_name; ?.../h1 ? echo $msg; ? /BODY /HTML -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Format Date
Dark Rotter wrote: Hi, When i print a date, the format of this date is: 8 nov 2001 0:00 (print ($array[date])) but i need print this: 08/11/2001 how i print this ? try print date( 'd/m/Y', strtotime( $array['date'] ) ); HTH Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Help w/ 4.2.3 Problem
Jack Sasportas wrote: I have been running 4.1.2 fine, but decided to compile in the latest version 4.2.3. When I run some existing code that works perfect under 4.1.2, not only does the code not run properly, but there are no error messages in the error_log ( apache file ). also in php.ini I added log_errors = On, and error_log = php_log, but I never see any error messages. Running on RedHat 7.2 with apache_1.3.27, mod_ssl-2.8.12-1.3.27, openssl-0.9.6g, php-4.2.3. ( Again this all ran fine with php-4.1.2 ). Any ideas on where to start ? Thanks Check the register_globals setting. As from php version 4.2.2, this setting defaults to Off, while older versions defaults to On. Grtz Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Cookie error after 4.2.3 upgrade
Jack Sasportas wrote: I get the following error when using a previously working cookie function: expects parameter 3 to be long Code is below... I just don't see the difference then the way the doc uses: time() - 3600 -vs- the way I did it below... Thanks ! function f_put_cookie($user_name,$user_email,$account_type,$company_name) { global $HTTP_COOKIE_VARS; global $s_c_url; $l_url = ..$s_c_url; $l_cookie_expireN = date('r', time() - 4000 ); $l_cookie_expire = date('r', time() + 400 ); $l_cookie_expire2 = date('r', time() + 400*30*12 ); time() - 3600 returns an integer. The date function returns a string. The function setcookie expects an integer (or long) as parameter 3. There's your problem, change your code to: $l_cookie_expireN = (int) date('r', time() - 4000 ); $l_cookie_expire = (int) date('r', time() + 400 ); $l_cookie_expire2 = (int) date('r', time() + 400*30*12 ); HTH Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Cookie error after 4.2.3 upgrade
change your code to: $l_cookie_expireN = (int) date('r', time() - 4000 ); $l_cookie_expire = (int) date('r', time() + 400 ); $l_cookie_expire2 = (int) date('r', time() + 400*30*12 ); No, that's even worse!! Try this: $l_cookie_expireN = time() - 4000; $l_cookie_expire = time() + 400; $l_cookie_expire2 = time() + 400*30*12; You're right of course, let's say that it was very early when I wrote that answer ;-)) Grtz Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] string to array
Tom Rogers wrote: Hi, Friday, November 8, 2002, 10:43:10 PM, you wrote: Hi all, has anyone an elegant (and faster) way of converting 'string' to array('s','t','r','i','n','g'), other then for($i=0; $istrlen($string); $i++) $array[$i]=$string[$i]; A string is already an array of chars $string = 'string'; echo $string[0]; // will echo 's' True, but that's different than the array type. Sometimes you'll just need an array instead of a string. Try using $string = explode( '', 'string' ); Grtz Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] string to array
$string = explode( '', 'string' ); Timothy Hitchens wrote: That won't work.. empty delimiter errors always.. Your right, I didn't know. you will have to use my preg one from earlier... But your preg thingy will only split at spaces, so that'll have to change to ? $string = 'test'; preg_split('//', $string, -1, PREG_SPLIT_NO_EMPTY); ? in this case, right? Grtz Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Image from MIME email
Christoph wrote: Hello, I'm currently programming a webmail interface with php 4.1.2 and c-client 2001. I'm getting the Mime data from the mail. Now I have the image data as text but how I can get it into an img field? At first, you'll have to convert the data back to binary using the encoding specified in the header (of that MIME part). Then you'll have to save the image to the disk (or to a database), after which you can use the img tag. Be sure to give the filename the correct extension (which you can gain using the content-type, also specified in the header of that MIME-part). Grtz Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: inserting preexisting image inside dynamic image
Eric Pierce wrote: Hi there... Just wondering... when creating a dynamic image, is there a way/fuction to insert an existing image using x,y coordiantes for precision? Yes, there is...use imagecopy (http://www.php.net/imagecopy) Grtz Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Dumb POST Array question
David Russell wrote: Hi all, I have a multiple select called Consultants[] In one page. On the target page, how would I reference it? Would it be: $_POST['Consultants'][0] $_POST['Consultants'][1] Etc Since $_POST['Consultants'] contains an array, you can indeed use the above syntax. Grtz Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: can't pass complete URL (part of the query string) from one script to another --??
Nicole Lallande wrote: Gretings: I want to pass a URL query string to another php script. I am able to pass the complete query string with all the variables I want through to the javascript function call but then the string gets cut in the php script: in the shopping cart: a href=javascript: openWin('email.php?ref=?php echo $pageURL; ')this page/a where 'ref' is set correctly and $pageURL is returned as 'http://mydomain.com/shop.php?val1=1val2=2val3=3' (this shows up on my status bar and I can 'echo' it on the shopping cart page - so Iknow it is getting captured correctly -- also - I removed the javascript and saw it get passet in the url as a 'get' correctly.) but in the email script I try to display 'ref' and what I get is: 'http://mydomain.com/shop.php?val1=1' -- everything past the first '' gets cut off (ie, I lose the 'val2=2val3=3' portion of the query string ) Use a href=javascript: openWin('email.php?ref=?=urlencode($pageURL);?')this page/a HTH Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: using mbstring without having /configure'd it
Oliver Spiesshofer wrote: Hi, Is it possible to use mbstring after setting the necessary values in ini_set() or htaccess without having it enabled during /configure? Nope...the functions of mb are unknown, because you didn't compile them. Grtz Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: amp; in Query String
Derick Rethans wrote: Jonathan Rosenberg wrote: I have a page with thumbnail pictures that can be clicked on to see a larger picture. Each picture is hyperlinked as follows a HREF=show_pic.php?pic=blahcaption=Some+Text I access the 'pic' 'caption' attributes with $_GET['pic'], etc. Pretty standard stuff. I have PHP set up so that error messages get mailed to a specified mail account. Every so often I get the following error message: Undefined index: caption In file /home//show_pic.php, line 64 page: /show_pic.php?pic=gb3.jpgamp;caption=Some+Text The problem is obviously (I think) that the $_GET['caption'] is failing. True, if you receive amp;caption in your URL, then the variable won't be called $_GET['caption'], but $_GET['amp;caption'], which (I think) is invalid because of the ;. What I can't figure out is why the '' got turned into 'amp;'. Is a browser doing this? Yes it is. No, it isn't. I sure hope there is no browser which turns in amp; in URL's. That would be very, very bad indeed! Actually, you should specify the URL with the amp; yourself, like this: a HREF=show_pic.php?pic=blahamp;caption=Some+Text Of course not...this is a HREF tag, which can use instead of amp;. amp; is for displaying purposes only, not for URL's. Following the tip from Marek, adjust your errormessage mailing thingy...add all the $_GET variables to it (print_r($_GET)). Some other notices maybe usefull to... Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Starting an application on web server
Nic Fordham wrote: Hi there, I am hosting a server running castle wolfenstein for a few friends of mine want to make a web page to run on the same server that they can log in to to stop start the game when they want. I have tried putting the following code in a web page - ? exec ('f:\wolf\wolfmp.exe +set dedicated 2 +map mp_beach +set sv_maxclients 8 ') This creates a process on my server as of wolfmp.exe but I cannot see it on my lan they can't see it over the web. Probably it failed? Or is requesting some more information? I also don't get any visual output on the server of the wolfmp.exe starting up the game console. Don't you get any visual output if you use passthru instead of exec??? Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: amp; in Query String
I'll let you know what turns up (of course, the problem will stop occurring once I add this info :-). As it always does ;-)) Grtz Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Strange comparison behaviour
Hi All, Can anyone explain me why the following code: if (info == 0) echo is 0\n; else echo not 0\n; Results in: not 0 Whereas: if (inf == 0) echo is 0\n; else echo not 0\n; Results in: is 0 Notice the difference: info in the first sample, inf in the second sample. The used PHP version is PHP 4.1.2 (CLI version) Erwin Kerk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Strange comparison behaviour
Bogdan Stancescu wrote: You probably mis-typed something: [EMAIL PROTECTED] ~]$ php ? if (info == 0) echo is 0\n; else echo not 0\n; ? Content-type: text/html X-Powered-By: PHP/4.3.11 is 0 Tried that, but notice the PHP Version, it is failing in PHP 4.1.2! Erwin Kerk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it Possible?
Sagar C Nannapaneni wrote: I'm calling a php script with img tag for ex: img src=http://localhost/test.php?img=asfd; and the test.php is as follows... test.php ? ... ... some server side validations ... readfile(abcd.gif); ? --- Theres no problem with this..its working fine. But i want to return some text(or Html) the browser along with the image. So is there anyway that i can send the text to the browser in this fashion. Even anyother solution other than the img is also Ok. Showing img is not a priority for me but sending the text is.. Any help will be greatly appreciated.. Thanks, /sagar I guess you're trying to get some data from the server after the page load (problably by javascript), so this might be of help: http://www.scss.com.au/family/andrew/webdesign/xmlhttprequest/ Erwin Kerk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image and PHP
Mario de Frutos Dieguez wrote: Petar Nedyalkov escribió: On Thursday 14 April 2005 10:06, Mario de Frutos Dieguez wrote: I have a page where i place an image but i want when i show the image delete it. How can i do this? You want to delete it from the clients machine or what? -- Mario de Frutos Dieguez División de Ingeniería del Software y Comunicaciones CARTIF -Parque Tecnológico Boecillo Sorry, i want delete it from the server side. I put the images in a directory in the server. Try a wrapper script, that first outputs the image data, and then removes the file. somethinglike: img src=script_that_show_image_and_deletes_it.php?image=ladieda.jpg / Erwin Kerk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regular expressions
pete M wrote: I've been messing about with this for a while to no avail.. so help would be appreciates I'm new to regular expressions and tried this with preg_replace, now I'm using eregi_replace ! here's the text $txt = 'span style=font-size: 10pt; font-family: Times New Roman;Itbr / blahh blahhh blahhh ofbr / /span'; what I want to do it take the font-size and font-family attributes out so style=font-size: 10pt; font-family: Times New Roman; beomes style= and the php $pattern = 'font-size:*\;'; $txt = eregi_replace($replace,'',$txt); $pattern = 'font-family:*\;'; $txt = eregi_replace($replace,'',$txt); What I'm trying to do is match the font-size: and replace everything up to the ; with '' ie nothing dont work Feel I'm so close ;-( tia Pete Try this: $pattern = 'font\-size:.*?\;'; Erwin Kerk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regular expressions
pete M wrote: The pattern $pattern = 'font\-size:.*?\;'; throwns the error eregi_replace(): REG_BADRPT Well, this should work (tested and all ) $pattern=|font\-size:.*?;|si; $txt = preg_replace( $pattern, , $txt ); Erwin -- mail : [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED] msn: [EMAIL PROTECTED] jabber : [EMAIL PROTECTED] skype : erwinkerk hello : vlits -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] is it possible to have the following URL?
This should work: https://url_locaion.org/prev_page.php?SID=$SIDuid=$uidELEM_ID=$id#tag Erwin Susan Ator wrote: I am passing 3 pieces of information on every URL. For example: https://url_location.org/page.php?SID=$SIDuid=$uidELEM_ID=$id I need to be able to return to a previous page using an anchor tag like so: https://url_locaion.org/prev_page.php#tag?SID=$SIDuid=$uidELEM_ID=$id So far it doesn't work at all. Is this even possible? Just using the javascript:history.go(-1) doesn't work in every browser. susan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] using a php variable in javascript
have you tried: so = window.open('','? echo $callerWin; ?'); ?? Erwin Kerk Web Developer Rich Fox wrote: I have a page with the following code: ? $callerWin = $_POST['CallerWin']; ? html body script type=text/javascript !-- so = window.open('','CompanyEdit'); so.location.reload(); window.close(); // -- /script /body /html I have 'CompanyEdit' hardcoded, but what I want instead is something like: so = window.open('','$callerWin'); This does not work, of course, but you get the idea: I want to use the value of the $callerWin php variable in my javascript. Can someone tell me the syntax for this? My reading of the documentation and trial-and-error have not met with success. thanks, Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: how to test string to see if it is a date or time?
Try this (as found on php.net) $str = 'Not Good'; if (($timestamp = strtotime($str)) === -1) { echo The string ($str) is bogus; } else { echo $str == . date('l dS of F Y h:i:s A',$timestamp); } Erwin Kerk Web Developer @ BliXem.nl Jason Wong wrote: On Tuesday 25 March 2003 00:39, DomIntCom wrote: can anybody help me out with this? I have figured out checkdate finally, but still have nothing that will help me with time validation. explode() on the time delimiter (probably colon) check that hour is 1-12 (or 0-23) check that minute is 0-59 check that second is 0-59 -- ____ | __|_ ___ __ _(_)_ _ | _|| '_\ V V / | ' \ @blixem.nl (work) |___|_| \_/\_/|_|_||_|@scoutingnederland.nl (private) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Apache SetHandler
Zoff wrote: Hi Guys! ich have a question with apache and mod_perl I can write a Handler in perl which is called before anything else happens. this allows me to write all sorts of auth stuff. is there something similar in PHP. There is a topic in the php manual which describes something similar. check: http://www.php.net/manual/en/features.file-upload.put-method.php Maybe something is similar is possible for POST, and for GET your could use a rewrite rule in the httpd.conf file Erwin Kerk Web Architect -- ____ | __|_ ___ __ _(_)_ _ | _|| '_\ V V / | ' \ @blixem.nl (work) |___|_| \_/\_/|_|_||_|@scoutingnederland.nl (private) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: creating and ftp text file
- Original Message - From: Petre Agenbag [EMAIL PROTECTED] To: Erwin [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, November 05, 2002 8:24 PM Subject: Re: [PHP] Re: creating and ftp text file Hi Erwin OK, my first problem: your code genrates errors, it says fwrite and fclose are invalid file descriptors. Errors or warnings? Probably the fopen function failes... Add the following code: ? $fp = fopen( 'ftp://ftp.domain.com/file.txt', 'w' ); if ( !$fp ) die( Cannot open file\n ); ? You can then see if the fopen failes. If it does, then check the rights for this user at the FTP Server. I gathered thatit is possibly because thos are for normal files, so I looked in the manual and found the FTP-functions, but it takes a $local_file variable, and that must be the name of the local file on disk, so I cannot simply put $content in there... That's true for the FTP functions indeed, but you CAN use the normal file function to...take a look at fopen in the manual. You can take a look at example 1. Any ideas on how to directly stream the variable to the ftp site? The only possibility to do this, is using fopen. If you can't use fopen for some reason (i.e. don't give anonymous users write access to your FTP Server), then you have to use the FTP functions: ? $query = 'select number from table where group=1'; $result = mysql_query( $query ); $content = ''; while ( $res = mysql_fetch_array( $result ) ) { $content .= 'Cellphone: ' . $res['number'] . \n; } $content .= 'Reference: ' . $reference . \n; $content .= 'Notify: ' . $notify . \n; $name = tempnam( /tmp, ); $fp = fopen( $name, w ); fwrite( $fp, $content ); fclose( $fp ); $ftp = ftp_connect( ftp.domain.com ); ftp_login( $ftp, username, password ); ftp_put( $ftp, filename, $name, FTP_ASCII ); unlink( $name ); ? For this to work, you'll have to compile PHP with the --with-ftp directive!!! But again, I'm pretty sure the first possibility should work also. Regards, Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and Intranets
Colin Eldridge wrote: Question: Is there a simple way for PHP to identify which host a form has come from? Do the hosts have fixed ip's? If Yes, you could use $_SERVER[REMOTE_ADDR] do identify them... Erwin Kerk Web Developer E: [EMAIL PROTECTED] W: www.blixem.nl -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP IDE?
Jough Jeaux wrote: Was wondering what everyone's favortie IDE is for coding in PHP. I've got a big PHP project in the works. I'll be doing alot with it and am looking for ways to boost my productivity. --Jough __ Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing. http://photos.yahoo.com/ I use HTML-kit all the time. Has a built-in ftp client, lots of plugins available, in-program previews (via local webserver), and much more. http://www.htmlkit.com Erwin Kerk Web Developer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Apache/IE hangs with PHP
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Vincent Bouret wrote: | Hi, | | I have this strange problem. I have Apache 1.3.28 on Windows XP Home SP1 | with PHP 4.3.4 as a module: | | httpd.conf | LoadModule php4_module c:/php/sapi/php4apache.dll | AddType application/x-httpd-php .php | AddType application/x-httpd-php .phtml | | //After a list of modules | AddModule mod_php4.c | | Let's say I have test.php that does nothing more than sleeping for 30 | seconds: | ?php | sleep(30); | ? | html | content | /html | | When I open up this script in IE with http://localhost/test.php and within | the 30 seconds sleep I try to load another file with .php extension | (regardless of whether there are some php statements or not in the file) on | the same localhost server with another IE window, IE or Apache hangs until | the first script is done and then gives output of the second script. | | The thing is that when I connect to Apache manually with Telnet during the | same 30 seconds and I request a PHP script, I get the answer immediately. | Thanks for your help, | Vincent | I suspect it has something to do with session handling. Check your ini settings for a session_autostart or something. Normal behavior for jultiple windows (or frames) and sessions, is that they wait for each other to close (not destrow, close) the session. See http://www.php.net/manual/en/function.session-write-close.php for more information. Godd luck with this one. Erwin Kerk Web Developer -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.4 (MingW32) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFAPfIW4rV3/oG+84URAizzAJ4+OpLSfMnA0J4tKl0NSdDprfvrtQCgvcc2 F2l+E0q/e0HpOwW5ecBAxUk= =sPMG -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Weird result from query...?
Ryan A wrote: which runs the sql in show_accounts.php: SELECT *,now()-0 from .$tcname. where oorder='.$o.' and nname='.$n.' and total='$p' Try this: which runs the sql in show_accounts.php: SELECT *,now()-0 from .$tcname. where oorder='.$o.' and nname='.$n.' and total=$p without the single quotes around $p Erwin Kerk Web Developer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Weird result from query...?
Daniel Clark wrote: p=4.78 I wonder if a dot is a valid character for a URL adderss? Yup. Just tried it, it works. Erwin Kerk Web Developer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] resubmitting $POST data to another script
Chris Shiflett wrote: It loses all new data: input type=hidden name=post value=?php echo htmlspecialchars(serialize($_POST)); ? / input type=text name=this_will_be_lost / Because of this: $_POST = unserialize(stripslashes($_POST['post'])); I think array_merge will fix this: $_POST = array_merge($_POST,unserialize(stripslashes($_POST['post']))); Erwin Kerk Web Developer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question in posting form-data
Yao, Minghua wrote: Hi, all, I am testing how to post form-data to a host using the following code (test.php): ?php function PostToHost($host, $path, $name, $value) { // Test of posting form-data $fp = fsockopen($host,80); fputs($fp, POST $path HTTP/1.1\n); fputs($fp, Host: $host\n); fputs($fp, Content-Type: multipart/form-data\n); fputs($fp, content-disposition: form-data; name=$name\n); fputs($fp, Connection: close\n\n); fputs($fp, $value\n); $res = ; while(!feof($fp)) { $res .= fgets($fp, 128); } fclose($fp); return $res; } Check your function carefully. Where are you using the $name of the value? Nowhere! Therefore the receiving script cannot identify the value as x. Try: fputs($fp, $name=$value\n); Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Website and Mozilla/Firefox
M. Sokolewicz wrote: M. Sokolewicz wrote: Lester Caine wrote: John Holmes wrote: I switched from using the us2.php.net mirror to the us4.php.net mirror and things were fine. That has been 'knobled' now. At least now I know I'm not going mad ;) it's because of an issue with the JS scripts. Just have to wait and see if anyone gets to fixing it. Just turning off Javascript when visiting the manual works fine. The reason us4. work(s|ed) is because it's not up-to-date (yet) turning automatic search completion off via my.php.net works aswell (but to get there you also need to turn off JS) Seems to be solved... Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] question about a cron job
Al wrote: I've got a question about the following cronjob. #At 3:01 our time, run backups 1 0 * * * /usr/local/bin/php /www/r/rester/htdocs/auto_backup/back_em_up.php /www/r/rester/htdocs/auto_backup/cron.log 21 #At 3:02 clean up sessions folder 2 0 * * * (find /www/r/rester/htdocs/sessions/ -name 'sess_*' -mtime +1 -delete) #this is only for testing a new cronjob, every minute * * * * * /usr/local/bin/php /www/r/rester/htdocs/phpList_cronjob/process_cronjob.php /www/r/rester/htdocs/phpList_cronjob/cron.log 21 The new one doesn't seem to want to run until after 3:01 or 3:02. Shouldn't the sever just run it every minute? And, the every minute job doesn't add anything to its log file. Apache on a virtual host. The 3:01 and 3:02 jobs have been running fine for months. Thanks The CRON daemon only refreshes it's job list after a job in the current list is completed. Therefore, the CRON daemon won't notice the every-minute job until 3.01 pm. Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Name of CRON visualiser script
Hi All, I've seen a script somewhere which accepts a crontab file for input, and then displays all jobs in a calendar-like screen. However, I forgot the name. Searching Google didn't help me either. Does anyone know the name (and if possible, an url) of this script? Thanks in advance, Erwin Kerk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php4 and php5 on the same apache server
Jacob Friis Larsen wrote: How can I run both php4 and php5 on the same apache server? Could I do it like this: AddType application/x-httpd-php .php AddType application/x-httpd-php5 .php5 And somehow tell php5 to use application/x-httpd-php5 The approach I use is as follows: On port 80 I run an Apache instance with PHP4 On port 81 I run an Apache instance with PHP5 Via an Apache rewriterule I rewrite all .php5 calls to the other webserver (by proxy), and therefore transparent. Like this (not sure, dont have the config at hand right now): RewriteEngine On RewriteRule (.*)\.php5$ http://%{HTTP_HOST}:81$1.php Erwin Kerk Webdeveloper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Destructor not called when extending SimpleXMLElement
Interesting problem. I would expect it to work too. I assume it is a bug. 2012/7/2 Nick Chalk n...@loadbalancer.org Afternoon all. I seem to be having a little trouble with extending the SimpleXMLElement class. I would like to add a destructor to the subclass, but am finding that it is not called. Attached is a minimal demonstration of the problem. The XMLConfig class extends SimpleXMLElement, and its destructor is not called. The XMLConfig2 class, which does not use inheritance, does have its destructor called. The test platform is CentOS 6.2, with PHP version 5.3.3. What am I missing? Thanks for your help. Nick. -- Nick Chalk. Loadbalancer.org Ltd. Phone: +44 (0)870 443 8779 http://www.loadbalancer.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Way to test if variable contains valid date
Or you could use a regular expression: $probe = '2000-01-01'; $found = preg_match('/(19|20)\d\d[- \.](0[1-9]|1[012])[- \.](0[1-9]|[12][0-9]|3[01])/', $probe); var_dump($found==1); Erwin 2012/7/3 shiplu shiplu@gmail.com I want to thank you, Daniel, for this help. - I was looking for an isarray type function There is no such function or facility in php. However you can check date in string by DateTime object also try { $date = new DateTime('2000-01-01'); } catch (Exception $e) { echo $e-getMessage(); exit(1); } Check php.net/datetime.construct -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader
Re: [PHP] Is this list less busy than it used to be?
Well, I think you are right. Take a look at this graph of the number of messages posted starting in 1998. The stackoverflow.org effect? messages - https://docs.google.com/spreadsheet/ccc?key=0Ak1QF0ijPYbedDNvb19SQl80MHcxUWhhbTZOYm5FUlE Erwin 2012/7/4 RGraph.net support supp...@rgraph.net Hi, Is this list less busy than it used to be? Or is it just me? When I used to be on this list ISTR sometimes being overwhelmed by email. Cheers -- Richard, RGraph.net support RGraph: JavaScript charts for your website http://www.rgraph.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Apache+PHP+DSO: maybe trivial (?): apxs doesn't create libphp4.so under AIX 4.3.3
Hi php4-Installers, what reason might cause the subject above ? We have installed (and working well): o gcc version 2.95.3 20010315 (release) o perl, version 5.003 with EMBED built under aix o OpenSSL 0.9.6 o mm-1.1.3 o Apache-1.3.23 configured with: time CC=gcc CFLAGS=-O ./configure \ --prefix=/pd/apache_1.3.23 \ --enable-module=rewrite \ --enable-shared=rewrite (with compiled-in modules mod_so.c - and mod_ssl.c ...) o mod_ssl-2.8.6-1.3.23 configured with: CC=gcc CFLAGS=-O ./configure \ --prefix=/pd/apache_1.3.23 \ --with-apache=/pd/apache_1.3.23 \ --with-ssl=/pd/openssl \ --with-mm=/pd/mm-1.1.3 \ --with-crt=/pd/openssl/certs/mail_cert.pem \ --enable-module=most \ --enable-module=ssl \ --enable-shared=rewrite o gmake - GNU Make version 3.79.1 built for powerpc-ibm-aix4.3.3.0 o php-4.1.1 configured as dynamic module (following verbose installation): time CC=gcc CFLAGS=-O ./configure \ --prefix=/pd/php-4.1.1 \ --with-apxs=/pd/apache_1.3.23/bin/apxs ... done well: ++ |*** WARNING *** | | You chose to compile PHP with the built-in MySQL support. If you | are compiling a server module, and intend to use other server | modules that also use MySQL (e.g, mod_auth_mysql, PHP 3.0, | mod_perl) you must NOT rely on PHP's built-in MySQL support, and | instead build it with your local MySQL support files, by adding | --with-mysql=/path/to/mysql to your configure line. ++ | License: | This software is subject to the PHP License, available in this | distribution in the file LICENSE. By continuing this installation | process, you are bound by the terms of this license agreement. | If you do not agree with the terms of this license, you must abort | the installation process at this point. ++ Thank you for using PHP. real29m48.27s (!) user1m6.67s sys 4m10.69s o gmake ... ok o gmake install ... ending with: . . . Making install in . gmake[1]: Entering directory `/appl/pd/php-4.1.1' /pd/apache_1.3.23/bin/apxs -i -a -n php4 libs/libphp4.so [activating module `php4' in /pd/apache_1.3.23/conf/httpd.conf] cp libs/libphp4.so /pd/apache_1.3.23/libexec/libphp4.so cp: libs/libphp4.so: No such file or directory apxs:Break: Command failed with rc=1 gmake[1]: *** [install-sapi] Error 1 gmake[1]: Leaving directory `/appl/pd/php-4.1.1' gmake: *** [install-recursive] Error 1 root@mail:/pd/php-4.1.1# So, no libphp4.so on the system. Considering we have the products (in most cases the up-to-date versions) it must be some obvious problem - but I have no idea. Thanks for help in advance, Erwin -- Dipl.-Ing. Erwin SRUBAR Zentraler Informatikdienst, Bereich ,,Zentrale Services`` Technische Universitaet Wien, Wiedner Hauptstrasse 8-10 Turm C (Roter Trakt), 2.Stk., Zi.DC02O08 A-1040 Wien, OeSTERREICH Mail:[EMAIL PROTECTED] Tel: (++43 1) 588-01/42084, Fax: (++43 1) 588-01/42099 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php