[PHP] Removing HTML codes using regexp
What if I want to replace all html codes from a string ? I've tried using : $myString = preg_replace('/<*>/, '', $myString); but that deletes all string... ( or everything from first '<' ) ... Toke Herkild... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] validating form data...
I've made a script which ought to validate if there is data in the fields or not... but it doesn't seem to work... the validation is following: if ((email_is_valid($Email)) and ($Name != "") and ($Message != "")){ do stuff ... } But even if I submit an empty form it executes "do stuf..." I have tried to put an empty space into the $Name and $Message test but that doesn't seem to do any difference either... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] validating form data...
Nope, wasn't that... And it should not do any difference using 'and', 'AND' or '&&' as they do the same thing... Nicolas Costes : > hellorghh !!! > > I think that : > > if ((email_is_valid($Email)) && ($Name != "") && ($Message != "")){ >do stuff ... > } > > ...should be better . (&&, not "and") > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: validating form data...
Very embaressing The error where not in my if-statement... but in what I did later on in the else-clause... so boys and girls... remember you do not set variables like this: $Var = = "Avariable"; // Doesn't work. (slap me!) the correct is : $Var = "Avariable"; Sorry for vasting your time... And Thanks for all the help... Toke. "Toke Herkild" <[EMAIL PROTECTED]> skrev i en meddelelse [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I've made a script which ought to validate if there is data in the fields or > not... but it doesn't seem to work... > > the validation is following: > if ((email_is_valid($Email)) and ($Name != "") and ($Message != "")){ > do stuff ... > } > > But even if I submit an empty form it executes "do stuf..." > I have tried to put an empty space into the $Name and $Message test but that > doesn't seem to do any difference either... > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Problems with implode
Hi All, I've an array() with approx 1200 items (list of id-mappings) that part works fine. Now I want to add this list to a query: $where = "id in (".$idList.")"; To accomplish that i do an implode: $idList = implode(',', $TidList); My problem is that some of the values gets concenated, others ere missing 2 or 3 cifres and some just doesn't show up. Is this some kind of implode feature or a string to large problem ? Regards, Toke Herkild -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems with implode
Per Jessen skrev: Andrea Giammarchi wrote: Dunno why you guys started talk about utf-8 problems, he has a list of ids which should contain only unsigned integers, otherwise I do not get how that query could work with an implode(',', $whatever) Very good point - maybe the OP has not yet tested his code that far? Is there a possibility that some of the id's are _not_ just plain integers made up of 0-9? /Per And exatly the reason I tried the following: $list[] = $row['uid']; $list[] = intval($row['uid']); $list[] = mb_convert_encoding($row['uid'], 'iso-8859-1'); $list[] = mb_convert_encoding(intval($row['uid']), 'iso-8859-1'); My best bet as for now: It isn't implode there's the problem, but the length of the string -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems with implode
Tom Worster skrev: On 3/24/09 9:15 AM, "Per Jessen" wrote: TG wrote: I don't think that would be a problem, the size of the array. I've used implode at least once or twice on fairly large arrays. More likely is something weird with your data. Yeah, like the odd backspace or carriage return perhaps. if using utf-8, validate the data with mb_check_encoding() or preg_match('/^.{1}/us', $s) for example, could be that the strings in the big array are mixing encodings. As for the data, it's numbers allright: array:0 is the imploded string array:1 is the array to be imploded array ( 0 => '12498,13018,13019,13020,13027,13028,13029,13031,13032,13030,13024,13026,13021,13022,13036,13035,13034,13023,12940,12991,12992,12993,12994,12995,12996,12997,12998,12999,13000,13001,13002,13003,13004,13005,13006,13007,13008,13009,13010,13011,13012,13013,13014,13015,13016,13017,12941,12942,12943,12944,12945,12946,12947,12948,12949,12950,12951,12952,12953,12954,12955,12956,12957,12958,12959,12960,12961,12962,12963,12964,12965,12966,12967,12968,12969,12970,12971,12972,12973,12974,12975,12976,12977,12978,12979,12980,12981,12982,12983,12984,12985,12986,12987,12988,12989,12990,12906,12939,12936,12937,12938,12934,12935,12930,12931,12933,12932,12925,12926,12927,12928,12916,12917,12918,12919,12920,12921,12907,12908,12909,12910,12911,12912,12913,12914,12915,12929,12922,12923,12924,12879,12884,12885,12886,12887,12888,12889,12890,12891,12892,12893,12894,12895,12896,12897,12898,13859,12899,12900,12901,12902,12903,12904,12905,12881,12882,12859,12860,12861,12862,12863,12864,12865,12866,1385 4,12867,12868,12869,12870,12871,12872,12873,12874,12875,12876,12877,12878,12843,12856,12857,12858,12853,12854,12855,12850,12851,12852,12846,12847,12848,12849,12844,12845,12836,12837,12838,12790,13898,12833,12834,12835,12830,12831,12832,12827,12828,12806,12807,12808,12809,12810,12811,12812,12813,12815,12816,12817,12818,12819,12820,12825,12826,12821,12823,12824,12822,12791,12792,12793,12794,12795,12796,12797,12798,12799,12800,12801,12802,12803,12804,12805,12829,12750,12770,12771,12772,12773,12774,12775,12776,12777,12778,12779,12780,12781,12782,12783,12784,12785,12786,12787,12788,12789,12767,12768,12751,12752,12753,12754,12763,12764,12765,12766,12757,12758,12759,12760,12762,12769,12716,12720,12721,12722,12723,12724,12725,12726,12727,12728,12729,12730,12731,12732,13676,12733,12734,12735,12736,12737,12738,12739,12740,12741,12742,12743,12744,12745,12746,12747,12748,12749,12717,12718,12719,12499,13889,13895,13894,13893,13892,13891,13890,13873,13756,13762,13763,13768,13764,13765,1376 6,13755,13757,13758,13767,13759,13760,13761,12500,12501,138 12502,12503,12504,12505,12506,12507,12510,12511,12512,12513,12514,12515,12516,12517,12518,12519,12520,12521,12522,12523,12524,12525,12526,12527,12528,12529,12530,12531,12532,12533,12534,12535,12536,12537,12538,12539,12540,12541,12542,12543,12544,12545,13875,13874,12546,12547,12548,12549,12550,12551,12552,12553,12554,12555,12556,12557,12558,12559,12562,12563,12564,12565,12560,12561,12566,13678,12567,12705,12714,12715,12706,12707,12708,12709,12710,12711,12712,12713,12674,12675,12676,12677,12678,12679,12680,12681,12682,12683,12684,12685,12686,12687,12688,12689,12690,12691,12692,12693,12694,12695,12696,12697,12698,13856,12699,12700,12701,12702,12704,12703,12568,13872,12569,12570,12571,12573,12574,12575,12576,12577,12578,12579,12580,12581,12582,12583,12584,12585,12586,12587,12588,12589,12590,12591,13871,12592,12593,12594,12595,12596,12597,12598,12599,12600,12601,12602,12603,12604,12605,12606,13870,12607,12608,12609,12610,12611,12612,12613,12614,12615,12616,12617,12618,12619,12620 ,12621,12622,12623,12624,12625,12626,12627,12628,12629,12630,12631,12632,12633,12634,12635,12636,12637,12638,12639,12640,12641,12642,12643,12644,12645,12646,12647,12648,12649,12650,12651,12652,12653,12654,12655,12656,12657,12658,12659,12660,12661,12662,12663,12664,12665,12666,12667,12668,12669,12670,12671,12672,12673,13037,13081,13082,13083,13084,13085,13086,13087,13088,13089,13090,13091,13092,13093,13094,13070,13663,13076,13077,13078,13079,13080,13071,13072,13073,13074,13075,13052,13053,13057,13058,13059,13060,13061,13062,13063,13064,13065,13066,13067,13068,13069,13054,13055,13056,13045,13046,13047,13048,13051,13049,13050,13038,13041,13042,13043,13044,13040,13039,12839,12840,12841,12842,13095,13374,13409,13412,13411,13410,13408,13404,13407,13406,13405,13403,13402,13395,13398,13401,13400,13399,13397,13396,13393,13394,13389,13392,13391,13390,13387,13388,13386,13385,13384,13383,13381,13382,13380,13379,13378,13376,13377,13375,13356,13372,13373,13371,13370,13369,13362,13367,13366 ,13364,13365,13363,13368,13359,13361,13360,13357,13358,13354,13704 355,13350,13353,13352,13351,13289,13342,13349,13344,13343,13347,13857,13346,13345,13326,13341,13340,13332,1,13335,13334,13336,13329,13331,13330,13328,13327,13337,13339,13338,13290,13753,13315,13316,13881,13880,13879,13887,13886,13885,13884,13883,13882,13313,13314,13312,13311,13310,13304,13291,1
Re: [PHP] Problems with implode
As stated before, packet size not the problem, data is delivered perfectly from MySQL. Problem seems to be when the result string is diplayed. I'll try to do a test with a numeric array: $list = array(12300..12800); and see what happens. regards, Toke Andrea Giammarchi skrev: What about MySQL max_allowed_packet setting? is it bigger than produced string? To: php-general@lists.php.net Date: Tue, 24 Mar 2009 15:23:20 +0100 From: t...@ezl-data.dk Subject: Re: [PHP] Problems with implode Per Jessen skrev: Andrea Giammarchi wrote: Dunno why you guys started talk about utf-8 problems, he has a list of ids which should contain only unsigned integers, otherwise I do not get how that query could work with an implode(',', $whatever) Very good point - maybe the OP has not yet tested his code that far? Is there a possibility that some of the id's are _not_ just plain integers made up of 0-9? /Per And exatly the reason I tried the following: $list[] = $row['uid']; $list[] = intval($row['uid']); $list[] = mb_convert_encoding($row['uid'], 'iso-8859-1'); $list[] = mb_convert_encoding(intval($row['uid']), 'iso-8859-1'); My best bet as for now: It isn't implode there's the problem, but the length of the string -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ More than messages–check out the rest of the Windows Live™. http://www.microsoft.com/windows/windowslive/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems with implode
Okay, tested in the following manner: for ($i=12300;$i<12801;$i++){ // List is filled with integers, in the correct charset from PHP $list[] = $i; } $pidList = implode(',', $list); mail('y...@email.dom, 'debug implode', var_export(array($pidList, $list),1)); And I got the same error, which indicates that perhaps implode works just as it should but the representation is off. that in it self would be okay, but how then do we control that the query is actually correct ? If we cannot trust the debug output how then can we trust that the query is doing what it is supposed to do ? Regards, Toke Toke Herkild skrev: As stated before, packet size not the problem, data is delivered perfectly from MySQL. Problem seems to be when the result string is diplayed. I'll try to do a test with a numeric array: $list = array(12300..12800); and see what happens. regards, Toke Andrea Giammarchi skrev: What about MySQL max_allowed_packet setting? is it bigger than produced string? To: php-general@lists.php.net Date: Tue, 24 Mar 2009 15:23:20 +0100 From: t...@ezl-data.dk Subject: Re: [PHP] Problems with implode Per Jessen skrev: Andrea Giammarchi wrote: Dunno why you guys started talk about utf-8 problems, he has a list of ids which should contain only unsigned integers, otherwise I do not get how that query could work with an implode(',', $whatever) Very good point - maybe the OP has not yet tested his code that far? Is there a possibility that some of the id's are _not_ just plain integers made up of 0-9? /Per And exatly the reason I tried the following: $list[] = $row['uid']; $list[] = intval($row['uid']); $list[] = mb_convert_encoding($row['uid'], 'iso-8859-1'); $list[] = mb_convert_encoding(intval($row['uid']), 'iso-8859-1'); My best bet as for now: It isn't implode there's the problem, but the length of the string -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ More than messages–check out the rest of the Windows Live™. http://www.microsoft.com/windows/windowslive/ As stated before, packet size not the problem, data is delivered perfectly from MySQL. Problem seems to be when the result string is diplayed. I'll try to do a test with a numeric array: $list = array(12300..12800); and see what happens. regards, Toke Andrea Giammarchi skrev: What about MySQL max_allowed_packet setting? is it bigger than produced string? To: php-general@lists.php.net Date: Tue, 24 Mar 2009 15:23:20 +0100 From: t...@ezl-data.dk Subject: Re: [PHP] Problems with implode Per Jessen skrev: Andrea Giammarchi wrote: Dunno why you guys started talk about utf-8 problems, he has a list of ids which should contain only unsigned integers, otherwise I do not get how that query could work with an implode(',', $whatever) Very good point - maybe the OP has not yet tested his code that far? Is there a possibility that some of the id's are _not_ just plain integers made up of 0-9? /Per And exatly the reason I tried the following: $list[] = $row['uid']; $list[] = intval($row['uid']); $list[] = mb_convert_encoding($row['uid'], 'iso-8859-1'); $list[] = mb_convert_encoding(intval($row['uid']), 'iso-8859-1'); My best bet as for now: It isn't implode there's the problem, but the length of the string -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ More than messages–check out the rest of the Windows Live™. http://www.microsoft.com/windows/windowslive/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems with implode
works fine, created a html output to browser which displayed nicely. - weird regards Toke Toke Herkild skrev: As stated before, packet size not the problem, data is delivered perfectly from MySQL. Problem seems to be when the result string is diplayed. I'll try to do a test with a numeric array: $list = array(12300..12800); and see what happens. regards, Toke Andrea Giammarchi skrev: What about MySQL max_allowed_packet setting? is it bigger than produced string? To: php-general@lists.php.net Date: Tue, 24 Mar 2009 15:23:20 +0100 From: t...@ezl-data.dk Subject: Re: [PHP] Problems with implode Per Jessen skrev: Andrea Giammarchi wrote: Dunno why you guys started talk about utf-8 problems, he has a list of ids which should contain only unsigned integers, otherwise I do not get how that query could work with an implode(',', $whatever) Very good point - maybe the OP has not yet tested his code that far? Is there a possibility that some of the id's are _not_ just plain integers made up of 0-9? /Per And exatly the reason I tried the following: $list[] = $row['uid']; $list[] = intval($row['uid']); $list[] = mb_convert_encoding($row['uid'], 'iso-8859-1'); $list[] = mb_convert_encoding(intval($row['uid']), 'iso-8859-1'); My best bet as for now: It isn't implode there's the problem, but the length of the string -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ More than messages–check out the rest of the Windows Live™. http://www.microsoft.com/windows/windowslive/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems with implode
Tom Worster skrev: On 3/24/09 9:25 AM, "Andrea Giammarchi" wrote: Dunno why you guys started talk about utf-8 problems, he has a list of ids which should contain only unsigned integers, otherwise I do not get how that query could work with an implode(',', $whatever) rather than 'id in ("'.implode('","', array_map('mysql_real_escape_string', $whatever)).'")' ... so, the problem could be more about missed ids in the array obtaining ,, ... so, in this case, array_filter before, no? it's certainly possible. but the way toke described his problem did not imply that his ids were unsigned integers. SELECT FROM ... WHERE id IN ('aardvark', 'abacus', 'abbey', ..., 'zulu', 'zygote'); AS written else it is not a problem with either implode nor with string, Only when sending debug info via unformatted mail. Which really should not give this problem, but it does one day I'll have time to figure out exactly what does trigger this error. Regards, Toke -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] thread question
Hi all, Another question: If a script starts to perform an operation and the user browses away will that terminate the thread perfoming the operation eg. the operation is aborted ? Mvh Toke -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] thread question
Virgilio Quilario skrev: Hi all, Another question: If a script starts to perform an operation and the user browses away will that terminate the thread perfoming the operation eg. the operation is aborted ? Mvh Toke the script is aborted as soon as server gets no response from the browser when it sent output to the browser. virgil http://www.jampmark.com Hi virgil, would that also apply to a script executed from the first script : example: if (do_stuff_which_takes_a_long_time){ exec('php /path_toscript/script.phpsh'); } would script.phpsh also be aborted if the connection is broken ? Regards, Toke -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] thread question
Ashley Sheridan skrev: On Wed, 2009-04-01 at 19:41 +0800, Virgilio Quilario wrote: Hi all, Another question: If a script starts to perform an operation and the user browses away will that terminate the thread perfoming the operation eg. the operation is aborted ? Mvh Toke the script is aborted as soon as server gets no response from the browser when it sent output to the browser. virgil http://www.jampmark.com Hi virgil, would that also apply to a script executed from the first script : example: if (do_stuff_which_takes_a_long_time){ exec('php /path_toscript/script.phpsh'); } would script.phpsh also be aborted if the connection is broken ? Regards, Toke when exec starts running commands, php will wait until it ends. virgil http://www.jampmark.com Unless you ask exec to run in the background... Ash www.ashleysheridan.co.uk Hi Ash & vigil, Thanks, I've found my solution to this problem then. adding the function to an external script, and run it through exec. Regards, Toke -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] problem with graphicsMagick and Apache
Hi All, Might not be the correct place, but I hope someone in here can help me with this problem. running this from command line will execute correctly: gm convert source -resize 600x800 dest but running the same from within a script using exec() causes the threads to hang, restarting apache with graceful, causes the threads to be finished and the images are stored correctly. code : exec('gm convert '.$source.' -resize 600x800 '.$dest); And I did try with shell_exec() also, no difference. Can anyone give me a pointer as to why this happens ? Regards, Toke Herkild -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php