Re: [PHP] read a bunch of files that are in many directors into one string
First, which version of PHP? PHP 5 added a lot of features for reading files. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Richard Kurth wrote: > I am trying to read a bunch of files that are in many directors into > one string > But it will only read one file. > Every file is a number 134328923 but they all start with 13 > They are in 22 directors named 0 to 22 > How can I make the script look in each directory and read each file > into a string that is one line after another. > There is only one line per file they are email address > > $file="/remote/0/13*"; > $data =""; > $fp = fopen($file, "r"); > while(!feof($fp)) { > $data .= fgets($fp, 1024); > } > > echo $data > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] read a bunch of files that are in many directors into one string
Try this: $rootPath = '/remote'; $string = ''; foreach (0..22 as $dirNum) { $dir = "$rootPath/$dirNum"; chdir($dir); $files = glob("13*"); foreach ($files as $file) { $string .= file_get_contents($file); } } echo $string; Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Richard Kurth wrote: > Version 5 >> First, which version of PHP? PHP 5 added a lot of features for reading >> files. >> >> Thank you, >> Micah Gersten >> onShore Networks >> Internal Developer >> http://www.onshore.com >> >> >> >> Richard Kurth wrote: >> >>> I am trying to read a bunch of files that are in many directors into >>> one string >>> But it will only read one file. >>> Every file is a number 134328923 but they all start with 13 >>> They are in 22 directors named 0 to 22 >>> How can I make the script look in each directory and read each file >>> into a string that is one line after another. >>> There is only one line per file they are email address >>> >>> $file="/remote/0/13*"; >>> $data =""; >>> $fp = fopen($file, "r"); >>> while(!feof($fp)) { >>> $data .= fgets($fp, 1024); >>> } >>> >>> echo $data >>> >>> >> >> > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] read a bunch of files that are in many directors into one string
oops. foreach (range(0..22) as $dirNum) :) Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Richard Kurth wrote: > *I get this when I run it > Parse error*: syntax error, unexpected T_DNUMBER in *remove.php* on > line *4 > it does not like the *foreach (0..22 as $dirNum) >> Try this: >> >> $rootPath = '/remote'; >> $string = ''; >> foreach (0..22 as $dirNum) >> { >> $dir = "$rootPath/$dirNum"; >> chdir($dir); >> $files = glob("13*"); >> foreach ($files as $file) >> { >>$string .= file_get_contents($file); >> } >> } >> >> echo $string; >> >> Thank you, >> Micah Gersten >> onShore Networks >> Internal Developer >> http://www.onshore.com >> >> >> >> Richard Kurth wrote: >> >>> Version 5 >>> >>>> First, which version of PHP? PHP 5 added a lot of features for >>>> reading >>>> files. >>>> >>>> Thank you, >>>> Micah Gersten >>>> onShore Networks >>>> Internal Developer >>>> http://www.onshore.com >>>> >>>> >>>> >>>> Richard Kurth wrote: >>>> >>>> >>>>> I am trying to read a bunch of files that are in many directors into >>>>> one string >>>>> But it will only read one file. >>>>> Every file is a number 134328923 but they all start with 13 >>>>> They are in 22 directors named 0 to 22 >>>>> How can I make the script look in each directory and read each file >>>>> into a string that is one line after another. >>>>> There is only one line per file they are email address >>>>> >>>>> $file="/remote/0/13*"; >>>>> $data =""; >>>>> $fp = fopen($file, "r"); >>>>> while(!feof($fp)) { >>>>> $data .= fgets($fp, 1024); >>>>> } >>>>> >>>>> echo $data >>>>> >>>>> >>>> >>> >> >> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] read a bunch of files that are in many directors into one string -- oops again
foreach (range(0,22) as $dirNum) Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Richard Kurth wrote: > *I get this when I run it > Parse error*: syntax error, unexpected T_DNUMBER in *remove.php* on > line *4 > it does not like the *foreach (0..22 as $dirNum) >> Try this: >> >> $rootPath = '/remote'; >> $string = ''; >> foreach (0..22 as $dirNum) >> { >> $dir = "$rootPath/$dirNum"; >> chdir($dir); >> $files = glob("13*"); >> foreach ($files as $file) >> { >>$string .= file_get_contents($file); >> } >> } >> >> echo $string; >> >> Thank you, >> Micah Gersten >> onShore Networks >> Internal Developer >> http://www.onshore.com >> >> >> >> Richard Kurth wrote: >> >>> Version 5 >>> >>>> First, which version of PHP? PHP 5 added a lot of features for >>>> reading >>>> files. >>>> >>>> Thank you, >>>> Micah Gersten >>>> onShore Networks >>>> Internal Developer >>>> http://www.onshore.com >>>> >>>> >>>> >>>> Richard Kurth wrote: >>>> >>>> >>>>> I am trying to read a bunch of files that are in many directors into >>>>> one string >>>>> But it will only read one file. >>>>> Every file is a number 134328923 but they all start with 13 >>>>> They are in 22 directors named 0 to 22 >>>>> How can I make the script look in each directory and read each file >>>>> into a string that is one line after another. >>>>> There is only one line per file they are email address >>>>> >>>>> $file="/remote/0/13*"; >>>>> $data =""; >>>>> $fp = fopen($file, "r"); >>>>> while(!feof($fp)) { >>>>> $data .= fgets($fp, 1024); >>>>> } >>>>> >>>>> echo $data >>>>> >>>>> >>>> >>> >> >> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] read a bunch of files that are in many directors into one string -- oops again
Well, make sure $rootPath is correct for your environment. Also, add a slash after the directory name. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Richard Kurth wrote: > *Now I get this error > Warning*: chdir() [function.chdir]: No error (errno 0) in > *C:\web\easycontactpro\removeemail.php* on line *7* > Where can I find what errno 0 means > it loops through all the directors but does not process any of the files >> foreach (range(0,22) as $dirNum) >> >> Thank you, >> Micah Gersten >> onShore Networks >> Internal Developer >> http://www.onshore.com >> >> >> >> Richard Kurth wrote: >> >>> *I get this when I run it >>> Parse error*: syntax error, unexpected T_DNUMBER in *remove.php* on >>> line *4 >>> it does not like the *foreach (0..22 as $dirNum) >>> >>>> Try this: >>>> >>>> $rootPath = '/remote'; >>>> $string = ''; >>>> foreach (0..22 as $dirNum) >>>> { >>>> $dir = "$rootPath/$dirNum"; >>>> chdir($dir); >>>> $files = glob("13*"); >>>> foreach ($files as $file) >>>> { >>>>$string .= file_get_contents($file); >>>> } >>>> } >>>> >>>> echo $string; >>>> Thank you, >>>> Micah Gersten >>>> onShore Networks >>>> Internal Developer >>>> http://www.onshore.com >>>> >>>> >>>> >>>> Richard Kurth wrote: >>>> >>>> >>>>> Version 5 >>>>> >>>>>> First, which version of PHP? PHP 5 added a lot of features for >>>>>> reading >>>>>> files. >>>>>> >>>>>> Thank you, >>>>>> Micah Gersten >>>>>> onShore Networks >>>>>> Internal Developer >>>>>> http://www.onshore.com >>>>>> >>>>>> >>>>>> >>>>>> Richard Kurth wrote: >>>>>> >>>>>> >>>>>>> I am trying to read a bunch of files that are in many directors >>>>>>> into >>>>>>> one string >>>>>>> But it will only read one file. >>>>>>> Every file is a number 134328923 but they all start with 13 >>>>>>> They are in 22 directors named 0 to 22 >>>>>>> How can I make the script look in each directory and read each file >>>>>>> into a string that is one line after another. >>>>>>> There is only one line per file they are email address >>>>>>> >>>>>>> $file="/remote/0/13*"; >>>>>>> $data =""; >>>>>>> $fp = fopen($file, "r"); >>>>>>> while(!feof($fp)) { >>>>>>> $data .= fgets($fp, 1024); >>>>>>> } >>>>>>> >>>>>>> echo $data >>>>>>> >>>>>>> >>>>>> >>>>> >>>> >> >> > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PUT vs. POST
Per Jessen wrote: > tedd wrote: > > >>> Todd, I just wanted to stress that there is NO way for PHP to access >>> anything on the client. The way you wrote it, you sort of implied >>> that there might be other ways: >>> >>> "PHP by itself cannot access the local file system in a way that >>> allows ..." >>> >>> That's all. >>> >> The above is saying two different things. >> >> 1). "PHP by itself cannot access the local file system" <-- true. >> >> 2) "... there is NO way for PHP to access anything on the client." >> <-- not true. >> > > Statement 2 _is_ 100% true. Sorry, end of discussion for my part. > > > /Per Jessen, Zürich > > No, if you said: .. there is NO way for PHP to access anything *directly* on the client. That's more true. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Incrementing variables based on database data
Why not let the DB do this for you? You can group by whatever column that is and select count(*), column_your_looking_for. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Vinny Gullotta wrote: > Nevermind, I figured it out. I needed to make the if statements use == > instead of = like this: > > if ($i[4] == "IISRESET") { > $iiscount = $iiscount + 1; > } > > etc. =) > > > ""Vinny Gullotta"" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> below is the output I'm seeing along with my code. There are 11425 >> items in the database, many of each of these possible values for >> $i[4], however you'll see from my Output that the $iiscount variable >> is the only one being incremented and it is getting incremented for >> every row in the table. Can anyone see anything I'm doing >> incorrectly? The data in this column in the table is formatted as >> TEXT. Thanks in advance for any help you can provide. =) >> >> 11425 >> 0 >> 0 >> 0 >> 0 >> 0 >> 0 >> 0 >> >> >> $query = "SELECT * FROM table"; >> $result = mysql_query($query) or die(mysql_error()); >> $iiscount = 0; >> $cfcount = 0; >> $nlbcount = 0; >> $srcount = 0; >> $sacount = 0; >> $rebootcount = 0; >> $apccount = 0; >> $othercount = 0; >> >> while($i = mysql_fetch_row($result)) { >> if ($i[4] = "IISRESET") { >> $iiscount = $iiscount + 1; >> } elseif ($i[4] = "CF Restart") { >> $cfcount = $cfcount + 1; >> } elseif ($i[4] = "NLB STOP IISRESET") { >> $nlbcount = $nlbcount +1; >> } elseif ($i[4] = "Service Restart") { >> $srcount = $srcount + 1; >> } elseif ($i[4] = "Restart System Attendant") { >> $sacount = $sacount + 1; >> } elseif ($i[4] = "Reboot") { >> $rebootcount = $rebootcount + 1; >> } elseif ($i[4] = "APC Reboot") { >> $apccount = $apccount + 1; >> } elseif ($i[4] = "Other") { >> $othercount = $othercount + 1; >> } >> } >> echo $iiscount, ""; >> echo $cfcount, ""; >> echo $nlbcount, ""; >> echo $srcount, ""; >> echo $sacount, ""; >> echo $rebootcount, ""; >> echo $apccount, ""; >> echo $othercount, ""; >> ?> >> >> > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Incrementing variables based on database data
Well, MySQL can aggregate the data for you so you don't have to pass it to PHP. It can just give you the results. I suggest reading up on the SELECT COUNT syntax and the GROUP BY syntax in MySQL. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Vinny Gullotta wrote: > Well, what I need to be able to do is then take the numbers of each > count and figure out which is used the most. We use this database to > log actions taken on servers in our network. What my boss wants me to > come up with is a list of which commands are issued the most, which > servers get the most attention, and for each server, which command is > issued the most, and so I was going to kind of do it messy-like as I'm > not really 100% sure of the best way to do it, but my goal was to > create the count variables and then compare them using if statements > to see which one is used the most. If you have a way of doing this > more efficiently, I'd love to hear it. I'm not the best programmer in > the world and I'm kind of just getting back into this stuff, so I'm > all ears for any suggestions you may have =) > > > > > "Micah Gersten" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> Why not let the DB do this for you? You can group by whatever column >> that is and select count(*), column_your_looking_for. >> >> Thank you, >> Micah Gersten >> onShore Networks >> Internal Developer >> http://www.onshore.com >> >> >> >> Vinny Gullotta wrote: >>> Nevermind, I figured it out. I needed to make the if statements use == >>> instead of = like this: >>> >>> if ($i[4] == "IISRESET") { >>> $iiscount = $iiscount + 1; >>> } >>> >>> etc. =) >>> >>> >>> ""Vinny Gullotta"" <[EMAIL PROTECTED]> wrote in message >>> news:[EMAIL PROTECTED] >>>> below is the output I'm seeing along with my code. There are 11425 >>>> items in the database, many of each of these possible values for >>>> $i[4], however you'll see from my Output that the $iiscount variable >>>> is the only one being incremented and it is getting incremented for >>>> every row in the table. Can anyone see anything I'm doing >>>> incorrectly? The data in this column in the table is formatted as >>>> TEXT. Thanks in advance for any help you can provide. =) >>>> >>>> 11425 >>>> 0 >>>> 0 >>>> 0 >>>> 0 >>>> 0 >>>> 0 >>>> 0 >>>> >>>> >>>> $query = "SELECT * FROM table"; >>>> $result = mysql_query($query) or die(mysql_error()); >>>> $iiscount = 0; >>>> $cfcount = 0; >>>> $nlbcount = 0; >>>> $srcount = 0; >>>> $sacount = 0; >>>> $rebootcount = 0; >>>> $apccount = 0; >>>> $othercount = 0; >>>> >>>> while($i = mysql_fetch_row($result)) { >>>> if ($i[4] = "IISRESET") { >>>> $iiscount = $iiscount + 1; >>>> } elseif ($i[4] = "CF Restart") { >>>> $cfcount = $cfcount + 1; >>>> } elseif ($i[4] = "NLB STOP IISRESET") { >>>> $nlbcount = $nlbcount +1; >>>> } elseif ($i[4] = "Service Restart") { >>>> $srcount = $srcount + 1; >>>> } elseif ($i[4] = "Restart System Attendant") { >>>> $sacount = $sacount + 1; >>>> } elseif ($i[4] = "Reboot") { >>>> $rebootcount = $rebootcount + 1; >>>> } elseif ($i[4] = "APC Reboot") { >>>> $apccount = $apccount + 1; >>>> } elseif ($i[4] = "Other") { >>>> $othercount = $othercount + 1; >>>> } >>>> } >>>> echo $iiscount, ""; >>>> echo $cfcount, ""; >>>> echo $nlbcount, ""; >>>> echo $srcount, ""; >>>> echo $sacount, ""; >>>> echo $rebootcount, ""; >>>> echo $apccount, ""; >>>> echo $othercount, ""; >>>> ?> >>>> >>>> >>> > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] More math fun
Robert, when you do yours, it's performing the same function on two different variable types and has to do a conversion before the function works. He was doing a numeric function on a string which might be giving the funky results. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Robert Cummings wrote: > On Tue, 2008-08-12 at 14:59 -0700, Jim Lucas wrote: > >> Jay Blanchard wrote: >> >>> abs($balanceTest) = 15.22 >>> abs($oldLineArray[16]) = 15.22 >>> >>> $diff = abs($balanceTest) - abs($oldLineArray[16]); >>> echo abs($diff) . "\n"; >>> >>> 1.7763568394E-15 >>> >>> WTF? This should be a big fat 0 >>> >>> >> I do not see how it makes any difference if $balanceTest and >> $oldLineArray[16] >> are strings in the beginning. In line that does the subtraction, they would >> have been converted to floats automagically by abs(). If you look at the >> manual for this function, you will see that the returned value is either a >> float or integer bases on the input type. Float would return a float. >> Anything else would return a integer. >> >> BTW - if I setup the following: >> >> > >> $balanceTest = '15.22'; # A string >> $oldLineArray[16] = 15.22; # A float >> >> $diff = abs($balanceTest) - abs($oldLineArray[16]); >> echo abs($diff) . "\n"; >> echo gettype(abs($diff)) . "\n"; >> >> # 1.7763568394E-15 >> >> ?> >> >> I get 0 and 'double' >> > > Yeah, I was probably thinking abs( $balanceTest - $oldLineArray[16] ) > versus what was actually present. But either way, I get 0 doing the > above also when I set up the values... so I have no idea how it's not > working for Jay. > > Cheers, > Rob. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: regex
Take a look at this function, it'll make things a little easier: http://us3.php.net/manual/en/function.parse-str.php Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Philip Thompson wrote: > Figured it out. Just needed to stretch my brain a lil. > > On Aug 13, 2008, at 3:07 PM, Philip Thompson wrote: > >> > function blegh ($subject) { >> // I know this pattern doesn't exactly work >> $pattern = '/(.*).php\?action=([^&].*)/'; > > $pattern = '/(.*).php\?action=([^&]+)+/'; > > >> preg_match ($pattern, $subject, $matches); >> return $matches; >> } >> >> blegh ('somePage.php?action=doSomething&id='); >> ?> >> >> Ok, the important parts that I need to obtain from this are: >> >> somePage >> doSomething >> >> How can you modify the pattern above to grab the action >> appropriately? Sorry, my regex is a lil rusty! >> >> Thanks in advance, >> ~Phil > > Cheers, > ~Philip > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Tool Tip in pdf
Why not wrap the text? Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Subhranil wrote: > Hi all, > > I am creating a pdf where text size of cell is not fixed. > My problem is if one text is too long than that cell then it overlap the > next cell. > > I wish to show the part of the text which are loneger than cell size and put > a tool tip on that cell which show the complete text. > > Is it possible ? Looking for any suggestion. > > Thanks, > Subhranil. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php-gd problems on Ubuntu 8.04
Make sure that your php.ini file for the cli is loading gd. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Chantal Rosmuller wrote: > Hi list, > > I have a PHP problem on Ubuntu 8.04, the php-gd package for ubuntu > doesn't use the gd bundles library for security reasons if I understood > this correctly. I solved it by downloading a php-gd fedora rpm and > converting it to .deb with alien. it works for the apache websites but > not for the commandline. I get the follwoing error: > > > php /path/to/process.php variable1 variable2 > > Warning: Wrong parameter count for strpos() in /path/to/config.php on > line 30 > JpGraph Error This PHP installation is not configured with the GD > library. Please recompile PHP with GD support to run JpGraph. (Neither > function imagetypes() nor imagecreatefromstring() does exist)ro > > does anyone know how to fix this? > > regards Chantal > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP editor for linux
I use Eclipse with PHPEclipse. I think you have to install from source to get PHPEclipse to work right. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com It flance wrote: > Hi, > > What do you think is the best php editor for linux. > > I'm using the Debian distribution. > > Thanks > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_replace strange behaviour, duplicates
Take a look at the negative assertions on this page: http://us2.php.net/manual/en/regexp.reference.php Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Adz07 wrote: > I am trying to nail down a bit of code for changing processor names depending > on matches. > Problem i am having is the replacement takes place then it seems to do it > again replacing the text just replaced as there are similar matches > afterwards. example (easier) > > $string = "The new Intel Core 2 Duo T8300"; > > $patterns = array("/Intel Core 2 Duo/","/Intel Core 2/"); > > $replacements = array("/Intel Core 2 Duo Processor Technology/","/Intel Core > 2 Processor Technology/"); > > I would expect to get the following: > > The new Intel Core 2 Duo Processor Technology T8300 > > but i get > > The new Intel Core 2 Processor Technology Duo Processor Technology T8300 > > I can see why its doing it, reading the string in and making the replacement > but then reading the string in for the next pattern, but i don't want it to > do this. How do i stop preg_replace from reading in the same part of the > string that has been replaced already? > > (it's a bad day! :( ) > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Tool Tip in pdf
Which PDF generator are you using? Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Subhranil wrote: > Hi Micah, > Sorry for late reply. Actually 15th August is our INDEPENDENCE DAY and I was > out of work. > I am a newbie. I have very little knowledge about pdf. Could you please give > some tip for wraping the text > > Thanks, > Subhranil. > > > > Micah Gersten wrote: > >> Why not wrap the text? >> >> Thank you, >> Micah Gersten >> onShore Networks >> Internal Developer >> http://www.onshore.com >> >> >> >> Subhranil wrote: >> >>> Hi all, >>> >>> I am creating a pdf where text size of cell is not fixed. >>> My problem is if one text is too long than that cell then it overlap the >>> next cell. >>> >>> I wish to show the part of the text which are loneger than cell size and >>> put >>> a tool tip on that cell which show the complete text. >>> >>> Is it possible ? Looking for any suggestion. >>> >>> Thanks, >>> Subhranil. >>> >>> >> -- >> 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] Tool Tip in pdf
Here's some code I use in FancyTable; for ($x=0; $xCell($w[$x],5,$textArray[0],'LR',0,'L',$fill); } $this->Ln(4); if (count($newRow) > 0) { for ($x=0; $xCell($w[$x],5,$newRow[$x],'LR',0,'L',$fill); } $this->Ln(); } Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Subhranil wrote: > I am using fpdf. > > > > Micah Gersten wrote: > >> Which PDF generator are you using? >> >> Thank you, >> Micah Gersten >> onShore Networks >> Internal Developer >> http://www.onshore.com >> >> >> >> Subhranil wrote: >> >>> Hi Micah, >>> Sorry for late reply. Actually 15th August is our INDEPENDENCE DAY and I >>> was >>> out of work. >>> I am a newbie. I have very little knowledge about pdf. Could you please >>> give >>> some tip for wraping the text >>> >>> Thanks, >>> Subhranil. >>> >>> >>> >>> Micah Gersten wrote: >>> >>> >>>> Why not wrap the text? >>>> >>>> Thank you, >>>> Micah Gersten >>>> onShore Networks >>>> Internal Developer >>>> http://www.onshore.com >>>> >>>> >>>> >>>> Subhranil wrote: >>>> >>>> >>>>> Hi all, >>>>> >>>>> I am creating a pdf where text size of cell is not fixed. >>>>> My problem is if one text is too long than that cell then it overlap >>>>> the >>>>> next cell. >>>>> >>>>> I wish to show the part of the text which are loneger than cell size >>>>> and >>>>> put >>>>> a tool tip on that cell which show the complete text. >>>>> >>>>> Is it possible ? Looking for any suggestion. >>>>> >>>>> Thanks, >>>>> Subhranil. >>>>> >>>>> >>>>> >>>> -- >>>> PHP General Mailing List (http://www.php.net/) >>>> To unsubscribe, visit: http://www.php.net/unsub.php >>>> >>>> >>>> >>>> >>>> >>> >>> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> >> >> > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_replace strange behaviour, duplicates
You know what's not supposed to be next in the second string, and that's the word Duo. Thank you Micah Gersten onShore Networks Internal Developer http://www.onshore.com Adz07 wrote: > Problem is that a negative assertion assumes i know what is going to come > after the match, but i don't. I am a bit stuck now :( > > > Adz07 wrote: > >> I am trying to nail down a bit of code for changing processor names >> depending on matches. >> Problem i am having is the replacement takes place then it seems to do it >> again replacing the text just replaced as there are similar matches >> afterwards. example (easier) >> >> $string = "The new Intel Core 2 Duo T8300"; >> >> $patterns = array("/Intel Core 2 Duo/","/Intel Core 2/"); >> >> $replacements = array("Intel Core 2 Duo Processor Technology","Intel Core >> 2 Processor Technology"); >> >> I would expect to get the following: >> >> The new Intel Core 2 Duo Processor Technology T8300 >> >> but i get >> >> The new Intel Core 2 Processor Technology Duo Processor Technology T8300 >> >> I can see why its doing it, reading the string in and making the >> replacement but then reading the string in for the next pattern, but i >> don't want it to do this. How do i stop preg_replace from reading in the >> same part of the string that has been replaced already? >> >> (it's a bad day! :( ) >> >> > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Breaking a line in two
If you use wordwrap, you don't need nl2br. See Example 1 for wordwrap. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Lupus Michaelis wrote: > Ron Piggott a écrit : > >> This is 23 characters long. I want added after the 12th character, >> following the first space: > > I guess you want to use wordwrap <http://www.php.net/wordwrap> and > nl2br <http://www.php.net/nl2br>. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Conditional compilation
You can always call a function with a DEBUG flag and execute certain parts if it's set or not. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Robert Cummings wrote: > On Fri, 2008-08-15 at 18:34 -0500, Shawn McKenzie wrote: > >> Herman Gomez wrote: >> >>> Hi, >>> >>> Here is something I used to do in C/C++ to include/exclude automaticaly >>> all debugging code at compiling time: >>> >>> #define debug TRUE >>> #ifdef(debug) >>> //debugging code >>> #endif >>> >>> That way I can include/exclude easily all debugging code in the final >>> compiled code. In PHP I have not been able to find anything like that. >>> The only solution I've found is having this kind of code in every debug >>> code block: >>> >>> if ($debug) { >>> //debugging code >>> } >>> >>> But this means that the debugging code is in the final compiled >>> (interpreted) code, wasting cpu cycles even if there won't be any >>> debugging in production. >>> >>> Does somebody know if there is something like conditional compilation in >>> PHP that I can use? >>> >>> Regards, >>> Herman Gomez >>> Madrid, Spain. >>> >> Well PHP isn't compiled it's interpreted. Still I don't see much diff >> and no overhead between the following: >> >> #ifdef(debug) >> //debugging code >> #endif >> >> ---and--- >> >> if (defined('DEBUG')) { >> //debugging code >> } >> >> I don't think checking a define is cpu intensive or even measurable. >> You could "assume" that it's defined as true or false and: >> >> if (DEBUG === true)) { >> //debugging code >> } >> >> Still, I don't think that even checking $debug is measurable. >> > > That depends on where the conditional exists. In C you can place it > anywhere, including wihtin a tight loop. In PHP you end up having to > either take an overhead penalty or duplicate code to force the > conditional outside of a tight loop. > > Contrast the following: > > > if( DEBUG === true ) > { > for( $i = 0; $i < 100; $i++ ) > { > // Do something common between DEBUG and !DEBUG modes. > // Do something dependent on debug mode. > } > } > else > { > for( $i = 0; $i < 100; $i++ ) > { > // Do something common between DEBUG and !DEBUG modes. > } > } > > ?> > > Versus: > > > for( $i = 0; $i < 100; $i++ ) > { > // Do something common between DEBUG and !DEBUG modes. > > if( DEBUG === true ) > { > // Do something dependent on debug mode. > } > } > > ?> > > Now depending on what "Do something common between DEBUG and !DEBUG > modes" does, it can be a real PITA to do code duplication to optimize > debug mode handling, but on the other hand, you really don't want to > check if DEBUG is enabled 1 million times. > > If I recall though... a few years ago the answer to this question was > that there's no reason why you can't use the C pre-processor to > accomplish the same thing with PHP. The down side though is that then > you lose debugging information such as the real line number on which an > error occurs. > > Cheers, > Rob. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Breaking a line in two
Actually, in HTML the space is irrelevant if you are breaking the line. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Ashley Sheridan wrote: > Unfortunately, the wordwrap function won't do what he needs. He needed > to add a *after* the space, and not replace the space. > > Ash > www.ashleysheridan.co.uk > > > > > Subject: > Re: [PHP] Re: Breaking a line in two > From: > Micah Gersten <[EMAIL PROTECTED]> > Date: > Wed, 20 Aug 2008 10:49:49 -0500 > To: > php-general@lists.php.net > > To: > php-general@lists.php.net > > > If you use wordwrap, you don't need nl2br. See Example 1 for wordwrap. > > Thank you, > Micah Gersten > onShore Networks > Internal Developer > http://www.onshore.com > > > > Lupus Michaelis wrote: > >> Ron Piggott a écrit : >> >> >>> This is 23 characters long. I want added after the 12th character, >>> following the first space: >>> >> I guess you want to use wordwrap <http://www.php.net/wordwrap> and >> nl2br <http://www.php.net/nl2br>. >> >> > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Breaking a line in two
Wordwrap can still keep the space and add the . Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Ashley Sheridan wrote: > In HTML it is, I agree, irrelevant with regards to display, but the > string could be going into an XML file, where the space has some > importance, and as Ron (the original person who asked the question) > asked specifically for the space to be preserved in the string, I > answered the question for him. I only added afterwards here that the > wordwrap function wasn't going to cut it as the topic got trolled up. > > Ash > www.ashleysheridan.co.uk > > > > > Subject: > Re: [PHP] Re: Breaking a line in two > From: > Micah Gersten <[EMAIL PROTECTED]> > Date: > Wed, 20 Aug 2008 11:24:06 -0500 > To: > [EMAIL PROTECTED], PHP General > > To: > [EMAIL PROTECTED], PHP General > > > Actually, in HTML the space is irrelevant if you are breaking the line. > > Thank you, > Micah Gersten > onShore Networks > Internal Developer > http://www.onshore.com > > > Ashley Sheridan wrote: > >> Unfortunately, the wordwrap function won't do what he needs. He needed >> to add a *after* the space, and not replace the space. >> >> Ash >> www.ashleysheridan.co.uk >> >> >> >> >> Subject: >> Re: [PHP] Re: Breaking a line in two >> From: >> Micah Gersten <[EMAIL PROTECTED]> >> Date: >> Wed, 20 Aug 2008 10:49:49 -0500 >> To: >> php-general@lists.php.net >> >> To: >> php-general@lists.php.net >> >> >> If you use wordwrap, you don't need nl2br. See Example 1 for wordwrap. >> >> Thank you, >> Micah Gersten >> onShore Networks >> Internal Developer >> http://www.onshore.com >> >> >> >> Lupus Michaelis wrote: >> >> >>> Ron Piggott a écrit : >>> >>> >>> >>>> This is 23 characters long. I want added after the 12th character, >>>> following the first space: >>>> >>>> >>> I guess you want to use wordwrap <http://www.php.net/wordwrap> and >>> nl2br <http://www.php.net/nl2br>. >>> >>> >>> >> >> > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Breaking a line in two
I tested it, and that's a valid break character. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Ashley Sheridan wrote: > I really don't think it does, and there's no mention of it on the man > page for it, unless your break character is " " rather than just > "" > > Ash > www.ashleysheridan.co.uk > > > > > Subject: > Re: [PHP] Re: Breaking a line in two > From: > Micah Gersten <[EMAIL PROTECTED]> > Date: > Wed, 20 Aug 2008 11:32:03 -0500 > To: > [EMAIL PROTECTED] > > To: > [EMAIL PROTECTED] > CC: > PHP General > > > Wordwrap can still keep the space and add the . > > Thank you, > Micah Gersten > onShore Networks > Internal Developer > http://www.onshore.com > > > > Ashley Sheridan wrote: > >> In HTML it is, I agree, irrelevant with regards to display, but the >> string could be going into an XML file, where the space has some >> importance, and as Ron (the original person who asked the question) >> asked specifically for the space to be preserved in the string, I >> answered the question for him. I only added afterwards here that the >> wordwrap function wasn't going to cut it as the topic got trolled up. >> >> Ash >> www.ashleysheridan.co.uk >> >> >> >> >> Subject: >> Re: [PHP] Re: Breaking a line in two >> From: >> Micah Gersten <[EMAIL PROTECTED]> >> Date: >> Wed, 20 Aug 2008 11:24:06 -0500 >> To: >> [EMAIL PROTECTED], PHP General >> >> To: >> [EMAIL PROTECTED], PHP General >> >> >> Actually, in HTML the space is irrelevant if you are breaking the line. >> >> Thank you, >> Micah Gersten >> onShore Networks >> Internal Developer >> http://www.onshore.com >> >> >> Ashley Sheridan wrote: >> >> >>> Unfortunately, the wordwrap function won't do what he needs. He needed >>> to add a *after* the space, and not replace the space. >>> >>> Ash >>> www.ashleysheridan.co.uk >>> >>> >>> >>> >>> Subject: >>> Re: [PHP] Re: Breaking a line in two >>> From: >>> Micah Gersten <[EMAIL PROTECTED]> >>> Date: >>> Wed, 20 Aug 2008 10:49:49 -0500 >>> To: >>> php-general@lists.php.net >>> >>> To: >>> php-general@lists.php.net >>> >>> >>> If you use wordwrap, you don't need nl2br. See Example 1 for wordwrap. >>> >>> Thank you, >>> Micah Gersten >>> onShore Networks >>> Internal Developer >>> http://www.onshore.com >>> >>> >>> >>> Lupus Michaelis wrote: >>> >>> >>> >>>> Ron Piggott a écrit : >>>> >>>> >>>> >>>> >>>>> This is 23 characters long. I want added after the 12th character, >>>>> following the first space: >>>>> >>>>> >>>>> >>>> I guess you want to use wordwrap <http://www.php.net/wordwrap> and >>>> nl2br <http://www.php.net/nl2br>. >>>> >>>> >>>> >>>> >>> >>> >>> >> >> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Fwd: [PHP] php not reading file properly
If the directory above it doesn't have execute privileges, it won't be able to read it either. Also, why not use the PHP5 function file_get_contents()? Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com sean greenslade wrote: > Thanks for the advice. I changed the perms to 777 and changed the user and > group to apache, but it still won't open. > > > On Wed, Aug 20, 2008 at 3:35 PM, Robbert van Andel <[EMAIL PROTECTED]>wrote: > > >> Does the user your PHP instance runs as have access to the file? It's >> possible that it runs under a different users depending on if you're running >> the script on the terminal or in a web browser. The function fopen will >> return false if the file fails to open. Find out if $fh is equal to false. >> While you're debugging, you might consider changing the display errors >> setting to see what warning fopen generates if the file fails to open. From >> http://us.php.net/fopen >> Errors/Exceptions >> >> If the open fails, the function an error of level *E_WARNING* is >> generated. You may use >> @<http://us.php.net/manual/en/language.operators.errorcontrol.php>to >> suppress this warning. >> >> >> On Wed, Aug 20, 2008 at 12:15 PM, sean greenslade <[EMAIL PROTECTED]>wrote: >> >> >>> I have this snippet of code that is supposed to read the apache access log >>> and display it: >>> >>$myFile = "/var/log/httpd/access_log"; >>>$fh = fopen($myFile, 'r'); >>>$theData = fread($fh, filesize($myFile)); >>>fclose($fh); >>>echo >>>"This weeks apache log (clears every sunday morning):". >>>substr($theData,0,2000); >>> ?> >>> For some reason, it displays the logs when I run the php file thru >>> terminal: >>> php -f /web/apache.php >>> >>> but not when I access it thru the web. when I browse to it, it just >>> displays >>> the static text ("This weeks apache log (clears every sunday morning):"), >>> not the log text. >>> >>> Very confused, >>> zootboy >>> >>> >> > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] testing my being subscribed
You are indeed. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Govinda wrote: > am I subscribed? > > I had to check. The other (php-install) list just sent me emails > (when I tried to post) saying I was abusing the system (even though I > am sure I subscribed properly and received the email confirming that > fact). > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Quick question regarding getcwd() and directory location.
Once you tell apache to load /example/index.php, that's where you are. You might try looking at the $_SERVER['HTTP_REFERER']. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Ólafur Waage wrote: > I'll throw out an example here. > > I have a directory structure of: /var/www/example/ > And in that i have a file: index.php > That file echo's getcwd() and returns: /var/www/example/ > > Now i tell Apache or Lighty that if a directory does not have an > index.php file, that it should use /example/index.php (for example via > DirectoryIndex of Apache) > > Then i make a new directory: /var/www/test/ > And browse to it and it echo's /var/www/example/ since its running > that file via DirectoryIndex > > This is true for all directories i make. Both for Windows and Linux > based servers. > > To my question. > > I am trying to get the full path of the current directory i am in. Not > from where the file is executing. How is that possible so it displays > a full path to that directory (regardless to the server setup)? > > I have tried a variation of things and have gotten mixed results. > Using $_SERVER["SCRIPT_FILENAME"] gives me the index file and the full > path to that. > $_SERVER["DOCUMENT_ROOT"] gets me part of the way but on a hosted > server with multiple domains it only gives me a partial path (rough > example: /var/www/ when the directory is /var/www/domain.com/test/) > And __FILE__ gives me the index.php's path. > I have also tried realpath("."); > And server("pwd"); with no luck. > > Any help would be appreciated. > > Ólafur Waage > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Restore Leading Zeros in Zip Codes
if (strlen($zip) == 4 || strlen($zip) == 9) $zip = "0$zip"; Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Keith Spiller wrote: > Hi, > > RE: Restore Leading Zeros in Zip Codes > > Does anyone happen to have a script that will restore the leading zeros in a > mixed data set of 5 digit zip codes and 10 digit zip+4 codes? Any > suggestions? > > Thanks, > > > Keith > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Restore Leading Zeros in Zip Codes
That's actually not going to work if there's more than 1 zero missing. This is better. if (strlen($zip) < 5) $zip = sprintf('%05d',$zip); else if (strlen($zip) < 10) { $zipArray = explode('-', $zip); $zip = sprintf('%05d',$zipArray[0]); $zip .= "-" . $zipArray[1]; } Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Micah Gersten wrote: > if (strlen($zip) == 4 || strlen($zip) == 9) > $zip = "0$zip"; > > Thank you, > Micah Gersten > onShore Networks > Internal Developer > http://www.onshore.com > > > > Keith Spiller wrote: > >> Hi, >> >> RE: Restore Leading Zeros in Zip Codes >> >> Does anyone happen to have a script that will restore the leading zeros in a >> mixed data set of 5 digit zip codes and 10 digit zip+4 codes? Any >> suggestions? >> >> Thanks, >> >> >> Keith >> >> > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Fwd: [PHP] php not reading file properly
What are the permssions of /var/log and /var/log/httpd? Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com sean greenslade wrote: > Yeah, but it wouldn't read access_log.tmp, which wasn't being written to at > the time of loading. I think the whole logs folder is restricted from php > access. > > On Fri, Aug 22, 2008 at 10:13 AM, Ashley Sheridan > <[EMAIL PROTECTED]>wrote: > > >> The log file was in the process of being written to as you were trying to >> read it. It's a bit like trying to look at a quark. By doing so, you've >> already affected its position. Although, unlike a quark, you can create a >> copy of the log file ;) >> >> Ash >> www.ashleysheridan.co.uk >> >> >> -- Forwarded message -- >> From: "sean greenslade" <[EMAIL PROTECTED]> >> To: php-general@lists.php.net >> Date: Fri, 22 Aug 2008 10:04:07 -0400 >> Subject: Re: Fwd: [PHP] php not reading file properly >> Yeah, I tried changing the perms, and that didn't work. I originally made >> the cron job put the temp copy in the same logs folder, but it refused to >> open that. I changed it to put the temp copy in the web folder, and it can >> read that. I think apache and/or php may have certain restrictions that >> keep >> them from accessing important system folders. >> >> On Fri, Aug 22, 2008 at 3:09 AM, Ashley Sheridan >> <[EMAIL PROTECTED]>wrote: >> >> >>> You can change the permissions on the file, which I believe you said you >>> did. If that didn't work, it must be because you are trying to read from >>> the file at the very same instant that Apache is writing to it logging >>> that you are trying to access it, if that makes sense? >>> >>> Ash >>> www.ashleysheridan.co.uk >>> >>> >>> -- Forwarded message -- >>> From: "sean greenslade" <[EMAIL PROTECTED]> >>> To: php-general@lists.php.net >>> Date: Fri, 22 Aug 2008 02:31:47 -0400 >>> Subject: Re: Fwd: [PHP] php not reading file properly >>> So I made a cron jop to copy the log to the web folder every 5 minutes. >>> That >>> worked fine. It seems that php can't read the /var/log/httpd folder >>> >> without >> >>> root perms. >>> >>> On Wed, Aug 20, 2008 at 7:53 PM, Ashley Sheridan >>> <[EMAIL PROTECTED]>wrote: >>> >>> >>>> Yeah, Apache is still running, but it is the access log you are trying >>>> to read, at the same time that you are Apache is being accessed. >>>> Accessing the log from the terminal will be fine while Apache is >>>> running, as it is unlikely it is being accessed at the very same >>>> instant. Are you able to access other files? Also, have you tried >>>> copying the file to another temporary version from within PHP an >>>> accessing that? If that doesn't work, try executing a Bash script that >>>> copies it someplace. Make sure to run the script in the background, and >>>> maybe add a sleep period to it so that it doesn't interfere with Apache >>>> accessing things. >>>> >>>> Ash >>>> www.ashleysheridan.co.uk >>>> >>>> >>>> -- Forwarded message -- >>>> From: "sean greenslade" <[EMAIL PROTECTED]> >>>> To: "Micah Gersten" <[EMAIL PROTECTED]> >>>> Date: Wed, 20 Aug 2008 19:41:54 -0400 >>>> Subject: Re: Fwd: [PHP] php not reading file properly >>>> Ashley Sheridan wrote: >>>> >>>> >>>>> As it's the Apache access log that you are trying to read in, are you >>>>> >>> sure >>> >>>> that Apache is >not in the process of writing to it as you are >>>> attempting to read from it? That might explain >why it seems to be >>>> >>> empty, >>> >>>> although I would have thought it would just append the data to >the end >>>> >>> of >>> >>>> the file, rather than rewriting the whole thing. >>>> >>>> I dunno. Like I said, I can read it thru the terminal. Apache is still >>>> running then. >>>> >>>> As for Micah's response, that function won't work either. >>>> >
Re: [PHP] Quick question regarding getcwd() and directory location.
You might want to try a Redirect Rule or rewrite which would tell you the HTTP PATH. AFAIK, there is no way to know which directory they tried to access unless you write your own index.php and store it in a session variable. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Ólafur Waage wrote: > Thanks for the reply Micah but i have no interest in the URL. I am > looking for the servers local path to the directory. (example: > /var/www/directory/ or C:\apache\htdocs\directory\) > Also the HTTP_REFERER is empty unless you are linked in from another > location. And then it gives you the URL you came from. > > Ólafur Waage. > > 2008/8/22 Micah Gersten <[EMAIL PROTECTED]>: > >> Once you tell apache to load /example/index.php, that's where you are. >> You might try looking at the $_SERVER['HTTP_REFERER']. >> >> Thank you, >> Micah Gersten >> onShore Networks >> Internal Developer >> http://www.onshore.com >> >> >> >> Ólafur Waage wrote: >> >>> I'll throw out an example here. >>> >>> I have a directory structure of: /var/www/example/ >>> And in that i have a file: index.php >>> That file echo's getcwd() and returns: /var/www/example/ >>> >>> Now i tell Apache or Lighty that if a directory does not have an >>> index.php file, that it should use /example/index.php (for example via >>> DirectoryIndex of Apache) >>> >>> Then i make a new directory: /var/www/test/ >>> And browse to it and it echo's /var/www/example/ since its running >>> that file via DirectoryIndex >>> >>> This is true for all directories i make. Both for Windows and Linux >>> based servers. >>> >>> To my question. >>> >>> I am trying to get the full path of the current directory i am in. Not >>> from where the file is executing. How is that possible so it displays >>> a full path to that directory (regardless to the server setup)? >>> >>> I have tried a variation of things and have gotten mixed results. >>> Using $_SERVER["SCRIPT_FILENAME"] gives me the index file and the full >>> path to that. >>> $_SERVER["DOCUMENT_ROOT"] gets me part of the way but on a hosted >>> server with multiple domains it only gives me a partial path (rough >>> example: /var/www/ when the directory is /var/www/domain.com/test/) >>> And __FILE__ gives me the index.php's path. >>> I have also tried realpath("."); >>> And server("pwd"); with no luck. >>> >>> Any help would be appreciated. >>> >>> Ólafur Waage >>> >>> >>> > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sorting Arrays
I believe you'll need a custom sorting function for this. http://us.php.net/usort Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Tom Shaw wrote: > I'm having a problem sorting my array and wondered if anybody had experience > sorting arrays by their values. What I need to do is resort the array below > > where the most expensive product shipping price starts at position zero no > matter how big the array is. > > > > array(2) { > > [0] => array(48) { > > ["product_id"] => string(2) "34" > > ["product_name"] => string(29) "Bears Ball Cap" > > ["product_ordered_size"] => string(5) "ADULT" > > ["product_sales_price"] => string(8) "11.90" > > ["product_shipping_price"] => string(4) "7.85" > > ["product_shipping_extra"] => string(4) "0.06" > > } > > [1] => array(48) { > > ["product_id"] => string(2) "37" > > ["product_name"] => string(21) "Baldwin L Grand Piano" > > ["product_ordered_size"] => string(5) "Grand" > > ["product_sales_price"] => string(8) "11671.90" > > ["product_shipping_price"] => string(6) "500.00" > > ["product_shipping_extra"] => string(6) "450.00" > > } > > > > Thanks > > > > [EMAIL PROTECTED] > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sorting Arrays
Robert Cummings wrote: > On Fri, 2008-08-22 at 21:04 +0100, Ashley Sheridan wrote: > >> Yeah, a bubble sorting algorithm should fix it, as it essentially only >> a very simple sort required. >> > > Why use bubble sort when you can use usort() function with an arbitrary > handler? > > Cheers, > Rob. > > Exactly. That's one reason why I love PHP. They have functions that do things you have to write subroutines for in other languages. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Quick question regarding getcwd() and directory location.
What is the point of figuring that out? If we knew that, we might be able to help you with a solution. As it stands what you want is not possible AFAIK. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Ólafur Waage wrote: > I am within a certain directory of the server via the browser. > > Example: > > http://www.example.com/foo/bar > would be > /var/www/example.com/foo/bar > > And Apache's DirectoryIndex feature is opening a index.php file that > is located at > /var/www/example.com/test/index.php > > And from that file i need to figure out the full local path of > /foo/bar (which would be /var/www/example.com/foo/bar ) or any other > directory i browse too. > > Ólafur Waage > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Adding a single php file to .htaccess.
You can replace the Python files with .html files that just have a redirect header in them. Then you can just have the php files as .php. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Dotan Cohen wrote: > On one particular server, all *.html files are written in Python. I > uploading a few PHP files to the directory, but they must also have > .html extensions (they are replacing files that _were_ python, but it > is rather important that the filename stay the same and I'd rather > avoid rewrite). I figured that it would be easy enough to add a > separate line in .htaccess for each PHP file, but I'm not getting it > for some reason. This is the .htaccess line that lets the system parse > *.html files as Python: > AddHandler cgi-script .html > > This is what I'm trying to add to have the system parse specific files as PHP: > AddType application/x-httpd-php filename.html > > I know that I am doing something wrong, but I do not know what. Any > ideas? Thanks! > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Quick question regarding getcwd() and directory location.
I said AFAIK. I was under the impression the DirectoryIndex did a redirect. I just tested it and it does not, so you are correct Jochem. He has everything he needs. He'll need the document root and $_SERVER['REQUEST_URI'] to do this. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Jochem Maas wrote: > Micah Gersten schreef: >> What is the point of figuring that out? If we knew that, we might be >> able to help you with a solution. As it stands what you want is not >> possible AFAIK. > > you know wrong. he has all the info needed. > > 1. the document root of the site (/var/www/example.com) > 2. the requested URL (http://www.example.com/foo/bar) > > extract the path from the URL and stick into to the document root, > problem sorted. No? > > do this: > > var_dump($_SERVER, $_REQUEST); > > read the output it contains, it should have everything you > need although you will have to do some munging. > > for more esoteric setups you will have to test the code > for completeness and possible expand it's capability to > be able to tackle those situations. > > take it a step at a time. > > me thinks I made it sound more complicated than it is for > most scenarios ... reading your last post it seems the > answer is (for now) quite straight forward. > >> >> Thank you, >> Micah Gersten >> onShore Networks >> Internal Developer >> http://www.onshore.com >> >> >> >> Ólafur Waage wrote: >>> I am within a certain directory of the server via the browser. >>> >>> Example: >>> >>> http://www.example.com/foo/bar >>> would be >>> /var/www/example.com/foo/bar >>> >>> And Apache's DirectoryIndex feature is opening a index.php file that >>> is located at >>> /var/www/example.com/test/index.php >>> >>> And from that file i need to figure out the full local path of >>> /foo/bar (which would be /var/www/example.com/foo/bar ) or any other >>> directory i browse too. >>> >>> Ólafur Waage >>> >>> >>> >> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP IDE needed
How much RAM do you have? Eclipse is a great IDE. Have you upgraded to 3.4? Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Sascha Braun wrote: > Hi people, > > I have a webproject which is round about 3 GB in size. I was usually > using eclipse to work with the software but over time eclipse became > very instable regarding that project. > > As soon as I open classes with 2000 or more lines of code in it, an out > of memory error occours. > > So I need a new IDE for linux. > > Please tell me which IDE might be a true alternative for projects at > that size. > > Thank you friends, > > kind regards, > > Sascha > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for email validation
That's a very handy extension. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com mike wrote: > > php should have a good check built-in. > > see http://www.php.net/manual/en/function.filter-var.php > > if(!filter_var($var, FILTER_VALIDATE_EMAIL)) { > echo "invalid email"; > } > > some people also go the extra mile and verify the MX record is valid, > or lookup the MX record and even validate the user exists by querying > the mail server. > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Variable name as a string
First, the type is checkbox, not check. Second, you cannot put a value in the brackets for a checkbox group. A checkbox group is passed to PHP automatically as an array. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Maciek Sokolewicz wrote: > Well, this seems easier/cleaner to me: > > 1 > 1 > 1 > 1 > > $my_checked_checkboxes = $_REQUEST['my_checkboxes'];// whichever > you wish, $_GET or $_POST, I don't care right now; you choose. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Variable name as a string
You cannot have anything in the brackets for the name in a checkbox group. The brackets specify that it is an array. The name of the array is the key in $_POST that contains the values of the checkbox group that were checked. You can have as many groups as you like. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Shawn McKenzie wrote: > I guess you missed my last post, it was maybe the first or second > reply to this thread: > > value="1" > > > Then on post you have a $_POST['data'] array that contains the > field_names as keys and the checkbox values as values. > > That's why I was wondering if I was missing something. > > -Shawn > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP IDE needed
That's an opinion that you state as fact. I use an IDE for PHP for function referencing is very PHP. The open declaration feature is very helpful in eclipse. Also, subeclipse is great too. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Dotan Cohen wrote: > Non-compiled languages need only a text editor. Text editors have > features such as code completion, library reference, code > highlighting, code folding, multiple document interface, etc. > > Compiled languages need a compiler. Cooperation between the compiler > and the text editor is done in an IDE. That's what the I in > _Integrated_ Development Environment means. If you don't need to > integrate with anything (specifically, a compiler) then you don't need > an integrated development environment. > > >> This question comes up so often it's painful, but I don't think I've ever >> actually answered it. I use TextMate most of the time, Coda for remote >> projects and occasionally Zend Studio when I need to step through code. I've >> also gone through phases of using vi, vim, pico, nano, emacs, epsilon, kate, >> notepad(!), notepad2, aptana, eclipse, and many more I can't remember. It's >> text, use what works for you. >> >> > > I've also rarely answered this question, and I don't know why I spoke up > today. > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP IDE needed
I've been on the list for over a month and I post quite a bit. I do the same thing apparently. See 'Re: [PHP] Re: Variable name as a string' thread. :-) Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Dotan Cohen wrote: > 2008/8/28 Micah Gersten <[EMAIL PROTECTED]>: > >> That's an opinion that you state as fact. >> > > You must be new here :) > >
Re: [PHP] grab the complete commandline used ...
Does this work? $command = implode(' ', $argv); http://us2.php.net/manual/en/reserved.variables.argv.php Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Jochem Maas wrote: > hiya, > > anyone know if it's possible to grab the entire commandline > that was used to start up a php script on the CLI, an example > of what I'm looking to grab from within the script (test.php in > this example): > > "php -qC -ddisplay_errors=1 ./test.php -o -d -e [EMAIL PROTECTED] > -f ./last.log | grep Exception" > > of course I know what the script name and arguments are but I'd rather > like the > whole enchilada (php binary and it's args + the pipe to grep). > > possible? bad idea? down boy? > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] grab the complete commandline used ...
I suggest creating a shell wrapper for PHP that will write the command to a file for you and then call PHP with the appropriate arguments. PHP won't even see most of the command that you originally posted. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Jochem Maas wrote: > Robert Cummings schreef: >> On Thu, 2008-08-28 at 10:22 -0500, Micah Gersten wrote: >>> Does this work? >>> $command = implode(' ', $argv); > > no syntax errors, so in that sense it works. > but it doesn't answer my question (check the body of the post as > well as the subject and that might become clear). > >> Only do it that way if it's for a log of general output. If you're going >> to punt any of those parts back to the OS in another command you'll need >> to properly escape them. > > true, and yes it's for a log and no join(' ', $argv); doesn't cut it :-) > >> >> Cheers, >> Rob. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] grab the complete commandline used ...
You can rename the php executable and replace it with a shell script that logs what is run. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Jochem Maas wrote: > David Otton schreef: >> >> Quote the entire command as a string. Pass it to a shell script that >> sets an environment variable to that string, then executes the string. > > if life were that simple. it's user X running the php script from the > commandline ... I wanna know exactly what he is doing (which is not > necessarily the same as what he should be doing). I only really control > the php script in question not the context it is run in. > >> > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] casting static property
Old timers like it at the bottom, but I agree with the newcomers. Top posting as long as it's not mixed with bottom posting can be easier for people who follow the threads. (I know I mixed it here) Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Diogo Neves wrote: > On Mon, Sep 1, 2008 at 12:43 AM, Govinda <[EMAIL PROTECTED]> > wrote: > >> On Aug 31, 2008, at 2:17 PM, Jochem Maas wrote: >> >>> another tip: don't top post :-) >>> >> does "top post" mean to puts one's reply text at the top of the email? >> People prefer it to be at the bottom? >> Personally I like the new text to be at the top so I don't have to scroll >> down to see the new part, but please do clarify what old timers >> expect/prefer so I can maximize my chance to get help when I need it ;-) >> >> (oops. Didn't mean to send you a copy too Jochem.) >> >> -G >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> >> > > Hi, > > I was confused too, then I seached wikipedia and found this: > http://en.wikipedia.org/wiki/Posting_style > > But I, like you, prefer too see te new text on top... > Maybe as you say he can clarify, but possible they like more like this? > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Shared memory, mutex functionality and spawning threads. Is it possible using PHP?
http://us2.php.net/apc Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Kent Larsson wrote: > Hi, > > Is it possible to have shared memory in the form of shared global variables > in PHP? Or any other form of shared memory? And if that is the case, is > there any form of mutex functionality which may be used to assure > syncronized access to this memory? > > My next question is related to the first one. > > Is it possible to have a thread running for processing of information. This > thread should be accessed from all the session instances, and it would also > need to be syncronized. I would like to have something like: > jobProcessorThread.addJob(aJobClassInstance) > > The job processor thread should work with the jobs in its queue until the > queue is empty. Then it should idle until more requests are received. > > And my last question. > > Is it possible to let any code run and perform its work after PHP has sent > the page to the user? This could be an alternative to having a worker thread > in if it's also possible to have mutexes and shared memory. Then the worker > thread jobs could be processed after a page has been sent inside a critical > block protected by mutex functionality. > > Best regards, > Kent > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Secure way to handle pw on session.
Take a look at this: http://us2.php.net/manual/en/function.session-save-path.php Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com k bah wrote: > Hi, > > I noticed session files are kept on /tmp for a while, and even if they were > immediately deleted, well, someone could use one of my php scripts to inject > code and read them, since they belong to the httpd user. > What's the best way to receive passwords thru a form and store them in the > $_SESSION while I process other information to decide whether or not that > user is able to proceed and login (check to see if user is also allowed to > use that service, not just validate user/pw)? I use https, always, no plain > http is used. > > Thanks > > = > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Secure way to handle pw on session.
If one does not know where the session data is, one cannot inject code to expose it. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Robert Cummings wrote: > On Tue, 2008-09-02 at 14:45 -0500, Micah Gersten wrote: > >> Take a look at this: >> http://us2.php.net/manual/en/function.session-save-path.php >> > > This won't help since the OP mentioned he was worried about code > injection exposing the contents of $_SESSION. > > Cheers, > Rob. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Secure way to handle pw on session.
I thought he'd be more worried about something like 'cat /tmp/sess_*'. Also, you can enable the save_path in the ini file or htaccess file and then disable the PHP function in the ini file. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Robert Cummings wrote: > On Tue, 2008-09-02 at 16:22 -0500, Micah Gersten wrote: > >> If one does not know where the session data is, one cannot inject code >> to expose it. >> > > PHP knows where the session data is, the very function you gave provides > the path to it also. If you've got code injection then you've got > someone who can probably read the return value of session_save_path(). > > Cheers, > Rob. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Individual bulk e-mails - performance question (was "skinning a cat") :-)
Robert Cummings wrote: > On Mon, 2008-09-01 at 14:34 +0200, Merlin Morgenstern wrote: > >> Per Jessen schrieb: >> >>> Jochem Maas wrote: >>> >>> >>>>> lockfile=/var/lock//file >>>>> # clear out a lock older than 60mins >>>>> find $lockfile -cmin +60 | xargs rm >>>>> test ! -f $lockfile && ( >>>>> touch $lockfile >>>>> >>>>> rm -f $lockfile >>>>> ) >>>>> >>>> wouldn't creating a dir be better here? (with regard to atomicity) >>>> >>>> >>> I haven't thought it through, but I don't think it would change >>> anything. >>> >>> >>> /Per Jessen, Zürich >>> >>> >> Hello everybody, >> >> thank you for the huge amount of replies on my question. I believe I >> quite lost a bit track on how to solve the problem hands on. To >> summerize, there are aparently two ways of skinning the cat :-) >> >> 1. Run a deamon >> I admit I have never wrote one, and that seems therefore to be the >> harder option for me. Well... perhaps not. >> I assume it is simply creating a shell script like Jochem wrote, however >> I guess it would just take longer for me to get it running as I have >> never done that before. >> >> 2. Create a PHP file that holds some lock code which is triggered by >> CRON every 5 minutes. Taking the example from Robert. >> >> 3. Following idea which I am now actually implementing :-) >> >> - Add all emails into a mysql db with one insert command. >> - Run a php script by cron every 5 min that does the following: >> - update table, set session_id = x on all entries without session id >> - get all entries with that session ID >> - send email to those with that session ID >> - remove all entries with that session ID >> >> Looks like easies sollution on how to skimm the cat. DB might not be the >> most performing sollution, but sufficient considering the hard ware power. >> > > Actually 3 was what I suggested with a lock mechanism to ensure that if > your script run by cron takes longer than 5 minutes that you don't have > two scritps stepping on each others' toes. > > Cheers, > Rob. > He solves that by adding the session ID at the beginning of the script and only operating on those entries. The scripts might be running simultaneously, but will not step on each other's toes. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP on 64bit Ubuntu
32 bit is 2^32 - 1. 64 bit is 2^64 - 1. 2 * 32 bit = 2 ^ 33 - 2 That's not 64 bit. :) Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Robert Cummings wrote: > > Please explain how it can take up more than twice. If I have a fence > segment with 32 vertical pieces (called fence32) and I make a new fence > segment with 64 vertical pieces (called fence64) effectively doubling > the length. Tell me how building a 20 segment fence with fence64 pieces > can possibly more than double the length of the fence created with > fence32 pieces? > > Cheers, > Rob. > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Altering the error_reporting
This seems like a futile activity. It's a waste of time to have to hunt down an error if you can be told where it is. I suggest spending time improving coding standards that error chasing. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com [EMAIL PROTECTED] wrote: > I am looking for a way to alter the error_reporting(E_All) > This displays > Parse error: parse error, unexpected '}' in /var/www/html/test.php on line 7 > > I want to remove the file location and line number from the error > to only produce > Parse error: parse error, unexpected '}' > > Why? You may ask. > > I am writting a code tester in php but i do not want to display the "in" > portion. > This will make you find the error on your own. As a learning tool. > > Understand I have error reporting off in the php.ini file and call the errors > in the php script with ini_set('display_errors', 1);. > > I am sure this is doable I just cant figure out how to do this without > altering the php.ini file. > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP: Mulitiple Arrary Sort
http://us3.php.net/basename Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Vernon wrote: > SOLVED! > > I made the following change as well to fix the file name: > > BEFORE: > echo date("m-d-Y", $entry['filemtime']) . " {$file}\n"; > AFTER: > echo date("m-d-Y", $entry['filemtime']) . $entry['filename'] . " > \n"; > > One last question. > The $entry['filename'] is the file name and path: >/home/website/public_html/resumes/1218044880/filename.htm > > How do I get it to display filename.htm only? > > Thanks for all your help Jim. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP on 64bit Ubuntu
My apologies. I sent this before I had my morning caffeine. You are correct, it's twice the storage space. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Robert Cummings wrote: > On Wed, 2008-09-03 at 11:12 -0500, Micah Gersten wrote: > >> 32 bit is 2^32 - 1. >> 64 bit is 2^64 - 1. >> >> 2 * 32 bit = 2 ^ 33 - 2 >> That's not 64 bit. :) >> > > You don't understand what you're talking about. We're not talking > values, we're talking storage width. Please go do some reading before > coming back with garbage. > > Cheers, > Rob. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] unset($_GET['i'])
The $_GET array comes from the URL which is resent every time someone hits F5. unset works on the server, not on the browser. You could capture it, add it to the session and then redirect without it in the URL. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Bill wrote: > Dan Shirah a écrit : >> How about just adding a simple counter on your page. >> > > That's what I do but that "counter" resets when you press F5 and is > not functionnal. > > Why $_GET['i'] doesn't unsets ? > -- Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Summing array indexes.
This should help: http://us.php.net/array_walk Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Tom Shaw wrote: > Is there an easy way to loop thru the array below and add the incremented > total price indexes so the order_total_price index contains the correct sum. > Any help would be greatly appreciated. > > > > > > array(5) { > > [0] => array(15) { > > ["order_date"] => string(8) "09-01-08" > > ["order_product_price_1"] => string(5) "10.00" > > ["order_product_price_2"] => string(5) "20.00" > > ["order_total_price"] => string(0) "" > > } > > [1] => array(19) { > > ["order_date"] => string(8) "09-01-08" > > ["order_product_price_1"] => string(5) "25.00" > > ["order_product_price_2"] => string(5) "15.00" > > ["order_total_price"] => string(0) "" > > } > > > > Like this. > > > > array(5) { > > [0] => array(15) { > > ["order_date"] => string(8) "09-01-08" > > ["order_product_price_1"] => string(5) "10.00" > > ["order_product_price_2"] => string(5) "20.00" > > ["order_total_price"] => string(0) "30.00" > > } > > [1] => array(19) { > > ["order_date"] => string(8) "09-01-08" > > ["order_product_price_1"] => string(5) "25.00" > > ["order_product_price_2"] => string(5) "15.00" > > ["order_total_price"] => string(0) "40.00" > > } > > > > Tom Shaw > > > > [EMAIL PROTECTED] > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending username/password
Jay Moore wrote: > Robert Cummings wrote: >> On Fri, 2008-09-05 at 21:07 +0100, Stut wrote: >>> On 5 Sep 2008, at 21:05, Robert Cummings wrote: >>>> On Fri, 2008-09-05 at 15:01 -0500, Jay Moore wrote: >>>>> Greetings list! >>>>> >>>>> Is it possible (and if so, how) to send username and password >>>>> information to a website with PHP? >>>>> >>>>> I would like to submit some information to some network devices >>>>> we have, >>>>> but they require login credentials to proceed. I would like to >>>>> bypass >>>>> the traditional username/password prompt so I can automate the >>>>> procedure. >>>>> >>>>> I hope this makes sense. >>>> If you mean http auth style login information then you do the >>>> following: >>>> >>>>http://www.somedomain.com:[EMAIL PROTECTED]/the/path/to/resource.html >>> I think he meant >>> http://user:[EMAIL PROTECTED]/the/path/to/resource.html >> >> Yeah, that's it lol :) >> >> Cheers, >> Rob. > > FYI - Typing this response on my old 286 because Rob's original > suggestion made my 37.612-core Core2Duo box (used for notepad and > newsgroups only) explode. > > Jay > That'll teach you to use Google Chrome. ;) Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Shopping Carts/Checkout Software
ZenCart Reasons: PHP-based Open Source lots if plugins Take a look at this: http://en.wikipedia.org/wiki/Zen_Cart Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Charlene wrote: > > Micah Gersten wrote: >> Try Zencart. >> >> Thank you, >> Micah Gersten >> onShore Networks >> Internal Developer >> http://www.onshore.com >> >> > Thank you for your recommendation, but I really need either reasons > why to use a particular product from experience or reference to an > article which support your recommendation. > > I don't want to start a flame war, but I really would like to hear > from all about their experiences with different products. Especially > if you used hooks in your PHP code to work with a particular product. > Also, I would like to know about the problems with a specific product > and would you would never use again. > > Charlene -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CSV output.
Have you opened the CSV file in a text editor? Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Tom Shaw wrote: > This statement _is_ correct. I see values such as 234.55, but not 234.00 in > the CSV file and when I dump the data. > 55.00 will equal 55 when it should equal 55.00. 234.00 shows up as 234. The > data is fine it just simple does not show up > correctly in the CSV file. > > $out > .="".$name.",".$description.",".$size.",".$stock.",".$price.",".$total_cost. > ""; > $out .= "\n"; > > } > > dump($out); This prints the correct data. > exit(); > > header("Content-type: application/vnd.ms-excel"); > header("Content-Disposition: attachment; filename=inventory_report.csv"); > > print $out; This prints wrong. > > -Original Message- > From: Eric Gorr [mailto:[EMAIL PROTECTED] > Sent: Monday, September 08, 2008 4:21 PM > To: PHP General > Subject: Re: [PHP] CSV output. > > > On Sep 8, 2008, at 5:06 PM, Tom Shaw wrote: > > >> Actually that won't work I tried it. For some reason the .00 shows >> up when I >> try to manually add a .00. I know weird. >> > > Did you mean to say that it .00 _doesn't_ show up when you try to > manually add a .00? > > >> The value is in the array or string >> before outputting printing to CSV. Number format does not work either. >> > > > And just to clarify...in your .csv file, you do see values such as > 234.55, but not 234.00. > > I can promise you that if you fprintf( $fp, "234.00" ), you will see > 234.00 in your file. > > So, the question becomes, what _exactly_ are you doing when you are > writing this stuff out. > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Creating single row for multiple items.
Databases are for storing and retrieving data. :) Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Ashley Sheridan wrote: > I'm assuming because this is part of a shopping cart, so he would have > to put the data into the database only to retrieve it again, which is a > little bit of a waste. > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Anything like XAMPP?
Xampp comes with PHPMyAdmin. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Ben Stones wrote: > There's a bug, I believe with XAMPP where from XAMPP CP you click 'admin' > under MySQL, when WinMySQLadmin comes up, the icon in the right (traffic > light) is always red, and there's no option to start the service anymore... > at the moment there's a "Stop the Service" option but it's unselectable. Are > there other ready-setup environment just like XAMPP that has phpMyAdmin > included, too? I know this has nothing to do with PHP individually but any > help will be appreciated! > > Cheers! > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] pain
You should read this: http://us3.php.net/manual/en/language.oop5.overloading.php The magic method __call passes all the arguments pass to the function that is not there in 1 array. So every time you execute a function that is not there and __call is called , you will add another outer array. This is also not the normal way to do oop programming. Normally, you extend a class and use parent::methodName to call a parent function. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Nathan Rixham wrote: > Not sure why I'm sharing this; but it could be a gotcha > > > class testBase { > > public function __call( $methodName , $values ) > { > echo __METHOD__ . PHP_EOL; > print_r( $values ); > } > > } > > class testOuter { > > private $base; > > public function __construct() > { > $this->base = new testBase; > } > public function __call( $methodName , $values ) > { > echo __METHOD__ . PHP_EOL; > print_r( $values ); > $this->base->test( $values ); > } > > } > > $test = new testOuter; > $test->test( 'test' ); > > ?> > > output: > testOuter::__call > Array > ( > [0] => test > ) > testBase::__call > Array > ( > [0] => Array > ( > [0] => test > ) > > ) > > point: > note the $values keep getting nested into an array one deeper; get's > frustrating when dealing with passing arrays and detecting whats in > them! [consider if( count($values) ) or even foreach etc..]! > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Thank you...
There is only 1 military service person that should be thanked for actions on 9/11 and that is the man who was brave enough to disobey orders and shoot down the flight over Pennsylvania. The rest who were involved obeyed orders and let chaos happen. There are many military men and women who for action after 9/11 deserve our thanks though. Thank you, Micah Gersten Jason Pruim wrote: > Hey everyone, > > Okay, so the first time I typed this out it got rejected for being off > topic... so here is my attempt to make it on topic > > > $day="Sept 11 2008"; > While($day=date("NOW")){ > echo << > Sorry for the off topic post... But I just wanted to say that if there > is anyone on this list that either was in military service, or is > currently serving, thank you It is because of YOUR efforts that I > can sit here and write this e-mail in the freedom of my home. > > And if anyone is near where I live in Michigan that has served, I'd be > honored to buy you a beer... (It may take awhile to get through to > everyone, since I'm not rich though.. hehehe) > > So again, Thank you! > HTML; > } > > if(isset($serviceperson)){ > echo "Thank you in so many ways I can't express!"; > }elseif($serviceperson[1] =="beer"){ > echo "Free beer for anyone in the service that is near me!"; > } > > > > ?> > -- > > Jason Pruim > Raoset Inc. > Technology Manager > MQC Specialist > 11287 James St > Holland, MI 49424 > www.raoset.com > [EMAIL PROTECTED] > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Interntet Explorer 8 beater 2
In the Microsoft world, you only support the latest couple of OSs, so IE7 won't run on Win2k. ank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Colin Guthrie wrote: > Why do they need to upgrade the whole OS just to upgrade a browser > who's sunset date has been reached? > > There are enough open source browsers out there that you can get a > modern, standards compliant browser on older hardware without any > problem. > > If this date was built in from the start and was well known, there > wouldn't be any problem. It's just trying to retrofit now that people > start to think that it's a problem (and due to the general reluctance > to keep prop. web apps up-to-date with modern browsers, this is > partially correct, but like I say, if this was all known up front, > these issues would all have been dealt with!) > > Col > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Thank you...
Agreed. We have days to honor those people though, Veteran's Day and Memorial Day. I wish to state with absolute clarity that I am not degrading people in the military service who do defend out country. I have the utmost respect for them. Thank you, Micah Gersten Jason Pruim wrote: > Anyone that defends their country deserves their countries thanks and > appreciation. > > > > -- > > Jason Pruim > Raoset Inc. > Technology Manager > MQC Specialist > 11287 James St > Holland, MI 49424 > www.raoset.com > [EMAIL PROTECTED] > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Thank you...
Jason, I think you just mentioned what we should remember today. The victims that lost their lives. I think everyone can agree that it was a tragedy. My condolences to you and all the other familes. Thank you, Micah Gersten Jason Pruim wrote: > Okay... I am sorry that I even sent the message. 7 years ago today, My > Uncle died because he worked in the south tower on the 93rd floor > All I wanted to do was say thank you to the WORLDS armed forces for > feeling the call to protect their country from what ever enemy was at > their gates Even to the point of thanking the iraqi army for > defending their country against America > > LET THIS END HERE PLEASE! > > > -- > > Jason Pruim > Raoset Inc. > Technology Manager > MQC Specialist > 11287 James St > Holland, MI 49424 > www.raoset.com > [EMAIL PROTECTED] > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Why MS Won't Retire Browsers -- was: Interntet Explorer 8 beater 2
The problem is that if you're running on older hardware, IE7 might be too CPU intensive to run correctly. That's why MS won't set Sunset Dates for an old browser. They instead set the Sunset Dates for the OS and that's how they make things out of date. They say upgrade the OS. Matter of philosophy. The problem is that the new OS won't run on the old hardware and costs lots of money so people don't upgrade. Remember, MS is for profit. If you can just upgrade your browser, they don't make any money. If you upgrade your OS, they do. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Colin Guthrie wrote: > What about FF, Opera, Chrome, Safari? Do *any* of those work? If not, > then it wouldn't take long to get one of them working if IE had a > sunset date in it. Then you'd see how quickly MS responded with making > IEx work on their older OSes (and simply recompiling IE6 with a > newer sunset date should not be allowed!) I'm not sure how you would > police it, but there should be a badge of honour associated with the > system in some way, probably overseen by W3C. > > Col > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Error Reporting
E_STRICT only shows one type of error. If you want everything than you need to set E_ALL | E_STRICT http://usphp.com/manual/en/errorfunc.constants.php#errorfunc.constants.errorlevels.e-strict Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Naz wrote: > I am trying to turn on errors in the browser, but for some reason they > are being suppressed. > > In php.ini I have display_errors = On and error_reporting = E_STRICT > > What else could be suppressing errors? > > السلام عليكم > - Naz. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL outer join problem
Compare phpinfo() on both servers. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Liz Kim wrote: > have a very simple script which connects to a database, execute a query > then displays the result. > This script uses odbc_connect and functions. > > There are two identical Apache web servers and one MS SQL database server. > When the script is ran on web server #1, all the results are returned > correctly. > Ran on server #2, however, some entries are missing. > Same script, different result.. > > I am using left outer join in the SQL query and the missing items are the > ones that should be canceled out from this join. > I directly ran the query on the database and made sure it is not causing and > problems. > I checked the odbc setting on php.ini and odbc.ini on both servers. No > difference. > No permission problems either as I am logging in as the same user... > > Any ideas??? > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: header
Wouldn't it be nice if in the $_SERVER array you could get the whole URL now that PHP has a parse_url function? Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Jochem Maas wrote: > Robert Cummings schreef: >> On Tue, 2008-09-16 at 21:18 +0100, Nathan Rixham wrote: >>> Jim Lucas wrote: >>>> Robert Cummings wrote: >>>>> On Tue, 2008-09-16 at 18:13 +0100, Nathan Rixham wrote: >>>>>> I also meant: >>>>>> define('PUBLIC_BASE_HREF' , 'http://php.net/') >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> and further thinking there has to be an easier / cleaner way of >>>>>> getting "http://"; / "https://"; in php.. >>>>> What's wrong with $_SERVER['HTTPS'] ? >>>>> >>>>> Cheers, >>>>> Rob. >>>> my way >>>> >>>> >>> >>>> function get_http_protocol() { >>>> $proto = 'http'; >>>> if ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) >>>> !== 'off' ) { >>>> $proto .= 's'; >>>> } >>>> return $proto . '://'; # Adding the :// is optionial >>>> } >>>> >>>> echo get_http_protocol(); >>>> >>>> ?> >>>> >>>> That is about as simple as you can get. >>>> >>> lol this one's got my brain going; here's mine: >>> >>> >> function get_http_protocol() { >>> return 'http' . ($_SERVER['SERVER_PORT'] == 443 ? 's' : '') . >>> '://'; >>> } >>> echo get_http_protocol(); >>> ?> >> >> Just because 443 is the default HTTPS port, doesn't mean HTTPS is being >> served over 443, nor does it mean HTTPS isn't also being served over >> another port. This is less effective than using $_SERVER['HTTPS']. > > although I hazard to offer the following as more complete: > > function get_http_protocol() > { > $proto = 'http'; > if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] && > strtolower($_SERVER['HTTPS']) !== 'off') { > $proto .= 's'; >} > > return $proto . '://'; # Adding the :// is optionial > } > > because if $_SERVER['HTTPS'] happens to be false (which I don't think > it ever should be) it > would cause the return value to be 'https://' which I don't think > would be correct in that case > (even thought the case is theoretical and likely to indicate an engine > problem if it did occur) > >> >> Cheers, >> Rob. > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and MySQL SELECT COUNT (*)
You'll want to change your Order By statement to 'ORDER BY CountSteps DESC'. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Vinny Gullotta wrote: > echo $query; > > yields > > SELECT servername, COUNT(steps) as CountSteps FROM monitoring WHERE > steps = 'IISRESET' AND timestamp <= '2008-09-17 11:40:34' AND > timestamp >= '2008-08-17' GROUP BY servername ORDER BY COUNT(*) DESC > LIMIT 10 > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and MySQL SELECT COUNT (*)
Do var_dump($i) in the loop to see if you're getting the data you want. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Vinny Gullotta wrote: > Still no luck displaying the stupid servername. Any other things I can > try? > > > "Micah Gersten" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> You'll want to change your Order By statement to 'ORDER BY CountSteps >> DESC'. >> >> Thank you, >> Micah Gersten >> onShore Networks >> Internal Developer >> http://www.onshore.com >> >> >> >> Vinny Gullotta wrote: >>> echo $query; >>> >>> yields >>> >>> SELECT servername, COUNT(steps) as CountSteps FROM monitoring WHERE >>> steps = 'IISRESET' AND timestamp <= '2008-09-17 11:40:34' AND >>> timestamp >= '2008-08-17' GROUP BY servername ORDER BY COUNT(*) DESC >>> LIMIT 10 >>> > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and MySQL SELECT COUNT (*)
What is the key for the server name? That's what you need when you output it. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Vinny Gullotta wrote: > var_dump($i); looks messy, but I can see the server names in there and > they are the correct names. > > > "Micah Gersten" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> Do var_dump($i) in the loop to see if you're getting the data you want. >> >> Thank you, >> Micah Gersten >> onShore Networks >> Internal Developer >> http://www.onshore.com >> >> >> >> Vinny Gullotta wrote: >>> Still no luck displaying the stupid servername. Any other things I can >>> try? >>> >>> >>> "Micah Gersten" <[EMAIL PROTECTED]> wrote in message >>> news:[EMAIL PROTECTED] >>>> You'll want to change your Order By statement to 'ORDER BY CountSteps >>>> DESC'. >>>> >>>> Thank you, >>>> Micah Gersten >>>> onShore Networks >>>> Internal Developer >>>> http://www.onshore.com >>>> >>>> >>>> >>>> Vinny Gullotta wrote: >>>>> echo $query; >>>>> >>>>> yields >>>>> >>>>> SELECT servername, COUNT(steps) as CountSteps FROM monitoring WHERE >>>>> steps = 'IISRESET' AND timestamp <= '2008-09-17 11:40:34' AND >>>>> timestamp >= '2008-08-17' GROUP BY servername ORDER BY COUNT(*) DESC >>>>> LIMIT 10 >>>>> >>> >>> > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and MySQL SELECT COUNT (*)
That's your problem, you need to use mysql_fetch_assoc instead of mysql_fetch_row. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Vinny Gullotta wrote: > var_dump looks like this: > > array(2) { [0]=> string(9) "wehost006" [1]=> string(2) "72" } array(2) > { [0]=> string(8) "H7848-49" [1]=> string(2) "71" } array(2) { [0]=> > string(7) "H7853-2" [1]=> string(2) "70" } array(2) { [0]=> string(7) > "H7842-2" [1]=> string(2) "64" } array(2) { [0]=> string(9) > "WEHOST005" [1]=> string(2) "64" } array(2) { [0]=> string(7) > "h7835-2" [1]=> string(2) "57" } array(2) { [0]=> string(9) > "wehost007" [1]=> string(2) "56" } array(2) { [0]=> string(7) > "H7814-1" [1]=> string(2) "55" } array(2) { [0]=> string(5) "H0542" > [1]=> string(2) "54" } array(2) { [0]=> string(8) "H7811-12" [1]=> > string(2) "54" } > > > ""Dan Joseph"" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> On Wed, Sep 17, 2008 at 4:21 PM, Vinny Gullotta >> <[EMAIL PROTECTED]>wrote: >> >>> var_dump($i); looks messy, but I can see the server names in there >>> and they >>> are the correct names. >>> >>> >>> "Micah Gersten" <[EMAIL PROTECTED]> wrote in message >>> news:[EMAIL PROTECTED] >>> >>> Do var_dump($i) in the loop to see if you're getting the data you >>> want. >>>> >>>> Thank you, >>>> Micah Gersten >>>> onShore Networks >>>> Internal Developer >>>> http://www.onshore.com >>>> >>>> >>>> >>>> Vinny Gullotta wrote: >>>> >>>>> Still no luck displaying the stupid servername. Any other things I >>>>> can >>>>> try? >>>>> >>>>> >>>>> "Micah Gersten" <[EMAIL PROTECTED]> wrote in message >>>>> news:[EMAIL PROTECTED] >>>>> >>>>>> You'll want to change your Order By statement to 'ORDER BY >>>>>> CountSteps >>>>>> DESC'. >>>>>> >>>>>> Thank you, >>>>>> Micah Gersten >>>>>> onShore Networks >>>>>> Internal Developer >>>>>> http://www.onshore.com >>>>>> >>>>>> >>>>>> >>>>>> Vinny Gullotta wrote: >>>>>> >>>>>>> echo $query; >>>>>>> >>>>>>> yields >>>>>>> >>>>>>> SELECT servername, COUNT(steps) as CountSteps FROM monitoring WHERE >>>>>>> steps = 'IISRESET' AND timestamp <= '2008-09-17 11:40:34' AND >>>>>>> timestamp >= '2008-08-17' GROUP BY servername ORDER BY COUNT(*) >>>>>>> DESC >>>>>>> LIMIT 10 >>>>>>> >>>>>>> >>>>> >>>>> >>> >>> -- >>> PHP General Mailing List (http://www.php.net/) >>> To unsubscribe, visit: http://www.php.net/unsub.php >>> >>> >> Can you show us one of the var_dumps? >> >> -- >> -Dan Joseph >> >> www.canishosting.com - Plans start @ $1.99/month. >> >> "Build a man a fire, and he will be warm for the rest of the day. >> Light a man on fire, and will be warm for the rest of his life." >> > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and MySQL SELECT COUNT (*)
I meant key in the array that was returned by MySQL. I answered you in my other post. The array was numerically index based instead of column based. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Vinny Gullotta wrote: > If by key you mean the column in the database, it's called: servername > > "Micah Gersten" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> What is the key for the server name? That's what you need when you >> output it. >> >> Thank you, >> Micah Gersten >> onShore Networks >> Internal Developer >> http://www.onshore.com >> >> >> >> Vinny Gullotta wrote: >>> var_dump($i); looks messy, but I can see the server names in there and >>> they are the correct names. >>> >>> >>> "Micah Gersten" <[EMAIL PROTECTED]> wrote in message >>> news:[EMAIL PROTECTED] >>>> Do var_dump($i) in the loop to see if you're getting the data you >>>> want. >>>> >>>> Thank you, >>>> Micah Gersten >>>> onShore Networks >>>> Internal Developer >>>> http://www.onshore.com >>>> >>>> >>>> >>>> Vinny Gullotta wrote: >>>>> Still no luck displaying the stupid servername. Any other things I >>>>> can >>>>> try? >>>>> >>>>> >>>>> "Micah Gersten" <[EMAIL PROTECTED]> wrote in message >>>>> news:[EMAIL PROTECTED] >>>>>> You'll want to change your Order By statement to 'ORDER BY >>>>>> CountSteps >>>>>> DESC'. >>>>>> >>>>>> Thank you, >>>>>> Micah Gersten >>>>>> onShore Networks >>>>>> Internal Developer >>>>>> http://www.onshore.com >>>>>> >>>>>> >>>>>> >>>>>> Vinny Gullotta wrote: >>>>>>> echo $query; >>>>>>> >>>>>>> yields >>>>>>> >>>>>>> SELECT servername, COUNT(steps) as CountSteps FROM monitoring WHERE >>>>>>> steps = 'IISRESET' AND timestamp <= '2008-09-17 11:40:34' AND >>>>>>> timestamp >= '2008-08-17' GROUP BY servername ORDER BY COUNT(*) >>>>>>> DESC >>>>>>> LIMIT 10 >>>>>>> >>>>> >>>>> >>> >>> > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP and MySQL SELECT COUNT (*)
While it's true that '.' concatenates and ',' is a list separator, The comma is actually more appropriate in this instance since you are just outputting each piece. It saves the overhead of concatenation before output. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Nathan Rixham wrote: > > 6: " vs ' > when you use " php will parse the enclosed string for variables, when > you use ' it won't; so ' leads for faster code, and also encourages > you to code strongly by closing strings and concatenating variables. > Further it allows you to use valid html " around attributes rather > than the invalid ' > > 7: , vs . > there is no vs :) to concatenate we use . (period) not , (comma) > > so for 6 & 7.. > echo '' . $i['servername'] . ''; > > I'm going to stop there, hope it helps a little bit; and I won't go > any further as half the fun is learning; so you finding out how to > save time on queries and write your own db handlers etc is not my > domain I reckons > > Regards > > nathan > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Static method variable
If you're looking for a persistent variable in one class instance, then you need a member variable. If you want it persistent across all class instances, you want a static variable. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Christoph Boget wrote: > Perhaps I'm misunderstanding what a static method variable is supposed > to do. I thought the value would be static for an class' instance but > it appears it is static across all instances of the class. Consider: > > class StaticTest > { > public function __construct() > { > } > > public function test( $newVal ) > { > static $retval = ''; > > if( $retval == '' ) > { > $retval = $newVal; > } > echo $retval . ''; > } > } > > $one = new StaticTest(); > $one->test( 'joe' ); > $two = new StaticTest(); > $two->test( 'bob' ); > > Should it be working that way? > > thnx, > Chris > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ODBC Functions & MS SQL Server 2005
If you need abstraction, check this out: http://us.php.net/pdo Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Dan Joseph wrote: > On Thu, Sep 18, 2008 at 3:36 PM, Dan Shirah <[EMAIL PROTECTED]> wrote: > > >> If you already have your results in an array, try using count($result); >> That should count the number of results returned to your result array. >> >> Or you could try uncommenting the mssql extension in your php.ini file and >> then try using: >> >> mssql_num_rows() ? >> >> Dan >> >> >> >> >> > I don't have them in an array usually, I just cycle thru each row. > > I've thought about using the mssql_* functions. My boss originally pushed > me into odbc posing the question "What if we move to a different database > server type?". > > I do have a class for handling all the database functions. Maybe I'll just > go that route. If he changed to Oracle or something, I could modify my > class easy enough. > > I'm assuming mssql_num_rows() works fine when calling a stored procedure? > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ODBC Functions & MS SQL Server 2005
You can't upgrade PHP? Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Dan Joseph wrote: > On Thu, Sep 18, 2008 at 4:35 PM, Micah Gersten <[EMAIL PROTECTED]> wrote: > > >> If you need abstraction, check this out: >> http://us.php.net/pdo >> >> Thank you, >> Micah Gersten >> onShore Networks >> Internal Developer >> http://www.onshore.com >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> >> > I looked at PDO, and liked it, but it seems really buggy in the version of > php we're running. I had to stop using it. We're running 5.1.2. > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Error message
Si, puedes tener espacio en blanco delante de session_start(), pero no puedes tener espacio delante de 'http://www.onshore.com CanihoJR wrote: > No puedes tener ningun espacio en blanco delante de session_start(); > > Sorry for my english: > you cant have any blank spaccing before SESSION_START() > > > Prueba: > TRY: > > session_start(); > > echo 'Welcome to page #1'; > > $_SESSION['favcolor'] = 'green'; > $_SESSION['animal'] = 'cat'; > $_SESSION['time'] = time(); > > // Works if session cookie was accepted > echo 'page 2'; > > // Or maybe pass along the session id, if needed > echo 'page 2'; > ?> > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing variables between pages
I would think debugging a chain of code is more of a nightmare than debugging a $_SESSION variable. Also, HTTP is a stateless protocol no matter what you do. If you want to pass data around, the only ways to do it are $_SESSIONS and cookies with $_SESSIONS being preferable as they stay on the server. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com tedd wrote: > However, there is another way, but it takes a little forethought. > > The technique is simply to continue the flow of a "single" script by > using includes. Here's an example: > > http://www.webbytedd.com/bb/tedd/index.php > > The code behind this is very simple. You simply branch to other > scripts by doing this: > > ob_clean; > include('the-next-script.php"); > exit(); > > This keeps ALL the variables intact because it acts like one large > script. -- it's not stateless and this technique works. > > However, what I don't understand is why it isn't used more often? > > Unless there is something here I don't understand, I believe I could > use this technique to write all the scripts I currently use without > ever using a session variable. > > Cheers, > > tedd > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing variables between pages
You're not passing anything from the browser which is what the OP wanted. You're hard coding variables and the using them in other scripts. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com tedd wrote: > > > I don't know what a "basic front-end loader pattern" is, but the data > is available to the next script provided that the script is loaded via > an include. > > As I have shown here: > > http://www.webbytedd.com/bb/script2script/ > > Here are two separate scripts -- one defines and populates the $test > variable and the other echo's the contents proving the pass was made. > > Also note, there is request to the server made here, but the data > (i.e., $test variable ) isn't passed in the normal manner (i.e., POST, > GET, SESSION). > > Cheers, > > tedd > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing variables between pages
Sessions are used to pass dynamic content between pages. Your method is passing static content. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com tedd wrote: > No problem. > > But here is what I would like you to consider, the next time you are > thinking about using sessions to pass variables to the next script, > try this technique instead. > > You see, a few months ago I was working with another programmer who > had a script that contained far more data than what I wanted to break > down into sessions to pass to my script. So I tried this and to my > surprise it worked flawlessly. > > Then I thought "Where else could I use this?" and it seems that I can > use this everywhere. > > Now, I've had three hours of sleep, so my mind may be more fuzzy than > usual, but I can't think of an example where I can't use this > technique instead of using sessions. > > If you can think of one, please tell me. > > Cheers, > > tedd > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Encrypt database table
You have the same worry of a DBA writing the root password on a post it note. In every organization, there has to be some level of trust. Tell the DBA to use Linux, there's a lock icon to enable the screensaver in most X environments. ;-) Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Philip Thompson wrote: > > I understand what you're saying, but I don't completely agree with > this. What happens when the DBA has a table of names and SSNs on > screen and then gets up from his desk to run to the bathroom? In the > fear that he may ruin is best slacks (err, jeans), he forgets to close > the DB viewer or lock his desktop. Mr. ShouldntBeInHere walks by, sees > the monitor of data and takes a picture with his new iPhone 3G and > keeps walking. Well, now he just grabbed 50 names and SSNs. Uh oh! > > Now, I understand that Mr. DBA should be held responsible for not > taking the necessary precautions to make sure that no one else got to > his database. However, if the database had been encrypted, then maybe, > just maybe those names wouldn't have been exploited. But, in an effort > to make sure that he is taking all the necessary precautions, > shouldn't he have encrypted his database as well? > > > Also, there was this same question last Friday (I think) about > encrypting DBs. Search the archives and/or ask a MySQL list. > > But to not be a complete jerk... I use AES. > > ~Philip > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $this->value VS $value
Eric Butera wrote: > On Tue, Sep 23, 2008 at 12:26 PM, Jochem Maas <[EMAIL PROTECTED]> wrote: > >> (using $this->foo or MyClass::$foo for static properties). >> > > also self:: > > Actually within a class, I think you must self:: before a static property or something shows up in the error log. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Filters and sanitizing a regexp
I'd return an error. You can use this function to make sure they entered a valid date: http://us.php.net/checkdate Provide a template like: (Month/Day/Year) or for EU (Day/Month/Year) If it's not valid, return an error and let them fix it. Chances are, if they entered more characters than a date, the date you parse might not be the one that they wanted. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Frank Stanovcak wrote: > Is it possible to use the php filter function to sanitize a regular > expression such as to return just the date part of a string that may be > passed by an nonobservant user? > > "#\d\d/\d\d/\d\d\d\d#" > > input would be something like > as02/05/2008df > > I want to use the filter to give me just the date should some oaf not leave > the date field as just digits. > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to submit form via PHP
Not according to this: http://www.w3.org/TR/html401/interact/forms.html#adef-action The only defined behaviour is when you specify a URI. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Richard Lynch wrote: > Actually, I believe action="" submitting to the same URL is *documented* HTTP > spec behavior. > > I welcome correction/confirmation if somebody wants to wade through the docs > again... > > >> -Original Message- >> From: Dotan Cohen [mailto:[EMAIL PROTECTED] >> Sent: Sunday, September 28, 2008 4:13 AM >> To: php-general@lists.php.net >> Subject: Re: [PHP] How to submit form via PHP >> >> 2008/9/28 Ashley Sheridan <[EMAIL PROTECTED]>: >> >>>> Sorry to drag up an old thread, but I just saw this. Is that true of >>>> all browsers? I'm wondering because I just coded a site to use this >>>> behavior, then I saw that the html specification says the action >>>> attribute is required. >>>> >>>> >>> Without the action attribute, the form submits to itself, i.e. a form >>> >> on >> >>> contact.php submits to contact.php without an action attribute being >>> specified. >>> >>> >> If it's undocumented then I would not rely upon it. How much trouble >> did we have in the early 00's because of sites that were coded for the >> undocumented 'features' of specific browsers five years prior? >> Additionally, if you cannot test all the varied platforms (PC, >> cellphones, iPhone, PS3, browsers for the disabled) then you should >> not rely on undocumented behaviour. >> >> Dotan Cohen >> >> http://what-is-what.com >> http://gibberish.co.il >> א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת >> >> ä-ö-ü-ß-Ä-Ö-Ü >> > > ___ > > The information in this email or in any file attached > hereto is intended only for the personal and confiden- > tial use of the individual or entity to which it is > addressed and may contain information that is propri- > etary and confidential. If you are not the intended > recipient of this message you are hereby notified that > any review, dissemination, distribution or copying of > this message is strictly prohibited. This communica- > tion is for information purposes only and should not > be regarded as an offer to sell or as a solicitation > of an offer to buy any financial product. Email trans- > mission cannot be guaranteed to be secure or error- > free. P6070214 > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: SESSION array problems
Nathan Rixham wrote: > tedd wrote: >> At 3:41 PM -0400 10/1/08, tedd wrote: >>>> What about: >>>> >>>> foreach ($_SESSION['user_id'] as $key => $value) >>>> { >>>> $last = $_SESSION['last_name'][$key]; >>>> $first = $_SESSION['first_name'][$key]; >>>> echo "$last, $first"; >>>> } >>> >>> Jay: >>> >>> Close, it produced: >>> >>> Array, Array >>> Array, Array >>> Array, Array >>> >>> Cheers, >>> >>> tedd >> >> >> My error, if produced. >> >> >> Cable, Diane >> a, i >> >> While print_r($_SESSION); JUST BEFORE IT produced: >> >> [user_id] => Array >> ( >> [0] => 6156 >> [1] => 7030 >> [2] => 656 >> ) >> >> [first_name] => Array >> ( >> [0] => Diane >> [1] => first name >> [2] => Helen >> ) >> >> [last_name] => Array >> ( >> [0] => Cable >> [1] => CagoEsogs-temp (forum) >> [2] => Cahalane >> ) >> >> Now, what wrong with this picture? >> >> Cheers, >> >> tedd > > tedd wrote: > > At 3:41 PM -0400 10/1/08, tedd wrote: > >>> What about: > >>> > >>> foreach ($_SESSION['user_id'] as $key => $value) > >>> { > >>> $last = $_SESSION['last_name'][$key]; > >>> $first = $_SESSION['first_name'][$key]; > >>> echo "$last, $first"; > >>> } > >> > >> Jay: > >> > >> Close, it produced: > >> > >> Array, Array > >> Array, Array > >> Array, Array > >> > >> Cheers, > >> > >> tedd > > > > > > My error, if produced. > > > > > > Cable, Diane > > a, i > > > > While print_r($_SESSION); JUST BEFORE IT produced: > > > > [user_id] => Array > > ( > > [0] => 6156 > > [1] => 7030 > > [2] => 656 > > ) > > > > [first_name] => Array > > ( > > [0] => Diane > > [1] => first name > > [2] => Helen > > ) > > > > [last_name] => Array > > ( > > [0] => Cable > > [1] => CagoEsogs-temp (forum) > > [2] => Cahalane > > ) > > > > Now, what wrong with this picture? > > > > Cheers, > > > > tedd > > in this case.. what's happened is: > $_SESSION['first_name'] is a reference to a variable $first (or > whatever is in your for loop) > $_SESSION['last_name'] is a reference to a variable $last (or whatever > is in your for loop) > > when you've set $last and $first to string's in the for loop it's > passed the variable by reference back to $_SESSION['first_name'] and > $_SESSION['last_name'] as strings; > > when it hit's the second iteration on the for loop it now has strings > to deal with so uses the $key (holding integer 1 at this stage) as a > string offset thus giving you the second character (offset [1]) of the > string variables $last/$first. now set to 'cable'/'diane' thus giving > you the 'a'/'i'. when it does pass three there is no offset [2] so > gives you nothing. > > *phew* > > reproduce code! > > > $userids = array('6156','1234','8867'); > $first = array('Diane','Big','Joe'); > $last = array('Cable','Ron','Dirt'); > > function save_to_session( ) { > global $userids , $first , $last; > $_SESSION['user_id'] = &$userids; > $_SESSION['first_name'] = &$first; > $_SESSION['last_name']= &$last; > } > > save_to_session( ); > > print_r( $_SESSION ); > > $num_users = count($_SESSION['user_id']); > > for ($i = 0; $i < $num_users; $i++) { > $first = $_SESSION['first_name'][$i]; > $last = $_SESSION['last_name'][$i]; > echo "$last, $first\n"; > } > ?> > > Regards! > This looks like a bug. If you are not modifying a variable with the same name as the session variable, it should not change the session variable. Also, why are you assigning references to arrays? What version of PHP are you using? You really should get up to speed on PHP 5. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SESSION array problems [THE REASON]
That's probably a good thing: https://www.example.com/secure/shop.php?page=/etc/passwd :-) Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Daniel Brown wrote: > On Thu, Oct 2, 2008 at 12:57 PM, Jim Lucas <[EMAIL PROTECTED]> wrote: > >> so long, farewell, bye bye >> > > If you say so. Do you realize how many websites are going to > break now? ;-P > > https://www.example.com/secure/shop.php?page=creditcardinfo.php > include($page); > ?> > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SESSION array problems [THE REASON]
As was mine. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Daniel Brown wrote: > On Thu, Oct 2, 2008 at 1:14 PM, Micah Gersten <[EMAIL PROTECTED]> wrote: > >> That's probably a good thing: >> >> https://www.example.com/secure/shop.php?page=/etc/passwd >> > > Yeah, it was a joke. > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: SESSION array problems
I was referring to Nathan's examples which you cut out of the post. > function save_to_session( ) { > global $userids , $first , $last; > $_SESSION['user_id'] = &$userids; > $_SESSION['first_name'] = &$first; > $_SESSION['last_name']= &$last; > } Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com tedd wrote: > At 11:14 AM -0500 10/2/08, Micah Gersten wrote: >> You really should get up to speed on PHP 5. > > Yeah, I'll be sure to tell me clients that. > > Sometimes you don't have a choice -- you have to work with what they got. > > Cheers, > > tedd > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] AJAX and PHP
Per Jessen wrote: > Alain Roger wrote: > > >> So in this case what is the plus for companies like MS, Google (with >> Gmail), flicker and so on to use AJAX ? >> > > For them (and others), it's about the user experience, and ajax is good > at enhancing the user experience. > > >> it is on internet, so i guess they have a purpose to do that. >> mine is to have a responsive and intuitive interface application >> whatever it is on internet or intranet. >> > > Now you are changing the rules - they are very different on the > internet. My advice - don't use ajax in an attempt to reduce network > traffic. Use it to enhance the user experience. Caching is much > better at reducing network atraffic anyway. > > > /Per Jessen, Zürich > > If it's the size of the page itself that is large, caching does not help as the HTML is pulled everytime if something is different. As for AJAX, check out http://xajaxproject.org It makes AJAX really easy to code. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Best Search Algorithm for Millions of record
The question is, what are you searching for in the records? Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Hemant Patel wrote: > My question is Whether I should go for Full Text Based search or Database > Search...?And is there algorithm in php which can help me in this case...? > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Best Search Algorithm for Millions of record
What type of data is in the fields? Also, which database engine? Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Hemant Patel wrote: > I have couple of tables with 1,60,0 records and now i need to > search the records based on some crieteria...so which will help me...? > > > On Mon, Oct 6, 2008 at 12:30 PM, Micah Gersten <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> wrote: > > The question is, what are you searching for in the records? > > Thank you, > Micah Gersten > onShore Networks > Internal Developer > http://www.onshore.com > > > > Hemant Patel wrote: > > My question is Whether I should go for Full Text Based search or > Database > > Search...?And is there algorithm in php which can help me in > this case...? > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and getting part of URL
dirname($_SERVER['REQUEST_URI']); Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Jason ML wrote: > Hi PHP'ers, > > PHP 4.4.8 and 5. > > say I have a url like: > > http://www.mydomain.tld/jason/index.php > > In that index.php I want to have a piece of code that runs that tells > me the 'jason' part of the URL so that I can run some custom read only > queries for 'jason' > > How can I do this? I know how to do everything except what PHP > commands to run to get the info. > > Thanks! > > -Jason > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and getting part of URL
Your original post has this as the URL: > http://www.mydomain.tld/jason/index.php That's why I gave you that command. If you want jason out of what you posted, Check out the following commands: http://us.php.net/array_pop http://us.php.net/explode Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Jason ML wrote: > Hi Micah, > >> dirname($_SERVER['REQUEST_URI']); > > > I have tried that and I dont get the proper URI: > > Example running print_r($_SERVER); I get: [REQUEST_URI] => > /net1003/people/jason/ > > But then doing: > > $jason = dirname($_SERVER['REQUEST_URI']); > > echo "URL: "; > echo $jason; > > I get: URL: /net1003/people > > Thoughts on what I am doing wrong. > > Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Login
What do you mean by open? You can redirect to a new page: http://us.php.net/header or You can include a file: http://us.php.net/include/ Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Terry J Daichendt wrote: > I want to open a page if a login is correct and another if not. What > is the function to open a page in PHP? Can you show me a simple > example of the syntax? > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Manipulating strings
For the 1st question: http://us.php.net/manual/en/function.substr-count.php For the second question: http://us.php.net/manual/en/function.strpos.php http://us.php.net/manual/en/function.str-replace.php Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Ron Piggott wrote: > I have a series of questions. > > How do I count the number of 's in a string? > > How do I add text in the middle of a string, let's say after the 3rd > > > Ron > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Manipulating strings
Then you'll need this as well: http://us.php.net/manual/en/function.strlen.php **strpos** ( $text , '' <http://us.php.net/manual/en/language.pseudo-types.php#language.types.mixed>, strlen($text)/2 ); Will give you the position. Use str_replace to insert your ad. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Ron Piggott wrote: > The first question was to find out how long the blog entry was (number > of paragraphs.) > > I am wanting to put an ad in half way. Consequently there are going to > be many 's before the one I am wanting to add text to. > > How should I handle this? > > Ron > > On Tue, 2008-10-07 at 20:55 -0500, Micah Gersten wrote: > >> For the second question: >> http://us.php.net/manual/en/function.strpos.php >> http://us.php.net/manual/en/function.str-replace.php >> >> Thank you, >> Micah Gersten >> onShore Networks >> Internal Developer >> http://www.onshore.com >> >> >> >> Ron Piggott wrote: >> >>> I have a series of questions. >>> >>> How do I count the number of 's in a string? >>> >>> How do I add text in the middle of a string, let's say after the 3rd >>> >>> >>> Ron >>> >>> >>> >>> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variable Variables and Super Global Arrays
That's fine as a test, but you never want to get a variable name from a URL in practice. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Richard Heyes wrote: >> $varname = "\$_SERVER['REMOTE_ADDR']"; >> $varvalue = $$varname; >> > > That's wrong. Offhand you'll end up printing a string. I tried this: > > $a = 365; > $b = 366; > > $var = $_GET['var']; > > echo $$var; > ?> > > And it was fine. > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variable Variables and Super Global Arrays
I mean that it is open for hacking if you pass a variable name through a URL. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com daniel danon wrote: > What do you mean? > > On Sun, Oct 12, 2008 at 5:40 PM, Micah Gersten <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> wrote: > > That's fine as a test, but you never want to get a variable name > from a > URL in practice. > > Thank you, > Micah Gersten > onShore Networks > Internal Developer > http://www.onshore.com > > > > Richard Heyes wrote: > >> $varname = "\$_SERVER['REMOTE_ADDR']"; > >> $varvalue = $$varname; > >> > > > > That's wrong. Offhand you'll end up printing a string. I tried this: > > > > > $a = 365; > > $b = 366; > > > > $var = $_GET['var']; > > > > echo $$var; > > ?> > > > > And it was fine. > > > > > > -- > 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