[PHP] Conceptional question on dealing with different languages
Hello list, it has been a while since I've posted the last time, but now I need your help/ opinion again. I'm re-designing an existing page for an online shop which is supposed to be used in different languages. The former design was just a plan echo for an output since the page was only intended for the German market. But now the output depends on the language the user selected. Currently we think of two languages, but that might change sooner or later (management decision...). Of course I don't want to ad an case of $language for every former echo. I want to export the content to one central file/ object / table... The infrastructure is PHP5 MySQL. Now my ideas, where I would need your opinion: 1. a XML File which I read via SimplXML 2. a plan Text file 3. a PHP class where I delviver the content out of arrays 4. or a table in MySQL Do you have other options, that might be useful? Which would you prefer? thx Jan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Comparing of string
Hi Jeremy, I tried if ( strcmp( trim($SollKombination), trim($formCheck) ) ) same negativ result. For some reason both strings are not considered to be the same. They have the same length, are of the same type and have the same content. Why PHP doesn't recognize them as beeing equal I don't get it. thanks for your help so far janbro Jeremy Privett schrieb: > janbro wrote: > >> Hello List >> >> I've got the following little code: >> >>$formCheck= $_GET['formCheck']; >>$SollKombination = $_SESSION['zufall']; >> >>echo "$SollKombination$formCheck"; >>print gettype($formCheck); >>echo "---"; >>print gettype($SollKombination); >> >> >>if ($SollKombination == $formCheck){ >> echo "test"; >>} >> >> To give you some background: This code is supposed to check if a user >> has tried to login via my form. >> >> Which gives me the following output: >> >> ZL0X~TT4PQ%0~R0OXPRUHY7E&!4~W337J71V4WDDI6$GS9480XP0TNP2I$1YX75S >> ZL0X~TT4PQ%0~R0OXPRUHY7E&!4~W337J71V4WDDI6$GS9480XP0TNP2I$1YX75S >> string---string >> >> Everything the way it's supposed to be.... >> >> What I don't get is, why isn't the if statement true? Shouldn't it >> show test as well? Where is my mistake? >> I run PHP 5.1.1 on Windows. On my Win PHP 5.0 this code works proper, >> but not here ?!? >> >> thx JanBro >> >> >> > Hey JanBro, > > Try replacing the if statement you have with this: > > if ( strcmp( trim($SollKombination), trim($formCheck) ) ) { > echo "test"; > } > > --- > Jeremy Privett [ http://www.jeremyprivett.com ] > Founder - Lead Software Developer - Hosting Systems Administrator > Omega Vortex > (http://www.omegavortex.com) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Comparing of string
Yep, they are of the same length. here they are: $SollKombination ZL0X~TT4PQ%0~R0OXPRUHY7E&!4~W337J71V4WDDI6$GS9480XP0TNP2I$1YX75S $formCheck ZL0X~TT4PQ%0~R0OXPRUHY7E&!4~W337J71V4WDDI6$GS9480XP0TNP2I$1YX75S When creating the string on the form page only visible characters were allowed. thanks but that's not it. Jon Westcot schrieb: > Hi JanBro: > > Quick guess: are the strings the same length? I've been bitten many > times by string comparisons that appear to be identical but which fail due > to trailing spaces, other "invisible" (i.e., non-printing) characters, and > the like. > > Hope this helps. > > Jon > > > - Original Message - > From: "janbro" <[EMAIL PROTECTED]> > To: > Sent: Tuesday, January 03, 2006 11:22 PM > Subject: [PHP] Comparing of string > > >> Hello List >> >> I've got the following little code: >> >> $formCheck= $_GET['formCheck']; >> $SollKombination = $_SESSION['zufall']; >> >> echo "$SollKombination$formCheck"; >> print gettype($formCheck); >> echo "---"; >> print gettype($SollKombination); >> >> >> if ($SollKombination == $formCheck){ >>echo "test"; >> } >> >> To give you some background: This code is supposed to check if a user has > tried to login via my form. >> Which gives me the following output: >> >> ZL0X~TT4PQ%0~R0OXPRUHY7E&!4~W337J71V4WDDI6$GS9480XP0TNP2I$1YX75S >> ZL0X~TT4PQ%0~R0OXPRUHY7E&!4~W337J71V4WDDI6$GS9480XP0TNP2I$1YX75S >> string---string >> >> Everything the way it's supposed to be >> >> What I don't get is, why isn't the if statement true? Shouldn't it show > test as well? Where is my mistake? >> I run PHP 5.1.1 on Windows. On my Win PHP 5.0 this code works proper, but > not here ?!? >> thx JanBro >> >> -- >> 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] Comparing of string
Hello List I've got the following little code: $formCheck= $_GET['formCheck']; $SollKombination = $_SESSION['zufall']; echo "$SollKombination$formCheck"; print gettype($formCheck); echo "---"; print gettype($SollKombination); if ($SollKombination == $formCheck){ echo "test"; } To give you some background: This code is supposed to check if a user has tried to login via my form. Which gives me the following output: ZL0X~TT4PQ%0~R0OXPRUHY7E&!4~W337J71V4WDDI6$GS9480XP0TNP2I$1YX75S ZL0X~TT4PQ%0~R0OXPRUHY7E&!4~W337J71V4WDDI6$GS9480XP0TNP2I$1YX75S string---string Everything the way it's supposed to be What I don't get is, why isn't the if statement true? Shouldn't it show test as well? Where is my mistake? I run PHP 5.1.1 on Windows. On my Win PHP 5.0 this code works proper, but not here ?!? thx JanBro -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Question to eregi Syntax
thx, that's what I've figured. but looking for ^ with any search engine won't give you anything useful. thx JaNbro M. Sokolewicz schrieb: janbro wrote: Hi List, my research hasn't turned anything useful up. Probably 'cause I don't have enough info. I've been playing around with the ereg function. What I was wondering is what is the ^ for like in the below example? ereg('[^[:space:]a-zA-Z0-9_.-]{1,}', $name) thx janbro it denotes the "start of the string" This might help (although it's for PCRE syntax, the POSIX (ereg(i)) syntax is very similair): http://www.php.net/manual/en/reference.pcre.pattern.syntax.php This is the manpage for the POSIX syntax: (might be a bit harder to read if you're just starting) http://www.tin.org/bin/man.cgi?section=7&topic=regex -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Question to eregi Syntax
Hi List, my research hasn't turned anything useful up. Probably 'cause I don't have enough info. I've been playing around with the ereg function. What I was wondering is what is the ^ for like in the below example? ereg('[^[:space:]a-zA-Z0-9_.-]{1,}', $name) thx janbro -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: send email at certain hour
vlad georgescu schrieb: i want to make a "reminder" application which sends emails at certain hour in php. is this posibile ? if not, what else can I use ? For Linux you could start a cron job, with windows I'd use the taskmanager to start a batch file which contains something like cd\programs\php php c:\webpages\php\timer.php janbro -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Question to example from manual
autsch, that's true, sorry for disturbing thx Jason janbro Jason Barnett schrieb: > janbro wrote: > >> Hi, I've been working on this example and copied it in my >> webroot, it doesn't give me an output. Does anybody know why? >> "System" WinXP Apache 2.0.50 php 5.0.3 > > > Because you've defined the function, but you've never called it. > >> >> thx >> janbro >> >> >> Example 7-6. Static variables with recursive functions >> >> > function Test() >> { >> static $count = 0; >> >> $count++; >> echo $count; >> if ($count < 10) { >> Test (); >> } >> $count--; >> } > > > Test(); > >> ?> > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Question to example from manual
autsch, that's true, sorry for disturbing thx Jason janbro Jason Barnett schrieb: > janbro wrote: > >> Hi, I've been working on this example and copied it in my >> webroot, it doesn't give me an output. Does anybody know why? >> "System" WinXP Apache 2.0.50 php 5.0.3 > > > Because you've defined the function, but you've never called it. > >> >> thx >> janbro >> >> >> Example 7-6. Static variables with recursive functions >> >> > function Test() >> { >> static $count = 0; >> >> $count++; >> echo $count; >> if ($count < 10) { >> Test (); >> } >> $count--; >> } > > > Test(); > >> ?> > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Question to example from manual
Hi, I've been working on this example and copied it in my webroot, it doesn't give me an output. Does anybody know why? "System" WinXP Apache 2.0.50 php 5.0.3 thx janbro Example 7-6. Static variables with recursive functions -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Exporting to MS Word or Excel
Hi, for Excel I'd use the pear package. If you need MS Word your only chance is probably DCOM. But that requires Windows and knowledge about configuration in DCOM. There is some docu on www.zend.com. Another chance could be to work with rtf files, but I remember only reading about it, never used it myself janbro Miguel Guirao schrieb: > Hi!!! > > Are there any chances that I could export a dynamic created web page into MS > Word or Excel? > I know this can be done with PDF!! > > I'm using LAMP!! > > --- > Miguel Guirao Aguilera > Logistica R8 TELCEL > Tel. (999) 960.7994 > Cel. 9931 600. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5 Question about OO
Alright thanks, I see there is a workaround to cope with that. I've never worked with __autoload, but will sure give it a look. I don't realy feel this satisfying, but hey I'm thankful to have oo at all. janbro Marcus Bointon schrieb: > On 1 Jun 2005, at 09:01, janbro wrote: > >> require (Class2.php); >> class Class1{ >> private function ... { >> $refClass2 = new Class2; >> } >> } >> >> Now my question, is it possible to skip that require/ include part? In >> Java you don't need that, as class and file names are identical. > > > PHP doesn't have this luxury - people can call files whatever they > like. However, PHP5 does have a nice feature to deal with this. In your > class1 class, create a function called __autoload like this: > > function __autoload($class_name) { >require_once $class_name . '.php'; > } > > In this case when you ask for a new class2 and you've not required it > before, it will automatically call __autoload with $class_name set to > 'Class2', which then requires the class file according to the pattern > used in the function, in this case 'Class2.php'. Note that while PHP is > not case sensitive to class names, the file system you're on probably > is, so keep your case consistent throughout. > > Docs are here: http://www.php.net/manual/en/language.oop5.autoload.php > > Marcus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5 Question about OO
Okay, I see there is a workaround but nothing realy satisfying, but I'm not hoing to complain, I'm hapy to have oo in PHP at all. I never worked with __autoload so far, but I will give it a try and check it out thx janbro Marcus Bointon schrieb: > On 1 Jun 2005, at 09:01, janbro wrote: > >> require (Class2.php); >> class Class1{ >> private function ... { >> $refClass2 = new Class2; >> } >> } >> >> Now my question, is it possible to skip that require/ include part? In >> Java you don't need that, as class and file names are identical. > > > PHP doesn't have this luxury - people can call files whatever they > like. However, PHP5 does have a nice feature to deal with this. In your > class1 class, create a function called __autoload like this: > > function __autoload($class_name) { >require_once $class_name . '.php'; > } > > In this case when you ask for a new class2 and you've not required it > before, it will automatically call __autoload with $class_name set to > 'Class2', which then requires the class file according to the pattern > used in the function, in this case 'Class2.php'. Note that while PHP is > not case sensitive to class names, the file system you're on probably > is, so keep your case consistent throughout. > > Docs are here: http://www.php.net/manual/en/language.oop5.autoload.php > > Marcus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP 5 Question about OO
Hi List, I'm using the oo orientation of PHP5 for a while now. All Classes I've got have a require on top them, if I try to reference to other classes. something like require (Class2.php); class Class1{ private function ... { $refClass2 = new Class2; } } Now my question, is it possible to skip that require/ include part? In Java you don't need that, as class and file names are identical. thx janbro -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Code Check fixed
Ok, thx, I've got it done. Dumb mistake, the user didn't have rights to delete, it's as simple as that. My trials thru the command line where as root thx guys janbro Richard Lynch schrieb: > What you are doing wrong is ignoring the error messages MySQL is storing > for you... > > > On Mon, May 30, 2005 12:37 pm, janbro said: > >>Hi List, I don't know where else to look. I've got PHP 5.0.0 and MySQL >>4.1.3. (on Windwows XP with Apache 2.0.50) >> >>Here is my Code: the Query with the delete is not executed and I don't >>know why. If I copy it into the MySQL Command line like it is here, >>everything works fine. I have another example with a more simple delete >>which works (same syntax) >> >>If I replace the delete with the insert statement it works. >> >>What 'am I doing wrong here? >> >> >> >> >>>public function DeleteOldFails (){ >>> $conClas=$this->con(); >>> $con=$conClas->mysqlConnect (); >>> >>> $query = "DELETE FROM LoginTracker WHERE >>>(UNIX_TIMESTAMP(CURRENT_TIMESTAMP) - UNIX_TIMESTAMP(DateAttack)) > >>>3600;"; >>>// $query ="INSERT INTO LoginTracker (IPAttack, User) VALUES >>>('127.0.0.1','user')"; >>> echo "$conDiesen Auf ERFOLG TESTEN! LÖSCHT ER WAS ER SOLL? >>>$query"; >>> print $con->query($query); > > > echo mysql_error(); > > >>> $con->query("OPTIMIZE TABLE LoginTracker "); >>> >>> $this->discon ($conClas, $con); >>> } >> >>thx >>janbro >> >>-- >>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] Code Check
Hi List, I don't know where else to look. I've got PHP 5.0.0 and MySQL 4.1.3. (on Windwows XP with Apache 2.0.50) Here is my Code: the Query with the delete is not executed and I don't know why. If I copy it into the MySQL Command line like it is here, everything works fine. I have another example with a more simple delete which works (same syntax) If I replace the delete with the insert statement it works. What 'am I doing wrong here? > public function DeleteOldFails (){ > $conClas=$this->con(); > $con=$conClas->mysqlConnect (); > > $query = "DELETE FROM LoginTracker WHERE > (UNIX_TIMESTAMP(CURRENT_TIMESTAMP) - UNIX_TIMESTAMP(DateAttack)) > 3600;"; > //$query ="INSERT INTO LoginTracker (IPAttack, User) VALUES > ('127.0.0.1','user')"; > echo "$conDiesen Auf ERFOLG TESTEN! LÖSCHT ER WAS ER SOLL? > $query"; > print $con->query($query); > $con->query("OPTIMIZE TABLE LoginTracker "); > > $this->discon ($conClas, $con); > } thx janbro -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: mysql_connect does not connect
Hi I connect to a MySQL 4.1 with the following String: if ($db_verbin=mysqli_connect("$mysql_host","$mysql_user","$mysql_passw","$DB_n ame")) watch the i in mysqli_connect! I think I've read somewhere that you are required to use that for the >4.1 Versions, but you better look that up, I might be wrong there. Hope this helps. By the way, can you connect thru PHPMyAdmin? If not you might have that old version password problem. JanBro -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: mysql_connect does not connect
Hi I connect to a MySQL 4.1 with the following String: if ($db_verbin=mysqli_connect("$mysql_host","$mysql_user","$mysql_passw","$DB_n ame")) watch the i in mysqli_connect! I think I've read somewhere that you are required to use that for the >4.1 Versions, but you better look that up, I might be wrong there. Hope this helps. By the way, can you connect thru PHPMyAdmin? If not you might have that old version password problem. JanBro -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: mysql_connect does not connect
Hi I connect to a MySQL 4.1 with the following String: if ($db_verbin=mysqli_connect("$mysql_host","$mysql_user","$mysql_passw","$DB_n ame")) watch the i in mysqli_connect! I think I've read somewhere that you are required to use that for the >4.1 Versions, but you better look that up, I might be wrong there. Hope this helps JanBro -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] finding string in string
Hi, I've got the following little function: public function addText($pdf, $xPos, $yPos, $schriftgroese, $text){ /** * @description: Returning Text with automatic linebreak */ $heuhaufen = $text; for ($i=0; $i < substr_count($heuhaufen, "\n") + 1; $i++){ $posStr= stripos ($heuhaufen,"\n"); $text = substr ($heuhaufen, 0, $posStr); $heuhaufen = substr ($heuhaufen, $posStr, 1 ); if ($posStr ==0) $text = $heuhaufen; echo "\n\t|| $i $posStr ||| $text"; } } That gives me in HTML: || 0 ||| Selbständiges Werk || 0 ||| Zweigwerk || 0 19 ||| Tochtergesellschaft || 1 0 ||| eines Konzerns oder einer Holding || 2 0 ||| eines Konzerns oder einer Holding || 0 ||| keine Angaben But if I have look at the generated code it schows CORRECTLY || 0 ||| Selbständiges Werk || 0 ||| Zweigwerk || 0 19 ||| Tochtergesellschaft || 1 0 ||| eines Konzerns oder einer Holding || 2 0 ||| eines Konzerns oder einer Holding || 0 ||| keine Angaben The $text is preformated and checked it it's to wide for the desired place. The Output is placed at x-y Coord. for PDF Output. My Qustion is: Why for crying out loud, doesn't it cut the second time, the way it's supposed to. I just can't find the reason for this behavior. substr_count($heuhaufen, "\n") is working stripos ($heuhaufen,"\n"); only the first time/ or the last line to be returned? Please help, I'm sitting on this for almost a day now. thx Jan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Variable variables
Hi List, I'm using PHP5 with global variables off. I've got around 20 dynamically generated forms with a total of 300 different variables sent thru these forms. I'd like to use variable variables, but according to the manual this is not possible. Now comes my Questoin, how do I receive my variables which have the form $a_123 or $a_124[]. Is there a workaround for PHP5 or PHP in general? Who do I make $data = $_REQUEST['a_123'] work ??? I'd hate to set global variables to on, as I'm dealing with sensitive data. Thx JanBro -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Question about the manual content
p {margin: 0px}Hi List,I have a little problem I posted a couple of times now. The PHP Manual gave me the idea that the clibpdf library seemed to work with php. Well I tried some things they didn't seem to work.Well I thought I'd ask the list, maybe somebody could help me out. But what a thought, nobody even answered it is not possible, or look there. I know this is not one of these how do I make a select from mysql questions, but is everyone on vacation?If it is not possible or nobody uses it anymore, which I totally understand why, then why is it still in the manual? I know I'm not the first to ask the questions I asked and I'm not the first not to receive an answer on this, but if it's not working why is it still in the f** manual?I'm especially talking about the point of a picture not showing with ClibPDf which somebody asked 2000 (he didn't get an answer either)This is getting sort of frusttrating, so I apolpgize for letting some steam out here. But I just can't believe there is nobody out there who has a clue.thx Jan __ Extra-Konto: 2,50 %* Zinsen p. a. ab dem ersten Euro! Nur hier mit 25 Euro-Tankgutschein & ExtraPrämie! https://extrakonto.web.de/?mc=021110 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] cpdf_import_jpeg() doesn't show input
Hi, I've got ClibPDF working soemhow, Only the cpdf_import_jpeg() function does not produce any output at all. There is no error message. I called the function like this: pdf = cpdf_open(0); cpdf_page_init($cpdf, 1, 0, 842, 594, 1.0); cpdf_import_jpeg($pdf,"image.jpg",10,10,0,300,100,0,0,1); cpdf_finalize($pdf); Header("Content-type: application/pdf"); cpdf_output_buffer($pdf);cpdf_close($pdf); The pdf-file does not show anything. If I google All I find is the manual 10.000 times but no answer to my problemes, please help __ Nachrichten, Musik und Spiele schnell und einfach per Quickstart im WEB.DE Screensaver - Gratis downloaden: http://screensaver.web.de/?mc=021110 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php