Re: [PHP] Read directory; store filenames found in mySQL table?
Ashley Sheridan wrote: On Wed, 2010-01-13 at 09:25 -0500, Rahul S. Johari wrote: Ave, This is what I'm trying to do; I want to read a directory (eg: W:\Test \) and take all the filenames found in the directory (eg: 1.vox, 2.wav, 3.txt) and store them in a simple mySQL table. Can I do this? --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] sleepwal...@rahulsjohari.com [Web] http://www.rahulsjohari.com You'll probably want to look at the readdir() function. The manual page also has dozens of different example scripts that would be easy to tweak for your purpose. http://php.net/manual/en/function.readdir.php Thanks, Ash http://www.ashleysheridan.co.uk I use the glob function in my little homemade web cam page, which can really swell up in memory when used against a large amount of files (in my case around 30k files). = $imgdir = 'img/south*'; $files = glob( $imgdir ); // Sort files by modified time, latest to earliest // Use SORT_ASC in place of SORT_DESC for earliest to latest array_multisort( array_map( 'filemtime', $files ), SORT_NUMERIC, SORT_DESC, $files ); = http://www.php.net/manual/en/function.glob.php DISCLAIMER: I found this code on a how-to somewhere out there and modified it to fit my need. Quite possibly there are much better means to this end. Ken Sande/KC8QNI -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Upgraded PHP now website doesn't work properly?
Ashley Sheridan wrote: On Mon, 2010-01-11 at 02:52 +0200, Kaya Saman wrote: Hi, I am hoping someone can help me?? I currently run Fedora 11 on an Apple PowerMac G4 and recently performed an upgrade to it which rendered my site completely unsee able for a while but then after re-saving it showed up through my browsers however my menu bar was slightly altered probably due to lack of formatting. Apache error logs claim this: [Sun Jan 10 23:06:23 2010] [error] [client 192.168.1.110] PHP Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/optiplex-networks/links.php on line 20, referer: http://co111w.col111.mail.live.com/mail/InboxLight.aspx?n=454360575 I have attempted to enable PHP debugging but nothing is being shown! To give an idea of where things are going wrong this is the start of the file: ?php # Script 3.4 - index.php // Set the page title and include the HTML header. $page_title = 'Optiplex Networks'; include ('./header.inc'); ? ?php ini_set('display_errors',1); error_reporting(E_ALL|E_STRICT); echo ' table width=100% align=center border=0 bgcolor=#CC trtd align=centerfont size=4strongContributors to Optiplex Networks:/strong/font/td/tr /table pIf it weren't for these projects Optiplex Networks would not have happened. My thanks and regards to everyone involved!/p table width=95% border=1 align=center tr td width=15%div align=center class=style2strongName/strong/div/td td width=20%div align=center class=style2strongAddress/strong/div/td td width=*div align=center class=style2strongDescription/strong/div/td /tr Line 20 is the line beginning with pIf it weren't for... I don't understand why this should be an error as it's basic html! The only php part I have used is just echoing the html out. As shown the echo ' is closed off at the bottom of the file with: '; ? which is fine according the book I read about php. Obviously something is wrong but I can't figure it out, if anyone can give me a hand I'd very much appreciate it! Many thanks, Kaya The main issue I can see is that the single quote string delimiter that you're using is also being used in the HTML text! Have you considered using heredoc syntax instead? echo OUTPUT your html goes here OUTPUT; The only thing to watch out for here is that the OUTPUT; line is all on it's own, and is preceeded with no whitespace at all. Also, the word OUTPUT in this example can be whatever you feel like. The main advantage ti heredoc is that you can use any quote characters you like within the text and you can output any PHP variables in the text also as if you had a double quoted string. Thanks, Ash http://www.ashleysheridan.co.uk Yup, and the single quote shows up right in this line: pIf it weren't for these projects Optiplex Networks would not have Ken Sande/KC8QNI -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] getting base domain and sub domains from url?
Hello all, I am trying to extract base domains and sub domains from url's, and expect there to exist something to do this already. I used the parse_url($url) to get the host variable. My thought is to use $domain_elements[]=array_reverse(explode('.',$url)); then simply check $domain_element[0] against some base of international+country specific extensions, if they have sub-extensions like co.uk then add a third level to the domain list , and set this up as base domain. Any levels beyond the registrable domain names would count as sub domains. What I would like to know is if there are some lists of all these base domains, or maybe some function already doing what I would like to do? In advance, thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] getting base domain and sub domains from url?
Thank you, Stut, It gives the top level ones, but I can't seem to find the lower specifications covering such as .co.uk .com.mx etc. I am also starting to realize some countries may two levels of top domains - in Norway for example you may get a .no domain, but there may also be lower level top domains such as .mil.no. I am not sure if there exists any general list for what I originally looked for, but then again, then again, I am just realizing the specs I looked at in fact does not require it this specific after all. If there should be such a list somewhere I am still interested, but the link you gave me is good enough for what I needed it for. Again thank you! Stut wrote: Kenneth Andresen wrote: What I would like to know is if there are some lists of all these base domains, or maybe some function already doing what I would like to do? A full list of gTLDs and ccTLDs can be found here: http://www.iana.org/domain-names.htm -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Problems getting the nodeName with DomDocument
Thanks Rob, that solved the problem for me! Rob Richards wrote: Kenneth Andresen wrote: I am having problems with the following functions where my return simply is #text Joe #text Smith #text unknown, it should have read firstname Joe lastname Smith address unknown What am I doing wrong? You're trying to access the name of the Text node which is always #text and not it's parent element. $name = $elem-parentNode-nodeName; Rob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problems getting the nodeName with DomDocument
I am having problems with the following functions where my return simply is #text Joe #text Smith #text unknown, it should have read firstname Joe lastname Smith address unknown What am I doing wrong? ?php $xmlstring = elementfirstnameJoe/firstnamelastnameSmith/lastnameaddressunknown/address/element; $domdoc = new DomDocument(); $domdoc-loadXML($xmlstring); $domroot = $domdoc-documentElement; function process_children($node) { $children = $node-childNodes; foreach ($children as $elem) { if ($elem-nodeType == XML_TEXT_NODE) { if (strlen(trim($elem-nodeValue))) { $name = $elem-nodeName ; $res = mb_convert_encoding(trim($elem-nodeValue), 'html', 'utf-8'); echo $name $res \n; } } else if ($elem-nodeType == XML_ELEMENT_NODE) { process_children($elem); } } } process_children($domroot); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] utf-8 in mysql but not outputting as utf-8 on web
Hello, why not simply convert the text to html mb_convert_encoding($string, 'html', 'utf-8'); Best regards, Kenneth jonathan wrote: I'm inserting some info into a mysql table which has the charset set to utf-8. When I do a select via the command-line from mysql, it looks like this: Clams and mussels with Dijon-crème fraîche-saffron sauce assuming this is coming out in your email client ok, it should look good. On a web page, I set the charset to utf-8 via: header(Content-type: text/html; encoding: UTF-8); as the top-line I then do a select for this field and it outputs like this in the browser: Clams and mussels with Dijon-crème fraîche-saffron sauce I'm familiar with html encoding. As this is going to go to XML, I wanted to see if I could keep it in the native format. Am I doing something wrong on the web side why I won't display this correctly? Is there some Apache config I need to be aware of? thanks, jonathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[3]: [PHP] utf-8 in mysql but not outputting as utf-8 on web
Hello Jonathan, You probably don't have php5 compiled with mbstrings enabled, if you have complied php5 with iconv instead you can try iconv('utf-8' , 'html', $string); I don't know what to recommend if you don't have any of these complied into php5. Best regards, Kenneth -- jonathan wrote: thanks, never used this function. the weird thing is that it's throwing a fatal error saying mb_convert_encoding is undefined. I'm running 5.0.4. h. Fatal error: Call to undefined function: mb_convert_encoding() in / home/arclocal/public_html/preview/Inc/menu.class.php on line 1563 On Dec 22, 2005, at 7:08 PM, Kenneth Andresen wrote: Hello, why not simply convert the text to html mb_convert_encoding($string, 'html', 'utf-8'); Best regards, Kenneth jonathan wrote: I'm inserting some info into a mysql table which has the charset set to utf-8. When I do a select via the command-line from mysql, it looks like this: Clams and mussels with Dijon-crème fraîche-saffron sauce assuming this is coming out in your email client ok, it should look good. On a web page, I set the charset to utf-8 via: header(Content-type: text/html; encoding: UTF-8); as the top-line I then do a select for this field and it outputs like this in the browser: Clams and mussels with Dijon-crème fraîche-saffron sauce I'm familiar with html encoding. As this is going to go to XML, I wanted to see if I could keep it in the native format. Am I doing something wrong on the web side why I won't display this correctly? Is there some Apache config I need to be aware of? thanks, jonathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Curl Content-Encoding header?
Hello all, I have been trying to get the Content-Encoding header from Curl, but have yet to manage. Using curl from command line I have no problems simply using: curl --compress page_to_get -o local_page_copy -D dumpheader.txt The data gets compressed and uncompressed also in PHP, I am just looking for a way to capture whether the compression was used or not, and in case it was used, what Content-Encoding was used. I would be happy for a tip to simply get the full response header too ;) In advance thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] OS/PHP Picnic -- Wilmington, NC
Hello all, I'm organizing an OS [Open Source]/PHP Picnic in Wilmington for the weekend of July 3rd and 4th. I've about fifteen people who have shown interest already, hoping to get at least thirty, sixty would be optimal. Plans include brief sessions (~30 minutes) about various OS/PHP topics and/or project summaries, case studies, etc etc by volunteer speakers (please contact me if you'd like to speak). Food and entertainment will be free (as in *free*) both days. Further details (and interest form) are available at http://picnic.archshadow.com Feel free to e-mail me if you have any questions/comments/etc. Thanks! Kenneth Schwartz -- [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Search MySQL and Match Whole Words
On 04-04-22 19:48 -0400, Matt Palermo wrote: That will work if there is only one word in the column I'm searching, but the columns I'm searching are in paragraph form, so the = will not work there if I want to just match one word from the whole paragraph... http://dev.mysql.com/doc/mysql/en/Regexp.html [[::]] [[::]] These markers stand for word boundaries. They match the beginning and end of words, respectively. A word is a sequence of word characters that is not preceded by or followed by word characters. A word character is an alphanumeric character in the alnum class or an underscore (_). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] how to convert array into integer
To all, I have an Array ( [0] = 2 [1] = . [2] = 2 [3] = 0 [4] = 8 ) but i want to convert it into integer 2.208 in order to use it to plot graphhow can i convert it? thx, Kenneth -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] getting message from file
My data file is sth like: 2.208 2.18 2.415 2.283 2.234 2.155 2.389 2.201 2.204 2.181 2.43 2.285 2.231 2.164 2.387 2.197 2.2 2.179 2.429 2.29 2.225 2.181 2.385 2.195 2.196 2.178 2.424 2.291 2.225 2.213 2.386 2.19 I would like to get these data in order to plot graph. I've tried to use fgets() and then convert them from string back into array...but it seems doesn't work~ Thanks, Kenneth Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Monday 08 March 2004 09:04, Kenneth wrote: I have a problem on getting content from a data file (data.txt). I have many numbers in the file...all of them are about 2.XXX, and I need them to plot a graph. What does your data file look like? Show a few sample lines. But I just can't read them out as a integer. What code did you use? -- 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 -- /* Have you lived here all your life? Oh, twice that long. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP support C++?
Hi all, Does PHP support C++ language? If yes, how can it be converted? The case is, I've use C++ to make a function (to get data from file and convert it from char type to int type), how can i import the function/variables and use it in PHP? Thanks, Kenneth -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Image creation
Dear all, Thanks Kilimajer's help and I can finally build-in the GD library. But when i use the imagecreate function for jpeg, don't know why there are some unknown wordings appears. Sth like the following: 1oACEEEO¡ÑOUUaaceeeno Don't know what's happening, I just use simple function (e.g. Imagecreate,Imagejpeg) to test it. Thx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] getting message from file
Dear All, I have a problem on getting content from a data file (data.txt). I have many numbers in the file...all of them are about 2.XXX, and I need them to plot a graph. But I just can't read them out as a integer. I've used C++ program to read them before, but i don't know how to import C++ program into PHP. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Image
Hi everyone, I would like to use the function 'image' in php~I know that I have to install GD before using itI've downloaded the zlib and lpng files...but how can I install them?? and may it ask for a simple testing function to test if the GD works? Thanks, Kenneth -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Image
To all, I have a problem on using the function image. I've downloaded the zlib and lpng files...but i don't know how to install them. Also, I've heard that for latter version PHP, there is already GD library, what i have to do is just to uncomment the linephp_gd2.dll, i've followed this but the image function still can't function. and I would like to ask how can i test if the GD lib works? may i ask for a simple function/program to check for that. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] function 'image'
dear all, I have a problem on using image function. I've download the zlib and lpng file as it was told, but i still can't use the image function. How can I install these files into php?? thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] about image
dear all, additional to the previous post, I was told that for later version of php, there is already GD with it, and what should i do is just uncomment the php_gd2.dll line...i've tried this also, but it still doesn't work, how can i solve this and use the function imagethanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Image
hello everyone, I've some question about using image function. I've followed the instruction and downloaded the zlib and libjepeg-6b, but how can i install them?? Some said that for new version of php, what i need to do is just uncommend the ini-file, but i just find it still doesn't work. Thanks, Kennneth -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Include files
How do I include external library files in PHP??? I would like to put the lines that are repeated in each php files, in a separate file. e.g. ?php $db_host = localhost; $db_port = 3306; $db_name = test; ... ? Kenneth -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] File handling
How do i delete all file in a directory??? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] File upload???
Hello everyone! =) Can anybody help me with file uploading with PHP??? i tried uploading a file through... form action=save_upload.php method=post input type=file name=userfile input type=submit /form but, in save_upload.php, there is no $HTTP_POST_VARS['userfile'], or $HTTP_POST_VARS['userfile_name'], etc... Can anybody help me with this... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File upload???
Can anybody help me with file uploading, again... I tried uploading a file through... form enctype=multipart/form-data action=project_save.php method=post input name=project_file type=file input type=submit value=ok /form but, on project_save.php, the $HTTP_POST_FILES[project_file][size] is zero(0) , and $HTTP_POST_FILES[project_file][tmp_name] is an empty string. i checked, $HTTP_POST_FILES[project_files][error] has a value of 2. What does error 2 mean??? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP 4.3.0 - Apache 2 Problem - Missing phpinfo() Info
phpinfo() on PHP Version 4.2.2 with Apache/1.3.24 has a block which called Apache Environment which does not appear in PHP 4.3.0/Apache2. This block of info has (in part): DOCUMENT_ROOT /usr/local/apache/htdocs_best-emts HTTP_ACCEPT image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, */* HTTP_ACCEPT_ENCODING gzip, deflate HTTP_ACCEPT_LANGUAGE en-us HTTP_CONNECTION Keep-Alive HTTP_COOKIE POSTNUKESID=af2005c09ffd2e5ceecf91eff96ee77d HTTP_HOST www.best-emts.com HTTP_REFERER http://www.best-emts.com/modules.php?op=modloadname=PostWrapfile=indexpag e=http://www.best-emts.com/emts/rosterByNumber.php HTTP_USER_AGENT Mozilla/4.0 (compatible; MSIE 6.0; Windows 98) PATH /usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/bin:/usr/local/java/b in:/bd/EMTS/bin:/usr/local/map/bin:/usr/local/mysql/bin REMOTE_ADDR 198.138.213.31 REMOTE_PORT 2010 SCRIPT_FILENAME /usr/local/apache/htdocs_best-emts/emts/rosterByNumber.php SERVER_ADDR 198.138.213.25 -- Some of the information does not seem to be available elsewhere. Is this an undocumented change? Is this a bug in my configuration? What, if anything, am I doing wrong? Thanks, Ken Kenneth Lerman[EMAIL PROTECTED] Systems Essentials Limited Fax: (203)426-9138 55 Main Street Voice: (203)426-4430 Newtown, CT 06470 http://se-ltd.com/~lerman -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] $_POST vars problem
I just changed my server to SSL, everything worked before that. now if I have a form with an input box (named searchstring for example) with a value of TEST, when that form is posted (submitted) I get the following: foreach($_POST as $key = $value) { echo [POST]Key: '$key'; Value: '$value'br\n; } will print: Key:'searchstring' ; Value: 'TESTsearchstring=TEST' can anyone tell me where the second searchstring=TEST is coming from? I have tried register globals on and off. [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_POST vars problem
I will try to shortly. The server in question is password protected and has lot of information I don;t need hacked into right now. I'll set up a limited short term account and post everything then. On another note, I have found that if I include (and use) the submit button everything works perfectly, HOWEVER if I just enter data and hit return then it messes up. That make no sence to me but maybe someone out there can put it together. thanks Chris Shiflett [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... --- Kenneth Brill [EMAIL PROTECTED] wrote: can anyone tell me where the second searchstring=TEST is coming from? I have tried register globals on and off. Can you also show us the HTML for your form on the previous page? The simplest test case that produces this problem would be best. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Getting https-page
I would just read up on the CURL functions and either use them or get CURL and use it externally. Chris Shiflett [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... --- Martin Thoma [EMAIL PROTECTED] wrote: How can I get an https-page? I have never tested this myself, but I found this page in the manual: http://www.php.net/manual/en/function.fsockopen.php It has this to say: As of PHP 4.3.0, if you have compiled in OpenSSL support, you may prefix the hostname with either 'ssl://' or 'tls://' to use an SSL or TLS client connection over TCP/IP to connect to the remote host. I'm sure you could use the openssl functions, but this sounds much easier. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] where's waldo
no no, i understand. really, what i was getting at, i guess was that this isn't really meant to be developed for mass distribution. more for a class. @ Edwin [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Well, I didn't really mean to imply anything about people's honesty and so forth... I just wanted to say that validating (anything) on the client side is not normally a good (and reliable) idea. Of course, as always mentioned, validation on the server side is always better. - E Kenneth Love [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... about the peeking at the code... yes, you could, unless the images were coded somehow. perhaps just numbers, not names. after a few tries they'd find waldo easily enough, but not at first. and besides. i'd like to give people credit for being more honest than that. @ Edwin [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... True. Perhaps. But, I think, you can actually do something like that WITH php. Say PHP+Flash or PHP+Javascript... Of course, if you're able to do something like this just by using PHP+Javascript (and HTML only), most probably, you can just take a peek at the code and find out where waldo is... ;) - E On Thursday, September 26, 2002 12:12 AM Marek Kilimajer wrote: This is for java, javascript, or flash, not much to do for php. Kenneth Love wrote: hi all. i'm interested in creating a php game that generates a page of random (ish) images, one of which is waldo (or the like). when the player clicks on waldo, they're taken to the next, slightly harder level. anyone think that sounds fun? any pointers, tips, advice, criticisms? -- -- http://kennethlove.onewingedangel.com -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] where's waldo
hi all. i'm interested in creating a php game that generates a page of random (ish) images, one of which is waldo (or the like). when the player clicks on waldo, they're taken to the next, slightly harder level. anyone think that sounds fun? any pointers, tips, advice, criticisms? -- -- http://kennethlove.onewingedangel.com -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] session garbage collection save path
So, it says in the manual that gc doesn't occur if the save path depth is more than 2. This is true in the manual at php.net, but not zend.com. I have tested this, and seems like there is no gc occurring if I DID have the save path elsewhere (i.e. where the directory depth is 2). Is there any way to change this (within a script, not php.ini - i have no rights to do that!) Thanks a bunch, Ken -- Kenneth Chau Web Developer http://www.gizzar.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: MySQL Query
Jason Whitaker wrote: OK, I need to know is there a place where i can find out how to pull information(TEXT) from a MySQL DB table and print where i place a variable in a php page? I have NO idea what your question is did you just want to echo something from your MySQL db table inside a PHP script? if so you'd just connect with a mysql_pconnect to your server, do a query, then do a fetch of some sort and the fetch probably will be read into an array Then you just do an echo on that array You can look at the mysql functions at phpnet for more details I'm sure Hope this helps - if not, please clarify your question! -- PHP General Mailing List (http://wwwphpnet/) To unsubscribe, visit: http://wwwphpnet/unsubphp
[PHP] Re: session garbage collection save path
STOOPID me !! I forgot to chmod the save path That's why it didn't work! bah! Let this be a lesson for all - chmod everything correctly :) Best regards! -Ken Kenneth Chau wrote: So, it says in the manual that gc doesn't occur if the save path depth is more than 2 This is true in the manual at phpnet, but not zendcom I have tested this, and seems like there is no gc occurring if I DID have the save path elsewhere (ie where the directory depth is 2) Is there any way to change this (within a script, not phpini - i have no rights to do that!) Thanks a bunch, Ken -- Kenneth Chau Web Developer http://wwwgizzarcom -- PHP General Mailing List (http://wwwphpnet/) To unsubscribe, visit: http://wwwphpnet/unsubphp
[PHP] #!interpreterDirective and Setting cookies
Hello all, I'm having a problem setting cookies, when running code using the explicit interpreter directive (#!\php\php.exe). The problem is that PHP cant set cookies because bytes are sent back to the client before the setcookie() (presumably \n or \r 's), but only when the interpreter directive is used. The question simply is, is the webserver reponsible for stripping that line after it passes the code to the interperter, or is PHP supposed to do it? Thanks, Ken -- 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] Can a WHILE be done inside an array?
I'm trying to figure out how to do a WHILE inside of an array. Here is the while statement. $modyear = "1982"; $curyear = date("Y"); $curyear = $curyear + 1; while($modyear = $curyear){ echo "option".$modyear.; $modyear++; } The array I want to use the WHILE in, looks like this. The X is where I want to insert the WHILE. 'year' = array('Year','12','keyword','1:30','select','X','text'), Here is what a functioning array statment in my script looks like for referance. 'make' = array('Make','12','keyword','1:30','select','optionChevroletoptionGMCop tionIsuzuoptionOldsmobile','text'), Can someone please give me some pointers. =) Thanks. Kenneth R Zink II [EMAIL PROTECTED]ICQ# 5095094 '87 GMC S-15 Ext. Cab (Hurricane) ...BBC 524 being built !!! http://www.s-series.org/htm/windstorm/project-windstorm.htm '85 Chevy S-10 Blazer (FireStorm) ...Soon to be 3.4L SFI !!! http://www.s-series.org/htm/firestorm/firestorm.htm '84 Oldsmobile Delta 88 Delta 88 Royal Brougham. Racing by the grace of God!!! -- 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] fopen to validate a URL
How would I use FOPEN to validate a URL? here is what I already have and it's not working properly. $url=$row[url]; echo "Old URL = ".$url."br"; $fp = @fopen($url,"r"); if ($fp){ echo "Valid URLbr"; }else{ echo "URL IS NOT VALID"; $url="http://"; } echo "New URL = ".$url."br"; Kenneth R Zink II [EMAIL PROTECTED]ICQ# 5095094 '87 2.8L TBI GMC S-15 Ext. Cab (Hurricane) ...524 in the works !!! http://www.s-series.org/htm/windstorm/project-windstorm.htm '85 3.4L Carbed Chevy S-10 Blazer (FireStorm) ...Soon to be 3.4L SFI DIS !!! http://www.s-series.org/htm/firestorm/firestorm.htm Racing by the Grace of God!!
[PHP] e-mail varification problems.
I got the following code in a script I'm testing, but it seams to not verify all good e-mail address as valid. echo "old email = ".$row[email]."br"; if (ereg("^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+" or "^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+",$email)){ $email = "none"; } else { $email = $row[email]; } echo "new email = ".$email."br"; It verifies "[EMAIL PROTECTED]" but not [EMAIL PROTECTED] it verifies "[EMAIL PROTECTED]" but not [EMAIL PROTECTED] for a look at the results, check out http://www2.ripcon.net/members/datacopy.php I'm stumped. Can someone shed light on this? Kenneth R Zink II [EMAIL PROTECTED]ICQ# 5095094 '87 2.8L TBI GMC S-15 Ext. Cab (Hurricane) ...524 in the works !!! http://www.s-series.org/htm/windstorm/project-windstorm.htm '85 3.4L Carbed Chevy S-10 Blazer (FireStorm) ...Soon to be 3.4L SFI DIS !!! http://www.s-series.org/htm/firestorm/firestorm.htm Racing by the Grace of God!!
[PHP] exist?
How would I go about checking to see if a file exist from php? I didn't find anything on php.net when I did a search for exist. basically, I'm trying to accomplish this. if $file exist { do something; }else{ echo "$file doesn't exist"; } thanks in advance. Kenneth R Zink II [EMAIL PROTECTED]ICQ# 5095094 '87 2.8L TBI GMC S-15 Ext. Cab (Hurricane) ...524 in the works !!! http://www.s-series.org/htm/windstorm/project-windstorm.htm '85 3.4L Carbed Chevy S-10 Blazer (FireStorm) ...Soon to be 3.4L SFI DIS !!! http://www.s-series.org/htm/firestorm/firestorm.htm Racing by the Grace of God!!
[PHP] Problem with apostrophes!!
My MySQL insert statements is returning errors when a field has an apostrophe in it. (I.E. Ken's) is there a way to get around that without using the \ in front of the apostrophes?? I've never had this problem before, in the past (on different servers) when a variable is inserted, it just accepted it. Help!! I need to know A.S.A.P. Kenneth R Zink II [EMAIL PROTECTED]ICQ# 5095094 '87 GMC S-15 Ext. Cab (Hurricane) ...BBC 524 being built !!! http://www.s-series.org/htm/windstorm/project-windstorm.htm '85 Chevy S-10 Blazer (FireStorm) ...Soon to be 3.4L SFI !!! http://www.s-series.org/htm/firestorm/firestorm.htm '84 Oldsmobile Delta 88 Delta 88 Royal Brougham. Racing by the grace of God!!! -- 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] Problem with apostrophes!!
Ok, I'm pretty sure I need to use the "addslashes" function, but I'm not sure how to implement it. The 2 variables that I would need to addslashes are $sire and $dam. can someone please help me, this is new to me. Thanks. Kenneth R Zink II [EMAIL PROTECTED]ICQ# 5095094 '87 GMC S-15 Ext. Cab (Hurricane) ...BBC 524 being built !!! http://www.s-series.org/htm/windstorm/project-windstorm.htm '85 Chevy S-10 Blazer (FireStorm) ...Soon to be 3.4L SFI !!! http://www.s-series.org/htm/firestorm/firestorm.htm '84 Oldsmobile Delta 88 Delta 88 Royal Brougham. Racing by the grace of God!!! My MySQL insert statements is returning errors when a field has an apostrophe in it. (I.E. Ken's) is there a way to get around that without using the \ in front of the apostrophes?? I've never had this problem before, in the past (on different servers) when a variable is inserted, it just accepted it. Help!! I need to know A.S.A.P. Kenneth R Zink II [EMAIL PROTECTED]ICQ# 5095094 '87 GMC S-15 Ext. Cab (Hurricane) ...BBC 524 being built !!! http://www.s-series.org/htm/windstorm/project-windstorm.htm '85 Chevy S-10 Blazer (FireStorm) ...Soon to be 3.4L SFI !!! http://www.s-series.org/htm/firestorm/firestorm.htm '84 Oldsmobile Delta 88 Delta 88 Royal Brougham. Racing by the grace of God!!! -- 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] Implode?
What is the best way to pull data from one table and insert into another? How can I delete entries from a table with a php document? The gist of what I'm trying to accomplish is this. This is somewhat of a detailed outline, so please bear with me. 1. I have one table (members) that has all the old data. 2. I'm am going to send an e-mail to every entry in that table that has an e-mail address and have a link for them to follow to a PHP page. Any entry that does not have an e-mail address, will be moved over with a different (but similar) PHP script that will do a mass search and move of that data to the new table (memberdetail) 3. That PHP page will ask for there name and e-mail address then display a list of matching results to edit. 4. The edit page will pull data from (members) and insert then updated info into a new table (memberdetail). Password protected. Unless you know the password for that information, it will error and stop (exit () ). 5. If the insertion is successful, I want it to open a new window (if statement that contains target="_blank") which will display the new data and then the old page will refresh itself to a new page (if statement with a meta tag). If not, I want it to error and stop. (exit() ). I have already implemented anti-duplication into our new insert script (for memberdetail). The new table (memberdetail) gets scanned for duplicate information in 5 fields (but can easily but expanded to cover more then that) before it inserts data. If it finds duplicate information it displays it with an option to accept it. (password protected). If accepted (with proper password) it will delete the old information (from members) and refresh the page while opening the new information in a new window. 6. The refreshed page will be passed an variable (id) from the old table (members) and delete the entry (from members). 7. Lastly, it will refresh and pass the name and e-mail address from step 3 and display any remaining matches if any. 8. If there were any results from the search in step 7, then it will do step 4 again. If no remaining entries it will error and stop. (exit () ) Doing it this way will help us clean up our old information and get more current information for our new website. Anything that is not moved over will be erased after a couple of months. That should give them plenty of time to update and move the old data to the new site. Thanks. Kenneth R Zink II [EMAIL PROTECTED]ICQ# 5095094 '87 GMC S-15 Ext. Cab (Hurricane) ...BBC 524 being built !!! http://www.s-series.org/htm/windstorm/project-windstorm.htm '85 Chevy S-10 Blazer (FireStorm) ...Soon to be 3.4L SFI !!! http://www.s-series.org/htm/firestorm/firestorm.htm '84 Oldsmobile Delta 88 Delta 88 Royal Brougham. Racing by the grace of God!!! -- 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] No result - need advice.
I'm having problem with a php script. I get a valid insert statment echoed to the screen but I don't get a result from it. If I cut and paste into the SQL query box in PHPMyadmin, it insert fine, but it will not do it from the script. Through debuging (echoing to the screen), I have determinde that it is connecting to the database and it does get the variables passed to it, but it just won't work. Here is the PHP. html !-- Coded by the grace of God! -- LINK REL=stylesheet HREF="../index.css" TYPE="text/css" ? $db = mysql_connect("localhost", "root", ""); mysql_select_db("memberstest",$db); echo "db = ".$db."p"; $date = date("m.d.y"); echo "date ".$date."p"; if (!$name || !$year || !$make || !$model || !$pass || !$cab || !$drive || !$active || !$mlist || !$pass || !$loc) { echo "PCENTERTABLE WIDTH=\"500\" BORDER=\"0\" CELLSPACING=\"0\" CELLPADDING=\"0\" TR TD WIDTH=\"500\"PCENTERFONT SIZE=\"+2\"You didn't fill in the required fields!/FONT/CENTERPCENTERFONT SIZE=\"+2\"Press the back button on your browser and fill in the required fields which have a /FONTFONT COLOR=\"#ff\" SIZE=\"+2\"*/FONTFONT SIZE=\"+2\" next to them./FONT/CENTER/TD /TR /TABLE "; exit(); } echo "passed requirementsp"; $sql = "INSERT INTO memberstest VALUES ('', '$name', '$icq', '$loc', '$active', '$date', '$mlist', '$email', '$url', '$year', '$make', '$model', '', '$et', '$mph', '$six', '$track', '$engine', '$notes', '', '$pass', '$drive', '$cab', '$length', '', '$aim', '$irc', '$city', '$bday', '$color', '$emods', '$tmods', '$elec', '$hmods', '$bmods', '$app', '$audio', '$user', '$vin')"; echo "sql = ".$sql."p"; $result = mysql_query($sql); echo "result = ".$result."p"; $myrow = mysql_fetch_array($result); echo "my row = ".$myrow."p"; if ($result) { echo "pcenterBThank you!/BPYour Member info has been added to the database./center"; $sql = "SELECT id FROM memberstest WHERE name=$name AND date=$date AND model=$model"; $result = mysql_query($sql); $myrow = mysql_fetch_array($result); echo "id = ".$id."p"; $pic1 = $id.$picture1_name; $pic2 = $id.$upicture1_name; echo "pic1p"; if($picture1 == 'none'){ $pic1="na.gif"; } echo $pic1."p"; echo "pic2p"; if($upicture1 == 'none'){ $pic2="na.gif"; } echo $pic2."p"; $sql = "UPDATE memberstest SET $pic1='$pic1' and $pic2='$pic2' WHERE id=$id"; exec("cp $picture1 /var/www/html/members/images/$pic1"); exec("cp $upicture1 /var/www/html/members/images/$pic2"); echo $pic1."p"; echo $pic2."p"; echo "headmeta HTTP-EQUIV=\"Refresh\" CONTENT=\"10\" URL=\"http://www.s-series.org/member/detail-wip?".$myrow["id"]."/head"; Here is what gets echoed to the screen. db = Resource id #1 date 02.20.01 passed requirements sql = INSERT INTO memberstest VALUES ('', 'Kenneth R Zink II', '5095094', 'Texas', 'yes', '02.20.01', 'yes', '[EMAIL PROTECTED]', 'http://www.s-series.org/htm/firestorm/firestorm.htm', '1985', 'Chevrolet', 'Blazer', '', '0.000', '0.000', '0.000', '', '3.4L', '', '', '', '2WD', '2 Door', '', '', '', '', 'Spring', '14 December 1976', 'Red', 'See my project page for details.', 'See my project page for details.', 'See my project page for details.', 'See my project page for details.', 'See my project page for details.', 'See my project page for details.', 'this is a test. let\'s see if this goes through.', '', '1gtcs14r3h8515786') result = Warning: Supplied argument is not a valid MySQL result resource in /var/www/html/member/add2-wip.php on line 31 my row = What am I doing wrong??? I can cut and pas Kenneth R Zink II [EMAIL PROTECTED]ICQ# 5095094 '87 2.8L TBI GMC S-15 Ext. Cab (Hurricane) ...524 in the works !!! http://www.s-series.org/htm/windstorm/project-windstorm.htm '85 3.4L Carbed Chevy S-10 Blazer (FireStorm) ...Soon to be 3.4L SFI DIS !!! http://www.s-series.org/htm/firestorm/firestorm.htm Racing by the Grace of God!!
[PHP] How do I limit a file size?
I want to limit uploaded files to $250k. The incoming files should be images, so I also want to limit the files to .gif or .jpg files. How would I go about doing this? Kenneth R Zink II [EMAIL PROTECTED]ICQ# 5095094 '87 2.8L TBI GMC S-15 Ext. Cab (Hurricane) ...524 in the works !!! http://www.s-series.org/htm/windstorm/project-windstorm.htm '85 3.4L Carbed Chevy S-10 Blazer (FireStorm) ...Soon to be 3.4L SFI DIS !!! http://www.s-series.org/htm/firestorm/firestorm.htm Racing by the Grace of God!!
[PHP] how do I do file maintenance with PHP?
Ok here is the deal. I have a Linux server running PHP4 and MySQL and a directory full of images. The images that are currently being used should be listed in a table (members) in a column titled "pic1". What is the best way to pull the file names of the files and check them against the files in the table? I want all files that are not listed in the table to be deleted. Also, is there a way to limit file size? I don't want new images to be accepted if they exceed 250k. It takes too long for images to display if they are larger then that. Thanks in advance for any help. Kenneth R Zink II [EMAIL PROTECTED]ICQ# 5095094 '87 2.8L TBI GMC S-15 Ext. Cab (Hurricane) ...524 in the works !!! http://www.s-series.org/htm/windstorm/project-windstorm.htm '85 3.4L Carbed Chevy S-10 Blazer (FireStorm) ...Soon to be 3.4L SFI DIS !!! http://www.s-series.org/htm/firestorm/firestorm.htm Racing by the Grace of God!!
[PHP] MySQL email function
How would I go about pulling e-mail addresses from a database and sending and e-mail using that list? Kenneth R Zink II [EMAIL PROTECTED]ICQ# 5095094 '87 2.8L TBI GMC S-15 Ext. Cab (Hurricane) ...524 in the works !!! http://www.s-series.org/htm/windstorm/project-windstorm.htm '85 3.4L Carbed Chevy S-10 Blazer (FireStorm) ...Soon to be 3.4L SFI DIS !!! http://www.s-series.org/htm/firestorm/firestorm.htm Racing by the Grace of God!! -- 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
Hi everyone, My name's Kenneth Zink and I'm a newbie here. I just started working with PHP on Wednesday, but with the help of John Guynn, I think I'm getting the hang of it pretty quickly. I joined the list so that I have more resources available to me as I continue learning how to program in PHP. My main website that I work on right now is www.s-series.org . please check it out and let me know what you think. BTW, if you know of a good PHP based classifieds script, please let me know, because I want to get away from the CGI based classifieds that we currently have. Thanks. Kenneth R Zink II [EMAIL PROTECTED]ICQ# 5095094 '87 2.8L TBI GMC S-15 Ext. Cab (Hurricane) ...524 in the works !!! http://www.s-series.org/htm/windstorm/project-windstorm.htm '85 3.4L Carbed Chevy S-10 Blazer (FireStorm) ...Soon to be 3.4L SFI DIS !!! http://www.s-series.org/htm/firestorm/firestorm.htm Racing by the Grace of God!! -- 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] How do I store a pic?
How do I store a jpg within a table? I want for a user to be able to pull a jpg from either their HD and store it in a table with some other information for a classifieds section. That way when the ad is deleted, the picture goes with it instead of remaining on my HD. Kenneth R Zink II [EMAIL PROTECTED]ICQ# 5095094 '87 2.8L TBI GMC S-15 Ext. Cab (Hurricane) ...524 in the works !!! http://www.s-series.org/htm/windstorm/project-windstorm.htm '85 3.4L Carbed Chevy S-10 Blazer (FireStorm) ...Soon to be 3.4L SFI DIS !!! http://www.s-series.org/htm/firestorm/firestorm.htm Racing by the Grace of God!! -- 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]