[PHP] test
does it work now? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Question
I've installed PHP using the windows installer I try to open then php pages containing the following script : ?php echo Current IP Address: ; $ipx = getenv(HTTP_CLIENT_IP) ? getenv(HTTP_CLIENT_IP) : 0; $ipx = !$ipx getenv(HTTP_X_FORWARDED_FOR) ? getenv(HTTP_X_FORWARDED_FOR) : 0 ; $ipx = !$ipx getenv(REMOTE_ADDR) ? getenv(REMOTE_ADDR) : 0 ; echo !$ipx ? UNKNOWN : $ipx; echo br; echo Server IP Address: ; $ipx = getenv(SERVER_ADDR) ? getenv(SERVER_ADDR) : 0; echo !$ipx ? UNKNOWN : $ipx; ? It works and gives me a correct current IP address When manually installing PHP it always gives me the status UNKNOWN. The only difference I've seen is that the Windows installer uses the php5ts.dll for ISAPI filter while the manually installed php uses the php5isapi.dll. I know that the PHP is working (when manually installed) because this script works : ?php phpinfo(); ? The only strange thing is that the phpinfo says that the ini file is located in C:\Winnt although it is not there (when installing manually it is in C:\PHP) How can I make the IP address script working when manually installing PHP ? Or is it really so unsafe to use the windows installer on a online server? Sincerely, Sven
[PHP] Re: Custom Open Tags
Hi all Thanks for your hints. I need this feature for an easy to use minimalistic CMS solution, so tweaking the PHP source is not that much of an option. But evals do the trick of course. I ruled that out at first because I thought it'll cause a lot of clumsy code. Yet there's quite an elegant way to do it, I mail it for future reference: /** * Includes a file executing ?mc ... ? tags as if they were ?php ... ? tags. * * @param string $file file to include * @param bool $php whether to execute ?php ... ? tags as well */ function xinclude($file, $php=TRUE) { $content = file_get_contents($file); if (!$php) { $content = preg_replace('/\?php.*?\?/', '', $content); } $content = str_replace(\x3Fmc, \x3Fphp, $content); $content = print '.str_replace(array(\x3Fphp, \x3F), array('; , ; print '), $content).';; eval($content); } The only downside: No single quote (') is possible outside ?xyz ... ? tags in the file included. This can of course be fixed, but only with a ridiculous amount of code. If only there was a way to do heredoc strings that DON'T parse variables (like in Perl). -sven -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Custom Open Tags
Hi folks Does anybody know whether there's a way to tell PHP to accept an alternative open tag like for instance ?mytag or ?mc along with the normal ?php tag? I'm looking for a way to have two kinds of PHP code in a page. The first kind tagged ?mc ... ? contains the PHP code to manage page elements (like includes, menus etc) while the second kind tagged ?php ... ? contains normal PHP code for dynamic pages (like DB stuff). A page resides on the Staging (Virtual) Host and contains both kind of tags. When viewing the page on the Staging Host, both open tags are executed. Yet when publishing a page to the Production (Virtual) Host, the mc-tags are executed (and thus complete the page design) while the php-tags are left untouched (as they contain the dynamic stuff). Sounds more complicated than it is :-) Thanks for your hints,-sven -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Custom Open Tags
Hi Trevor I'm not sure, but that may allow you to use ?php ? AND % % tags at the same time. Thought about that, it would actually be very elegant if it was the other way round. ASP tags would be great instead of a ?mc ... ? custom tag, however, that won't do the trick as the execution of the ?php ... ? tags can't be switched off (or can it?) when using % ... % tags. Thanks for your thoughts though! -sven -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Performance issues and trees
Hi, I'm currently struggleing with trees built from arrays of arrays and their performance. During tree traversal php spends a frightening amount of time in there, which (I guess) is due to the way the tree is constructed. What I have is an unbalanced binary tree, the inner nodes of which are encoded as Array( [0] - left subtree, [1] - right subtree ) and a string as a leaf. Where I need to go is encoded as a binary string, consisting of the letters 0 and 1. My tree-traversal algorithm looks like this: $bit_array = str_split( $bitstring ); $tree_climber = $tree; // assign tree-climber to the tree root // main loop while( !is_null( $bit = array_shift( $bit_array ) ) ) { $tree_climber = $tree_climber[$bit]; // going down... if( !is_array( $tree_climber ) ) { // we reached a node process( $tree_climber ); $tree_climber = $tree;// and back up to the root we go } } I'm seeing execution times in excess of 30 seconds for a few hundred (~ 200 - 300 ) tree-runs (with the tree in question being of average depth 5, translating to 1000 - 1500 assignments, which is way to slow to be practical. And the main holdup _is_ the tree-traversal, the sum of the process() functions is in the range of 0.3 seconds (measured with microtime(true) ). Is there any way to speed this up? I've already tried constructing a lookup-table from the tree, and going through the bitstring along the lines of // Pseudocode while( not_done ) { for( $i = 1; $i $max_tree_path; ++$i ) { $examined = substr( $bitstring, 0, $i ); // lets look at the first $i bits if( is_set( $lut[$examined ] ) ) { $result = $lut[$examined]; $bitstring = substr( $bitstring, $i ); break; } } but this actually fares worse in terms of runtime. I'm using php 5.0. Regs, Sven -- -Trigital- Sven Riedel . Tel: +49 511 1236364 . Fax: +49 511 1690746 . email: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Performance issues and trees
On Tue, Jul 20, 2004 at 09:49:07AM -0500, Michael Sims wrote: above is necessary. If you merely need to traverse $bit_array without actually modifying it then I suspect a simple foreach would be much faster, but I'm probably missing something... Ah, I just changed that and now it's a hundred-fold faster, thanks! Regs, Sven -- -Trigital- Sven Riedel . Tel: +49 511 1236364 . Fax: +49 511 1690746 . email: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: deleting array elements
Benjamin Jeeves schrieb: Hi All I have two array one with a list of items in it. Then a second array with a list of items in it what I want to be able to do is compare array1 to array2 and if a match is found in both arrays delete that match from array1 and then so now? Any help would be good. so array1 = (1,2,3,4,5) array2 = (1,3,5) then print array1 and the output be 2,4 Thank you hi, try array_diff() or array_intersect() or any other corresponding function. hth sven -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: regexp appears to be faulty (DONT actually think so)
Henry Grech-Cini schrieb: ... $regexp=/fieldset([^]*)[^(\/fieldset)]*/i; ... $result=extractFieldsets('testfieldset attribute=hellocontent of hello/fieldsetemblah/emfieldset attribute=goodbyegoodbye/fieldset'); ... And it produced; (0)= (0)=[fieldset attribute=hellocon] (1)=[fieldset attribute=goodbyegoo] (1)= (0)=[ attribute=hello] (1)=[ attribute=goodbye] hi, as it is defined in regex-spec: a '^' inside a char-group '[...]' defines all chars, that aren't allowed, and not a string! so the first 't' of 'content' and the 'd' of 'goodbye' don't match your regex anymore. a start for a solution could be: ?php $rx = '/fieldset[^]*(.*)\/fieldset/i'; ? if you want to take care of your fieldset-attribs in your result, you can set your brackets again: ([^]*) some probs i can think of are nested fieldsets inside fieldsets (don't know by head, if this is allowed by w3). and another prob: is that you don't catch multiple fieldsets after another. i think there is a switch, that catches only the least result. hth SVEN -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: regexp appears to be faulty (DONT actually think so)
Henry Grech-Cini schrieb: Thanks Sven, You are quite right with your some probs comment. hi, think i found it. try this: ?php $rx = '/fieldset.*(.*)\/fieldset/iU'; ? the '/U' stands for 'ungreedy'. also note the change in the attribs-regex. hth SVEN -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: regexp appears to be faulty!?
Henry Grech-Cini schrieb: I came accross this link a href= http://www.alpha-geek.com/2003/12/31/do_not_do_not_parse_html_with_regexs.html http://www.alpha-geek.com/2003/12/31/do_not_do_not_parse_html_with_regexs.html /a Do we all agree or should I keep trying? Henry hi henry, this could be an interesting discussion. i think there can be a solution for every problem. it's only a question of the logic. the main problem in this example are white spaces in every kind (space, tab, newline, carriage return, ...) and there are solutions in regex. a little example: '/( |\t|\n|\r)*/' checks optional white spaces you can also give '\s*' a try (any whitespace char). maybe it also works with '\r\n'? just some thoughts. hth SVEN ps: it surely is possible to ignore everything between 'script/script', isn't it? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mp3 with php?
Chris W. Parker schrieb: carlos castillo mailto:[EMAIL PROTECTED] on Thursday, February 12, 2004 3:53 PM said: does anyone know how to reproduce a mp3 file with php? What do you mean reproduce? Copy? Create from scratch? Represent visually? In any case.. I'd say PHP cannot do anything but create a copy of a file. It cannot read in data from a microphone or a cd player or the like (as far as I know). Chris. but php can call external progs (e.g. exec(); system()). so you can run lame or other progs and give the desired params like source- and target-file, sampling-rate, mode (mono, stereo), and so on. maybe that's what you want? hth SVEN -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] STMP Configuration
John Nichel schrieb: Kaushan wrote: Hi friends, When I'm trying to use the mail() function I got the following error : Failed to connect to mailserver at localhost port 25, verify your SMTP and smtp_port setting in php.ini or use ini_set() . I'm currently using PHP 2.0.0b1 and localhost (Apache) as the web server. PHP 2??? Do I have to install a seperate STMP server? If you're trying to send mail thru localhost, localhost needs to have a running MTA (sendmail, qmail, etc), and that MTA needs to be configured to accept mail from localhost (default for all that I know), and relay for mail sent from localhost. ... and if you not want to send from localhost, you can change your smtp-params in your php.ini. hth SVEN -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: i need help help with include
hi, is this useful? ?php echo $_SERVER['DOCUMENT_ROOT']; ? hth SVEN Php schrieb: Hi I created a directory and files 3 directory's down root/dir1/dir2/dir3/files now i need to include my function file out of the root root/dir/funtionfile How do i do this? I cannot create a htacess file on this server nor set my include path. Can anyone help please Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Counting back 90 days...
Tristan Pretty schrieb: I believe I can minus 10 days from $day by having... $timestamp = mktime (0,0,0,$month,$day-10,$year); hi tristan, i believe, that this works with 90 days, too. mktime() takes care of invalid dates. otherwise you had a problem with your code with the first 10 days of the month. give it a try. hth SVEN -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Problem with using php at the command line with mysql
hi richard, Richard Kurth schrieb: ? include(location.inc); Global $roothostname,$rootusername,$rootpassword,$dbName; dbconnect($dbName,$rootusername,$rootpassword,$roothostname); $query = SELECT * FROM domhosted; $result=safe_query($query); i don't know what safe_query() does for you. if it's your own function from your .inc-file some code could be helpful. otherwise try this: $result=mysql_query($query); while($row = mysql_fetch_row($result)){ $dom=$row[domname]; $total=getguota($dom); $result = safe_query(update datasubused set quotaused ='$total' where domname = '$dom'); } ? hth SVEN -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Regex to grab a Windows Path from a String...
[EMAIL PROTECTED] schrieb: My regex skills are serious lacking and after scouring the net for relevant links I'm a bit stuck. I've got a textarea field where I pull user input from, and I'd like to search this entire field for a Windows Directory Path (ex. C:\Documents\Blah). Basically my users are allowed to specify HTML img tags in this textarea and I'd like to make sure that they don't reference any images that are on their local hard drive (which many of them are doing and then thinking the HTML that I generate from that actually works when it doesn't). Suggestions? hi, i would start like this: 1. get the entire src-param of your img tag: ?php $regex = '/src=([^])/'; ? this should search for everything between the two doubleqoutes and give it as $match[1] if working with this param in preg_match(). 2. check this string for url or local path: some possibilities are, to check for backslashes, as they are only allowed in win-paths, not in url. or to check whether your path starts with a letter, followed by a colon ('/[a-zA-Z]:/') as the local root (drive letter). if both is false assume that it's a relative or absolute url. the other (better?) way is, to check generally, whether it's a valid url according to rfc1738 (a local win-path isn't). maybe there are existing functions? hth SVEN -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: sql query and some math
Patrik Fomin schrieb: ... q2) i got like 100 matches from a database into a $num variable, then i want to devide that by 3 aslong as it can be done, eg: while ($num != 0) { ïf ($num / 3 = true){ some code to display some fields from a database $num = $num - 3; } else { some other code to display $num = 0; } } basicly i want the if statement to check if its more then 3 posts left to print out, if not its gonna print out the remaining last 1 - 2 post in a diffrent way (for the looks) hi patrik, for your second question maybe 'modulus' helps you. ?php $mod = $num % 3; ? gives you your remaining results (0, 1 or 2) depending on division by 3. another possibility could be the use of 'limit' in your sql-select-statement. hth SVEN -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Q on RegExp extended Char
Jswalter schrieb: ... - allow apostrophes, but only if preceded *and* followed by a Alpha/Extend - allow hyphen/dash, but only if preceded *and* followed by a Alpha/Extend ... hi walter, how about something like this: ?php $_alpha = 'a-zA-Z'; // standard latin letters $_xascii = '\x80-\xFF'; // extended ascii-codes $_achar = $_alpha.$_xascii; // allowed characters $regex = '/^['.$_achar.']+(\'|-)['.$_achar.']+$/'; ? hth SVEN -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: logic for displaying hierarchical data (ala windows explorer)
Chris W. Parker schrieb: Hi everyone, Last Friday I struggled for a long time with displaying some data that's stored using the Modified Preorder Tree Traversal method. Without making this email overly long and complicated (like my first draft was) I'd like to simply ask if someone has any links or functions or instructions they can give me on how to display my data in such a way. I want the following: Level 1A |--Level 2A | \--Level 3A | |--Level 4A | | \--Level 5A | \--Level 3B |--Level 2B | \--Level 3C \--Level 2C \--Level 3D What I always end up with is this (or some variant of it): Level 1A |--Level 2A | \--Level 3A | | |--Level 4A | | | \--Level 5A | | \--Level 3B |--Level 2B | \--Level 3C \--Level 2C | \--Level 3D Any help is appreciated. Chris. hi chris, just some thoughts: i assume you build your tree from leaves to root via recursive functions? if so you need a logic like this: ?php function isLastChild($self, $parent) { // check, whether $self is the last child of parent // return true or false } if (!isLastChild($parent, $grandparent)) { // draw your vertical line symbol } else { // draw just a spaceholder } // following draw the label of $self ? hope you understand, what i mean? hth SVEN -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] trouble parsing an XML document
Alfredo schrieb: hi, Sven wrote: take a look at http://www.php.net/manual/language.variables.php: A valid variable name starts with a letter or underscore, followed by any number of letters, numbers, or underscores. so, a minus isn't allowed in varnames! hth SVEN I agree with you but let me say the problem: I'm parsing some XML documents, I'm not the writer of them and of DTD, who wrote them used some tags like: REG-ORIG This is allowed in XML, but when I initialise varibles I need to use the same name of tags(also respect Case-sensitiveness). This is a big compatibility problem, how can I do? I cannot change all the XML docs and the DTD. bye Alfredo hi alfredo, maybe you can workaround with arrays? for keys you can use any string. so $xml['REG-ORIG'] is valid in php. hth SVEN -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Fatal Error: PDFlib error ...
Matthias Nothhaft schrieb: Hi, I'm trying to get the pdflib work... I use pdflib 4.0.3 downloaded from pdflib.de and php 4.3.4 on Debian Linux. I wrote this test code: hi matthias, if you want to use this lib it's good to be familiar with classes and objects in php. the manual can help you at this. now to your code. ?php dl(libpdf_php.so); $pdf = pdf_new(); you just created a php-object $pdf. for your further methods you must explicit declare them to your objects: pdf_begin_page($pdf, 421, 595); $pdf-pdf_begin_page($pdf, 421, 595); ... and so on. hth SVEN -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: help with install
Paul Vinten schrieb: ok, Just installed PHP with Xitami, with Apache 1.3 AND 2. I've used PHP versions 4.33 and 4.3.4. I'm running Windows XP, mucking around with some pages that came with my Web Programming book, most of the php pages work, but anything involving sessions, forms and cookies etc just doesn't work. Anyone any pages that they know work that I can try, so I can figure out what the problem is? Should they work, even though the PHP code is actually quite old? (the version that came with the book is 4.0.3) The stuff works ok under 4.0.3, but I need the functionality of the latest version for some stuff on my Uni course... Anyone able to help me, or point me in the right direction? hi, just some thoughts: for sessions it's possible, that in php.ini 'session.save_path' or 'session.cookie_path' isn't correctly defined? another possiblility is, that your scripts depend on 'register_globals = On', which is (now) set to 'off' by default (location: php.ini). either you set it 'on' (not recommended, search the newsgroup for that and the security issues), or rewrite your scripts for off-support, e.g. $_SESSION['sess_var']. hth SVEN -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] trouble parsing an XML document
hi, Raditha Dissanayake schrieb: doesn't look like a xml parser problem. I haven't tried your code but i think the error is $this-$k no, why not a variable method depending on $k? alfredo wrote: Hello, I'm trying to parse a XML doc, but the doc has some tags like: REG-ORIG so when I try to initialize variables: class Documenti { var $FILE; //nomefile var $NUMERO; //numerodiserie var ${'REG-ORIG'}; // here is the broblem take a look at http://www.php.net/manual/language.variables.php: A valid variable name starts with a letter or underscore, followed by any number of letters, numbers, or underscores. so, a minus isn't allowed in varnames! hth SVEN function Documenti($aa) { foreach ($aa as $k=$v) $this-$k = $aa[$k]; } i have an error: Parse error: parse error, unexpected '$', expecting T_VARIABLE... I tryed changing the $ position: var {$'REG-ORIG'}; // here is the broblem does not change anything: Parse error: parse error, unexpected '{', expecting T_VARIABLE... thanks for any suggestion, Alfredo (Italy) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Problem with adding quotations to a mysql insert statement
Richard Kurth schrieb: I need to add extra quotation marks in to the following insert command for mysql. I need one that is part of the info right before the |$wrapper resend and right after the $outgoing,nobody $query = insert into majordomoaliases (domain,listname,var,address1,address2)values (/$domname/,\$listname\,\a\,\$listdomain-$listname:\,\ |$wrapper resend -C $domaincf -l $listname -h $listdomain $listdomain-$listname-$outgoing,nobody\); The whole line should look like this when it is printed out to the page it will be written to from the database |/var/wrapper resend -C /var/domaincf -l list1 -h domain.com domain.com-list1-outgoing,nobody I am totaly stuped on haw to add this extra quotation mark no mater what I do I get mysql errors. hi richard, take a look at mysql-manual /6 MySQL Language Reference /6.1 Language Structure /6.1.1 Literals: How to Write Strings and Numbers /6.1.1.1 Strings A `' inside a string quoted with `' may be written as `'. so for your query: $query = insert into majordomoaliases (domain, listname, var, address1, address2) values (\$domname\, \$listname\, \a\, \$listdomain-$listname:\, \ \\$wrapper resend -C $domaincf -l $listname -h $listdomain $listdomain-$listname-$outgoing,nobody\\\); hth SVEN -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Q on RegExp extended Char
Jswalter schrieb: I've hit my limit on regular expressions. I need to check a string to see if it contains legal characters... A thru Z [a-z], SPACE, PERIOD, DASH/HYPHEN, APOSTROPHE [\' -,\.] OK, this is not a problem. My problem comes in with extended characters, as these examples... González Vänligen före innehålla I'm trying to build a RegExp that will see if the string is a proper name format or not. Names only have A thru Z, extended characters for other languages (than English), SPACE, PERIOD, DASH/HYPHEN, APOSTROPHE Dr. Roger O'Malley Mrs. Sara Harris-Henderson I have a RegExp to do English letters, but not the extended set... Manuel González Försök Bokstäver Contém Espaço-Válido (Ok, these are not really names, but you get the idea) Any ideas on this? All I want to know is if a given string contains only these types of characters. anything else would give me a FALSE. Thanks Walter hi walter, because most of these chars are extended ascii (decimal: 128-255), this regex should work: '/\x80-\xFF/' (hex-values). also take care of the minus in your regex if it doesn't stand on start or end of your char-group it means 'from-to'! hth SVEN -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: var check not working...
Jas schrieb: For some reason this will not work... my $_POST variables check for no form variables and display a form... if they choose an item from a select box it queries the database for a field matching the $_post var and builds a new form creating 8 separate $_post variables to check for.. so far it works except when selecting an item from the select box it will only display the first form when there are $_post vars present. I think I am missing something, could someone look over my code? Thanks in advance, Jas function vlans_dhcp() { $lvl = base64_decode($_SESSION['lvl']); if ($lvl != admin) { $_SESSION['lvl'] = base64_encode($lvl); $_SESSION['msg'] = $dberrors[12]; call_user_func(db_logs); } elseif ($lvl == admin) { $_SESSION['lvl'] = base64_encode($lvl); if (($_POST == ) || (!isset($_POST['dhcp_vlans'])) || (!isset($_POST['sub'])) || (!isset($_POST['msk'])) || (!isset($_POST['dns01'])) || (!isset($_POST['dns02'])) || (!isset($_POST['rtrs'])) || (!isset($_POST['vlans']))) { create 1st form with dhcp_vlans as $_post var; } elseif (($_POST != ) || (isset($_POST['dhcp_vlans'])) || ($_POST['dhcp_vlans'] != --) || (!isset($_POST['sub'])) || (!isset($_POST['msk'])) || (!isset($_POST['dns01'])) || (!isset($_POST['dns02'])) || (!isset($_POST['rtrs'])) || (!isset($_POST['vlans']))) { create 2nd form based on dhcp_vlans $_post var and create 8 different $_post vars...; } elseif (($_POST != ) || (!isset($_POST['dhcp_vlans'])) || (isset($_POST['id'])) || (isset($_POST['sub'])) || (isset($_POST['msk'])) || (isset($_POST['dns01'])) || (isset($_POST['dns02'])) || (isset($_POST['rtrs'])) || (isset($_POST['rnge'])) || (isset($_POST['vlans']))) { now put 8 $_post vars in database...; } else { $_SESSION['lvl'] = base64_encode($lvl); header(Location: help.php); } } else { $_SESSION['lvl'] = base64_encode($lvl); $_SESSION['msg'] = $dberrors[12]; call_user_func(db_logs); } } hi jas, the problem is, that your second form is only executed if your first condition is false (else if). but because of your or condition (||) only one of them has to be true. right? right! so it doesn't matter if your $_POST['dhcp_vlans'] is not set, when any other isn't set. a solution might be: ?php if ( $_POST == || ( !isset($_POST['dhcp_vlans']) !isset($_POST['sub']) !isset($_POST['msk']) !isset($_POST['dns01']) !isset($_POST['dns02']) !isset($_POST['rtrs']) !isset($_POST['vlans']) ) ) ? hth SVEN -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Display Query Result As Editable Form
Sophie Mattoug schrieb: input type=text name=name value=?=$value? [EMAIL PROTECTED] wrote: Hi all, I am creating a user form whereby I will do an INSERT , SELECT , UPDATE and of course DELETE for the form. Right now I am trying to create a form whereby when user choose to update their info, they wil be directed to a form where the fields region are EDITABLE , before that, the fields should contain their old info...so can i know how should i go about creating this kinda Editable fields using php scripting ???Fields should contain old info retrieved from the DB.Anyone have any idea?? Realli need some help here. Thanks in advance =) Irin. ... or the long version, if you work with other namespaces or your webserver doesn't support these short tags: input type=text name=name value=?php echo $value; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Constraint Violation when INSERT
[EMAIL PROTECTED] schrieb: Hi all, I got the error Constraint Violation when I did an INSERT . Gone thru the code umpteen times but to no avail..Wondering where my error was??...Below is a snip of the block of code: ? $dsn = mysql://root:[EMAIL PROTECTED]/tablename; $db = DB::connect ($dsn); if (DB::isError ($db)) die ($db-getMessage()); //create variables ready to go into DB $tutor_name = $db-quote($_POST[tutor_name]); $tutor_contact = $db-quote($_POST[tutor_contact]); $tutor_email = $db-quote($_POST[tutor_email]); $tutor_profile = $db-quote($_POST[tutor_profile]); $sql = INSERT INTO tutor (tutor_name, tutor_contact, tutor_email, tutor_profile) VALUES ($tutor_name,$tutor_contact,$tutor_email,$tutor_profile); $result = $db-query($sql); if( DB::isError($result) ) { die ($result-getMessage()); } ? -- - Everything was fine and the INSERT works, user input was insert into the database successful using the same block of code but the next thing i know I got this error anyone know watz the proz here??? Hope to get some help soon. Thanks in advance=) Irin. Don't you need to quote your strings? $sql = INSERT INTO tutor (tutor_name, tutor_contact, tutor_email, tutor_profile) VALUES ('$tutor_name','$tutor_contact','$tutor_email','$tutor_profile'); Martin -- Yes, I actually quoted my string at the beginning but whenever i do an INSERT it actually insert a NULL value into the fields...why is this so???So I try not to quote the strings but I got a Contraints Violation errorWhat could be the problem?? -- Hope to get some help soon. All help are greatly appreciated. Irin. hi, i don't know this db-class, but it seems that $db-quote() already quotes your values. so first take a look what comes from your form: ?php var_export($_POST); ? then, take a look what this quote-method does with your vals. eg: ?php var_export($tutor_name); ? if these vars constist of your information try to setup qour query according to mysql manual, depending on the values in your vars. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: spambothoney: script to pollute spammer's databases
Manuel Lemos schrieb: Hello, On 12/09/2003 12:26 AM, Daniel Hahler wrote: I proudly announce the first release of my first PHP script: spambothoney. It provides a class to generate different types of email addresses (random invalid, combination of users/hosts, with spambots IP/host, binary output) and is meant to pollute the crawling spambots that harvest email addresses from webpages. It uses a MySQL database for configuration (through web-interface) and for logging purposes. I would be glad, if this is of some interest for you and you would take a look: http://thequod.de/comp/mysoft/spambothoney (direct download: http://thequod.de/action.php?download=1) That is curious. This seems to be the second class that I see that seems to be for the same purpose. The other class also seems to be meant to generate honey pot e-mail addresses. Class: Honey Pot http://www.phpclasses.org/honeypot I'm especially interested into security issues, but feedback in general is very appreciated.. I read something about e-mail honey pots and I am afraid that may not be as useful as you think. When you say polluting crawling spambots you will probably be causing harm to innocent mail servers. Let me explain. The latest spamming strategies consist on using valid sender addresses of inocent companies. Therefore, when you make up invalid addresses, all the bounces will go to the innocent companies mail servers. The more invalid addresses you make up the more harm you cause to innocent companies. Anyway, you may want to contribute your class also to the PHP Classes site so you can get the feedback of tens of thousands of potential users that are notified when a new class is published. Despite your class seems to do the same as the other above, it will also be approved for publishing and let the users decide which is more useful. hi, not only the bounces are the problem, think of the traffic and the 'innocent' isp's. ;-) i think that's not the best method for fighting against spam. ciao SVEN -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP eregi filtering problem
Purpleonyx schrieb: Greetings all, I ran into a problem today and was hoping someone could provide an answer. I am fetching a web page, and attempting to parse certain variables from it. I've done this plenty of times in the past with no problem. The only difference this time is the file that I am parsing is much larger. The HTML file is about 42kb in size (usually I only parse ~4kb worth). In the web browser, the script seems to just shut down, but reports no errors, not even to the web server logs. Is there some specific max size that it can accept or a setting in php.ini I need to modify? Thanks hi, i don't think, that 42k is too much for the size of your file. mut maybe php simply times out while parsing? there is a php.ini-parameter max_execution_time and a runtime-function set_time_limit(). try set_time_limit(0) at top of your script fo debugging. also take a look at preg_* functions instead of ereg_*. they are said to be much faster. hth SVEN -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem With Apache / PHP Installation
Shaun schrieb: Ajai Khattri [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Sat, Dec 06, 2003 at 07:46:07PM -, Shaun wrote: I have installed PHP and Apache but when i try to view a PHP file i.e. http://127.0.0.1/hello.php i get a dialog box asking me if i want to open or save the file? Any ideas why this is happening? Assuming, your Apache is configured to load the php module: Your Apache is not configured to handle .php files. You need to add directives in httpd.conf for PHP files. See PHP installation docs. -- Aj. Sys. Admin / Developer Thanks for your reply, I have added the following lines to the beginning of httpd.conf LoadModule php4_module c:/php/sapi/php4apache.dll AddModule mod_php4.c AddType application/x-httpd-php .php But am still unable to view php files... Any ideas? hi, did you install apache 1.x or 2.x? does http://127.0.0.1 or http://localhost show your apache-startpage? did you stop and restart apache after changing httpd.conf? did you copy php4ts.dll to one of the dirs as said in the manual? just some thoughts from me. every time i install a new envionment i make a file to '/htdocs'-dir called 'phpinfo.php' with the following: ?php phpinfo(); ? i call this file for testing: 'http://localhost/phpinfo.php'. this file will also be vey useful when developing new scripts. hth SVEN -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] New line problem - but for Excel
David T-G schrieb: Manisha -- ...and then Manisha Sathe said... % % Actually I do not have phpscript for this. I am using readymade function % from PHPMyAdmin 2.1.0. They are having option to export to csv file with % delimeter ';' (It comes on screen first and then i copy to file manually.) Ah. % % So my csv fil looks like % % 22;33;address line1 % address line2 hi newsgroup, maybe a quotation helps? i remember, the php-csv-export-functions have a param for that. so if the results look like this: 22;33;address line1 address line2 the line-break isn't interpreted? maybe someone can give it a try? ciao SVEN -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: HTML form handling
Chris Baxter wrote: Hi, I am trying to send the results of a form to my email account and am having difficulty carrying the form variable through if I use an html mime type. Basically, if I send the form using a plain text format, the form results are sucessfully copied to the email, however, if I change to mime type to HTML (becuase I want to include a company logo and make the form a little easier to read by using tabulation and bold text), I only seem to get the HTML, not the php variables that carry the from info. Below is an example of the script for the body of the email, which I am then sending using the mail() function: $body = html body table width=85% border=0 align=center tr td width=50%Applicant 1 Forename:/td td ? $App_1_Forename; ?/td /tr tr tdApplicant 1 Surname:/td td ? $App_1_Surname; ?/td /tr tr tdApplicant 2 Forename:/td td ? echo $App_2_Forename; ?/td /tr tr tdApplicant 2 Surname: /td td ? echo $App_2_Surname; ?/td /tr /table /body /html; hi chris, okay, you try to put your html-code into a string '$body', which will be used by mail(). but, did you look at $body before sending? i'm afraid your vars are already missing here? maybe you have to change your code to this: ?php $body = 'html body table width=85% border=0 align=center tr td width=50%Applicant 1 Forename:/td td' . $App_1_Forename . '/td ...'; ? or this: ?php $body = html body table width=\85%\ border=\0\ align=\center\ tr td width=\50%\Applicant 1 Forename:/td td$App_1_Forename/td ...; ? look at the quotes. which style you want to use depends on you (i prefer the 1st) ciao SVEN -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How to you compare dates in a query in Mysql
take a look into mysql-manual 6.3.1.2 Comparison Operators ciao SVEN Bogdan Stancescu wrote: Depends on what exactly you're after, but for strict comparison arithmetic operators work as expected (, , =). Bogdan Safal Solutions wrote: Dear friends, Plesae help in finding the correct syntax for comparing two dates in a query in MySql database Thank you Subodh Gupta -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Mysql query and PHP loops
did you also play with group by? what does this return? select * from `yourTable` group by `val1` ciao SVEN Petre Agenbag wrote: Hi List I've been trying to do something with one MySQL query, but I don't think it is possible, so, I would need to probably do multiple queries, and possibly have queries inside loops, but I am rather weary of that so, I'd like your views/possible solutions to doing the following: Consider this: id val1 val2 val3 1 a 1 1 2 b 2 3 3 a 1 2 4 b 2 1 5 c 3 3 6 c 2 1 I need to query this table to return this: id val1 val2 val3 3 a 1 2 4 b 2 1 6 c 2 1 Thus, I need to firstly only return ONE row for each val1, and that row MUST be that last row (ie, the row with the highest id, OR, should val3 for instance be a date, then with the highest date). if I do a select distinct val1, MAX(id) from table order by val1, then it returns id val1 3 a 4 b 6 c which is correct, BUT select distinct val1, MAX(id), val2 from table order by val1 it returns id val1 val2 3 a 1 4 b 2 6 c 3 --- incorrect it then returns the FIRST hit for val2 in the db, and NOT the one in the row with the max id... Can I do this with one query? ( PS, I cannot use MAX on val2 or val3, they are text) Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: xls2pdf
Jan wrote: Hi! what's the best to convert xls to pdf (using PHP) ? maybe there is util (binary executable) xls2pdf i dont know about which would help me as well hi jan, i don't know, whether there is such a tool. but for your convertion it depends on what tool you got. as .xls is a microsoft excel file you either need to parse this file manually to get your cells and then put them to a pdf-file via a php-class or a php-extension. but i think its much easier to work with a com-extension and force microsoft excel to print your sheet to a vitual pdf-printer (i.e. acrobat) ciao SVEN -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: wheres the problem?
Ryan A wrote: Hi everyone, Am confused about what the @#%# is happening to my scripts because this was working yesterday, now i restarted my localhost machine and its not working now moreand its real simple stuff as you see. if(isset($id)) { $result = count ($id); echo $result; echo $id[0]. .$id[1]. .$id[2]. .$id[3]. .$id[4]; exit; } then i am passing 2 id[]'s like so: http://localhost/BWH/Project/compareTesting.php?PHPSESSID=431984b7b39946fd74 bf0b45b9771b54id%5B2efwaf2%5D=20id%5B2efwaf3%5D=21type=1 /* *** html code something like this: input type=checkbox name='id[sh1]' value=3 input type=checkbox name='id[sh2]' value=4 * */ hi ryan, from your html-form you get: $id = array( 'sh1' = '3', 'sh2' = '4', ); (or something similar.) so there is no $id[0] and so on, but $id['sh1']. my suggestion: if(isset($id)) { $result = count($id); echo $result; echo implode(' ', $id); exit; } hth SVEN -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dynamically generate a drop down list
... or even shorter (since php 4.1.0): function init_auth_list() { print select name=author option value=\\select the name of the author/option\; $query=select name from author order by name; $result=pg_exec($GLOBALS[db],$query); while ($row = pg_fetch_row($result)) { print option name=\.$row[0].\$row[0]/option; } print /select; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Displaying MySQL data inside of a table
[EMAIL PROTECTED] wrote: $mysql_link = mysql_connect(localhost, USER, PASS); mysql_select_db(DB, $mysql_link); $SQL = SELECT * FROM tbl; $result = mysql_query($SQL, $mysql_link) or die (mysql_error()); echo table border=1 cellpadding=5; while($resultat = @mysql_fetch_array($result)) { echo trtd $resultat[ip] /td; here is '/tr' missing: /td/tr; echo /table; } the echo '/table'; should come after the closed while: } echo '/table'; $mysql_link=mysql_close($mysql_link); Un saludo, Danny ciao SVEN -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include Problems
hi eric, as far as i can see, there is no definition for your '$subnav' in your 'incHeader.php'. if you call your main script like this: 'http://example.com/index.php?subnav=home;', this should work with your inclusion. ciao SVEN Eric Fleming wrote: Here is a snippet from the header file. You can see that I am just trying to determine what the value of the subnav variable is set to in order to determine which navigational link is bold. There are other places the variable is used, but you can get an idea based on what is below. Thanks for any help. -incHeader.php-- html head title[Site Name]/title /head body table cellpadding=0 cellspacing=0 border=0 align=left tr td ? if($subnav == home){ ?b? }?a href=index.phphome/a? if($subnav == home){ ?b? }? /td /tr /table -incHeader.php-- Jennifer Goodie [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Without seeing what you have in your includes, it will be hard to determine where your scope is messed up. ?php $subnav = home; include(incHeader.php); !--- CONTENT AREA --- The content would go here. !--- END CONTENT AREA --- ?php include (incFooter.php); ? Now, when I try to reference the subnav variable in the inHeader.php or incFooter.php files, it comes up blank. I am basically trying to adjust the navigation on each page depending on the page I am on. I am just learning PHP, have programmed in ColdFusion for years and in ColdFusion this was not a problem. Any ideas? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ereg problem?
by the way, it's to complicated. the brackets [ and ] are used for cha-groups. you can leave them for only one char. so this would be the same: \\n (you have to escape the backslash with a backslash) Curt Zirzow wrote: * Thus wrote John W. Holmes ([EMAIL PROTECTED]): [EMAIL PROTECTED] wrote: who can tell me what's the pattern string mean. if(ereg([\\][n],$username)) { /*Do err*/ } It's looking for a \ character or a \ character followed by the letter n anywhere within the string $username. I hope that isn't looking for a Carriage Return, cause it never will... Just in case it is strstr($username, \n); Curt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Classes
do you get an error-message? which? maybe you use var $id = array(); instead of var $id[]; ciao SVEN Patrik Fomin wrote: I need to create a class that looks like this: class Artikel { var $id[]; var $rubrik[]; var $ingress[]; var $kategori[]; var $frontbildtyp[]; var $frontbild[]; var $kategoribild[]; var $aktuell; function SetId($id) { $this-id[$this-aktuell] = $id; } function SetRubrik($id) { $this-id[$this-aktuell] = $id; } function SetIngress($id) { $this-id[$this-aktuell] = $id; } function SetKategori($id) { $this-id[$this-aktuell] = $id; } function SetKategoriBild($id) { $this-id[$this-aktuell] = $id; } function SetFrontbildtyp($id) { $this-id[$this-aktuell] = $id; } function SetFrontbild($id) { $this-id[$this-aktuell] = $id; } function SetNextPost() { $this-aktuell++; } function SetStartPost() { $this-aktuell = 0; } } the problem is that php wont let me :/, any ideas? regards patrick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: File upload
Peda wrote: I want to upload some file to my web site. The upload_single.php script is just this: ?php $ime = $_FILES[thefile][name]; print ($ime); I just want for begining to print the name of file. But It doesn't work. did you look what comes from your form? try: var_export($_FILES); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Get the current file name
how about this: $_SERVER[PHP_SELF]; ciao SVEN Shaun wrote: thanks for your reply, but that doesn't seem to work either, how about removing everything after and including the ?, how would i do that? Manoj Nahar [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] u can try $filename=$_SERVER[SCRIPT_NAME]; Manoj Shaun wrote: Hi, due to a current PHP upgrade i am unable to use the following code to get the filename of the page: $s = getenv('SCRIPT_NAME'); I need to get the filename without any avariables attached. For example if the URL is www.mydomain.com/test.php?test=yes using $s = getenv('PHP_SELF'); returns test.php?test=yes how can I return just test.php i.e. the filename on its own Thanks for your help -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] function: global, static and...?
Curt Zirzow wrote: * Thus wrote Michael Müller ([EMAIL PROTECTED]): Hi, I was just thinking about functions, and I believe there were more than two keywords like global and static, which could be used in functions... does anybody know them and their functions? hm. I dont even know where global and static are defined in the manual. hi, look here: http://www.php.net/manual/en/language.variables.scope.php ciao SVEN -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: people who has done a POS system before
hi, for mobiles: there is a wap-browser for windows-plattform: http://www.winwap.org ciao SVEN Tan Ai Leen wrote: Hi, I was just wondering there is a emulator for us developers to develop programs for palm and handphone, etc. Is there a program that emulates the output from various printers on screen? Regards, Tan Ai Leen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Please help!!! thx a lot~~~
hi joe, you want a server-script, that lists a dir on a client? i think that's impossible. think of if you visit a website written in php and in background your hdd is scanned? that's simply a security reason. ciao SVEN Joe wrote: any alternative method is also welcome Joe [EMAIL PROTECTED] ¼¶¼g©ó¶l¥ó·s»D [EMAIL PROTECTED] I have written a php to show file in directories. The problem is due to is_dir() can't opearate on remote files. What should I do in order to fix it. thx a lot~~~ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] removing parts of a string...
hi, Juan Nin wrote: From: [EMAIL PROTECTED] I wanna be able to take a URL http://www.mysite.com/downloads/file_1_a.pdf and then remove: http;//www.mysite.com/ [...] look at preg_match() ... or preg_replace(); regards, ciao SVEN -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: sorting multi-array
hi, try usort(); ciao SVEN JiøîÆèî eË wrote: hello, i have got a problem, tehere is an array: $x = array( array(15,55,array(1,2,3),3,5,array(1,2,5)), array(25,55,array(1,2,3),3,5,array(1,2,5)), array(5,55,array(1,2,3),3,5,array(1,2,5)) ); and I need to sort this arraybz first item of sub-arrays (x[0][0], $x[1][0], $x[2][0]). this is the correct result: $x = array( array(5,55,array(1,2,3),3,5,array(1,2,5)), array(15,55,array(1,2,3),3,5,array(1,2,5)), array(25,55,array(1,2,3),3,5,array(1,2,5)) ); some idea how sort this multidimensional array? thank you for your reply. jiøí nìmec, ICQ: 114651500 www.menea.cz - www stránky a aplikace -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Selectoption....../select
sorry, i didn't understand your problem. can you give an example what you can get from your database (your keys, years, months, ...) and how it should be transformed? ciao SVEN Etienne Mathot wrote: I am quite new to web programming and PHP/mySQL, I try to find my way between all these tools. Currently, I have a problem with a page where activities happen in 3 steps. Encoding Key Fields is the first step, than reading the customer...etc Key Fields is composed by Year, month and auto-increment field. Up to this step, everything is Ok. But the form recalls themselves for going on. I use SELECTOPTION../SELECT for the year and the month. If anybody knows a way to redisplay the correct values of these fields and not Pick Up yours? Thanks four your help. Etienne Mathot Email: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Mail functions in php
hi, 1. for mime-types try rfc2046. there are two top-level media types for you: 'audio' and 'video'. the subtypes depend on your media files. 2. to send files simply as attachment you can use 'application/octet-stream'. or use a readymade php-mime-mail-class. ciao SVEN Uma Shankari T. wrote: Hello, I need to send audio/video files through PHP mail() function. What is the MIME type i need to use? or else Is there any other way to send attachment as a mail? Please help me. Thanx in advance, Uma -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: homemade authentication function
i think the problem isn't only your 'return false' but also your 'return true' in your first loop through your foreach will definetly a 'return' be passed. and return means return a value AND stop the function. not? try it this way: foreach ($groups as $value) { if(!isset($this-user['groups'][$value]) || !$this-user['groups'][$value]) { return false; } } return true; ciao SVEN SævË Ölêöyp wrote: I'm making an authentication script with groups and roles. This function checks if the groups the user belongs to specified groups and compares them to the groups required. However, since this is a loop, the function doesn't return true or false as expected. If I call the function and require 3 groups, and the user belongs to only one of them, he is still accepted. Is this method right thinking? Should I make the function stop somehow when it returns false for the first time? All suggestions and comments are appreciated. Thanks. This is the function: function require_groups() { if (!isset($this-user['groups'])) { $this-user['groups'] = $this-get_user_groups($this-id); } $groups = func_get_args(); foreach ($groups as $value) { if (!isset($this-user['groups'][$value]) || !$this-user['groups'][$value]) { return false; } else{ return true; } } } And I call it like this: require_groups(admins, moderators,members); This returns true. Kveðja, Sævar Öfjörð [EMAIL PROTECTED] þetta reddast - hönnunarlausnir file:///C:\Documents%20and%20Settings\S%E6var\Application%20Data\Micros oft\Signatures\www.reddast.is www.reddast.is -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Newbie lost in array
hi tony, how is your table structured? is is a csv-file, a database, a html-table, ...? ciao SVEN Tony Crockford wrote: I've got brain fade today and am in need of a clue, please accept apologies if this is obvious. I have a data table: P_ref P_code P_Value I want to read the data out where P_ref='somevalue' and create variables for the content of P_Code with a value of P_Value what should I be looking for in the manual? TIA Tony -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Newbie lost in array
then try: $query = 'select * from `yourTable` where `P_ref`=somevalue'; $result = mysql_query($query); while($row = mysql_fetch_assoc($result)) { $rows[] = $row; } var_export($rows); hth SVEN Tony Crockford wrote: hi tony, how is your table structured? is is a csv-file, a database, a html-table, ...? ciao SVEN Ooops! MySQL sorry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: regex help?
hi john, try a regex like this: '/td[^]*(.*)/td/i' ciao SVEN John Herren wrote: Can't seem to get this to work... trying to yank stuff xxx from TD class=a8b noWrap align=middle width=17 bgColor=#ccxxx/TD and stuff yyy from TD class=a8b noWrap width=100nbsp;yyy/TD preg_match(|nbsp;(.*)/TD$|i, $l, $regs); works for the second example, even though it isn't the correct way, but nothing works for for me for the first example. Any help is appreciated! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mail From option in PHP.ini
... and how about this? $headers .= Return-Path: $email_address_from_your_database\r\n; tell me, if it works. ciao SVEN Brian S. Drexler wrote: I tried the extra header. The problem is with the return receipts. The mail is being generated by a server other than my main e-mail server, so if I want a delivery/read receipt I have to specify a From e-mail address or else it will default to the user executing the script, i.e. [EMAIL PROTECTED] ini_set() does not appear to work with sendmail_path. sendmail_path is in the PHP_INI_SYSTEM group so it can only be set in the php.ini or httpd.conf...Thanks for the suggestion though... -Original Message- From: CPT John W. Holmes [mailto:[EMAIL PROTECTED] Sent: Friday, July 18, 2003 11:09 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] Mail From option in PHP.ini Ok, I want to specify who the mail is coming from by using the sendmail_path option in the PHP.ini. I've added the [EMAIL PROTECTED] to it, but I want to be able to dynmaically change [EMAIL PROTECTED] to [EMAIL PROTECTED] or whatever else. Anyone have any ideas how I can do this? I'm pulling the e-mail I'd like to change it to from a MySQL database but can I rewrite the php.ini file on the fly or am I stuck. Any help is greatly appreciated. Why not just put it in the extra headers? $headers .= From: $email_address_from_your_database\r\n; Or you could possibly use ini_set() to change the php.ini setting. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: pdf information..
a pdf-page can have almost every format you want. originally you work with postscript-dots, where 72 dots are 1 inch. it's easy from that point to calculate from metric system, where 1 inch is 2.54 cm or 25.4 mm. with this in mind you can exactly define the height and width of your pdf-page. i suggest you use one of the ready-made pdf-php-classes. ciao SVEN Louie Miranda [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Hello, I have been given a task to generate a business card program over the web. The option that i can think of it to make it easier is generate a pdf based on the user's experience over my preview program on the web. Now im wondering does pdf have those image resolution size? I mean on image you can specify 100x100 pixels and make the resolution into 300dpi. How about pdf? -- Thank you, Louie Miranda ([EMAIL PROTECTED]) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: multi file multi colomn
can you more clearly explain your problem? - do your files contain of many lines and you want this: f1l1;f2l1;f3l1; ... f1l2;f2l2;f3l2; ... (f=file, l=line) - or do you simply want the complete content of the files separated by semicolon? ciao SVEN Fb [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Hi, I have 40 text files.. each files have 1 colomn of a data. I want to write a script to merge them like datafrom1;datafrom2;datafrom3;datafrom40 how can I do that? TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Using a drop down box with an udetermined field amount
hi ron, there are 2 steps to do this: 1. get data from mysql (you can use 'group by' in your select-query for doubles, maybe some kind of sort) 2. create your 'select' for each mysql-row create your 'option value=$var1$var2/option' (if you like, add some logic for 'selected') close you '/select' ciao SVEN Ron Allen wrote: What I want to do: Have a person input information about individuals into a database. One of the fields in the database will be Unit. On a form one of my drop down menu's will be Unit. I would like to have the PHP page poll the Unit field in the database and send all the different Unit results to the drop down box. Unit:tdINPUT SIZE=6 NAME=Unit value= This would be an example of the information that would be an entered H Co H Co B Co A Co K Co This should be the results H Co B Co A Co K Co Any help would be appreciated! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Storing HTML string in database
is escaping a solution? addslashes() for your insert-query stripslashes() for your select-query Aaron Axelsen [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I have a php script set up for a user to upload a word document, which is then coverted to html form, which I would then lke to store in a database. Howver, when I run the following command: INSERT into sermons (data) VALUE ('$output'); It failes to work, because the $output strings contains , which messes things up. Is there some way that this can be ignored while entering into the databse? Or am I better of replace all the with ''? Thanks for the assistance. - --- Aaron Axelsen AIM: AAAK2 Email: [EMAIL PROTECTED] Want reliable web hosting at affordable prices? www.modevia.com Web Dev/Design Community/Zine www.developercube.com -BEGIN PGP SIGNATURE- Version: PGPfreeware 7.0.3 for non-commercial use http://www.pgp.com iQA/AwUBPw4PI7rnDjSLw9ADEQLL5QCg6rxSs/roIiGyxC6nN3XNiuONg00AoK/T PSAAAbM+O7+e6iVNMMnpK5AC =phqJ -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: SQL select
hi, JiøîÆèî eË wrote: hello, i have got a problem with SQL select: I have got a table such this: id_k typ name id 1 f bla1 1 2 f bla2 1 2 i bla3 1 3 z bla4 1 3 f bla5 1 4 i bla6 1 4 z bla7 1 5 z bla8 1 and id = 1 and I need select these rows: id_k typ nazev id 1 f bla1 1 2 f bla2 1 3 f bla5 1 4 i bla6 1 so, when doesn'i exist component (id_k = component) type f so I want component with type i, but when doesn't exist type f noir i I don't want to select row with type z. jiri nemec, ICQ: 114651500 www.menea.cz - www stránky a aplikace don't know, if i correctly understood, but how about this: SELECT * FROM `YourTable` WHERE `typ`=f OR `typ`=i ODER BY `typ`; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: too stupid to install php on windows
hi, Johannes Reichardt wrote: Hi there! I had a perfectly working installation of apache 1.23 and php4.12 - unfortunatly i got heavy problems with the mail() function that didnt seem to like my subjects and froms. anyway - i just de-installed apache and php and reinstalled the most recent versions (apache 1.27 and php 4.32) - i followed the very same way like always while installing: but i fail. i can´t start apache with php, actually i do not get any meaningful errormessage (the only thing is NET HELPMSG 3534) the only thing i found for this: Z:\net helpmsg 3534 Der Dienst hat keinen Fehler gemeldet. ERLÄUTERUNG Der Dienst hat keinen Fehler angezeigt. MASSNAHME Versuchen Sie es später erneut. Falls das Problem weiter besteht, wenden Sie sich an den Netzwerkadministrator. sorry, i got a german windows version. shouldn't be the problem for you (mit freundlichen grüßen) ;-) anyway, the input at the commandline should bring a result. but i think your service didn't start correctly, but also didn't return an error. does your apache start without php? just comment the lines in httpd.conf. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Get previous folder
... and what about dirname()? Matt Palermo wrote: Anyone know how I can stip off the end of a folder location, so that it will be a folder in the next level up? I want to turn something like this: /path/to/folder/MyFolder/ into somthing like this: /path/to/folder/ I just need to strip off the last folder and that is it. Can anyone help me out? I appreciate it. Thanks. Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Regex nightmare:(
Tim Steele wrote: i need to uses reg ex to change a href=url to a href=url target=_blank the brackets have to be represented using lt; and gt; I have tried so many ways, but none work. here is an example of my faliure. $body = preg_replace(/(href=\/?)(\w+)(gt;\/?)/e,'\\1'.'\\2'./'target=_blank/ '.'\\3', $body); Thanks did i understand you correct? you search in real html-code (with '' and '') and want to replace them later by 'lt;' and 'gt;'? - if so, your regex can't find any gt;. either you search for an '' or you use htmlspecialchars() or htmlentities() to convert these brackets before. - also, if in your href= stands a full url (with scheme://domain.tld) your '\w' doesn't work - what are the optonal escaped slashes for? '\/?' hope this helps for your start: $body = 'a href=http://www.url;'; $body = preg_replace ('/()(a href=[^]+)()/', 'lt;\\2 target=_blankgt;', $body); var_export($body); ciao SVEN -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] isset function problem
... or: if(!empty($SenderEmailAddress)) { ... } Dean E. Weimer wrote: What about the rest of the code? How is this variable defined? I have had this happen in some code before, I found that the variable was set to . Try using: if (isset($SenderEmailAddress) $SenderEmailAddress != ) { mail($mailTo, $mailSubject, $Message); } I have the following code : Quote: if (isset($SenderEmailAddress)){ mail($mailTo, $mailSubject, $Message); } Unquote All I want to do is that , if the $SenderEmailAddress is not entered, the mail() function should not run. However, if the $senderEmailAddress variable is not set, the error I get is No recipient addresses found in header Can someone help and tell me why I get this error? Thanks Denis -- 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] Re: mail() - how to attach file to the message???
do you want to send a file via mail (mime-type of the file?) or do you want to attach the file to a mail (multipart?)? the mail-format is defined in rfc2045 and following. but if you don't want to build your own function, there are good mime-mail-classes out there. (e.g. http://www.phpguru.org/mime.mail.html) ciao SVEN Szparag [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] i know that in mail-form i need input type=file name=attach but i don't know how to write message headers to send file with e-mail. please help me. szparag. IncrediMail - Email has finally evolved - Click Here
Re: [PHP] string modification
thanks, this works. ciao SVEN Leif K-Brooks wrote: hi, i didn't find a function for this in the manual, but maybe there is one (or a workaround): does anyone have a solution for replacing multiple whitespaces with a single whitespace whitin a string? similar to trim(). maybe a regular expression? eg: $string = 'word1 word2 word3'; $modified = preg_replace('|(\\s)+|','$1',$string); $modified = 'word1 word2 word3'; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Connect Active Directory using LDAP... please help :)
hi vince, Vince C wrote: ?php $ldaphost= company.com; if(!($ldap = ldap_connect($ldaphost,389))){ die(ldap server cannot be reached); } else { $oudc = dc=company, dc=com; $dn2 = ; $password = ; did you define your user and password? afaik win ad isn't searchable by anonymous. ciao SVEN echo pConnected and ready to bind...; if (!($res = @ldap_bind($ldap, $dn2, $password))) { print(ldap_error($ldap) . BR); die (Could not bind the $dn2); echo pCouldn't bind ; } else { echo pBinded and Ready to search; echo brLDAP = $ldap; echo broudc = $oudc; // $filter=((objectClass=user)(objectCategory=person)(|(sn=sorg))); $filter= sn=*; $sr=ldap_search($ldap,$oudc,$filter); echo pnumber of entries found: . ldap_count_entries($ldap, $sr) . p; echo brfilter = $filter; echo brsr=$sr; if (!$sr) { die(psearch failed\n); } else { echo p Searched and ready for get entries.; $info= ldap_get_entries($ldap, $sr); for ($i=0; $i$info[count]; $i++) { print (TR); print (TD width=15% . $info[$i][cn][0] . . $info[$i][sn][0] . /TD); print (TD width=85% . $info[$i][mail][0] . /TD); print (/TR); print brIn the display FOR loop; } echo br After loop.; } } ldap_unbind($ldap); echo pLDAP unbinded; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How can I get all vars
get_defined_vars (); ? Slava wrote: Hi, Can somebody say how can I get all vars and their values from a script. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Regex Help with - ?
looks like id3v2 ;-) how about this: $string = [TIT2] ABC [TPE1] GHI [TALB] XYZ; $pattern = /\[TIT2\]([^]*)/; // matches anything exept ''; till '' or end of string preg_match($pattern, $string, $match); var_export($match); hint to your regex: either use quantifier '*' (0-n times) OR '?' (0-1 times) ciao SVEN Gerard Samuel [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] I have a string something like - [TIT2] ABC [TPE1] GHI [TALB] XYZ Im applying a regex as such - // Title/Songname/Content preg_match('/\[TIT2\](.*?)(\[)?/', $foo, $match); $title = trim( $match[1] ); The above regex doesn't work. At the end of the pattern Im using (\[)? The pattern may or may not end with [ For example searching for - [TALB] XYZ The string, is *NOT* expected to hold a certain order as how it is retrieved. How does one go about to fix up this regex? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: unexpected return from $_POST['foo']
strange. look into the sourcecode of your output-page, whether there is more information (html-tags, i.e.). and try var_export($_POST); instead of you echo to see what information come with post. maybe it's your server/php config. your code works for me. ciao SVEN Kyle W. Cartmell [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Given a page containing a form which posts data to another page... HTML BODY Please enter a string.BR FORM method=post action=nextpage.php INPUT type=text name=wakka INPUT type=submit name=submit /FORM /BODY /HTML And a page which accepts this data... HTML BODY ?PHP echo $_POST['wakka']; ? /BODY /HTML If I type blueberry_muffins into the text field and click submit, the resulting output is as follows... blueberry_muffinswakka=blueberry_muffins However the output I expected was, of course... blueberry_muffins Have you ever seen anything like this? Am I doing something wrong? Do you need more information? Thanks! :) Kyle W. Cartmell - a mildly confused PHP newb -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: twodimensional array / word-frequencylist
hi dore, Dore Van Hoorn wrote: # i would like a similar function that removes interpuntuation like . etc. # all i want remaining in the array are the separate words, all in lower case maybe you can replace your unwanted chars with preg_replace() i.e.: $textStripped = preg_replace(/[.:;]/, , $textInterPuncted); # i would like a function that pushes this word into a second array. # before pushing, it has to check whether or not the same word is already in the array. # if it is: do not push word into array, but add 1 to the number of occurrences of that word # if it is not: push this new word into array # all of this has to result into a word - frequency array (content analysis of free text) # question 1: how do i produce such an array? how about this: if(array_key_exists($wordInText, $occurences)) { $occurences[$wordInText]++; } else { $occurences[$wordInText] = 1; } # question 2: how do i get the two elements (word and number of occurrences) # together out of the array and print them to the screen? # f.e.: the word computer occurred two times in this text. look at the array-stucture with print_r, var_dump, var_export, ... or loop through the array: echo table; foreach($occurences as $word = $count) { echo trtd$word/tdtd$count/td/tr } echo /table; hope this helps. (didn't test the code, just wote it from brain. but the manual would be your friend) ciao SVEN -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: rtf files
hi steven, i don't know the rft-file-syntax, but i would start here. if you find out, how the page break is defined, you could splitt the whole file by that. but i assume, that works only on manual page-breaks. and like other text-files (i.e. .txt or .doc) the page-break is done by the progamm that opens the file. in that case, maybe a splitt by chapter or by a special amount of lines would be a start? ciao SVEN Steven wrote: I need some advice on how to go about importing rtf files page by page seperatly into a mysql database, or some way that can read a file and break each page into page sized sections, maybe an array, that i could then import to a database. The rtf files are mostly about '7mb' in size, and contain anything upto 200 pages, and need to be imported by : id, filename, page_number , page_content. I can read whole file into a data table, but that doesnt split the file page by page. Has anyone any suggestion to how this can be accomplished, Steven -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: remove characters, add newline making a twodimensional array
hi dore, Dore Van Hoorn wrote: Well, i'm kind of a newby, but this is what i would like to do in php: 1. i'm writing all instances of a mysql table to a txt file, but when i add \n to go on on the next line, in the txt file there is a square printed. When i try to import the txt file into ms access, the square is not recognized by this program to represent a newline.. how can i add a newline to a txt file, that actually IS a newline (or better: hard return) and that will be recognized as one, when reading the file into another program? seems like you are using a windows-machine, so try '\r\n' instead of '\n'. 2. a array contains a string of text, multiple words and interpunction. my first question: how can i remove the interpunction ( i know how to strip slashes and trim spaces..)? secondly, after this, i would like to count all double entries. f.e. when the word computer occurs twice in the sentence, i would like to make an array that is twodimensional: word-number of occurences (f.e. 'computer' '2'). How do i do that, for i don't really understand the phpmanual-explanation about this topic. And thirdly: how do i get both facts (word and number) out of the array? (all this has to produce a word-frequecylist, so if anybody has a clue how to do that..) a little bit confusing with your interpunctation, maybe you can provide some examples? to your array: why not using a mono-dimensional array with your words as key and the occurances as value? $words = array( 'myWord1' = 5, 'myWord2' = 3, ... ); or if you got your $word and $occurance in these vars: $words[$word] = $occurance; 3. how can i upload an image to my server and then call the image back into a webpage, just by using php? there are some articles about uploading files. if you got te file on your server you can simply use the location in the next script: $location = /path/to/my.file; echo 'img source='.$location.' /'; (or: echo img source=\$location\ /;) +++ NDore van Hoorn Ss1000454 AlfaInformatica-RuG E[EMAIL PROTECTED] Whttp://www.let.rug.nl/~s1000454 +++ ciao SVEN -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Help please!
hmm, well this post is here twice. so it works better than you thought? ;-) Nadim Attari wrote: Hi php-general, I have subscribed to news://news.php.net/php.general. But when I post something (i'm using Outlook Express), it seems that the post is sent; but in fact it isn't and so I don't find my post(s) on the newsgroup. Help please! Nadim Attari -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: ereg_replace and quotation marks
maybe stripslashes() can solve your problem? Paul Nowosielski wrote: I'm trying to strip quotation marks out of user from input but it doesn't seem to work correctly. $string=ereg_replace(\,,$string); I get a \ mark after I run a quote through the form. When I want the quote turned to nothing. Any suggestions?? Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Problem with GET variables
hi sid, this is often discussed here. if you use your local installation only for development purposes, you can set register_globals = on in php.ini. but if you want a more secure plattform, leave it off and write you scripts with $_GET[]. (some additional help: http://de3.php.net/manual/function.extract.php). so you also don't rely on register_globals by hosting externally. ciao SVEN Sid [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Hello, I just updated PHP on my local computer from PHP 4.0.2 to 4.3.2 (Yes, I know, its a very very long time). I also downloded the latest version of Apache and installed PHP as a module. Now PHP runs fine on the server. I have a small problem though. Variables being sent via the GET method are not getting parsed. I can acess these variables via the $_GET[variable] method but not through $variable. Any idea why. Most of my old PHP scripts accessed the variables directly by their name and so this will be a very very big problem for me. Any idea how I can get this old feature back. Thank you. - Sid -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: preg_match
preg_matchtry without backslashes. $pattern = /$search/i; if (preg_match ($pattern, $date[$i])) { echo $date[$i]br /; } you don't need the .*? in your regex (either * or ? multiplier) as preg_match searches for any occurance (not from begin ^ or to end $). ciao SVEN Aaron Axelsen [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I am trying to code a search, and i need to get my matching expression to work right. The user can enter a value swhich is stored in the vraible $search. What the below loop needs to do, is search each entry of the array for any occurance of the $search string. If i hard code in the string it works, but not when passed as a varaible. Is there something I am missing? Do i need to convert the $search variable to soetmhing? if (preg_match (/.*?\\\$search.*?/i,$date[$i])) { print $date[$i]br; } - --- Aaron Axelsen AIM: AAAK2 Email: [EMAIL PROTECTED] Want reliable web hosting at affordable prices? www.modevia.com Web Dev/Design Community/Zine www.developercube.com -BEGIN PGP SIGNATURE- Version: PGPfreeware 7.0.3 for non-commercial use http://www.pgp.com iQA/AwUBPvKWA7rnDjSLw9ADEQIfGQCgwAO5ikh/RIN5OXoVkC8F4FH/YAoAoJE5 zMxHkRssHbU2Vm4svv2hId8O =DJOi -END PGP SIGNATURE-
[PHP] Re: Compare dates
you can work with a timestamp. mktime() changes your date into a number you can sort, compare, ... ciao SVEN Shaun [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Hi, I have two dates retrieved from a database stored as variables: $mindate and $maxdate, how can i compare the two with PHP so i can loop and increment i.e. while($mindate $maxdate){ //do some stuff $mindate++; } Thanks for your help -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: SQL Select on a DATE field
just some thoughts to your script: i don't know (yet) the pear db functions and the database you use. so i assume you already got some logic to transform your dates into valid sql-dates (eg. mysql: mmdd or -mm-dd). that is important for valid results from your sql-statements as the dates must be compared somehow. (in other words your DD/MM/YY as an example 04/05/03 can be interpreted in many ways.) i assume, that in your order_date-field should only stand one statement, so i suggest using preg_match. so for your code i would start this way: if (preg_match($yourBetweenDatesPattern, $order_date, $matches)) { // between two dates // define your filter here, maybe with your qouted_date-function from pear } elseif (preg_match($YourAfterDatePattern, $order_date, $matches)) { // after a date filter } elseif (preg_match($YourExactDatePattern, $order_date, $matches)) { // exact date filter } else { echo no valid date given.; } For your Patterns: If you use something like this preg_match (/between ($YourDatePattern) and ($YourDatePattern)/, $subject, matches); you can easily catch your date1 and date2 using: $matches[1] and $matches[2] hope this helps. ciao SVEN Lorenzo Ciani [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Hi all! I would like to ask your advice on a script that I wrote. As you can surely see from my script below, I really need help as I am totally new to PHP. Regular expressions are my worst nightmare because I don't have a background in software programming: I'm just kidding around here! Please post your suggestions. Thanks. Problem --- HTML form to filter records from an SQL database on a DATE field. Search expressions are of the form: DATE (should be transformed into = DATE) = DATE (or other operator) BETWEEN DATE_1 AND DATE_2 The variable named $order_date contains the search expression submitted by the HTML form. Here's my script // Regex pattern for date, e.g. DD/MM/YY or MM-DD- $date_pat = '[0-9]+(\/|-)[0-9]+(\/|-)[0-9]+'; // Regex pattern for SQL operators $op_pat = '|=|=|!=|||='; // First, see if there is at least one date in $_POST['order_date'] $count = preg_match_all('/'.$date_pat.'/', $order_date, $matches); if ($count) { for ($i = 0; $i = $count - 1; $i++) { // Quote dates using PEAR::DB $quoted_date[$i] = $db-quote($matches[0][$i]); } } // Then see if search string is of type BETWEEN DATE_1 AND DATE_2 $count = preg_match_all('/between\s'.$date_pat.'\sand\s'.$date_pat.'/i', $order_date, $matches); if ($count) { // Yes it's a BETWEEN...AND. We assume that we have two valid dates $date_filter = ' BETWEEN '.$quoted_date[0].' AND '.$quoted_date[1]; } else { // No. Then check if we have a search string like '= DATE' $count = preg_match_all('/'.$op_pat.'/', $order_date, $matches); if ($count) { // Yes, then use operator and quoted date $date_filter = ' '.$matches[0][0].' '.$quoted_date[0]; } else { // No, then we just use something like ' = DATE' $date_filter = ' = '.$quoted_date[0]; } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: unix time stamp to readable date
use date(). first argument is the structure of your readable date, second ist the unix timestamp. ciao SVEN Diana Castillo [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] I know this is a stupid question but I am confused, how do I convert a unix timestamp to a readable date with php? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Link to a Site
don't echo anything before the header. else there is automatically a header generated by your server. Mishari [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Hi, I used it before, but I had a problem my code look like, if (--) { echo ---; header(--); } I don't know what is it? --- Marek Kilimajer [EMAIL PROTECTED] wrote: Discused few threads ago: header('Refresh: 15; url=newurl.php' ); 15 is in seconds. Mishari wrote: Hi all, I need help, actually I'm building a PHP site where my users will wait for a few seconds reading a text then it will automatically link them to another site. I'm looking for the command which auto. link to other sites. Kind Regards, esheager __ Do you Yahoo!? Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Do you Yahoo!? Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: problem with apache 2.0
php.ini: register_globals = off? look at $_POST['id']. ciao Franck Collineau [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Greeting, I have just change my server to apache 2.0.44 and php 4.3.1 (from mandrake 9.1) and i have a problem now When i pass a numeric parameter to a php script from a form, the parameter is equal zero ! Here is my form: p Modification d'un matériel: /p table tr td align=rightNuméro: /td tdform action=edit.php method=POST target=bas name=forme input type=text name=id size=3/td tdinput value=Modifier type=submit/td /form /tr /table here is my script php: ? $taille=strlen($id); print(ident: $id br); $id=(int) $id; ? where does the problem come from ? Thanks Franck -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: LoadModule Help
do you have an exact error message? so far i can only point you to some often made mistakes: - did you copy php4ts.dll to c:\winnt\system32 - did you copy php.ini.dist to c:\winnt, renamed it to php.ini and modified it? - in httpd.conf added these two lines? LoadModule php4_module PHP_DIR/sapi/php4apache2.dll AddType application/x-httpd-php .php (note the apache2 module) ciao SVEN Tmcclelland [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Hi all, As you will guess from this question I'm new to all this. Firstly I hope this is the right list. I have installed the latest version of Apache, and the latest version of PHP, on Windows 2000. I can start the server fine but as soon as I change the httpd.conf file and add the LoadModule section the server refuses to start. I wonder if anyone can shed any light on this. I can run PHP under IIS 5.0 which I have installed and tried, but would prefer to use Apache. IIS has been fully removed from the machine before the installation of Apache. Hope someone can help. King Regards Tim ** This email message and any files transmitted with it are confidential and intended solely for the use of addressed recipient(s). If you have received this email in error please notify the Spotless IS Support Centre (61 3 9269 7241) immediately who will advise further action. This footnote also confirms that this email message has been scanned for the presence of computer viruses. ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Problem on Date Function
have a look at date() and mktime(): from the manual: $tomorrow = mktime(0, 0, 0, date(m), date (d)+1, date(Y)); ciao SVEN Jack [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Dear all Here is the situation : Our automation system will generate a large number of pdf file to a specific folder every day. The name format for all these pdf file is .20030602.pdf. is the name of the file, 20030602 is last working date. what i want to do is: 1. create a sub-folder inside this specific folder, and name it to current month(Jun-2003) 2. move the pdf which is not containning last working's file name to this new create sub-folder. 3. the files with last working date's name will stay on the specific folder. question : 1. I had used a date function with w parameter to check if current date i execute the script is monday (1), if so , i tell the script to take the current date minus 3, so the date will become last friday (as our last working day), then i can base on this date to tell the script which files should not be move to sub-folder! q: how i can do a date subtraction in php? (eg. 2003-06-02 - 3 = 2003-05-30) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: POST Values
take a look at the $_POST array (or $_REQUEST). they contain all submitted values. if there are still empty fields, try foreach() and !empty(). Shaun [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Hi, I have a page with 78 textfields on, is there a way of picking out the field names and values that the user has filled in as they are very unlikey to be filling in all of them? Thanks for your help -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: $_POST array
this works too: $message = $_POST['first_name']. .$_POST['last_name'].\n. $_POST['address'].\n. $_POST['city']. .$_POST['state']. $_POST['zip'].\n. $_POST['country'].\n. $_POST['email'].\n. $_POST['design'].\n. $_POST['comments']; Zbranigan [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Steven == Steven Farrier [EMAIL PROTECTED] writes: Steven I have tried using $_POST array variables in the following Steven ways $message = ($_POST['first_name']) Steven ($_POST['last_name'])\n($_POST['address'])\n($_POST['city']) Steven ($_POST['state']) Steven ($_POST['zip'])\n($_POST['country'])\n($_POST['email'])\n($_POST['design'])\ Steven n($_POST['comments']); Steven $message = $_POST['first_name'] Steven $_POST['last_name']\n$_POST['address']\n$_POST['city'] Steven $_POST['state'] Steven $_POST['zip']\n$_POST['country']\n$_POST['email']\n$_POST['design']\n$_POST[ Steven 'comments']; Steven Neither of these have worked what am I doing wrong? Steven Steve try it like this: $message = ({$_POST['first_name']}) ({$_POST['last_name']})\n({$_POST['address']})\n({$_POST['city']}) ({$_POST['state']}) ({$_POST['zip']})\n({$_POST['country']})\n({$_POST['email']})\n({$_POST['des ign']})\ n({$_POST['comments']}); $message = {$_POST['first_name']} {$_POST['last_name']}\n{$_POST['address']}\n{$_POST['city']} {$_POST['state']} {$_POST['zip']}\n{$_POST['country']}\n{$_POST['email']}\n{$_POST['design']}\ n{$_POST[ 'comments']}; -- no toll on the internet; there are paths of many kinds; whoever passes this portal will travel freely in the world -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] flawless script
you can use the default: statement as last case in switch, too. Jason K Larson [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Greetings- I prefer to check the $_SERVER['REQUEST_METHOD'] before I do anything in a script that operates for both GET and POST methods. Also, especially for a switch statement, I'd check for the existance of the variable first, you know some sort of isset() or !is_null() test. Hope that helps. -- Jason k Larson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] varible in url question
on my page (lessen.php) i have a variable $sort if this varible is empty if enterd the page then it will be set on 'day' i have 3 links in the page lessen.php?sort=day lessen.php?sort=game lessen.php?sort=player so these links refure to the same page (itself) on clicked it opens itself and should set the varible to day, game or player but that doesn't happen. can somebody help me please see attachmend greetz cid begin 666 lessen.php M/#]P:' -T*:68H(21S;W)T*7L-B1S;W)T(#T(F1A2([#0I]#0H-F5C M:\H(G-OG0Z(B N(1S;W)T*3L-C\^#0H-CQ(5$U,/T*/$A%040^#0H) M/%1)5$Q%/CPO5$E43$4^#0H-T*/](14%$/T*/$)/1%D^#0H\!A;EG M;CTBFEG:'0B(#XN3$534T5.4D]/4U1%4CPO#X-CQT86)L92!W:61T:#TB M,3 P)2(8F]R95R/2(P(B!C96QLW!A8VEN9STB,2(/T*( \='(/B - MB ( \=0@=VED=](C$W)2(^/$:')E9CTB;5SV5N+G!H#]S;W)T M/61A2(=%R9V5T/2)?V5L9B(^9%Y/]A/CPO=0^#0H( /'1D('=I M9'1H/2(Q.24B/DAO=7(\+W1D/T*3QT9!W:61T:#TB,S$E(CX\82!HF5F M/2)L97-S96XNAP/W-OG0]9V%M92(=%R9V5T/2)?V5L9B(^9V%M93PO M83X\+W1D/T*3QT9!W:61T:#TB,S,E(CX\82!HF5F/2)L97-S96XNAP M/W-OG0]QA65R(B!T87)G970](E]S96QF(CYP;%Y97(\+V$^/]T9#X- JCPO='(^#0H-CPO=%B;4^#0H-T*#0H\+T)/1%D^#0H\+TA434P^ ` end -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Apache is not rendering php pages. Config problem?
There is no phpmodule in there, so I cant activate it. I did include some lines from my old config: AddType application/x-httpd-php .php4 .php3 .php AddType application/x-httpd-php-source .phps if you're using Apache 1.x you need to add: LoadModule php4_modulelibexec/libphp4.so or if you're using Apache 2.x LoadModule php4_modulemodules/libphp4.so Sven -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mail
hey Is it possible to put somebody in CC when you use the mail() function ???
RE: [PHP] Making a simple borderless pop up window with a Close button
class.overlib does that nicely http://www.posi.de/phpclass/ -Original Message- From: Denis L. Menezes [mailto:[EMAIL PROTECTED]] Sent: mardi 19 mars 2002 13:12 To: [EMAIL PROTECTED] Subject: [PHP] Making a simple borderless pop up window with a Close button Hello friends. I am making a database website where I need to add a small help button for every field on the form. Whenever the user clicks the small help button, I wish to show a titleless popup window containing the help text and a close button. Can someone help me with the php script for this. Thanks Denis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] dateformat
hey all I want to convert 20020211150245 into 2002-02-11 15:02:45. Does somebody have the correct conversion for this ?
[PHP] how to check session
How can I check if a session is still valid or if it has been expired. I want to check that and if not valid then execute an other script. Can't be that difficult but after 2 hours in traffic jams my brain is not working anymore .
[PHP] Again Session
Hey I have 2 values stored in my session, how do I pull them back out ?
[PHP] LDAP question
Hey I'm testing LDAP and I seem to have an error Call undefined function ldap_connect() the code is from php.net Can anybody tell me what I'm doing wrong :-)
[PHP] Sessions PROBLEMS
Hey I have a problem with sessions, with the code below If I post i always seems to get the same session_id That is not the idea. I want to generate everytime a unique one what is wrong with my code if ($action ==logout){ session_destroy(); print destroy; } if ( $action == post ){ session_start(); session_register($username); print session_id(); print BRinput type='text' name='azerty' size='100'; print a href='http://192.168.101.75/netsaint/ldap3.php?action=logout'Logout/a; } if ( $action == ){ print form name='test' action ='http://192.168.101.75/netsaint/ldap3.php?action=post' method ='post' Login : input type='text' name='username' Password : input type='password' name='password' input type='submit' name='blabla' value='blabla' /form ; } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Why session is not deleted ???
I've the same problem here If i do logout it doesn't doe a session_destroy :( -Original Message- From: Beta [mailto:[EMAIL PROTECTED]] Sent: jeudi 7 mars 2002 18:54 To: [EMAIL PROTECTED] Subject: [PHP] Why session is not deleted ??? Firstly i create a session, After that when i close the browser the sesion can still be seen in tmp directory in apache webserver. I just wanted to know that If i close the browser, Does the session terminates ? Beta -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] how the ticks works?
Hey I want to run a shell script, all the values that are returned normal by that script I want to put as var. For example tracert X.X.X.X 1 10 ms 10 ms 10 ms blablabla.bla.com [X.X.X.X] 2 10 ms10 ms10 ms RFC1918-Host [X.X.X.X] 3 10 ms10 ms10 ms BUOPS [X.X.X.X] The 3 values I want tot put in a table when I run the script Thanks Sven