Re: [PHP] strip_tags
20 jul 2013 kl. 18:25 skrev Tedd Sperling : > Hi gang: > > I've been using > >$str = strip_tags($str, $allowable) > > as it is described via the manuals: > > http://php.net/manual/en/function.strip-tags.php > > The problem I've found is the tags "" and "" are not stripped. > > How do you strip all tags, but leave some tags (such as , , and -- > I know these are depreciated, but my client wants them anyway). > From the manual: allowable_tags You can use the optional second parameter to specify tags which should not be stripped. Note: HTML comments and PHP tags are also stripped. This is hardcoded and can not be changed with allowable_tags. Note: This parameter should not contain whitespace. strip_tags() sees a tag as a case-insensitive string between < and the first whitespace or >. It means that strip_tags("", "") returns an empty string. It's all there… ;-) Cheers, /frank > Cheers, > > tedd > > _ > t...@sperling.com > http://sperling.com > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Detecting massive web hits
12 apr 2013 kl. 17.23 skrev Angela Barone: > Does anyone know if there's a ready-made script that detects if someone > hits multiple web pages within seconds of each other and then can temporarily > ban them by IP from accessing our site? > > Looking through the logs, I see someone/something hit each and every > page of a site I work on within only a few seconds of each other. I > seriously doubt they are a customer. ;) > > I'd appreciate any insights. > > Thank you, > Angela > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > Maybe Fail2ban is what you are looking for? http://www.fail2ban.org/wiki/index.php/Main_Page /frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Expected behaviour or bug?
17 sep 2012 kl. 10.50 skrev Camilo Sperberg: > Hello list, I have a little question with PHP's internal working. I've > managed to reduce the test to the following lines: > > $globalVariable = 'i am a global variable'; > function testFunction() { > global $globalVariable; > unset($globalVariable); > } > > testFunction(); > > if(isset($globalVariable)) { > var_dump('global variable IS set'); > } else { > var_dump('global variable is NOT set'); > } > > > > When executing the above test, you will get printed that the global variable > is set, despite unsetting it in the function. Is it really the intention to > unset a global variable inside a function locally or have I just happen to > found a little bug? > > unreal4u-MBP:~ unreal4u$ php --version > PHP 5.3.13 with Suhosin-Patch (cli) (built: Jun 20 2012 17:05:20) > Copyright (c) 1997-2012 The PHP Group > Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies >with Xdebug v2.3.0dev, Copyright (c) 2002-2012, by Derick Rethans > > If it is expected behavior, is there any documentation on why this is done > this way? > > Greetings and thanks. > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > Sometimes, it helps reading the manual... http://lmgtfy.com/?q=php+unset+global "If a globalized variable is unset() inside of a function, only the local variable is destroyed. The variable in the calling environment will retain the same value as before unset() was called." [...] "To unset() a global variable inside of a function, then use the$GLOBALS array to do so:" Took about 1 minute to find out. /frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] array_push
2 sep 2012 kl. 19.48 skrev John Taylor-Johnston: > How can I clean this up? >>> My approach would be to split the hole text into smaller chunks (with e.g. >>> explode()) and extract the interesting parts with a regular expression. >>> Maybe this will give you some ideas: >>>> $chunks = explode("-30-", $mystring); >>>> foreach($chunks as $chunk) { >>>> preg_match_all("/News Releases\n(.+)/s", $chunk, $matches); >>>> var_dump($matches[1]); >>>> } >>>> The regex matches all text between "News Releases" and the end of the >>>> chunk. >> 2) How could I suck it into one nice easy to handle array? >> >> |$mynewarray=|array { >> [0]=> "Residential Fire Determined to be Accidental in Nature ..." >> [1]=> "Arrest Made in Residential Fire ..." >> } > I was hoping preg_match_all would return strings. I w/as hoping |$matches[1] > was a string.|/ > > source: http://www.cegepsherbrooke.qc.ca/~languesmodernes/test/test4.phps > result: http://www.cegepsherbrooke.qc.ca/~languesmodernes/test/test4.php Have you read up on 'preg_match_all' in the manual? What makes you think that preg_match_all returns strings? "$matches[1]", in the above case contains an array with all matches from the parenthesized subpattern, which is "(.+). > This is ugly. How can I clean this up like this? > > $mynewarray= array { > [0]=> "Residential Fire Determined to be Accidental in Nature ..." > [1]=> "Arrest Made in Residential Fire ..." > } Why not add two lines of code within the first loop? $chunks = explode("-30-", $mystring); foreach($chunks as $chunk) { preg_match_all("/News Releases\n(.+)/s", $chunk, $matches); foreach($matches[1] as $matched_text_line) { $mynewarray[] = $matched_text_line; } } Besides the regex, this is pretty basic php. /frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] extract Occurrences AFTER ... and before "-30-"
2 sep 2012 kl. 14.40 skrev Matijn Woudt: > On Sun, Sep 2, 2012 at 6:23 AM, John Taylor-Johnston > wrote: >> See: >> http://www.cegepsherbrooke.qc.ca/~languesmodernes/test/test.php >> http://www.cegepsherbrooke.qc.ca/~languesmodernes/test/test.phps >> >> In $mystring, I need to extract everything between "|News Releases|" and >> "-30". >> >> The thing now is $mystring might contain many instances of "|News Releases|" >> and "-30". >> >> How do I deal with this? My code only catches the first instance. >> >> Thanks for you help so far. >> >> John >> > > You could use substr to retrieve the rest of the string and just start > over (do it in a while loop to catch all). > Though, it's probably not really efficient if you have long strings. > You'd be better off with preg_match. You can do it all with a single > line of code, albeit that regex takes quite some time to figure out if > not experienced. > > - Matijn > > PS. Please don't top post on this and probably any mailing list. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > My approach would be to split the hole text into smaller chunks (with e.g. explode()) and extract the interesting parts with a regular expression. Maybe this will give you some ideas: $chunks = explode("-30-", $mystring); foreach($chunks as $chunk) { preg_match_all("/News Releases\n(.+)/s", $chunk, $matches); var_dump($matches[1]); } The regex matches all text between "News Releases" and the end of the chunk. /frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] no traffic
6 mar 2012 kl. 15.29 skrev Mike Mackintosh: > On Mar 6, 2012, at 8:55, Lawrence Decker wrote: > >> I've been playing with PHP for about 6 years and I have no idea why this is >> happening... I've been writing a script to auth to AD. When I run the >> script on my dev box, nothing. I have wireshark running in the background >> on the dev box, I can see the script's traffic go out and hit the DNS >> server but no other traffic. Command line, no problem talking to other >> hosts with whatever port I'm trying to hit. On my box, all the scripts >> work fine. LDAP is enabled, but I can't hit ANY port other than DNS and if >> I use the IP in the script, I see no traffic. Both are FC16-64 patched as >> of last week. I matched line-by-line in the phpinfo() on my box and the dev >> box - no difference. Used this script to try any port open on other hosts >> but no traffic shows up in wireshark!! Any ideas >> >> >> Lawrence >> >> >> >> > function ping($host,$post=25,$timeout=6) >> >> { >> $fsock = fsockopen($host, $port, $errno, $errstr, $timeout); >> if ( ! $fsock ) >> { >> return FALSE; >> } >> else >> { >> return TRUE; >> } >> } Have you noticed that you have a typo in your function? '$post' should be '$port'... /frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php://input
15 jan 2012 kl. 06.18 skrev Adam Tong: > Hi, > > I am trying to read variables from input method. > I am using this tuorial: > http://www.lornajane.net/posts/2008/Accessing-Incoming-PUT-Data-from-PHP. > Here is my code: > if($_SERVER['REQUEST_METHOD'] == 'GET') { >echo "this is a get request\n"; >echo $_GET['fruit']." is the fruit\n"; >echo "I want ".$_GET['quantity']." of them\n\n"; > } elseif($_SERVER['REQUEST_METHOD'] == 'PUT') { >echo "this is a put request\n"; >parse_str(file_get_contents("php://input"),$post_vars); >echo $post_vars['fruit']." is the fruit\n"; >echo "I want ".$post_vars['quantity']." of them\n\n"; > } > ?> > > I am using the firefox extension "poster" to run this example. GET > works fine but when using PUT, file_get_contents("php://input") > returns an empty string. > > I found a bug related to this: https://bugs.php.net/bug.php?id=51592 > > I am using xampp on win7 ( > + Apache 2.2.17 > + MySQL 5.5.8 (Community Server) > + PHP 5.3.5 (VC6 X86 32bit) + PEAR) > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php Hi Adam. Although I've never worked with PUT/DELETE requests, here are my thoughts. 1) According to the manual, file_get_contents only allows URL's as filenames if "fopen wrappers" are enabled. Make sure that this is the case (have a look at the settings in your php ini file). Do you get any data when changing 'file_get_contents' to e.g. (as found here: http://php.net/manual/en/features.file-upload.put-method.php)? 2) Have a look in your Appache log files and make sure the client is actually making a valid PUT request. /frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about date calculations
29 dec 2011 kl. 22.22 skrev Eric Lommatsch: > So far in looking at the functions that are available at > http://www.php.net/manual/en/ref.datetime.php I have not been able to figure > out how to do what I need to do. Below is a snippet showing approximately > what I am trying to do. On the same page you are referring, there are plenty of examples on how to calculate the difference between two dates. Choose one and see if it fits your bill. Or is there any particular reason why you're writing your "own" function? http://www.php.net/manual/en/ref.datetime.php#78981 /frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PDF Page Size
20 dec 2011 kl. 16.15 skrev Floyd Resler: > What is a good solution for get the size of a PDF page in pixels? I've tried > a few different methods but haven't had much success. > > Thanks! > Floyd If you don't mind using a command line tool, Xpdf would be my first choice. Look out for "pdfinfo". http://foolabs.com/xpdf/download.html /frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Opening Multiple Files
7 sep 2011 kl. 16.21 skrev Ron Piggott: > > Hi Everyone > > I am trying to load an HTML book into mySQL. The book was distributed with > each chapter being it’s own HTML file. > > The only way I know how to open a file is by specifying the file name. Such > as: > > $myFile = "B01C001.htm"; > $lines = file($myFile); > foreach ($lines as $line_num => $theData) { > > Is there a way PHP will open each file in the directory ending in “.htm”, one > file at a time, without me specifying the file name? > http://se.php.net/manual/en/function.glob.php /frank > When the file is open I need the FOREACH (above) to parse the content which > ends with an “INSERT INTO” for a mySQL table. > > Thank you in advance for any help you are able to give me. > > Ron > > The Verse of the Day > “Encouragement from God’s Word” > http://www.TheVerseOfTheDay.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Using function prototypes in code
In the interest of clarity and maintainability I would like to be able to write code that makes it clear what kind of arguments a function expects and what it returns. This is what I tried: function integer int_func(string $s) { // does something like, say, converting "five" to 5 } There are two problems: 1 The appearance of a type name before the function name is treated as a syntax error 2 Even if I forget about declaring the return type and code it instead as function int_func(string $s) { ... } I get a run-time error when I call the function with a string. (eg $var = int_func("five");) The error message says"Catchable fatal error: Argument 1 passed to int_func() must be an instance of string, string given". It seems that basic data types cannot be specified in ths way although (intstances of) classes can. I have successfully used the technique to catch run-time errors of wrong object types when testing, but am surprised that I can't use it to trap unexpected basic types - or at least to document what is expected. To confuse me a bit further, I can't find a definitive list of the basic type names. For example, is it "integer" or "int"? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ftell Issue or Feature
8 jun 2011 kl. 09.09 skrev Christian Grobmeier: > The object itself is always the same, for all threads. Every thread > gets this "Appender" from a kind of a pool. > > My guess is, every thread gets some kind of a copy of this object, > working at it. Once it reaches the method, its members states are not > reflected into the other stack call. I never worked with "log4php", so I am really not sure how "getMaxFileSize" calculates the log file size. In general, results for functions like PHP's "filesize" are cached. See e.g. http://php.net/manual/en/function.filesize.php Right after the flock call, try to clear the cache with clearstatcache(). Maybe that helps. /frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RelaxNG parser in PHP?
Hello List! Currently I am using a pear package in one of my projects to parse and query XML DTD files. The package is called XML_DTD 0.5.2 and includes the so called XML_DTD_Parser. One of the purposes of this class is to parse a given DTD file and return that file as a tree like object. With the help of that object, I can find out valid children (and valid attributes) for a given tag (which is what I am using the XML_DTD class for). Now I am looking for a similar class in order to parse RelaxNG (alternatively Schematron) files. I have search Google high and low but was not able to find anything suitable. Any hints are more than welcome! Regards, /frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: echo?
23 mar 2011 kl. 02.42 skrev Jim Giner: > ok - here's the code in question. > $q = 'select * from director_records '; > $qrslt = mysql_query($q); > $rows = mysql_num_rows($qrslt); > for ($i=0; $i<$rows; $i++) >{ >$j = $i+1; >$row = mysql_fetch_array($qrslt); >echo $j.'-'.$row['userid']; >if ($row['user_priv']<> "") >echo ' ('.$row['user_priv'].') '; >else >echo ' '; >} > > > The output I get is: > > > 1-smith5 > f-ginerjm (M) > g-smith8 > > While the alpha parts are valid, the index is only correct for the first one > (0) obviously. > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > Why not try some basic debugging strategies and see what you get? Try: for ($i=0; $i<$rows; $i++) { var_dump($i); $j = $i+1; $row = mysql_fetch_array($qrslt); echo $j.'-'.$row['userid']; var_dump($j); if ($row['user_priv']<> "") echo ' ('.$row['user_priv'].') '; else echo ' '; } The output you've posted, that's rendered output, right? What's the raw output? By the way, the code snippet you gave us is not complete. Is there anything else? As Dan noticed earlier, judging from that code snippet only, there must be something else funky going on. /frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] extract price by preg_match_all
"; print_r($matches); echo ""; } else { echo "Didn't find anything..."; } ?> Untested. /frank 14 feb 2011 kl. 15.05 skrev Tontonq Tontonq: > example data: > > > old price 829,00 > €your price 58,90 € * > > > another : > 9,90 € * > > i want to extract 829,.00 & 58,90 from first source , 9,90 from the second > > i tried many way like preg_match_all('/ class="newprice">(\$[0-9,]+(\.[0-9]{2})?)<\/span>/',$data,$prices); > it doesn't work -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] file upload utility ?
On 02/07/2011 05:01 PM, Daniel Brown wrote: On Mon, Feb 7, 2011 at 10:56, Frank Bonnet wrote: Hello I'm searching for a utility that let our users upload a file on a server , then generate a temporary link that point to the real file. As this is for internal use we don't need security, the file can be read by anyone. The goal is to distribute the file to our users by sending them an email containing the address of the http temporary link instead of sending it as an email attachement X 1000 ... Sounds great. Good luck in your Google search. I found nothing that's why I wrote this !!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] file upload utility ?
Hello I'm searching for a utility that let our users upload a file on a server , then generate a temporary link that point to the real file. As this is for internal use we don't need security, the file can be read by anyone. The goal is to distribute the file to our users by sending them an email containing the address of the http temporary link instead of sending it as an email attachement X 1000 ... Thank you -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] a quick question about array keys
Have a look at the manual, especially the function "array_values()". /frank Skickat från min iPhone. 31 aug 2010 kl. 17:43 skrev Tontonq Tontonq : > a quick question > lets say i have an array like that > > > Array > ( > [300] => 300 > [301] => 301 > [302] => 302 > [303] => 303 > [304] => 304 > [305] => 305 > [306] => 306 > [307] => 307 > [308] => 308 > ... > how can i change keys to 0,1,2,3,.. by faster way > (it should like that) > > Array > ( > [0] => 300 > [1] => 301 > [2] => 302 > [3] => 303 > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Server-side postscript-to-PDF on-the-fly conversion
27 mar 2010 kl. 05.41 skrev Rob Gould: Is there a free solution out there that will enable me to take a PHP- generated postscript output file, and dynamically, on-the-fly convert it to a PDF document and send to the user as a download when the user clients on a link? More description of what I'm trying to do: 1) I've got a web-page that accepts some user input 2) They hit SUBMIT 3) I've got a PHP file that takes that input and generates a custom Postscript file from it, which I presently serve back to the user. On a Mac, Safari and Firefox automatically take the .ps output and render it in Preview. 4) However, in the world of Windows, it seems like it'd be better to just convert it on-the-fly into a PDF, so that the user doesn't need to worry about having a post-script viewer app installed. If your webserver runs on MacOSX, look out for a binary called 'pstopdf'. From the man page: [...] pstopdf is a tool to convert PostScript input data into a PDF document. The input data may come from a file or may be read from stdin. The PDF document is always written to a file. The name of the output PDF file is derived from the name of the input file or may be explicitly named using the -o option. [...] Another option might be xpdf (http://www.foolabs.com/xpdf/). There are several different tools bundled with that app and there might be some ps -> pdf converter too. Otherwise, there is always Ghostscript. /frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Anyone good with multiple SSL on Apache?
Not that I know of. - Frank On 3/8/10 2:21 PM, Skip Evans wrote: D'oh! ...and I suppose there is just no way around that, eh? Skip Frank M. Kromann wrote: You can only have one SSL per IP address. The SSL connection between the client and server is done before the host header name is made available to Apache. - Frank On 3/8/10 2:13 PM, Skip Evans wrote: Hey all, I have an Apache virtual config running a bunch of sites, one with SSL. I finally have a need to add SSL to one more, but when I do the first one (which is further down the file) comes up "untrusted". Since this is pretty far off topic I'd be obliged if someone who has configured this before can email me off list for some assistance. Much thanks! Skip -- Frank M. Kromann, M.Sc.E.E. Web by Pixel, Inc. Phone: +1 949 742 7533 Cell: +1 949 702 1794 Denmark: +45 88 33 64 80 -- Frank M. Kromann, M.Sc.E.E. Web by Pixel, Inc. Phone: +1 949 742 7533 Cell: +1 949 702 1794 Denmark: +45 88 33 64 80
Re: [PHP] Anyone good with multiple SSL on Apache?
You can only have one SSL per IP address. The SSL connection between the client and server is done before the host header name is made available to Apache. - Frank On 3/8/10 2:13 PM, Skip Evans wrote: Hey all, I have an Apache virtual config running a bunch of sites, one with SSL. I finally have a need to add SSL to one more, but when I do the first one (which is further down the file) comes up "untrusted". Since this is pretty far off topic I'd be obliged if someone who has configured this before can email me off list for some assistance. Much thanks! Skip -- Frank M. Kromann, M.Sc.E.E. Web by Pixel, Inc. Phone: +1 949 742 7533 Cell: +1 949 702 1794 Denmark: +45 88 33 64 80
Re: [PHP] Merry Christmas!
Merry Christmas from Sweden! /frank Skickat från min iPhone. 25 dec 2009 kl. 15.16 skrev Shawn McKenzie : Merry Christmas from Texas, USA! -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] remove namespace from xml
2 dec 2009 kl. 19.12 skrev Augusto Flavio: Hi all, i'm trying to connect to a SOAP Server but i'm having a problem. Look the xml that i need send to the server: // THIS IS THE XML CORRECT THAT NEED BE SENT TO THE SERVER http://www.w3.org/2001/XMLSchema-instance"; xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";> http://tempuri.org/";> X XX 40010 30840300 30840280 10 1 20 5 100 S 300 S And now the xml that i'm sending to the SOAP Server. //THIS IS THE XML THAT THE PHP IS SENDING http://schemas.xmlsoap.org/soap/envelope/"; xmlns:ns1="http://tempuri.org/"; xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"; SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";> // HOW CAN I REMOVE THIS NAMESPACE? ns1: X XX 40096 30840280 30840300 10 1 5 10 0 300 N 300 N How can i remove the ns1 from the Child CalcPrecoPrazo? Some idea? //here is the php code: $client = new SoapClient(null, array('location' => $url, 'uri' => "http://tempuri.org/CalcPrecoPrazo";, 'trace'=> 1 )); $results = $client->CalcPrecoPrazo($empresaCod, $empresaSenha, $codigoFrete, $cepOrigem, $cepDestino, $peso, (int)$formatoCd, (int)$comprimento, (int)$altura, (int)$largura, (int)$VlDiametro, $codMaoPropria, (float)$valor, $codAvisoRecebimento); thanks Augusto Morais Although I never worked with SOAP so far, at least when it comes to XML namespaces, you need to explicitly set those somewhere in your code before use (which you haven't). Have you asked Google or even looked at the MAN pages? After two minutes of googling, I found this. From the SOAP man page: [...] nico 25-Aug-2006 01:20 If you want to build a Soap Server for Microsoft Office's client (like Microsoft Office Research Service) you need to rewrite SOAP's namespaces : $server = new SoapServer($wsdl, array('uri' => $uri, 'classmap' => $classmap)); $server->setClass($class); function callback($buffer) { $s = array('', 'ns1:', 'xmlns:ns1="urn:Microsoft.Search "'); $r = array('', '', ''); return (str_replace($s, $r, $buffer)); } ob_start('callback'); $server->handle(); ob_end_flush(); // (...) ?> There are a complete example at this URL : http://touv.ouvaton.org/article.php3?id_article=104 [...] I am sure there are other examples too. /frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [News] Affordable Independent Web Developer - Search Engine Optimization Services - March 19th, 2009
"George Larson" wrote in message news:a623739c0903201141o3b430640haf91ea575f276...@mail.gmail.com... > houses ain't gunna cleen themselfs... > > On Fri, Mar 20, 2009 at 2:39 PM, Ginkga Studio, LLC > wrote: > >> LOL. >> >> :0) >> >> Ok. You guys are fun but I have to get to work. Hope all works out for >> you >> guys. Sorry for posting to your list. Just block me so I don't bother you >> again. >> >> Good luck with all your programming. You all seem like pretty good >> people. >> >> Sorry for harassing you George. I'm sure you are sexy in something short >> and >> lacy. >> >> Sorry for offending Daniel and all of his greatness. I'm sure he's a >> pretty >> good guy when he isn't being so defensive. >> >> >> Anyway, nice meeting you all, even it was on such terms. >> >> God Bless. >> >> XOXOXOXO >> >> >> >> >> -Original Message- >> From: George Larson [mailto:george.g.lar...@gmail.com] >> Sent: Friday, March 20, 2009 11:34 AM >> To: Thiago H. Pojda >> Cc: webdes...@ginkga.com; php-general@lists.php.net >> Subject: Re: [PHP] [News] Affordable Independent Web Developer - Search >> Engine Optimization Services - March 19th, 2009 >> >> Oh, good; I look forward to polishing your nails... spammer. >> >> >> On Fri, Mar 20, 2009 at 2:29 PM, Thiago H. Pojda >> wrote: >> >> >>On Fri, Mar 20, 2009 at 3:23 PM, Ginkga Studio, LLC >> wrote: >> >> >>> >>> IF YOU WERE MY HUSBAND I WOULD SPANK YOUR ASS SO HAR YOU'D NEVER >> TALK BACK >>> ANY WOMAN EVER AGAIN !!! >>> >>> >> >>> Oh, gee. >> >>Thanks for filters, Gmail. >> >>-- >>Thiago Henrique Pojda >>http://nerdnaweb.blogspot.com >> >> >> >> >> > Great...Just great! She walks in and drops a spam ball in a tech mailling list, spends most of her day ranting back and forth with us, teases us with mildly expicit imagry, and then throws George in something lacy out there. My GF is going to so hate you for the next few days when all I want to do is cuddle and wimper. Frank...so what's my title? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Stopping bad entries in PHP form
"Ashley Sheridan" wrote in message news:1237498771.3562.22.ca...@localhost.localdomain... > On Thu, 2009-03-19 at 17:33 -0400, Marc Christopher Hall wrote: >> IP lookups are like Marxism, great idea in theory, terrible in reality. >> IP's >> can be spoofed. The best recommendation I can think of would be to add >> some >> word filters to your (I'm assuming javascript) form validation script. >> Even >> here caution needs to be used, i.e don't filter Moscow because there is a >> Moscow, Idaho >> >> >> >> >> -Original Message- >> From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] >> Sent: Thursday, March 19, 2009 5:19 PM >> To: Shawn McKenzie >> Cc: php-general@lists.php.net >> Subject: Re: [PHP] Stopping bad entries in PHP form >> >> On Thu, 2009-03-19 at 16:04 -0500, Shawn McKenzie wrote: >> > Ashley Sheridan wrote: >> > > On Thu, 2009-03-19 at 13:46 -0700, sono...@fannullone.us wrote: >> > >> I have a PHP form that allows end users to request a sample of the >> > >> products we sell. Unfortunately, a person/people have found it and >> > >> are sending in bad requests. We sell only within the US, and so >> > >> I've >> > >> set up the form so that they must choose one of the 50 States. But >> > >> we >> >> > >> keep getting requests with countries in the city field, i.e. "Moscow >> > >> Russia". >> > >> >> > >> Is there a way that I can scan for country names, etc. in the text >> > >> fields and stop a request from going through if it finds one of >> > >> those >> > >> "banned" words? I've searched for a solution but haven't been able >> > >> to >> >> > >> find it. >> > >> >> > >> If this is not enough info, please let me know. Also, I only know >> > >> enough PHP just to be dangerous, so please be kind. =;) >> > >> >> > >> Thanks, >> > >> Frank >> > >> >> > > Why make them enter the details? Let them choose from a select list >> > > instead, forcing them to select a state. >> > > >> > > >> > > Ash >> > > www.ashleysheridan.co.uk >> > > >> > >> > Ummm... And what if they enter or select Texas? You consider it a >> > valid request even though they are really from Moscow and the other >> > fields may be junk? >> > >> > -- >> > Thanks! >> > -Shawn >> > http://www.spidean.com >> > >> Is it viable to couple it with an IP lookup to see the country they >> appear to be visiting from? >> >> >> Ash >> www.ashleysheridan.co.uk >> >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> >> __ Information from ESET Smart Security, version of virus >> signature >> database 3949 (20090319) __ >> >> The message was checked by ESET Smart Security. >> >> http://www.eset.com >> >> >> >> >> __ Information from ESET Smart Security, version of virus >> signature >> database 3949 (20090319) __ >> >> The message was checked by ESET Smart Security. >> >> http://www.eset.com >> >> >> > Filtering by Javascript is even worse than by IP, it's a matter of > seconds to turn that off, a little bit more to change the IP ;) > > Back to the OP; what kind of form is it that should only allow US > citizens to use it? > > > Ash > www.ashleysheridan.co.uk > Personally when I've had to provide sample code to people for a client like this I've found that the client prefers to have the requester to provide a phone number, and then have a CS rep contact them. I then set it up so the CS rep could generate a 1 day valid pass code for the web site that they then emailed to the prospective client. Solves several problems. 1. They know they are talking to a perspective customer, and can add them as a contact while validating the location fairly acurately. 2. It saves you a headache in validation code. c. It makes you look proactive to the client, and could help you in the future. Frank...yes I put c in there on purpose -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Problems with exec() on windows
"Kyohere Luke" wrote in message news:9bc423c50903191018k3c783213l4929cf2878e98...@mail.gmail.com... > Eventually settled for getting rid of the spaces in the path. That worked. > Thanks. > Luke > > On Thu, Mar 19, 2009 at 8:06 PM, Bastien Koert wrote: > >> >> >> On Thu, Mar 19, 2009 at 12:48 PM, Kyohere Luke wrote: >> >>> Thanks, but I tried this. Doesn't work because the path\to\gammu.exe has >>> spaces in it >>> Haliphax, thanks for your comments. I tried escapeshellarg() to no end. >>> >>> I'm exploring your reply regarding proc_open, but how exactly does >>> proc_open >>> separate the arguments from the command? >>> >>> Unless i'm mistaken, data written to the process's stdin (for the other >>> process) is not treated like an argument. >>> >>> If I add the arguments to the process name/path? I'm back to square one. >>> >>> Luke. >>> >>> On Thu, Mar 19, 2009 at 6:25 PM, Shawn McKenzie >> >wrote: >>> >>> > Kyohere Luke wrote: >>> > > Hi, >>> > > I'm trying to use exec to call gammu.exe and send sms on windows XP. >>> > > >>> > > This works from commandline: >>> > > >>> > > C:\path\to\gammu.exe 1 --sendsms EMS 200 -text "test1 test2" >>> > > >>> > > But if I run it through php like this: >>> > > >>> > > $command = "\"C:\path\to\gammu.exe\" --sendsms EMS 200 -text \"test1 >>> > > test2\"".; >>> > > @exec($command, $response, $retval); >>> > > >>> > > This always fails, returns 1 and the response is empty. >>> > > >>> > > If the last argument is a string with no spaces, and the double >>> > > quotes >>> > were >>> > > omitted, it works perfectly. >>> > > >>> > > If the double quotes are added around the string with no spaces, it >>> fails >>> > > again, which makes me believe that the problem is with the double >>> quotes. >>> > > >>> > > I've used procmon and it shows that when the double quotes are added >>> > around >>> > > the last argument, gammu.exe is not even called at all. >>> > > >>> > > Problem is that the double quotes are required by gammu to send an >>> > > sms >>> > with >>> > > spaces in it. >>> > > >>> > > Any ideas? :-( >>> > > >>> > > Luke >>> > > >>> > >>> > Why not try: >>> > >>> > $command = 'C:\path\to\gammu.exe --sendsms EMS 200 -text "test1 >>> > test2"'; >>> > >>> > -- >>> > Thanks! >>> > -Shawn >>> > http://www.spidean.com >>> > >>> > -- >>> > PHP General Mailing List (http://www.php.net/) >>> > To unsubscribe, visit: http://www.php.net/unsub.php >>> > >>> > >>> >> >> try double slashes for the path and wrap the pathin quotes if there are >> spaces in it. Or if possible get rid of the spaces in the folder names >> >> -- >> >> Bastien >> >> Cat, the other other white meat >> > Rule of thumb. Since PHP is for web access try to avoid spaces in any folder names you will be making accessable through either the site or php references. It makes life much much easier. Frank. Back from his binge drinking, and School applications after his layoff. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How should I ....--its a date/timestamp issue
"Paul M Foster" wrote in message news:20090219022913.gl18...@quillandmouse.com... > On Wed, Feb 18, 2009 at 05:25:16PM -0600, Terion Miller wrote: > > > >> What about just accepting any date in to the system, and defaulting >> to >> the current date if any numptys/users try to set one before? >> >> Do something maybe like this (untested) >> >> $userDate = strtotime($_REQUEST['date']); >> $startDate = ($userDate < time())?time():$userDate; >> >> >From there, you can use the timestamp how you wish. >> >> OOH found it: >> $startday = mktime(0, 0, 0, date("m") , date("d")+2, date("Y")); >> >> Well no, guess I didn't find it because that code above gives me >> this 1235109600 >> >> What is that?? > > It's a *nix timestamp number. Give it to date() this way: > > date('Y-m-d', $startday) > > And you'll see the date it represents. (It's actually the number of > seconds since, the Unix epoch, in 1970.) > > Paul > > -- > Paul M. Foster Sorry been gone a while. I usually double validate. Once in javascript to make sure the date is valid before submit, and then again in php incase some maroon screws around and/or has javascript disabled on their system. Hope that helps even if it is a bit late. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Stupid is as Stupid does
""Michael A. Peters"" wrote in message news:49a79416.6060...@mac.com... > As my web app is coming to completion, I added a means to search records > (different from site search). > > This involves reading post input and is many cases converting it to an > integer. > > Damn I feel dumb. > > The search app wasn't working, so I did what I often do when > troubleshooting crap - I put a die($variable) at various points to see if > the variable is what it is suppose to be. > > I kept getting blank returns from die after the conversion from a post > string to an integer. I looked in the apache logs, system logs, I even > tried rebooting - I couldn't figure why the smurf the variable wasn't > converting to integer. > > I even turned off eaccelerator in case that was causing it, though it > never has given me issue before (except once when I was doing something in > a really shoddy way - cleaned up my method and it behaved) > > After several hours contemplating if I had bad RAM, an issue with the CPU, > verifying my RPMs were good, wondering why I wasn't getting anything in > the logs, it dawned on me. > > If variable is an integer, die($var) returns nothing and is suppose to > return nothing, it takes a string as an argument to echo on death - > die("$var") is what I wanted. > > I need sleep. > > I did finally find the error and fix the record search problem. Meh...just replace the muffler bearings, and be done with it. Frank...what's sleep? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Clarity needed OT
"Daniel Brown" wrote in message news:ab5568160902061416u10e761dal224ec7177d83e...@mail.gmail.com... > On Fri, Feb 6, 2009 at 13:46, Frank Stanovcak > wrote: >> >> Ok...I'm sure that somewhere in here has to be reference to the original >> topic, and php...right? >> >> Frank...there is isn't there? *sigh* > >Stick around you'll see this happens frequently. It's > considered a Good Thing[tm]. It maintains a level of sanity among the > community. > > -- > > daniel.br...@parasane.net || danbr...@php.net > http://www.parasane.net/ || http://www.pilotpig.net/ > Unadvertised dedicated server deals, too low to print - email me to find > out! since when have the words 'sanity', and 'programmer' ever been used together outside of the setup for a joke? Frank...still faithfully taking his pills. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How can I use a function's default arguments but change one of the end ones in the list?
""Boyd, Todd M."" wrote in message news:33bde0b2c17eef46acbe00537cf2a19003d07...@exchcluster.ccis.edu... > -Original Message- > From: Daevid Vincent [mailto:dae...@daevid.com] > Sent: Friday, February 06, 2009 2:26 PM > To: php-general@lists.php.net > Subject: Re: [PHP] How can I use a function's default arguments but > change one of the end ones in the list? > > On Fri, 2009-02-06 at 14:10 +1300, German Geek wrote: > > > I've thought about this problem before but couldn't think of a > > solution either. > > > Well, I guess I *did* think of a solution, it just happens that PHP > doesn't do "the logical thing"(tm) > > ;-) > > I would hope the PHP developers would implement this idea for a future > version. The concept is simple, just specify which parameters in the > function call you want to change and leave the others as their default. > > I've added it here: http://bugs.php.net/bug.php?id=47331 with comments > about similar/related bugs. > > Feel free to vote on this. I think it's a necessary addition to the > language and often a source of frustration for me in large projects > especially where functions get older and older and more parameters are > needed to maintain backwards compatibility yet get new functionality > too. Just tell 'em that .NET already has it; that'll light a fire under them! :D C# can do function calls like: FunctionName(VariableName:=Value); I wholeheartedly prefer PHP to .NET for most things... but you've got to admit--that's a pretty slick feature. Me likey. // Todd I don't remember what it was I was using, but I remember a lang that allowed func(,,,change,,,change) where all the empty comas just went to default. *shrug* -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] long echo statement performance question
"Stuart" wrote in message news:a5f019de0902060932k1ccf2948ua42f3cfa33694...@mail.gmail.com... > 2009/2/6 Frank Stanovcak : >> >> "Richard Heyes" wrote in message >> news:af8726440902060918v6d2f1ee1ia3f839189874...@mail.gmail.com... >>>> Wouldn't have thought so. But for readability, you may find this a >>>> little easier instead: >>> >>> Slight correction: >>> >>> ?> >>> blah >>> >> >>> -- >>> Richard Heyes >>> >>> HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari: >>> http://www.rgraph.org (Updated January 31st) >> >> Actually that's what I'm in the middle of undoing. The first revision >> was >> jumping in and out of PHP mode upwards of 60 times per page on the >> shorter >> pages. I've read a couple places that that can put a huge performace hit >> on >> things, so I was just trying to simplify the code a bit. Plus I don't >> have >> the fast tags, > They're called short tags, not fast tags. There is nothing faster > about them beyond the typing effort required. > > This question, or rather variations of it, appear on this list at > pretty regular intervals. A little while ago I wrote a script to test > the speed of various output methods. > >http://stut.net/projects/phpspeed/?iterations=1 > > As you can see, the difference is so minimal that unless you're doing > it hundreds of thousands of times per script it makes little > difference how you do it. > > In short it's usually not worth optimising at this level since greater > gains are certainly to be had by looking at your interaction with > databases or other external resources. > > -Stuart > > -- > http://stut.net/ Thanks Stuart! So for clarity's sake jumping into and out of PHP parsing mode to echo a var isn't going to do as great a performance hit as these naysayers would have me believe. Good. I like the color coding of my html in my editor that is lost when I have to quote it to get it to echo/print properly! Frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Clarity needed OT
"Eric Butera" wrote in message news:6a8639eb0902061020v793d22b9x1430872c2170b...@mail.gmail.com... > On Fri, Feb 6, 2009 at 1:13 PM, tedd wrote: >> At 1:55 AM +0100 2/6/09, Jochem Maas wrote: >>> >>> that tedd's unlimited educational resources (tutors/courses) might >>> go someway to undoing all the harm Fox News inflicts on the masses. >> >> Or to provide clarity to those who think that Fox News is doing harm. >> >> Alter all, the main-stream news doesn't like reporting unfavorable things >> about their favorites celebrities, do they? Keep in mind that "not paying >> taxes by elected officials" has not met the same threshold of reporting >> "not >> knowing how to speak publicly" has made. >> >> I would rather have all politicians stammer in their speeches and pay >> their >> taxes than the other way around. >> >> In fact, it would be nice if the politicians would get their facts/words >> straight. For example, the "Speaker of the House" just announced that >> "Last >> month over 500 million people lost their jobs" in her support for the >> importance of rushing the approval of the "Stimulus package" (whatever >> that >> is). >> >> In any event, it's interesting to realize that accordingly to her, >> EVERYONE >> in the USA lost their job last month and two thirds of the population >> lost >> it twice! >> >> It would be nice if the "Speaker of the House" at least realized how many >> people actually live in the country she represents. BUT -- you didn't >> hear >> that on the main-stream news -- or -- if you did, they didn't make much >> of >> it, right? However, if Bush had said it, that would have been something >> different -- it would be headline news and on Saturday Night Live. >> >> Clearly, there is a difference in news reporting today. There are no >> impartial sources -- everything has biases and spin. The days of Walter >> Cronkite reporting are over. >> >> Viva opposing opinions. >> >> Cheers, >> >> tedd >> >> -- >> --- >> http://sperling.com http://ancientstones.com http://earthstones.com >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> > > I think people should just be wise enough to understand the world they > live in, how things work, and when people are puppets. There are lots > of ways to find information out there... > > -- > http://www.voom.me | EFnet: #voom Ok...I'm sure that somewhere in here has to be reference to the original topic, and php...right? Frank...there is isn't there? *sigh* -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: going blind for looking...need eyes
"Terion Miller" wrote in message news:37405f850902060944y74a7a5e8ndce0c3456a32d...@mail.gmail.com... > Need eyes on this query, it is not inserting, I am going to highlight > what/where I thought the problem is (there is no " )but when I add the " > it > then changes the syntax coloring on the rest of the code in my editor > which > makes me wonder if I'm wrong... argh. and either way it's not inserting > ... > > - > $sql = "INSERT INTO admin (UserName, Password, Name, Email, Property, > Department, AddWorkOrder, "; >$sql .= "ViewAllWorkOrders, ViewNewOrders, ViewNewArt, > ViewPendingWorkOrders, ViewPendingArtwork, ViewCompletedArt, "; >$sql .= "ViewCompletedWorkOrders, SearchWorkOrder, EditWorkOrder, > DelWorkOrder, ChangeStatus, AddEditAdmin"; >$sql .= ") VALUES( '$UserName', '$Password', '$Name', '$Email', > '$Property', '$Department', '$AddWorkOrder', "; >$sql .= "'$ViewAllWorkOrders', '$ViewNewOrders', '$ViewNewArt', > '$ViewPendingWorkOrders', '$ViewPendingArtwork', "; >$sql .= "'$ViewCompletedArt', '$ViewCompletedWorkOrders', > '$SearchWorkOrder', '$EditWorkOrder', '$DelWorkOrder', "; >$sql .= "'$ChangeStatus', '$AddEditAdmin', '$ViewMyOrders')"; >$result = mysql_query($sql); > Try this for readability $sql = "INSERT INTO admin SET UserName='$UserName', Password='$Password', Name='$Name', Email='$Email', Property='$Property', Department='$Department', AddWorkOrder='$AddWorkOrder', ViewAllWorkOrders='$ViewAllWorkOrders', ViewNewOrders='$ViewNewOrders', ViewNewArt='$ViewNewArt', ViewPendingWorkOrders='$ViewPendingWorkOrders', ViewPendingArtwork='$ViewPendingArtwork', ViewCompletedArt='$ViewCompletedArt', ViewCompletedWorkOrders='$ViewCompletedWorkOrders', SearchWorkOrder='$SearchWorkOrder', EditWorkOrder='$EditWorkOrder', DelWorkOrder='$DelWorkOrder', ChangeStatus='$ChangeStatus', AddEditAdmin='$AddEditAdmin'"; plus there is an extra value with no matching field in the original query. $ViewMyOrders has no field assigned to it. Hope that helps some! Frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] long echo statement performance question
"Bruno Fajardo" wrote in message news:eeb6980b0902060915k2b34ec31nc6ad166e2c544...@mail.gmail.com... In my opinion, you would achieve better results using a template engine, like Smarty (http://www.smarty.net/). In addition, your code would be entirely separated from presentation in a elegant way. 2009/2/6 Frank Stanovcak : > I'm in the process of seperating logic from display in a section of code, > and wanted to make sure I wasn't treading on a performance landmine here, > so > I ask you wizened masters of the dark arts this... > > is there a serious performance hit, or reason not to use long, ie more > than > 30 - 40 lines, comma conjoined echo statments... > > echo 'blah', $var, 'blah', $var2,...ad nauseum > > ... to output mixed html and php var values? If so could you refer me to > a > work around, or better way? > > Frank > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Bruno Fajardo - Desenvolvimento bruno.faja...@dinamize.com - www.dinamize.com Dinamize RS - Porto Alegre-RS - CEP 90420-111 Fones (51) 3027 7158 / 8209 4181 - Fax (51) 3027 7150 I'm going to take a serious look at that for ver 2.0, but unfortunately live beta 1 rollout is monday, and I'm just cleaning house right now. Thanks for the advice though! Frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] long echo statement performance question
"Richard Heyes" wrote in message news:af8726440902060918v6d2f1ee1ia3f839189874...@mail.gmail.com... >> Wouldn't have thought so. But for readability, you may find this a >> little easier instead: > > Slight correction: > > ?> > blah > > -- > Richard Heyes > > HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari: > http://www.rgraph.org (Updated January 31st) Actually that's what I'm in the middle of undoing. The first revision was jumping in and out of PHP mode upwards of 60 times per page on the shorter pages. I've read a couple places that that can put a huge performace hit on things, so I was just trying to simplify the code a bit. Plus I don't have the fast tags, http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] long echo statement performance question
I'm in the process of seperating logic from display in a section of code, and wanted to make sure I wasn't treading on a performance landmine here, so I ask you wizened masters of the dark arts this... is there a serious performance hit, or reason not to use long, ie more than 30 - 40 lines, comma conjoined echo statments... echo 'blah', $var, 'blah', $var2,...ad nauseum ... to output mixed html and php var values? If so could you refer me to a work around, or better way? Frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: preg_match question...
"Shawn McKenzie" wrote in message news:e1.67.59347.e494c...@pb1.pair.com... > bruce wrote: >> hmmm... >> >> tried your preg__match/regex... >> >> i get: >> 0 - 1145 total >> 1 - 1145 >> 2 - l >> >> i would have thought that the 2nd array item should have had "total"... >> > > Probably want this: '#(\d+)(.+)#' > > -- > Thanks! > -Shawn > http://www.spidean.com yep. Relized it after I saw his post. the space doesn't hurt either '#(\d+) (.+)#' Frank...doh! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: preg_match question...
""bruce"" wrote in message news:234801c98863$88f27260$0301a...@tmesa.com... > hi... > > trying to figure out the best approach to using preg_match to extract the > number from the follwing type of line... > > " 131646 sometext follows.." > > basically, i want to extract the number, without the text, but i have to > be > able to match on the "text" > > i've been playing with different preg_match regexs.. but i'm missing > something obvious! > > thoughts/comments.. > How about preg_match('#(\d+)(.)+#',$haystack,$match) if I remember right $match[0] would be all of it $match[1] would be the numbers $match[2] would be the text -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Garbage Collection
""Boyd, Todd M."" wrote in message news:33bde0b2c17eef46acbe00537cf2a19003cb4...@exchcluster.ccis.edu... > -Original Message- > From: tedd [mailto:t...@sperling.com] > Sent: Thursday, February 05, 2009 10:07 AM > To: php-general@lists.php.net > Subject: [PHP] Garbage Collection > > Hi gang: > > A related question to my last "Clarity needed" post. > > I have a tutor table (showing all the tutors), a course table > (showing all the courses), and a course-to-tutor table (showing all > the instances of what tutor teaches what course). > > Okay, everything works. Whenever I want to find out what courses a > specific tutor teaches OR what tutors teach a specific course, I > simply search the course-to-tutor table and bingo out pops the answer. > > Now, how do you handle the situation when a tutor quits or when a > course is no longer offered? > > If I search the course-to-tutor table for all the tutors who teach a > course and find a tutor who is no longer there OR search the > course-to-tutor table for all the courses a tutor teaches and find a > course that is no longer offered, how do you handle the record? > > I realize that if either search turns up nothing, I can check for > that situation and then handle it accordingly. But my question is > more specifically, in the event of a tutor quilting OR removing a > course from the curriculum, what do you do about the course-to-tutor > orphaned record? > > As I see it, my choices are to a) ignore the orphaned record or b) > delete the orphaned record. If I ignore the record, then the database > grows with orphaned records and searches are slowed. If I delete the > orphaned record, then the problem is solved, right? > > I just want to get a consensus of how you people normally handle it. > Do any of you see in danger in deleting an orphaned record? tedd, I believe relational integrity can solve your problem. In MySQL (and maybe MSSQL, but I am less "versed" with that product) you should be able to put a CASCADE option on the DELETE action for your tutor table so that when a record is deleted, its associated record in tutors-to-courses is also deleted. I'm assuming you would want to do the same for removing a record in tutors-to-courses when a course is removed (but not remove the tutor, the same as you do not remove the course itself when the tutor is deleted). I suppose you could also do it yourself with PHP code when a failed link is turned up, but why bother separating DB logic from the DB itself? :) HTH, // Todd I agree with todd. Set up the relationship so that when a record in one of the two master tables is deleted the delete cascades to the linked table. One to many forced update/delete I think it's called if you want to do a search on it. Frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Blank page of hell..what to look for
"Terion Miller" wrote in message news:37405f850902020902j624356ccp4ea869bc45161...@mail.gmail.com... > Is there a certain thing that should be suspected and looked at first when > getting the php blank page of hell > I have errors on and nothing is being output anywhere to lead me in the > right direction, I have a VariableReveal script (one of you provide and > THANK YOU IT HAS BEEN A LIFESAVER) But it is doing nothing today, > yesterday > the page worked today I get the blank page with not a clue in sight > ARGH... > Terion > I'm not sure what your setup is, but I get this frequently when testing on my windows server with IE What I do to get the error is save a blank page over the one that is causing the problem. Load it in the browser, then resave the probelem code, and refresh. I almost always end up having left off a ; or } somewhere, and it just won't report it till I refresh like this. Hope that helps. Frank. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Switch statement Question
"tedd" wrote in message news:p06240801c5aa0ed7d...@[192.168.1.101]... > At 4:16 PM +0100 1/30/09, Jochem Maas wrote: >>tedd schreef: >>> At 4:43 PM -0500 1/29/09, Frank Stanovcak wrote: >>>> >" >>>> >>>> yes...that is legal. as long as the statment resolves to a boolean it >>>> will >>>> work. It's not technically correct, but it does work. >>> >>> There you go again. What's technically correct? >> >>hiya tedd, >> >>you mean to ask "not technically correct" ... I plead >>that it's his statement that is not technically correct. >> >>1. php does a soft comparison ('==' rather than '===') so the >>results of each case expression is auto-cast to a boolean >>(in the case of switch'ing on TRUE), ergo there is no 'as long', >>statements will always resolve to a boolean ... only they may not >>do it in a way that is readily understood by everyone. >> >>2. the php engine specifically allows for 'complex expression' >>cases testing against a boolean switch value ... not best practice >>according to some but very much technically correct according to >>the php implementation. > > > Good explanation -- I think the drum he's beating is that some of use the > switch without actually using the main expression within the control, such > as: > > switch($who_cares) >{ >case $a = $b: >// do something > break; >case $a > 0: > // do something else > break; >case $a < 0: >// do something elser > break; > } > > The control works. > > However to him, technically correct means: > > switch($a) >{ >case 0: >// do something > break; >case 1: > // do something else > break; >case 2: >// do something elser > break; > } > > That's what I think he's advocating. > > Cheers, > > tedd > > > -- > --- > http://sperling.com http://ancientstones.com http://earthstones.com very true since this is the way it is taught in every book. Php, however, allows for other uses that weren't "technically" in the original plan for this command from other languages. The problem is I shave my head, so I have no hairs to split over this one. :) Frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] frameworks
Ok. I've done some reading on frameworks for PHP now, and have this question. What are some good resources for learning about the various frameworks available, and do you recomend one over another? If so why? I started using PHP before frameworks came into the picture, and then had to take my leave for a while. I'm sure this information will also help others out there who are just learning the ropes as well. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Switch statement Question
>"Alice Wei" wrote in message >news:snt101-w587cd616331fc59b84834af0...@phx.gbl... > >Hi, > > I have a code snippet here as in the following: > >//Switch statements between the four options >switch($string) { >case "": >$string= "NOT book.author='All'"; >break; >default: >$string= $string . "AND NOT book.author='All'"; >break; >} > This code does work, but I am wondering if it is possible in the switch > statement clauses for me to do something like case does not equal to a > certain author name if I don't want $string with that content to >be > processed. or, do I always use default in this case? > >Thanks in advance. > >Alice >_ >All-in-one security and maintenance for your PC. Get a free 90-day trial! >http://www.windowsonecare.com/purchase/trial.aspx?sc_cid=wl_wlmail You mean as in... switch($string){ case "": code break; case $string == 'some value': code break; case in_array($string, $somearray): code break; default: code }; yes...that is legal. as long as the statment resolves to a boolean it will work. It's not technically correct, but it does work. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] New to PHP question
"Don Collier" wrote in message news:4980c3d3.8040...@collierclan.com... > > > Paul M Foster wrote: >> See? This is what I'm talking about. >> >> *I* understand what you're saying, Don, and I agree. But this guy is >> just learning PHP from what is arguably not one of the best books on PHP >> (IMO). And you're throwing MVC at him. Let him master the subtleties of >> the language first, then we'll give him the MVC speech. >> >> Yes, I know, they should learn proper programming practices from the >> beginning, blah blah blah. But think back to the first programming >> language you ever learned, when you were first learning it. If someone >> had thrown stuff like this at you, would you have had a clue? I had >> enough trouble just learning the proper syntax and library routines for >> Dartmouth BASIC and Pascal, without having to deal with a lot of >> "metaprogramming" stuff. >> >> This is the problem when you get newbies asking questions on a list >> whose membership includes hardcore gurus. The gurus look at things in >> such a lofty way that answering simple questions at the level of a >> beginner sounds like a dissertation on the subtleties of Spanish art in >> the 1500s. >> >> Just my opinion. >> >> Paul >> > On that note, what would be a better book to learn from? I have always > been a fan of the O'Reilly books, but I am open to differing flavors of > kool-aid. One can never have too many resources. First of all...for **insert deities name here** sake don't drink the kool-aid! I started with the visual series of books just to get the hang of the rudimentry language, and then went right to the online php manual. www. devguru. com isn't bad, but tends to be a bit sparse on explinations. If you are familliar with any programming language google is your friend. php is pretty close to c for ease of refference so googling for like 'switch php' brings up loads of examples and refs. I still don't know anything about this pear, or other frameworks they speak of on here, but I'm sure I will learn it in time. :) Personally I think French art from the 1500's was better any way. Frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: New to PHP question
"Don Collier" wrote in message news:4980ac7e.2080...@collierclan.com... >I am just learning PHP from the O'Reilly "Learning PHP 5" book and I have a >question regarding the formatting of text. Actually it is a couple of >questions. > > First, when I use the \n and run the script from the command line it works > great. When I run the same code in a browser it does not put the newline > in and the text runs together. I know that I can use to do the same > thing, but why is it this way? > > The second question is closely related to the first. When formatting text > using printf the padding works great when running from the command line > but not at all when in a browser. > Here is the code that I am working with: > > $hamburger = 4.95; > $chocmilk = 1.95; > $cola = .85; > $subtotal = (2 * $hamburger) + $chocmilk + $cola; > $tax = $subtotal * .075; > $tip = $subtotal * .16; > $total = $subtotal + $tip + $tax; > print "Welcome to Chez Don.\n"; > print "Here is your receipt:\n"; > print "\n"; > printf("%1d %9s \$%.2f\n", 2, 'Hamburger', ($hamburger * 2)); > printf("%1d %9s \$%.2f\n", 1, 'Milkshake', 1.95); > printf("%1d %9s \$%.2f\n", 1, 'Soda', .85); > printf("%25s: \$%.2f\n",'Subtotal', $subtotal); > printf("%25s: \$%.2f\n", 'Tax', $tax); > printf("%25s: \$%.2f\n", 'Tip', $tip); > printf("%25s: \$%.2f\n", 'Total', $total); > ?> > > Thanks for the help everyone. It has specifically to do with how the browser renders the page. part of the spec for rendering is that newlines are ignored, and the only way to get a line to break in a browser window is with the use of . As for the padding this is the same issue. In Browswer rendering all white space except the first one is ignored, and you have to use for aditionall spaces. ie: 3 space would be ' ' or ' ' Hope that helps! Frank. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: validating directory and file name with preg_match
""Boyd, Todd M."" wrote in message news:33bde0b2c17eef46acbe00537cf2a19003bb9...@exchcluster.ccis.edu... > -Original Message- > From: Frank Stanovcak [mailto:blindspot...@comcast.net] > Sent: Wednesday, January 28, 2009 1:04 PM > To: php-general@lists.php.net > Subject: [PHP] Re: validating directory and file name with preg_match > > > ""Frank Stanovcak"" wrote in message > news:a8.d6.08436.5cf80...@pb1.pair.com... > > I'm limiting access to certain proceedures based on the file trying > to use > > them, and the directory they are located in on my server. Right now > I am > > using two preg_match statments as you will see. What I want to know > is > > this. Is there a way to write a single regex for this that will > supply > > the file name as a match, and only return if the directory is valid? > > > > > > //make sure we are calling from the propper directory, and get the > file > > name that included to determine > > //database access needs > > > preg_match('#^C:Inetpubwwwrootfolder(entry|edit)(\w > *\\.(php|pdf))#i', > > $included_files[0], $check1); > > > preg_match('#^C:Inetpubwwwrootfolder(\w*\\.(php|pdf))#i > ', > > $included_files[0], $check2); > > if(isset($check1)){ > > if(is_array($check1)){ > > $matches[4] = $check1[2]; > > }; > > unset($check1); > > }; > > if(isset($check2)){ > > if(is_array($check2)){ > > $matches[4] = $check2[1]; > > }; > > unset($check2); > > }; > > if(isset($matches[4]){ > > more code here > > }; > > > > --Then Robyn Sed-- > Looks like the difference between the 2 patterns is the > '(entry|edit)' part -- couldn't you make that optional and combine > it into one expression? Ie, '((entry|edit))*' > > As for returning the filename, basename() is your friend. > > R > --end-- > > I would use basename, but I want only the two file types specified to > trigger a return. They are the only two valid php types on this > server. > > Your suggestion worked like a charm! Thank you very much! Upon reading this, I realize that I over-thought my suggestion. /^c:\\inetpub\\wwwroot\\folder\\(?:entry|edit)\\(\w+\.(?:php|pdf))$/i That's my final answer. :) // Todd Thank you too Todd. I don't know why, but for some reason if I don't double escape the slashes it fails everytime. I never knew you could stop the return with ?: that will help a great deal in the future! Frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: validating directory and file name with preg_match
""Frank Stanovcak"" wrote in message news:a8.d6.08436.5cf80...@pb1.pair.com... > I'm limiting access to certain proceedures based on the file trying to use > them, and the directory they are located in on my server. Right now I am > using two preg_match statments as you will see. What I want to know is > this. Is there a way to write a single regex for this that will supply > the file name as a match, and only return if the directory is valid? > > > //make sure we are calling from the propper directory, and get the file > name that included to determine > //database access needs > preg_match('#^C:Inetpubwwwrootfolder(entry|edit)(\w*\\.(php|pdf))#i', > > $included_files[0], $check1); > preg_match('#^C:Inetpubwwwrootfolder(\w*\\.(php|pdf))#i', > $included_files[0], $check2); > if(isset($check1)){ > if(is_array($check1)){ > $matches[4] = $check1[2]; > }; > unset($check1); > }; > if(isset($check2)){ > if(is_array($check2)){ > $matches[4] = $check2[1]; > }; > unset($check2); > }; > if(isset($matches[4]){ > more code here > }; > --Then Robyn Sed-- Looks like the difference between the 2 patterns is the '(entry|edit)' part -- couldn't you make that optional and combine it into one expression? Ie, '((entry|edit))*' As for returning the filename, basename() is your friend. R --end-- I would use basename, but I want only the two file types specified to trigger a return. They are the only two valid php types on this server. Your suggestion worked like a charm! Thank you very much! Frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] validating directory and file name with preg_match
I'm limiting access to certain proceedures based on the file trying to use them, and the directory they are located in on my server. Right now I am using two preg_match statments as you will see. What I want to know is this. Is there a way to write a single regex for this that will supply the file name as a match, and only return if the directory is valid? //make sure we are calling from the propper directory, and get the file name that included to determine //database access needs preg_match('#^C:Inetpubwwwrootfolder(entry|edit)(\w*\\.(php|pdf))#i', $included_files[0], $check1); preg_match('#^C:Inetpubwwwrootfolder(\w*\\.(php|pdf))#i', $included_files[0], $check2); if(isset($check1)){ if(is_array($check1)){ $matches[4] = $check1[2]; }; unset($check1); }; if(isset($check2)){ if(is_array($check2)){ $matches[4] = $check2[1]; }; unset($check2); }; if(isset($matches[4]){ more code here }; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Get Money Fast with the Government Grants
"Andrew Williams" wrote in message news:1adf0c280901270134o2f06d0f9kaf3fce2fb4b6c...@mail.gmail.com... > Hi, > Beware of he spam mailer so do not let them spam your money away. > > Andrew > > On Tue, Jan 27, 2009 at 9:18 AM, clive > wrote: > >> Dora Gaskins wrote: >> >>> If you have received this email, take a time to really read it >>> carefully! >>> >>> American Gov Money >>> >> More spam, can't we have the maillist software require people to register >> before posting? >> >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> > > > -- > > Best Wishes > Andrew Williams > --- > 31 Davies Street > W1K 4LP, London, UK > www.NetPosten.dk > OK peeps...who's machine has a cold? Frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: New PHP User with a simple question
"Paul M Foster" wrote in message news:20090126222404.gc18...@quillandmouse.com... > On Mon, Jan 19, 2009 at 04:45:08PM -0500, Christopher W wrote: > >> Dear responders, >> >> I was not sure which post was the best to respond to all of you so I >> chose >> the original. >> >> I wanted to thank you all for taking the time to try and help answer my >> question. I truly appreciate it. >> >> For the record, I have a PHP book and I understand (I think) all the >> variables, functions, conditionals, loops, constants, etc. of PHP. My >> problem, with no computer programming to speak of, was putting those >> variables, functions, conditionals, loops, constants, etc. together to >> make >> it do things I was hoping to accomplish. I am hoping that with reading >> more >> tutorials, looking at other people's php files and lots of practicing I >> may >> one day "get it." >> >> I am truly grateful for all the time all of you spent in trying to help. > > Glad you found a solution (from Kevin). > > Don't worry about the sniping on the list. A lot of programmer types can > get prickly with each other about details. > > Paul > -- > Paul M. Foster Paul...leave Ash alone. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Make New-Age Money Online with Google
""Martin Zvarík"" wrote in message news:66.93.12464.913ee...@pb1.pair.com... > Ashley Sheridan napsal(a): >> On Sat, 2009-01-24 at 10:14 +0200, Dora Elless wrote: >>> That's why I am sending this email only to people I know and care >>> about. >> And they send to a mailing list. Come again? >> >> >> Ash >> www.ashleysheridan.co.uk >> > > The sad thing though is that there will be always people who believe this > shit and pays... > > Like my dad bought a little book "Take off your glasses" for $10 and he > received 2 papers saying: sun is our best friend, look right into it and > it will heal your eyes. just like that little pile of plutonium in my back yard is great for warming your butt on...Have a seat! ATTENTION SHORT SITED, HUMORLESS, MORONS IN THE GOVT...that should cover everyone...THIS IS A JOKE. I DO NOT OWN... 1. A YARD 2. A HOUSE FOR THE YARD I DON'T OWN 3. ANY RADIOLOGICAL MATERIALS 4. A SINGLE FRICKING THING REALLY SINCE YOU TAX MOST OF IT OUT OF ME ALREADY! NOW GO FIND SOMETHING MORE USEFULL TO DO WITH ALL MY TAX DOLLARS! frank. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dirty Button
"tedd" wrote in message news:p06240802c5a28dd01...@[192.168.1.101]... > At 3:41 PM -0600 1/25/09, Micah Gersten wrote: >>tedd wrote: >>> At 7:02 PM + 1/25/09, Ashley Sheridan wrote: Tedd, what about having it reset if you then go back and select the original option without submitting, i.e. you originally selected and submitted on A, then selected B, then selected A again? >>> >>> That's a good idea. >>> >>> Now I just have to figure out how to make it all-encompassing enough >>> to handle one, or more, selection-control and compare current values >>> with the values that were previously selected. >>> >>> Oh, the holes we dig for ourselves. :-) >>> >>> Cheers, >>> >>> tedd >>> >>What about an onChange javascript function that checks all the boxes >>that need input. Call it whenever any of the inputs change and in the >>onSubmit for the form, check it again. > > I currently use onClick for the select control and that works well enough. > It's not the trigger that's the issue. > > If I decide to do that, then I have to loop through all the tag ID's, get > the current values, and check them against what was presented. This just > requires some thinking and I'm about all thought-out for the moment -- the > end of another 12 hour day. > > Thanks for your input. > > Cheers, > > tedd > > -- > --- > http://sperling.com http://ancientstones.com http://earthstones.com Getting the previously sellected is easy. When php renders the page have them inserted as javascript vars. Why not use an on change event that checks the value selected against the orig, and then depending on the selection starts a timer, say 5 - 15 sec. If the user does nothing else on any of the controls just resubmit for them. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] can I do this without eval?[RESOLVED]
"Nathan Nobbe" wrote in message news:7dd2dc0b0901221048g2f089cf9s36ecb9a5b35ab...@mail.gmail.com... > > yeah, id try call_user_func_array(), > > omit the line to create a string out of the $params, then merge the later > arguments into an array w/ the first 2 args > > #$params = implode(", ", $params); > $check = call_user_func_array('mysqli_stmt_bind_param', > array_merge(array($stmt, $ptype), $params)); > > something like that i think should do the trick. > > -nathan > Ok. I only had to make minimal chnages to the offered solution...highlighted below...I would still appreciate anyone letting me know if my understanding of call_user_func_array() is incorrect though. :) Thanks everyone! Frank //put the string fields directly in as we will be preparing the sql statment //and that will protect us from injection attempts if($continue){ foreach($stringfields as $value){ $FILTERED[$value] = $_POST[$value]; }; }; //ok...we've made it this far, so let's start building that update query! $vartype = ''; if($continue){ //start building the SQL statement to update the bol table $sqlstring = "UPDATE bol SET"; //initialize a variable to let us know this is the first time through on //the SET construction $i = true; //step through all the FILTERED values to build the SET statment //and accompanying bind statment foreach($FILTERED as $key=>$value){ //make sure we don't put a comma in the first time through if($i){ $sqlstring .= " $key = ?"; $i = false; }else{ $sqlstring .= ", $key = ?"; }; //build the list of types for use durring the mysqli perepared statments switch($key){ case in_array($key, $stringfields): $ptype[] = 's'; break; case in_array($key, $doublefields): $ptype[] = 'd'; break; default: $ptype[] = 'i'; }; }; //make sure we only update the row we are working on $sqlstring .= ' WHERE BoL=' . $FILTERED['BoL']; //connect to the db include('c:\inetpub\security\connection.php'); //ok...let's do this query //use mysqli so we can use a prepared statment and avoid sql insert attacks $stmt = mysqli_prepare($iuserConnect, $sqlstring); if(!$stmt){ die(mysqli_stmt_error($stmt)); }; //implode the field types so that we have a useable string for the bind $ptype = implode('', $ptype); <> <- I completely did away with the $param and inserted --> <- $FILTERED directly and everything worked great! --> <> //bind the variables using a call to call_user_func_array to put all the //$FILTERED variables in $check = call_user_func_array('mysqli_stmt_bind_param', array_merge(array($stmt, $ptype), $FILTERED)); if(!$check){ die(mysqli_stmt_error($stmt) . ''); }; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] can I do this without eval?
"Nathan Nobbe" wrote in message news:7dd2dc0b0901221048g2f089cf9s36ecb9a5b35ab...@mail.gmail.com... > On Thu, Jan 22, 2009 at 8:35 AM, Frank Stanovcak > wrote: > >> I'm trying to build a prepared statment and dynamically bind the >> variables >> to it since I use this on severaly different pages I didn't want to build >> a >> huge bind statement hard coded on each page and then have to maintain it >> every time there was a change. >> >> I despise having to use eval() and was hoping one of you had stumbled >> upon >> this and found a better workaround for it. >> >> I've seen references to call_user_function_array, but couldn't find a >> tutorial, or description that could make me understand how to use it. >> I think the big problem with all of them was they expected me to know >> oop, >> and that is on my plate to learn after I finnish this project. >> >> >> Frank >> >> >> //initialize a variable to let us know this is the first time through on >> //the SET construction >> $i = true; >> >> //step through all the FILTERED values to build the SET statment >> foreach($FILTERED as $key=>$value){ >> >> //make sure we single quote the string fields >> if($i){ >> $sqlstring .= " $key = ?"; >> $i = false; >> }else{ >> $sqlstring .= ", $key = ?"; >> }; >> >> //build the list of variables to bound durring the mysqli prepared >> staments >> $params[] = "\$FILTERED['" . $key . "']"; >> >> //build the list of types for use durring the mysqli perepared statments >> switch($key){ >> case in_array($key, $stringfields): >> $ptype[] = 's'; >> break; >> >> case in_array($key, $doublefields): >> $ptype[] = 'd'; >> break; >> >> default: >> $ptype[] = 'i'; >> }; >> }; >> >> //make sure we only update the row we are working on >> $sqlstring .= ' WHERE BoL=' . $FILTERED['BoL']; >> >> //connect to the db >> include('c:\inetpub\security\connection.php'); >> >> //ok...let's do this query >> //use mysqli so we can use a prepared statment and avoid sql insert >> attacks >> $stmt = mysqli_prepare($iuserConnect, $sqlstring); >> if(!$stmt){ >> die(mysqli_stmt_error($stmt)); >> }; >> >> //implode the two variables to be used in the mysqli bind statment so >> they >> are in >> //the proper formats >> $params = implode(", ", $params); >> $ptype = implode('', $ptype); >> >> <---> >> <- is there a better way to accomplish this? -> >> <---> >> //run an eval to build the mysqli bind statment with the string list of >> variables >> //to be bound >> eval("\$check = mysqli_stmt_bind_param(\$stmt, '$ptype', $params);"); >> if(!$check){ >> die(mysqli_stmt_error($stmt) . ''); >> }; >> > > yeah, id try call_user_func_array(), > > omit the line to create a string out of the $params, then merge the later > arguments into an array w/ the first 2 args > > #$params = implode(", ", $params); > $check = call_user_func_array('mysqli_stmt_bind_param', > array_merge(array($stmt, $ptype), $params)); > > something like that i think should do the trick. > > -nathan > Thanks Nathan! Just to make sure I understand call_user_func_array, and how it opperates. It's first paramer is the name of the function...any function, which is part of what made it so confusing to me...and the second paramter is an array that will be used to populate the the parameters of the called function as a comma seperated list. Please tell me if I got any of that wrong. This is how I learn! Frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Military <-> Standard times
"Richard Heyes" wrote in message news:af8726440901220050i71d99bf7m5425620f67350...@mail.gmail.com... >> PS - I think the best ever name for a Exception class is 'Tantrum': >> >>throw new Tantrum('Ra Ra Ra Aaaargh'); > > Lol. > > -- > Richard Heyes > > HTML5 Graphing for Firefox, Chrome, Opera and Safari: > http://www.rgraph.org (Updated January 17th) I got tired of an app throwing errors about one line of code that needed to be the way it was so I set up an error handeling routine called just_f*ing_die() once. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] can I do this without eval?
I'm trying to build a prepared statment and dynamically bind the variables to it since I use this on severaly different pages I didn't want to build a huge bind statement hard coded on each page and then have to maintain it every time there was a change. I despise having to use eval() and was hoping one of you had stumbled upon this and found a better workaround for it. I've seen references to call_user_function_array, but couldn't find a tutorial, or description that could make me understand how to use it. I think the big problem with all of them was they expected me to know oop, and that is on my plate to learn after I finnish this project. Frank //initialize a variable to let us know this is the first time through on //the SET construction $i = true; //step through all the FILTERED values to build the SET statment foreach($FILTERED as $key=>$value){ //make sure we single quote the string fields if($i){ $sqlstring .= " $key = ?"; $i = false; }else{ $sqlstring .= ", $key = ?"; }; //build the list of variables to bound durring the mysqli prepared staments $params[] = "\$FILTERED['" . $key . "']"; //build the list of types for use durring the mysqli perepared statments switch($key){ case in_array($key, $stringfields): $ptype[] = 's'; break; case in_array($key, $doublefields): $ptype[] = 'd'; break; default: $ptype[] = 'i'; }; }; //make sure we only update the row we are working on $sqlstring .= ' WHERE BoL=' . $FILTERED['BoL']; //connect to the db include('c:\inetpub\security\connection.php'); //ok...let's do this query //use mysqli so we can use a prepared statment and avoid sql insert attacks $stmt = mysqli_prepare($iuserConnect, $sqlstring); if(!$stmt){ die(mysqli_stmt_error($stmt)); }; //implode the two variables to be used in the mysqli bind statment so they are in //the proper formats $params = implode(", ", $params); $ptype = implode('', $ptype); <---> <- is there a better way to accomplish this? -> <---> //run an eval to build the mysqli bind statment with the string list of variables //to be bound eval("\$check = mysqli_stmt_bind_param(\$stmt, '$ptype', $params);"); if(!$check){ die(mysqli_stmt_error($stmt) . ''); }; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Client/Server Printing
"Paul M Foster" wrote in message news:20090120151606.gu18...@quillandmouse.com... > I'd like a side check on what I'm doing to print on our internal > network. > > We have an internal server/site which uses PHP code I've written to > "run" the business-- invoicing, A/P, inventory, etc. Some things, like > invoices and reports, need to be printed. Now remember, the code is on > the server, and we access it from our client machines on our desks. When > we print, we do so to our local printers, attached to the client > machines. > > So the best way I could think of to making printing work was to generate > PDFs of whatever needs to be printed, dump the PDF on the server, and > provide a link to the PDF on the web page. The user clicks on the > generated PDF, and his/her browser opens up Acrobat or xpdf, and prints > from that application to their local machine. > > Is that a reasonable way to implement this? Any better ideas? > > Paul > > -- > Paul M. Foster I'm using fpdf to generate a pdf that is displayed in a seperate window for review prior to printing...sort of like a print preveiw. If you can set the webserver to process .pdf files through php it will display in the adobe reader plug in and all the client has to do is hit print. www. fpdf .com Frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] developers life
"Robert Cummings" wrote in message news:1232447313.30838.5.ca...@localhost... > On Mon, 2009-01-19 at 22:06 +, Nathan Rixham wrote: >> Robert Cummings wrote: >> > On Mon, 2009-01-19 at 21:53 +, Nathan Rixham wrote: >> > >> >> Robert Cummings wrote: >> >> >> >>> On Mon, 2009-01-19 at 21:28 +, Nathan Rixham wrote: >> >>> >> >>>> well just for the hell of it; and because I'm feeling worn.. >> >>>> >> >>>> anybody else find the following true when you're a developer? >> >>>> >> >>>> - frequent bursts of side-tracking onto more interesting subjects >> >>>> - vast amount of inhuman focus, followed by inability to remain >> >>>> focussed >> >>>> - general tendancy to keep taking on projects, often for no good >> >>>> reason >> >>>> - inability to flip out of work mode at 5pm like the rest of the >> >>>> world >> >>>> -- [sub] not feeling normal unless worked you've extra; while other >> >>>> professions demand overtime as little as an extra 15 minutes >> >>>> - constant learning (positive thing) >> >>>> - unlimited skill scope, if its on a computer you'll give it a go >> >>>> - amazing ability to prioritise (the wrong things) >> >>>> - all projects suddenly become uninteresting and all motivation is >> >>>> lost >> >>>> at approx 65-85 percent completion >> >>>> - the code seems more important than the app (even though its not) >> >>>> - lots more but lost interest / focus >> >>>> >> >>> Are you an INTP? >> >>> >> >>> http://www.personalitytest.net/cgi-bin/q.pl >> >>> >> >>> >> >> thanks for that rob, but predicatably I've got to number 26 and >> >> stopped >> >> - penetrating insight, lol >> >> >> > >> > Then your not INTP enough :) An INTP would want to know. >> > >> > Cheers, >> > Rob. >> > >> and finished in 3 sessions: "Your personality type is INTP" shock > > *lol* There ya go! > > Cheers, > Rob. > -- > http://www.interjinn.com > Application and Templating Framework for PHP > huh...I ended up INFP Frank <--realizes he's not like the cool kids. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: developers life
"Nathan Rixham" wrote in message news:32.be.60519.170f4...@pb1.pair.com... > well just for the hell of it; and because I'm feeling worn.. > > anybody else find the following true when you're a developer? > > - frequent bursts of side-tracking onto more interesting subjects > - vast amount of inhuman focus, followed by inability to remain focussed > - general tendancy to keep taking on projects, often for no good reason > - inability to flip out of work mode at 5pm like the rest of the world > -- [sub] not feeling normal unless worked you've extra; while other > professions demand overtime as little as an extra 15 minutes > - constant learning (positive thing) > - unlimited skill scope, if its on a computer you'll give it a go > - amazing ability to prioritise (the wrong things) > - all projects suddenly become uninteresting and all motivation is lost at > approx 65-85 percent completion > - the code seems more important than the app (even though its not) > - lots more but lost interest / focus > > ps: > expectantly installed windows 7 over the weekend, brief moment of > excitement coupled with the thought "i wonder what it's like"; anticlimax > + reality check, it was just a taskbar, start menu and desktop.. you'd > think I'd know by now. > > regards :-) > > i so have more important things to do I have this to say re:win 7 http://xkcd.com/528/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Security question
"VamVan" wrote in message news:12eb8b030901141421u6741b943q396bc784136b7...@mail.gmail.com... > On Wed, Jan 14, 2009 at 2:22 PM, Frank Stanovcak > wrote: > >> This is mostly to make sure I understand how sessions are handled >> correctly. >> As far as sessions are concerned the variable data is stored on the >> server >> (be it in memory or temp files), and never transmitted accross the net >> unless output to the page? So this means I should be able to store the >> username and password for a program in session vars for quick >> validations, >> and if I force rentry of the password for sensitive areas (every time) >> even >> if someone mannages to spoof the sesid all they will have access to is >> non >> sensitive areas? This also assumes I, at least, quick validate at the >> start >> of every page immideately after starting the session. >> >> >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> > Password should never be stored anywhere in clear text. You can store md5 > version in session or database. As long as password is encrypted ure fine > and safe. > > Thanks, > V > Thanks V So if I store the hash in the db, and in the session var then I should be resonably safe provided I salt the hash prior to storing it? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] installing php 5 with pdflib
13 jan 2009 kl. 22.38 skrev Merlin Morgenstern: Hi there, I am still facing trouble with pdflib and php 5. After hours of research I found that I do have to install the pecl package. So I decided to compile it into php staticly like described here: http://www.php-resource.de/handbuch/install.pecl.static.htm The configure command stops with the error: configure: error: pdflib.h not found! Check the path passed to -- with-pdflib=. PATH should be the install prefix directory. actually the file is and always was there. Does it have to be a new version? I am using pdflib 4.x which workes fine in the running php 4.x installation. Thank you for any help, Merlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Are you talking about pdflib lite or the commercial version? Is there any particular reason why you like to compile pdflib directly into PHP? pdflib (at least the commercial version) is available as a .so extension for PHP. See: http://www.pdflib.com/download/pdflib-family/pdflib-7/ Maybe you should download the current version (7) and try to compile your php again. Version 4 seems pretty outdated. //frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Security question
This is mostly to make sure I understand how sessions are handled correctly. As far as sessions are concerned the variable data is stored on the server (be it in memory or temp files), and never transmitted accross the net unless output to the page? So this means I should be able to store the username and password for a program in session vars for quick validations, and if I force rentry of the password for sensitive areas (every time) even if someone mannages to spoof the sesid all they will have access to is non sensitive areas? This also assumes I, at least, quick validate at the start of every page immideately after starting the session. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Quotes in querys
"Ashley Sheridan" wrote in message news:1231962521.3613.13.ca...@localhost.localdomain... > On Wed, 2009-01-14 at 11:17 -0500, MikeP wrote: >> Hello, >> I am trying to get the following to work: >> "Select Netid from Users where Netid = '$_SESSION[phpCAS][user]'" >> Netid is a string type. >> No matter where of if I put the quotes, I still get array[phpCAS] not the >> value. >> If there is anything I still have trouble with after all these years its >> quoting variables. >> Help? >> Thanks >> Mike >> >> >> > I always go with this: > > "Select Netid from Users where Netid = '{$_SESSION[phpCAS][user]}'" > > The curly braces allow PHP to use the full variable you intended. Note > that you may need single quote marks around the text in each square > bracket block or PHP my give you a warning about an unintended string > literal. > > > Ash > www.ashleysheridan.co.uk > even though it might have it's drawbacks I've never had a problem with concat for sql statements. $sqlstmt = "Select Netid from Users where Netid = '" . $_SESSION['phpCAS']['user']} . "'"; Frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php session GC error
So from everything I've read there is no real way to assure a session timeout with out timestamping it myself and dealing with it in code by doing a time compare. bummer. ""Frank Stanovcak"" wrote in message news:57.31.25553.de80d...@pb1.pair.com... > > "Shawn McKenzie" wrote in message > news:e3.00.25553.8560d...@pb1.pair.com... >> Frank Stanovcak wrote: >>> "Nathan Rixham" wrote in message >>> news:496d03d3.2060...@gmail.com... >>>> Frank Stanovcak wrote: >>>>> "Shawn McKenzie" wrote in message >>>>> news:f8.ef.24097.e510d...@pb1.pair.com... >>>>>> Frank Stanovcak wrote: >>>>>>> I'm trying to make sure that my sessions are timed out by my server. >>>>>>> I'm running it on winxp, and my php.ini contains the following >>>>>>> >>>>>>> session.gc_probability = 1 >>>>>>> session.gc_divisor = 1 >>>>>>> >>>>>>> ; After this number of seconds, stored data will be seen as >>>>>>> 'garbage' >>>>>>> and >>>>>>> ; cleaned up by the garbage collection process. >>>>>>> session.gc_maxlifetime = 30 >>>>>>> >>>>>>> I am now getting this error >>>>>>> >>>>>>> PHP Notice: session_start() [function.session-start]: >>>>>>> ps_files_cleanup_dir: >>>>>>> opendir(C:\WINDOWS\TEMP\) failed: No such file or directory (2) in >>>>>>> C:\Inetpub\wwwroot\Envelope1\edit\EditMain.php on line 2 >>>>>>> >>>>>>> What do I have to do to make this work right? >>>>>>> >>>>>>> Frank >>>>>>> >>>>>>> >>>>>> Does C:\WINDOWS\TEMP\ exist? >>>>>> >>>>>> -- >>>>>> Thanks! >>>>>> -Shawn >>>>>> http://www.spidean.com >>>>> Yes it does, well C:\Windows\Temp does, but win isn't case >>>>> sensitive...does it matter to PHP? >>>> try changing it to the correct case then come back and tell us if case >>>> matters? :) >>> ok...let me try it like this. >>> >>> how do I explicitly tell PHP in the ini what directory to use for >>> session >>> storage and cleanup. I've been googling for about an hour now, and am >>> just >>> getting more frustrated. :( >>> >>> The server is a single purpose server, and it will remain that way, so I >>> don't want to have to code ini settings into each page. :) >>> >>> Frank >>> >>> >> Should be session.save_path, but check phpinfo() to see what it's using. >> Should be the path in the error. >> >> -- >> Thanks! >> -Shawn >> http://www.spidean.com > > So if my ini looks like the following I should be able to get rid of any > session data after a preset timelimit? > > session.save_path = "C:\temp" > > ; Whether to use cookies. > session.use_cookies = 1 > > ;session.cookie_secure = > > ; This option enables administrators to make their users invulnerable to > ; attacks which involve passing session ids in URLs; defaults to 0. > ; session.use_only_cookies = 1 > > ; Name of the session (used as cookie name). > session.name = PHPSESSID > > ; Initialize session on request startup. > session.auto_start = 0 > > ; Lifetime in seconds of cookie or, if 0, until browser is restarted. > session.cookie_lifetime = 0 > > ; The path for which the cookie is valid. > session.cookie_path = / > > ; The domain for which the cookie is valid. > session.cookie_domain = > > ; Whether or not to add the httpOnly flag to the cookie, which makes it > inaccessible to browser scripting languages such as JavaScript. > session.cookie_httponly = > > ; Handler used to serialize data. php is the standard serializer of PHP. > session.serialize_handler = php > > ; Define the probability that the 'garbage collection' process is started > ; on every session initialization. > ; The probability is calculated by using gc_probability/gc_divisor, > ; e.g. 1/100 means there is a 1% chance that the GC process starts > ; on each request. > > session.gc_probability = 1 > session.gc_divisor = 1 > > ; After this number of seconds, stored data will be seen as 'garbage' and > ; cleaned up by the garbage collection process. > session.gc_maxlifetime = 30 > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php session GC error
"Shawn McKenzie" wrote in message news:e3.00.25553.8560d...@pb1.pair.com... > Frank Stanovcak wrote: >> "Nathan Rixham" wrote in message >> news:496d03d3.2060...@gmail.com... >>> Frank Stanovcak wrote: >>>> "Shawn McKenzie" wrote in message >>>> news:f8.ef.24097.e510d...@pb1.pair.com... >>>>> Frank Stanovcak wrote: >>>>>> I'm trying to make sure that my sessions are timed out by my server. >>>>>> I'm running it on winxp, and my php.ini contains the following >>>>>> >>>>>> session.gc_probability = 1 >>>>>> session.gc_divisor = 1 >>>>>> >>>>>> ; After this number of seconds, stored data will be seen as 'garbage' >>>>>> and >>>>>> ; cleaned up by the garbage collection process. >>>>>> session.gc_maxlifetime = 30 >>>>>> >>>>>> I am now getting this error >>>>>> >>>>>> PHP Notice: session_start() [function.session-start]: >>>>>> ps_files_cleanup_dir: >>>>>> opendir(C:\WINDOWS\TEMP\) failed: No such file or directory (2) in >>>>>> C:\Inetpub\wwwroot\Envelope1\edit\EditMain.php on line 2 >>>>>> >>>>>> What do I have to do to make this work right? >>>>>> >>>>>> Frank >>>>>> >>>>>> >>>>> Does C:\WINDOWS\TEMP\ exist? >>>>> >>>>> -- >>>>> Thanks! >>>>> -Shawn >>>>> http://www.spidean.com >>>> Yes it does, well C:\Windows\Temp does, but win isn't case >>>> sensitive...does it matter to PHP? >>> try changing it to the correct case then come back and tell us if case >>> matters? :) >> ok...let me try it like this. >> >> how do I explicitly tell PHP in the ini what directory to use for session >> storage and cleanup. I've been googling for about an hour now, and am >> just >> getting more frustrated. :( >> >> The server is a single purpose server, and it will remain that way, so I >> don't want to have to code ini settings into each page. :) >> >> Frank >> >> > Should be session.save_path, but check phpinfo() to see what it's using. > Should be the path in the error. > > -- > Thanks! > -Shawn > http://www.spidean.com So if my ini looks like the following I should be able to get rid of any session data after a preset timelimit? session.save_path = "C:\temp" ; Whether to use cookies. session.use_cookies = 1 ;session.cookie_secure = ; This option enables administrators to make their users invulnerable to ; attacks which involve passing session ids in URLs; defaults to 0. ; session.use_only_cookies = 1 ; Name of the session (used as cookie name). session.name = PHPSESSID ; Initialize session on request startup. session.auto_start = 0 ; Lifetime in seconds of cookie or, if 0, until browser is restarted. session.cookie_lifetime = 0 ; The path for which the cookie is valid. session.cookie_path = / ; The domain for which the cookie is valid. session.cookie_domain = ; Whether or not to add the httpOnly flag to the cookie, which makes it inaccessible to browser scripting languages such as JavaScript. session.cookie_httponly = ; Handler used to serialize data. php is the standard serializer of PHP. session.serialize_handler = php ; Define the probability that the 'garbage collection' process is started ; on every session initialization. ; The probability is calculated by using gc_probability/gc_divisor, ; e.g. 1/100 means there is a 1% chance that the GC process starts ; on each request. session.gc_probability = 1 session.gc_divisor = 1 ; After this number of seconds, stored data will be seen as 'garbage' and ; cleaned up by the garbage collection process. session.gc_maxlifetime = 30 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php session GC error
"Nathan Rixham" wrote in message news:496d03d3.2060...@gmail.com... > Frank Stanovcak wrote: >> "Shawn McKenzie" wrote in message >> news:f8.ef.24097.e510d...@pb1.pair.com... >>> Frank Stanovcak wrote: >>>> I'm trying to make sure that my sessions are timed out by my server. >>>> I'm running it on winxp, and my php.ini contains the following >>>> >>>> session.gc_probability = 1 >>>> session.gc_divisor = 1 >>>> >>>> ; After this number of seconds, stored data will be seen as 'garbage' >>>> and >>>> ; cleaned up by the garbage collection process. >>>> session.gc_maxlifetime = 30 >>>> >>>> I am now getting this error >>>> >>>> PHP Notice: session_start() [function.session-start]: >>>> ps_files_cleanup_dir: >>>> opendir(C:\WINDOWS\TEMP\) failed: No such file or directory (2) in >>>> C:\Inetpub\wwwroot\Envelope1\edit\EditMain.php on line 2 >>>> >>>> What do I have to do to make this work right? >>>> >>>> Frank >>>> >>>> >>> Does C:\WINDOWS\TEMP\ exist? >>> >>> -- >>> Thanks! >>> -Shawn >>> http://www.spidean.com >> Yes it does, well C:\Windows\Temp does, but win isn't case >> sensitive...does it matter to PHP? > > try changing it to the correct case then come back and tell us if case > matters? :) ok...let me try it like this. how do I explicitly tell PHP in the ini what directory to use for session storage and cleanup. I've been googling for about an hour now, and am just getting more frustrated. :( The server is a single purpose server, and it will remain that way, so I don't want to have to code ini settings into each page. :) Frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php session GC error
"Shawn McKenzie" wrote in message news:f8.ef.24097.e510d...@pb1.pair.com... > Frank Stanovcak wrote: >> I'm trying to make sure that my sessions are timed out by my server. >> I'm running it on winxp, and my php.ini contains the following >> >> session.gc_probability = 1 >> session.gc_divisor = 1 >> >> ; After this number of seconds, stored data will be seen as 'garbage' and >> ; cleaned up by the garbage collection process. >> session.gc_maxlifetime = 30 >> >> I am now getting this error >> >> PHP Notice: session_start() [function.session-start]: >> ps_files_cleanup_dir: >> opendir(C:\WINDOWS\TEMP\) failed: No such file or directory (2) in >> C:\Inetpub\wwwroot\Envelope1\edit\EditMain.php on line 2 >> >> What do I have to do to make this work right? >> >> Frank >> >> > > Does C:\WINDOWS\TEMP\ exist? > > -- > Thanks! > -Shawn > http://www.spidean.com Yes it does, well C:\Windows\Temp does, but win isn't case sensitive...does it matter to PHP? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php session GC error
I'm trying to make sure that my sessions are timed out by my server. I'm running it on winxp, and my php.ini contains the following session.gc_probability = 1 session.gc_divisor = 1 ; After this number of seconds, stored data will be seen as 'garbage' and ; cleaned up by the garbage collection process. session.gc_maxlifetime = 30 I am now getting this error PHP Notice: session_start() [function.session-start]: ps_files_cleanup_dir: opendir(C:\WINDOWS\TEMP\) failed: No such file or directory (2) in C:\Inetpub\wwwroot\Envelope1\edit\EditMain.php on line 2 What do I have to do to make this work right? Frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] variable probe revision
"Chris" wrote in message news:496bbd52.2080...@gmail.com... > Frank Stanovcak wrote: >> I posted this once before, and then tried to use it multiple times in a >> script. As you can guess I got a bunch of func already defined errors. >> >> Here is a revision incase anyone decided to use it that will work >> multiple times in the same script for variable watching. >> >> ---Code follows--- >> > if(!function_exists(breakarray)){ > > that needs to be quoted: > > if (!function_exists('breakarray')) { > > otherwise php will generate an E_NOTICE (I think) looking for a constant > called breakarray. > > You do have error_reporting(E_ALL); set yeh? > > -- > Postgresql & php tutorials > http://www.designmagick.com/ > Yep, and thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] variable probe revision
"Ashley Sheridan" wrote in message news:1231796437.3558.62.ca...@localhost.localdomain... > On Mon, 2009-01-12 at 16:11 -0500, Frank Stanovcak wrote: >> I posted this once before, and then tried to use it multiple times in a >> script. As you can guess I got a bunch of func already defined errors. >> >> Here is a revision incase anyone decided to use it that will work >> multiple >> times in the same script for variable watching. >> >> ---Code follows--- >> > if(!function_exists(breakarray)){ >> function breakarray($passed){ >> echo 'keyvalue'; >> foreach($passed as $tkey=>$tvalue){ >>echo '[' , $tkey , ']'; >>if(is_array($tvalue)){ >> if(sizeof($tvalue) > 0){ >> breakarray($tvalue); >> echo ''; >> }else{ >> echo '"' , $tvalue , '"'; >> }; >>}else{ >> echo 'EMPTY '; >>}; >> }; >> echo ''; >> }; >> }; >> >> echo ' variable value '; >> foreach(get_defined_vars() as $key => $value){ >> echo '$',$key ,''; >> if(is_array($value) and $key != 'GLOBALS'){ >> if(sizeof($value) > 0){ >>breakarray($value); >>echo ''; >> }else{ >>echo 'EMPTY '; >> }; >> }else{ >> echo '"' , $value , '"'; >> }; >> }; >> echo ''; >> ?> >> >> >> > Why not put the function in a functions include and use a require_once() > on it? > > > Ash > www.ashleysheridan.co.uk > You could do that, but I prefer to just keep one file in my root, and call it when I need it. It's not meant to stay there as it's only for bug hunting purposes. It's a preference thing I guess. Frank. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] variable probe revision
I posted this once before, and then tried to use it multiple times in a script. As you can guess I got a bunch of func already defined errors. Here is a revision incase anyone decided to use it that will work multiple times in the same script for variable watching. ---Code follows--- keyvalue'; foreach($passed as $tkey=>$tvalue){ echo '[' , $tkey , ']'; if(is_array($tvalue)){ if(sizeof($tvalue) > 0){ breakarray($tvalue); echo ''; }else{ echo '"' , $tvalue , '"'; }; }else{ echo 'EMPTY '; }; }; echo ''; }; }; echo ' variable value '; foreach(get_defined_vars() as $key => $value){ echo '$',$key ,''; if(is_array($value) and $key != 'GLOBALS'){ if(sizeof($value) > 0){ breakarray($value); echo ''; }else{ echo 'EMPTY '; }; }else{ echo '"' , $value , '"'; }; }; echo ''; ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] switch vs elseif
""Eric Butera"" wrote in message news:6a8639eb0901121231r253eed48xe1974d8ef44ab...@mail.gmail.com... > On Mon, Jan 12, 2009 at 3:15 PM, Frank Stanovcak > wrote: >> I've googled, and found some confusing answers. >> I've tried searching the history of the news group, and only found info >> on >> switch or elseif seperately. :( >> >> Strictly from a performance stand point, not preference or anything else, >> is >> there a benefit of one over the other? >> >> >> for($i=0;$i<3;$i++){ >>switch($i){ >>case 0: >>header pg1 code >>break; >>case 1: >>header pg2 code >>break; >> case 3: >>header pg3 code >>break; >>}; >> }; >> >> >> or would that be better served using an if...elseif structure? >> >> Frank >> >> >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> > > This might be of interest in answering your question: > > http://www.suspekt.org/switchtable/ Wow...so if I read that right. the only difference in the root code of PHP is that the pre compiled code is easier to read. PHP actually generates the If...elseif...elseif... structure any way when it compiles the script. ewww. Frank. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] switch vs elseif
"Ashley Sheridan" wrote in message news:1231793310.3558.55.ca...@localhost.localdomain... > On Mon, 2009-01-12 at 15:15 -0500, Frank Stanovcak wrote: >> I've googled, and found some confusing answers. >> I've tried searching the history of the news group, and only found info >> on >> switch or elseif seperately. :( >> >> Strictly from a performance stand point, not preference or anything else, >> is >> there a benefit of one over the other? >> >> >> for($i=0;$i<3;$i++){ >> switch($i){ >> case 0: >> header pg1 code >> break; >> case 1: >> header pg2 code >> break; >> case 3: >> header pg3 code >> break; >> }; >> }; >> >> >> or would that be better served using an if...elseif structure? >> >> Frank >> >> >> > And a switch is a lot neater for dealing with these sorts of things. I > tend never to use if...elseif's at all, and use switches. Like Rob said, > you can fall into further cases below, and it's very simple to add more > at a later date. There is one place where an if...elseif would work and > a switch could not, and that is where you were performing lots of > different logic tests on different variables. Aside from that, I think > any speed benefit one would have over the other would be marginal. > > > Ash > www.ashleysheridan.co.uk > Yeah, I knew about the fall through benefit. :) I was just worried about speed since I have to loop through this several times and generate a pdf from it. Thanks folks! Frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] switch vs elseif
I've googled, and found some confusing answers. I've tried searching the history of the news group, and only found info on switch or elseif seperately. :( Strictly from a performance stand point, not preference or anything else, is there a benefit of one over the other? for($i=0;$i<3;$i++){ switch($i){ case 0: header pg1 code break; case 1: header pg2 code break; case 3: header pg3 code break; }; }; or would that be better served using an if...elseif structure? Frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] switch vs elseif
I've googled, and found some confusing answers. I've tried searching the history of the news group, and only found info on switch or elseif seperately. :( Strictly from a performance stand point, not preference or anything else, is there a benefit of one over the other? for($i=0;$i<3;$i++){ switch($i){ case 0: header pg1 code break; case 1: header pg2 code break; case 3: header pg3 code break; }; }; or would that be better served using an if...elseif structure? Frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Couple of beginner questions
"Ashley Sheridan" <> wrote in message news:1231681793.3527.2.ca...@localhost.localdomain... > On Sun, 2009-01-11 at 08:08 -0500, tedd wrote: >> At 4:16 PM -0500 1/10/09, Paul M Foster wrote: >> >And let me present an alternative perspective. Never do something like: >> > >> > >> > >> >Let Apache (or whatever) interpret HTML as HTML, and don't make it >> >interpret PHP code as HTML. >> > >> >Instead, do: >> > >> >Hello world >> > >> >If you're going to use PHP in the middle of a bunch of HTML, then only >> >use it where it's needed: >> > >> >Hello >> > >> >The contents of the PHP $name variable can't be seen by the HTML, which >> >is why you need to enclose it in a little PHP "island". Naturally, if >> >you're going to put PHP code in the middle of a HTML page, make the >> >extension PHP. Otherwise, Apache will not interpret the PHP code as PHP >> >(unless you do some messing with .htaccess or whatever). It's just >> >simplest to call a file something.php if it has PHP in it. >> > >> >Paul >> >-- >> >Paul M. Foster >> >> Paul: >> >> I agree with you. My example was not well thought out. My point was >> not to mix style elements with data. I should have said: >> >> I would consider the following"bad practice": >> >> $whatever"); ?> >> >> Whereas, the following I would consider "good practice". >> >> >> >> Thanks for keeping me honest. >> >> Cheers, >> >> tedd >> >> >> -- >> --- >> http://sperling.com http://ancientstones.com http://earthstones.com >> > Unless it's something like this: > > echo "$whatever"; > ?> > > Which is unlikely for a header tag, but I know this sort of format gets > used a lot by me and others, especially for setting alternate row styles > on tables (damn browsers and not supporting alternate rows!) > > > Ash > www.ashleysheridan.co.uk > Hey Ash...Why don't you just use CSS subclassing? h1.odd {class stuff here} h1.even {class stuff here} then no escaping, and no need to php your css styles. :) Frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Couple of beginner questions
"VamVan" wrote in message news:12eb8b030901091135u4e17f1f3p24698dbc8f5a2...@mail.gmail.com... > -- Remember as you re still a beginner try to avoid using ?> at the end of > complete PHP code page. or else if you have empty lines at the end of the > file "then you wont see blank page of death in PHP". > I never knew this. Could this be why I get 401 errors if a page throws an error with out a successful run first? as in if I load up the page and there is an error I get 401, but if I upload a blank file with the same name, load that, then upload the errant code and refresh I can suddenly see an error? Frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First steps towards unix and php
*bangs head on wall* Great...just what I need. More acronyms. :P Frank "Paul Scott" wrote in message news:1231506224.7389.7.ca...@paul-laptop... > > On Fri, 2009-01-09 at 14:53 +0200, Paul Scott wrote: >> First choice is ./configure && make && make install, second choice is >> apt >> > > Even better, of course, is the: > > "Yo sysadmin intern! Install for me please and don't screw it > up" > > -- Paul > > > All Email originating from UWC is covered by disclaimer > http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [SOLVED] Re: can a session be used in a query?
if you want to know what is happening...I just did the research...the while statment runs untill the condition is false. This means that, this your case, $row = false. We were getting results in the loop becuase that never happened while it was looping, but to end the loop it proccessed $row = false and then quit setting $row ="" for the rest of the program. if you are expecting more than one row as a result set you may want to think about outputing the result to an array like this while ($row = mysql_fetch_array($result)){ echo $row['AddEditAdmin']; //to print out the value of column 'var1' for each record $rowset[] = $row; } }else{ echo 'No records found.'; } this will give you a zero enum array of all the returned records. they could be accessed with $rowset[n][column name] anywhere in the code. Hope that helps! I know I learned from it. Frank "tedd" wrote in message news:p06240806c58be7e24...@[192.168.1.101]... > Terion Miller wrote: > >>SOLVED: Thanks everyone I got it working it was the loop...took it out and >>now it works like a charm!! Is there a way to mark things solved? > > Normally, when one post [SOLVED] in the subject line, the post also > provides the solution. > > As it is now, a person with a similar problem would have to read the > entire thread to figure out what you did to solve the problem you faced. > They would have to figure out what you meant when you said "...took it out > and now it works like a charm!!" ? > > Would it not be easier just to post the corrected code? > > If possible, always put back more than you take. > > Cheers, > > tedd > > -- > --- > http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] First steps towards unix and php
I've been a microshaft punk for some time now, and am just getting ready to try to step over to unix on one of my own boxes. Does anyone have any suggestions on which flavor would be a good idea to start with? I'm looking mostly for compatibility with php, mysql, and other web based programming languages. Thanks in advance! Frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Because you guys/gals/girls/women/insert pc term hereare a smart lot
And people tell me that I'm just wrong. "Nathan Rixham" wrote in message news:4965dffc.6020...@gmail.com... > Robert Cummings wrote: >> On Thu, 2009-01-08 at 10:51 +, Richard Heyes wrote: until you have to dump it, zip it, ssh it over to another box and then import it back in >>> That's what fag breaks are for... :-) Well, that and smoking. >> >> So... when you're forgetful... have you ever had to bum a fag? >> > > yup, and had my fags bummed, but never my bum fagged - thank god -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: can a session be used in a query?
because you so nicely didn't make fun of me...that much :) I keep it in it's own file and just use it as in include to probe where I need to. --code follows-- keyvalue'; foreach($passed as $tkey=>$tvalue){ echo '[' , $tkey , ']'; if(is_array($tvalue)){ breakarray($tvalue); }else{ echo '"' , $tvalue , '"'; }; }; echo ''; }; echo ' variable value '; foreach(get_defined_vars() as $key => $value){ echo '$',$key ,''; if(is_array($value) and $key != 'GLOBALS'){ if(sizeof($value) > 0){ breakarray($value); echo ''; }else{ echo 'EMPTY '; }; }else{ echo '"' , $value , '"'; }; }; echo ''; ?> - Original Message - From: Ashley Sheridan To: Chris Cc: Frank Stanovcak ; Terion Miller ; php-general@lists.php.net Sent: Wednesday, January 07, 2009 7:23 PM Subject: Re: [PHP] Re: can a session be used in a query? On Thu, 2009-01-08 at 11:09 +1100, Chris wrote: Ashley Sheridan wrote: > On Wed, 2009-01-07 at 18:50 -0500, Frank Stanovcak wrote: >> here is a handy little snippet of code I use. Just include it where you >> want to get a snap shot of all the variables in an app. >> >> ta ta for today boys! > Is it just me, or can anybody else not see the code snippet? :p it was an attachment.. Ah, he would have been better off posting a link, the list blocks attachments! Ash www.ashleysheridan.co.uk
Re: [PHP] Re: can a session be used in a query?
here is a handy little snippet of code I use. Just include it where you want to get a snap shot of all the variables in an app. ta ta for today boys! - Original Message - From: "Chris" To: "Terion Miller" Cc: "Frank Stanovcak" ; Sent: Wednesday, January 07, 2009 5:29 PM Subject: Re: [PHP] Re: can a session be used in a query? I will try that, thanks, I did just try to echo the $row['AddEditAdmin'] results, as I do in the query section and in that it does return YES or NO like I expect, but when I tried to echo it down in the page where I need to use it guess what..no echo... am I cutting my query off somewhere? could it be the while statement Ok tried that and got "*Warning*: Invalid argument supplied for foreach()" var_dump($row); what is in there? -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: can a session be used in a query?
""Terion Miller"" wrote in message news:37405f850901071354p7abd0aa8i7c96cf69c81fa...@mail.gmail.com... >> >$result=mysql_query($query) or die('Queryproblem: ' . mysql_error() >> > . >> > 'Executedquery: ' . $query); >> > if (mysql_num_rows($result) >= '1'){ >> >while ($row = mysql_fetch_assoc($result)){ >> >echo $row['AddEditAdmin']; //to print out the value of >> > column >> > 'var1' for each record >> > } >> > }else{ >> > echo 'No records found.'; >> > } >> > ?> >> > >> > anyone have ideas for me, the session user is working, and I need to >> > use >> > it >> > in the query to pull only that users data I also on the login page >> > where >> I >> > set that session all set it to = $UserName but when I try and use that >> > in >> > the query UserName = $UserName I get an undefined variable error... >> > >> > Really trying but not quite getting it... >> > >> >> >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> Well I am def. further along, the query is working, I can echo fields in > the $row and get the results but when I try and use this: > >if ($row['AddEditAdmin'] == 'YES') { >?> > to sort out what menu items to load it just doesn't do its job. > I would say do this to see if what is in the return is what you are expecting foreach($row as $key=>$value){ echo $key , ': ' , $value , ''; }; just to make sure that the value is "yes", and not 1 or true or something like that. Frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: can a session be used in a query?
One other thought. If you are getting a blank page with no errors or out put at all, I've noticed that I somtimes have to get the page to load successfully before the web server will dish out the error. What I normally do is upload a blank php page with the same name as the one I am working on, load it up, and then upload the page with all the code and refresh. I never really looked into why this was, but it's not that big of a hassle for me. *shrug* Frank ""Terion Miller"" wrote in message news:37405f850901071146i11d33987ga747ef2e4932f...@mail.gmail.com... >I am still struggling with getting my sessions and logins to pull just the > allotted data that each user is allowed... > I have the session working, and can echo it to see that .. what I'm having > problems with is this : I want to pull the data specific to each user > ..right... so far I either get all data regardless of user privileges or I > get nothing.. a blank page, I have tried so many ways but never one that > works: here are a few I have worked with > > This one pulls all data regardless of user level: > error_reporting(E_ALL); > ini_set('display_errors', '1'); > session_start(); > include("inc/dbconn_open.php"); > > > if (empty($_SESSION['AdminLogin']) OR $_SESSION['AdminLogin'] <> 'True' ){ >header ("Location: LogOut.php"); > } > > >$query = "SELECT * FROM admin WHERE AdminID = AdminID"; >$result = mysql_query ($query); >$row = mysql_fetch_object ($result); > ?> > > From there I tried: > > error_reporting(E_ALL); > ini_set('display_errors', '1'); > session_start(); > include("inc/dbconn_open.php"); > > > if (empty($_SESSION['AdminLogin']) || $_SESSION['AdminLogin'] != true){ >header ("Location: LogOut.php"); > } > > >$query = > "SELECT * FROM `admin` WHERE `UserName` = `{$_SESSION['user']}"; >$result = mysql_query ($query); >$row = mysql_fetch_assoc($result); > ?> > > this one didn't work with the if $row -> statements that are used to > select > what menu items to load. > > Now I have this one which loads nothing, nil a blank page: > > $query = "SELECT * FROM admin WHERE UserName = "$_SESSION['user']" "; >$result=mysql_query($query) or die('Queryproblem: ' . mysql_error() . > 'Executedquery: ' . $query); > if (mysql_num_rows($result) >= '1'){ >while ($row = mysql_fetch_assoc($result)){ >echo $row['AddEditAdmin']; //to print out the value of column > 'var1' for each record > } > }else{ > echo 'No records found.'; > } > ?> > > anyone have ideas for me, the session user is working, and I need to use > it > in the query to pull only that users data I also on the login page where I > set that session all set it to = $UserName but when I try and use that in > the query UserName = $UserName I get an undefined variable error... > > Really trying but not quite getting it... > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: can a session be used in a query?
I'm working in the same kind of environment. Make sure you are single quoting string data in MySQL as in $query = "SELECT * FROM admin WHERE UserName = '" . $_SESSION['user'] . "' "; Thats a single quote, double quote, dot, session var, dot, double quote, single quote I wrote that out because I always have a hard time seeing the two types of quotes so close together in code. Frank...let us know if it works! ""Terion Miller"" wrote in message news:37405f850901071146i11d33987ga747ef2e4932f...@mail.gmail.com... >I am still struggling with getting my sessions and logins to pull just the > allotted data that each user is allowed... > I have the session working, and can echo it to see that .. what I'm having > problems with is this : I want to pull the data specific to each user > ..right... so far I either get all data regardless of user privileges or I > get nothing.. a blank page, I have tried so many ways but never one that > works: here are a few I have worked with > > This one pulls all data regardless of user level: > error_reporting(E_ALL); > ini_set('display_errors', '1'); > session_start(); > include("inc/dbconn_open.php"); > > > if (empty($_SESSION['AdminLogin']) OR $_SESSION['AdminLogin'] <> 'True' ){ >header ("Location: LogOut.php"); > } > > >$query = "SELECT * FROM admin WHERE AdminID = AdminID"; >$result = mysql_query ($query); >$row = mysql_fetch_object ($result); > ?> > > From there I tried: > > error_reporting(E_ALL); > ini_set('display_errors', '1'); > session_start(); > include("inc/dbconn_open.php"); > > > if (empty($_SESSION['AdminLogin']) || $_SESSION['AdminLogin'] != true){ >header ("Location: LogOut.php"); > } > > >$query = > "SELECT * FROM `admin` WHERE `UserName` = `{$_SESSION['user']}"; >$result = mysql_query ($query); >$row = mysql_fetch_assoc($result); > ?> > > this one didn't work with the if $row -> statements that are used to > select > what menu items to load. > > Now I have this one which loads nothing, nil a blank page: > > $query = "SELECT * FROM admin WHERE UserName = "$_SESSION['user']" "; >$result=mysql_query($query) or die('Queryproblem: ' . mysql_error() . > 'Executedquery: ' . $query); > if (mysql_num_rows($result) >= '1'){ >while ($row = mysql_fetch_assoc($result)){ >echo $row['AddEditAdmin']; //to print out the value of column > 'var1' for each record > } > }else{ > echo 'No records found.'; > } > ?> > > anyone have ideas for me, the session user is working, and I need to use > it > in the query to pull only that users data I also on the login page where I > set that session all set it to = $UserName but when I try and use that in > the query UserName = $UserName I get an undefined variable error... > > Really trying but not quite getting it... > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Logic puzzle. Not a question. Just for fun
This is verbatim from the manufacturer except I replaced the code info with vanilia filler to keep from getting in trouble with them. See how long it takes you to write the shortest SQL code that returns all State a and State f records. If this seems simple to you remember I have no formal training in logic structure or DB design, and yes I know the answer. E-mail me if you want it. Frank. the value of a status field is given in the sdk text as such... ...This number is determined by adding the following values together: State a = 0 State b = 1 State c = 2 State d = 3 State e = 4 State f = 5 State g = 6 State h = 255 + State i: No = 0 Yes = 256 + State j: No = 0 Yes = 1024 + State k: No = 0 Yes = 4096 + State l: No = 0 Yes = 8192 + State m: No = 0 Yes = 16384 Example: a State a, State i, State k will have a value of 0 + 256 + 4096 = 4352 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Import files from directory
I may be mistaken, but it seems to me you would be better served letting it be file uploaded via php and process it as it arrives. This would save the chron run every 5 min, and dir search headaches. Or is there an issue that requires you to use an ftp transport? "Merlin Morgenstern" wrote in message news:39.7d.07052.f7f92...@pb1.pair.com... > Hi everybody, > > I am running a real estate portal and would like to allow users to upload > their listing from their existing software. They do this with a XML file > which they will upload on a ftp server that places this xml file into a > seperate directory on the file system. > > My basic idea was to run a php scipt triggered by cron every 5 minutes > that checks if there is a new upload and then reads the file and removes > it. Now here is where the problem starts. Imagine if there are 1000 users, > I would need to go through 1000 folders to check for new content. There > must be a better solution to identify the directory that has a new > finished upload. > > Has anybody an idea on how to do this? Thank you for any hint. > > Best regards, > > Merlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Because you guys/gals/girls/women/insert pc term here are a smart lot
So what I'm taking away from this is that I can index a text column, but that is relatively new. Based on experience with technology I'm going to guess it's not a very efficient index or search function yet. CHAR seems to be well entrenched, and the favorite for any column I may need to search against. I just need to be warry of the size limits and account for them in my program and data entry. Does that seem to be the consensus? "Nathan Rixham" wrote in message news:4963388f.5080...@gmail.com... > chris smith wrote: >>> It may be worth mentioning that, IIRC, CHAR is faster due to the fixed >>> length. If you can make your table use a fixed length row size (ie no >>> variable length columns), it'll be faster. >> >> I'd be interested in seeing tests about this.. I doubt there's any >> difference. > > quote: http://dev.mysql.com/doc/refman/5.1/en/data-size.html > For MyISAM tables, if you do not have any variable-length columns > (VARCHAR, TEXT, or BLOB columns), a fixed-size row format is used. *This > is faster but unfortunately may waste some space.* See Section 13.4.3, > MyISAM Table Storage Formats. You can hint that you want to have fixed > length rows even if you have VARCHAR columns with the CREATE TABLE option > ROW_FORMAT=FIXED. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Because you guys/gals/girls/women/insert pc term hereare a smart lot
This would be the winning answer. I've been using text up till now. I'll have to change that. Thank you! "Robert Cummings" wrote in message news:1231185251.4.2.ca...@localhost... > On Mon, 2009-01-05 at 19:15 +, Stuart wrote: >> 2009/1/5 Frank Stanovcak : >> > It's been a while since I've programed (VB was on version 4) I was >> > wondering >> > if any one could tell me what the diff is between char, varchar, and >> > text in >> > mysql. >> > I know this isn't a mysql news group, but since I am using php for the >> > interaction it seemed like the place to ask. Thanks in advance, and >> > have a >> > great day! >> >> char: the space required for the length of the field is allocated for >> each row no matter how much of it is used. >> >> varchar: only the space required for the content of the field is >> allocated per row but these fields are limited to 255 chars (IIRC) in >> length. >> >> text: for all intents and purposes these have unlimited length (4GBish >> IIRC). >> >> There is a page in the MySQL manual that explains all of the data >> formats. Google for mysql data formats and you'll likely get it. > > It's generally worth mentioning that you can usually index char or > varchar, but not text. > > Cheers, > Rob. > -- > http://www.interjinn.com > Application and Templating Framework for PHP > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Because you guys/gals/girls/women/insert pc term here are a smart lot
Thank you. I have a stupid/nasty habit of realizing I can search after I post a question. Problem was I was overwhelmed on google. I was hoping for a simple this type is good for this use because, but bad for other things because. type answer. My mantra around this office is "I'm old not addled damnit!" :) "Stuart" wrote in message news:a5f019de0901051115ree20159tbbcf5b3cb2633...@mail.gmail.com... > 2009/1/5 Frank Stanovcak : >> It's been a while since I've programed (VB was on version 4) I was >> wondering >> if any one could tell me what the diff is between char, varchar, and text >> in >> mysql. >> I know this isn't a mysql news group, but since I am using php for the >> interaction it seemed like the place to ask. Thanks in advance, and have >> a >> great day! > > char: the space required for the length of the field is allocated for > each row no matter how much of it is used. > > varchar: only the space required for the content of the field is > allocated per row but these fields are limited to 255 chars (IIRC) in > length. > > text: for all intents and purposes these have unlimited length (4GBish > IIRC). > > There is a page in the MySQL manual that explains all of the data > formats. Google for mysql data formats and you'll likely get it. > > -Stuart > > -- > http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Because you guys/gals/girls/women/insert pc term here are a smart lot
It's been a while since I've programed (VB was on version 4) I was wondering if any one could tell me what the diff is between char, varchar, and text in mysql. I know this isn't a mysql news group, but since I am using php for the interaction it seemed like the place to ask. Thanks in advance, and have a great day! Frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Question on if() priorities
Thanks. Don't know how I could have missed that. "Maciek Sokolewicz" wrote in message news:49428d51.3090...@php.net... > Frank Stanovcak wrote: >> I can't seem to find a reference to this in the manual, but is there an >> order of precedence for and or xor in an if statement? Kind of like >> PPMDAS or polish notation for math (PPMDAS = Powers. Parenthacies. >> Multiplication...) >> >> I ask because this seems to be working for me, but I want to make sure it >> is doing what I think it is. >> >> (code follows) >> if((($FILTERED['cod1'] == 0) or ($FILTERED['cod1'] == 1)) and >> (($FILTERED['cod2'] == 0) or ($FILTERED['cod2'] == 2)) and >> (($FILTERED['cod3'] == 0) or ($FILTERED['cod3'] == 4))) >> (end code) >> >> which is if either of the first set, and either of the second set, and >> either of the third set is true return true. >> >> Thanks in advance! >> Frank > http://nl.php.net/manual/en/language.operators.php#language.operators.precedence > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Need a brain to bounce some Mysql/DB thoughts off of!!
"Robert Cummings" wrote in message news:1229096146.22284.27.ca...@localhost... > On Fri, 2008-12-12 at 06:34 -0600, Jay Blanchard wrote: >> [snip] >> It's Christmas... the season of giving and tolerance :| >> [/snip] >> >> We will return you to your regularly scheduled Robert Cummings Jan 2nd, >> 2009 > > Are you suggesting I'm not tolerant? Pfff. > > :) > > Cheers, > Rob. > -- > http://www.interjinn.com > Application and Templating Framework for PHP > if you break it down he actually said you are very tollerant, but there is an explicit limiter of Jan 2nd on the degree of tollerance supplied by the said Cummings system. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Question on if() priorities
I can't seem to find a reference to this in the manual, but is there an order of precedence for and or xor in an if statement? Kind of like PPMDAS or polish notation for math (PPMDAS = Powers. Parenthacies. Multiplication...) I ask because this seems to be working for me, but I want to make sure it is doing what I think it is. (code follows) if((($FILTERED['cod1'] == 0) or ($FILTERED['cod1'] == 1)) and (($FILTERED['cod2'] == 0) or ($FILTERED['cod2'] == 2)) and (($FILTERED['cod3'] == 0) or ($FILTERED['cod3'] == 4))) (end code) which is if either of the first set, and either of the second set, and either of the third set is true return true. Thanks in advance! Frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Waste of storage space? [follow-up]
1 nov 2008 kl. 16.27 skrev Michelle Konzack: Hello Frank, Do you use Linux or Windows? Initially, the system I am working on will be installed under Mac OS X Server. If Windows you have already lost since the cluster size of e.g. Windows 2003 is 32 kByte or 64 kByte... If Linux, you can setup the partitoin to use a blocksize of 1, 2, 4 or 8 kByte. I asume you are using Linux and "two or three sentences per text" can not realy large... even 2 kByte is already big for it. I have arround 140 million files on one of my storage server (38 TByte) with a size of some kBytes up to a half GByte and I have set the blocksize to 4 kByte... Calculating the wasted space give me arround 340 GByte... Reducing the blocksize to 2 kByte the wasted space is only 170 GBYte. But I give a f..k on it... Diskspace is cheap (even using 300 GByte SCSI drives) and I realy do not like to reinitialize 10 Raid-5 volumes (each 16 HDD) with 3900 GBytes of usable space I agree, disk space is cheap. And to be honest, I am now convinced that storage space really isn't a serious issue. So, to sum up. Previously I was working with the idea to store both old and new values. But, thanks to what Bastien Koert suggested earlier, the history table now stores changes (=new text) only. I think that this is much more sleek to work with. Besides that, before recording something to the history table, I do some filtering on the new text which means that minor changes are walked over. Thank you all for sharing your ideas. //frank Thanks, Greetings and nice Day/Evening Michelle Konzack Systemadministrator 24V Electronic Engineer Tamay Dogan Network Debian GNU/Linux Consultant -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Printing Web Page
6 nov 2008 kl. 21.21 skrev Patrick Moloney: I'd like to enable my users to print individual web pages from their browser. If they simply select the browser print button they don't get all the text that is displayed in a scrolling text area. The web page is static html and css, in a php file. This might be a good starting point. http://www.alistapart.com/articles/printyourway //frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Waste of storage space?
29 okt 2008 kl. 01.08 skrev Bastien Koert: On Tue, Oct 28, 2008 at 4:24 PM, Frank Arensmeier <[EMAIL PROTECTED]> wrote: Hi all. In short, I am working on a system that allows me to keep track of changes to a large amount of short texts (a couple of thousand text snippets, two or three sentences per text). All text is stored in a database. As soon as a user changes some text (insert, delete, update), this action is recorded. Look at an article on e.g. Wikipedia and click "History". This is more or less what I am trying to accomplish. Right now, my "history" class that takes care of all changes, is working pretty much as I want. The thing is that both the original text and the altered text is stored in the database every time the text is changed. My concern is that this will eventually evolve into a serious problem regarding amount of storage and performance. So, I am looking for a more efficient way to store all changes. Ideas I have come up with so far are: 1) Store the "delta" (=the actual change) of a text change. This could be done by utilizing the Pear package TextDiff. My idea was to compare the old with the new text with help of the TextDiff class. I would then grab the array containing the changes from TextDiff, serialize it and store this data into the db. The problem is that this is every thing else but efficient when it comes to smaller text (the serialized array holding the changes was actually larger than the two texts combined). 2) Do some kind of compression on the text to be stored. However, it seems that the build-in compression functions from PHP5 are more efficient when it comes to large texts. Any other ideas? thank you. //frank ps. I notice that Mediawiki also stores complete articles in the db (every time an article is updated, the hole article is stored in the database). ds. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Save just the new version each time table like record_id //PK relates_to //FK item_text author_id timestamp much easier to work with Yes, maybe it's just as simple as that. Thanks. //frank -- Bastien Cat, the other other white meat
[PHP] Re: Waste of storage space?
29 okt 2008 kl. 00.00 skrev Maciek Sokolewicz: Frank Arensmeier wrote: Hi all. In short, I am working on a system that allows me to keep track of changes to a large amount of short texts (a couple of thousand text snippets, two or three sentences per text). All text is stored in a database. As soon as a user changes some text (insert, delete, update), this action is recorded. Look at an article on e.g. Wikipedia and click "History". This is more or less what I am trying to accomplish. Right now, my "history" class that takes care of all changes, is working pretty much as I want. The thing is that both the original text and the altered text is stored in the database every time the text is changed. My concern is that this will eventually evolve into a serious problem regarding amount of storage and performance. So, I am looking for a more efficient way to store all changes. Ideas I have come up with so far are: 1) Store the "delta" (=the actual change) of a text change. This could be done by utilizing the Pear package TextDiff. My idea was to compare the old with the new text with help of the TextDiff class. I would then grab the array containing the changes from TextDiff, serialize it and store this data into the db. The problem is that this is every thing else but efficient when it comes to smaller text (the serialized array holding the changes was actually larger than the two texts combined). 2) Do some kind of compression on the text to be stored. However, it seems that the build-in compression functions from PHP5 are more efficient when it comes to large texts. Any other ideas? thank you. //frank ps. I notice that Mediawiki also stores complete articles in the db (every time an article is updated, the hole article is stored in the database). ds. Hi Frank, why don't you simply make use of systems specifically designed for such things. eg. CVS or SVN (subversion.tigris.org). You could pretty easily tie it in with your application. It's quite compact, and pretty fast too. - Tul Hi Tul. I think would be an idea worth investigating a little bit more. But what about performance? I am really not that familiar with version control systems like CVS etc. Let's say there are 30 different text snippets with 10 recorded changes each. And I want to see what changes users have made to those snippets. That would be 300 calls to the (filesystem based) CVS system. Would that be overheat? Besides that, in the database I am able to store more information about those recorded changes. E.g. the user ID and the time is currently stored as well. Can this be done with CVS as well? /frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Waste of storage space?
28 okt 2008 kl. 23.56 skrev Chris: 1) Store the "delta" (=the actual change) of a text change. This could be done by utilizing the Pear package TextDiff. My idea was to compare the old with the new text with help of the TextDiff class. I would then grab the array containing the changes from TextDiff, serialize it and store this data into the db. The problem is that this is every thing else but efficient when it comes to smaller text (the serialized array holding the changes was actually larger than the two texts combined). What happens when you want to restore a particular version? You have to go through each edition and apply patches. Could get very messy. Not only that. What would happen if they update TextDiff and all stored serialized arrays got obsolete? The system is aimed to store documents for several years to come. Besides that, doing some advanced search in the "history/revision" table would be very difficult. I'd say you're on the right track in just storing each version. 2) Do some kind of compression on the text to be stored. However, it seems that the build-in compression functions from PHP5 are more efficient when it comes to large texts. All compression techniques (in or out of php) will work better on more text. I noticed that too. //frank -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php