[PHP] script execution stops after mail()
Hi, I've been skipping a night over this strange error: after execution of a mail() command, de rest of the script just gets ignored and my browser displays a "Cannot find server or DNS Error" page instead. Ideas about how to make this baby work would be very welcome; thanks in advance. I'm using PHP 4.0.6 on Apache/1.3.20 and sendmail -t -i. Just in case that helps. Vincent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] How to do a dynamic UPDATE SET
| But here's what I want to do now: I want to use the same two | lines of code for any possible form data that might be submitted mysql_list_fields retrieves all field names of $table; with that you can build your SET-clause for the query. something like: $fields = mysql_list_fields($db, $tbl); $columns = mysql_num_fields($fields); for ($i = 0; $i < $columns; $i++) { $fld = mysql_field_name($fields, $i); $set .= "$fld='$".$fld."', "; } btw: mysql_query("UPDATE ..."); works and saves a line of code. Vincent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] How to do a dynamic UPDATE SET
| The result: PHP updates the values of lang, record, date, what (etc.) to | [LITERALLY] $lang, $record, $date, etc--NOT the values of those fields | submitted by the form. I'm kinda lost as to what to do... Any | suggestions?? Ow yea, little mistake of mine, sorry. I think removing the single quotes should do the trick. Vincent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] backticks vs Safe Mode
I can think of no security reason why you would want to allow anyone to display output from a command, but wouldnt want them to be able to assign that output to a variable. Can someone explain a situation where that would be useful? Arent any security concerns addressed by the safe_mode_exec_dir= directive? Is there any way to get the safety of safe mode without this seemingly backwards rule? [If I was a malicious user with the ability to upload a script, I certainly wouldnt be at all hindered by being unable to have the script itself parse the output- I'd get a seperate script to do that for me and POST the results back to the server's script just as fast.] {The intent of this message is to find a way to circumvent this idiocy, to be noticed by a developer who will go "oops, did we leave that idiocy in?" or to be presented with an explanation for what is seemingly, idiocy. } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] does //commenting reduce performance?
> I have always had the opinion that the more comments you put into php > scripts, the slower they will run because there is more data to be read... > Can someone tell me if there is any truth in this or whether commenting has > absolutely 'no' impact on the performance of a script? If the overhead of the parser removing comments becomes an issue for you, you'll probably be in the situation where your application is heavy, with thousands of scripts, and a lot of commenting everywhere. As said before, the comments only impact the parsing. So, you just have to implement a "stripcomment" script, that you run when you move your script from your development server to your production server. And anyway, this would not be significant, unless you recompile a custom PHP version where you remove the comment parsing. This would be intereting if your code was already optimized... Vincent Vandemeulebrouck -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Bug with register_globals on versus 1 and php_value vs php_flag?
I don't know if this is a known bug or it's supposed to work like this, but after randomly trying things, this finally worked: DocumentRoot /home/interact/public_html ServerName interact ServerAlias www.interact.com *.interact.* ErrorLog logs/interact-error_log CustomLog logs/interact-access_log common php_value register_globals 1 Whereas: php_flag register_globals on Didn't work (as I would assume it should) I'm running: PHP 4.2.2 Apache 2.0.40 Zend engine 1.2.0 RedHat 8.0 Kernel 2.4.18 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Resizing a png tranparent image.
Hello, I am trying to resize a png file, my autograph ;-) Good result thanks to gimp: http://boxfly.free.fr/test/test1.jpg Bad result with php: http://boxfly.free.fr/test/test2.jpg This is my PHP code to resize the autograph: $newAuto = imagecreatetruecolor( $widthImgAu, $heightImgAu) ; imagecolortransparent($newAuto,imagecolorat($newAuto,0,0)) ; $imgAuto = ImageCreateFromPNG($img_auto); imagecopyresized($newAuto, $imgAuto, 0, 0, 0, 0, $widthImgAu, $heightImgAu, $imageInfoAu[0], $imageInfoAu[1]) ; ImagePNG($newAuto,"new_auto.png"); So I tried: imagecopyresampled($newAuto, $imgAuto, 0, 0, 0, 0, $widthImgAu, $heightImgAu, $imageInfoAu[0], $imageInfoAu[1]) ; Instead of imagecopyresized... To copy the autograph inside the photo I do: $newImg = ImageCreateFromJPEG($img_des); ImageAlphaBlending($newImg, true); ImageCopy($newImg, $newAuto, $posX, $posY, 0, 0, $widthImgAu, $heightImgAu); But with no sucess If I do not resize the png autograph and copy it directly inside the photo, that's perfect, as a result the problem is the resizing... What do I have to do to resize a png image without loosing transparency ? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] include "problem" -- how to use an external 'template' file and still use PHP variables?
I have a similar question/problem. However, I want to use an external "email template" as it were, so that the sales guys can edit it as they like and simply shuffle the three variables around that they need $username, $password, $code (either with or without the tags). I don't want them mucking around in my code and potentially screwing it up. Not to mention having a huge 'email' text in between those HTMLMESSAGE markers is ugly as hell and ends up making the color-coding in HomeSite all kinds of whack at the end of it. I tried to use: $message = << in the customer_email.php the field is blank (like it's being parsed but doesn't have a value for it or something), instead of being converted to their actual PHP values. I also tried to put the "global" keyword in the customer_email.php file at the top. Is there no way to accomplish this? > -Original Message- > From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]] > > > Use a here-doc: > > echo << [$data] $titulo ($user) $intro $texto > (comentarios=$contador) > EOB; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP & PostgreSQL
Michael Sims wrote: >>o Changing database structure is harder. With PG, I usually found it >> easier to dump, edit, then reload the database to make changes I did >> in MySQL with ALTER TABLE. > > True, changing schema is a major PITA with Postgres. My only real > complaint about it, in fact... Have you installed the recent PostgreSQL version 7.3 already? This new version allows the use of ALTER TABLE much like you'd want it. Vincent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Possible bug with PHP v4.1.1 and bits?
I'm not even sure how to classify this... Given: Where $Enabled is either a 0 or 1 as read from a database ( TINYINT(1) ); And echo "action = ".$_POST[action].""; if ($_POST[action] == "1" || $_POST[action] == "0") echo = "UPDATE Company SET Enabled = ".!(intval($_POST[action]))." WHERE CompanyID = $id"; (skipping all the obvious bits -- no pun intended) I cannot figure out how to simply make the 0 and 1 invert or negate or toggle as it were. When I submit the form, my output is: action = 0 UPDATE Company SET Enabled = 1 WHERE CompanyID = 89 action = 1 UPDATE Company SET Enabled = WHERE CompanyID = 17 I've tried all kinds of combinations, but whenever the action is 1 to begin with, the 'inverted' version is always blank or -2 when I would expect it to be 0. If I use echo = "UPDATE Company SET Enabled = ".~(intval($_POST[action]))." WHERE CompanyID = $id"; action = 1 UPDATE Company SET Enabled = -2 WHERE CompanyID = 17 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] [announce] AtomicBoard v0.6.1
Hi, AtomicBoard v0.6.1, an advanced template-based forum system has just been released. please try it, we need your feedback. If you are a PHP developer looking for a challenging and fun project, please have a look at AtomicBoard, we are in need of more developers. have a look at: http://cal007300.student.utwente.nl/atomicboard/ cheers, - Vincent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Unexpected $end error?
Can someone tell me why I keep getting that error: Parse error: parse error, unexpected $end in D:\Program Files\Apache Group\Apache2\htdocs\proxy\acc_new.php on line 62 line 62 refers to Thanks for your help Vincent Here is the content of acc_new.php Account Management Tools - Add a new account Accounts Management Tools Add a new account Username: Password: Must contain between 4 and 20 characters. Firstname: Lastname: Email address: Usergroup: Back to Account Management Tools and here is the content of auth.php and mysql.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] locally enabling register_globals?
This might help... Put this at the top of each page: reset ($_POST); while (list ($key, $val) = each ($_POST)) { //echo "$key => $val\n"; $$key = $val; } You could do the same for $_GET if you need to as well. DÆVID. > -Original Message- > From: Michael Greenspon [mailto:[EMAIL PROTECTED]] > Sent: Friday, January 03, 2003 5:51 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] locally enabling register_globals? > > > Thanks. This is what we've chosen to do-- 'fix' the code. > Unfortunately this was all written 'old style' by novices, so 'fixing' > it by putting in references to $_GET, $_POST etc. doesn't really lend > any clarity to it. Values are still splayed out across multiple pages > with no structure. But at least it works now. Still uncertain why the > php_flag in htaccess didn't do it-- perhaps not enabled with Apache. > Cheers > M. > > > "Michael J. Pawlowsky" wrote: > > > > Why not just fix your code? > > > > *** REPLY SEPARATOR *** > > > > On 03/01/2003 at 2:50 PM Michael Greenspon wrote: > > > > >Our hosting provider installed PHP 4.2 and thus disabled > > >register_globals by default which our scripts depend on. > We don't have > > >access to php.ini to change this. This is with Apache. I > tried putting > > > > > >php_flags register_globals on > > > > > >into .htaccess in the directory(s) with pages that need > this but it does > > >not seem to work. How can I enable register_globals > selectively for some > > >directories of pages so that our old scripts work again? > > > > > >Thanks > > >Michael > > > > > >-- > > >PHP General Mailing List (http://www.php.net/) > > >To unsubscribe, visit: http://www.php.net/unsub.php > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] building web album - design questions
Why re-invent the wheel. There are plenty of these out there... Two I suggest are [1] mine... http://daevid.com/photo_album.phtml And [2] http://www.andymack.com/freescripts/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] how can I use an external 'template' file and still use PHP variables?
I've posted this a few weeks ago with no response. I want to use an external "email template" as it were, so that the sales guys can edit it as they like and simply shuffle the variables around that they need $username and $password (either with or without the tags). I don't want them mucking around in my code and potentially screwing it up. Not to mention having a huge 'email' text in between those HTMLMESSAGE markers is ugly as hell and ends up making the color-coding in HomeSite all kinds of whack at the end of it. I tried to use: $message = << in the customer_email.php the field is blank (like it's being parsed but doesn't have a value for it or something), instead of being converted to their actual PHP values. I also tried to put the "global" keyword in the customer_email.php file at the top. Ideally I would like to set things up so we have varoius form letter emails and I can switch them around based upon say a "special order code", where the $user/$pw is always the same (depending on the database user of course), but the email content is different formats. Is there no way to accomplish this? Am I not being clear on what it is I'm trying to accomplish? My final thought is to use some regex to search for in $message after it's all been read in, and replace it with the variable $username or make up my own tag codes like [!username!] or something like that. This seems like such a hack, when PHP should be able to do this natively somehow. Surely somebody out there has had to do this type of thing? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] how can I use an external 'template' file and still use PHP variables? [solved]
Benjamin, you are my father! Dude! That worked perfectly... In case you all didn't understand what I was trying to do, attached are some examples... This worked thanks to "Benjamin Vincent" ;-) snip 'customer_email.php' -- Untitled Username Password Company Code snip 'customer_email.php' -- snip 'emailtest.php' -- EMAIL include test \r\n"; $headers .= "To: ".$email."\r\n"; $headers .= "Reply-To: ".$myname." <".$myreplyemail.">\r\n"; $headers .= "X-Mailer: Linux Server"; mail($email, $subject, $message, $headers); echo $message; ?> check your email to see if this worked. snip 'emailtest.php' -- > -Original Message- > From: Benjamin Niemann [mailto:[EMAIL PROTECTED]] > Sent: Friday, January 10, 2003 2:02 AM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] how can I use an external 'template' file > and still use PHP variables? > > > I think this should make it: > > ob_start(); > include("/pathto/customer_email.php"); > $message = ob_get_contents(); > ob_end_clean(); > > - Original Message - > From: "Daevid Vincent" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Friday, January 10, 2003 10:48 AM > Subject: [PHP] how can I use an external 'template' file and > still use PHP > variables? > > > > I've posted this a few weeks ago with no response. I want to use an > > external > > "email template" as it were, so that the sales guys can > edit it as they > > like and simply shuffle the variables around that they need > > $username and $password (either with or without the tags). > > > > I don't want them mucking around in my code and potentially > screwing it > > up. Not to mention having a huge 'email' text in between those > > HTMLMESSAGE markers is ugly as hell and ends up making the > color-coding > > in HomeSite all kinds of whack at the end of it. > > > > I tried to use: > > > > $message = << > include("/pathto/customer_email.php"); > > HTMLMESSAGE; > > > > But $message has the literal string > > ''include("/pathto/customer_email.php");'' instead of including the > > file. Grr.. (wouldn't it make sense that an include() > should be parsed > > FIRST with the contents put in place basically? This seems > like a 'bug' > > not a feature. > > > > I also tried: > > > > $filename = "/pathto/customer_email.php"; > > $fd = fopen ($filename, "r"); > > $message = fread ($fd, filesize ($filename)); > > fclose ($fd); > > > > But all the $username, etc. are treated as literals and if I use > > in the customer_email.php the field is blank > (like it's > > being parsed but doesn't have a value for it or something), > instead of > > being converted to their actual PHP values. I also tried to put the > > "global" keyword in the customer_email.php file at the top. > > > > Ideally I would like to set things up so we have varoius form letter > > emails and I can switch them around based upon say a "special order > > code", where the $user/$pw is always the same (depending on > the database > > user of course), but the email content is different formats. > > > > Is there no way to accomplish this? Am I not being clear on > what it is > > I'm trying to accomplish? > > > > My final thought is to use some regex to search for > in > > $message after it's all been read in, and replace it with > the variable > > $username or make up my own tag codes like [!username!] or something > > like that. This seems like such a hack, when PHP should be > able to do > > this natively somehow. > > > > Surely somebody out there has had to do this type of thing? > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Favorite Email validation routine?
I just use a simple Javascript function. I figure if it's remotely close, then good, if not then it's going to be an invalid email address most likely anyways: function emailCheck(str) { var at="@" var dot="." var lat=str.indexOf(at) var lstr=str.length var ldot=str.indexOf(dot) if (str.indexOf(at)==-1){ return false } if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){ return false } if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){ return false } if (str.indexOf(at,(lat+1))!=-1){ return false } if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){ return false } if (str.indexOf(dot,(lat+2))==-1){ return false } if (str.indexOf(" ")!=-1){ return false } return true } DÆVID. "A good friend will come and bail you out of jail...but a true friend will be sitting next to you in the holding cell, laughing and saying -'That was fucking awesome!'" > -Original Message- > From: Manuel Lemos [mailto:[EMAIL PROTECTED]] > Sent: Sunday, January 12, 2003 9:30 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Re: Favorite Email validation routine? > > > Hello, > > On 01/13/2003 03:21 AM, Peter Janett wrote: > > I'm looking for everyone's favorite email syntax validation > routine. Code > > that takes an email address and does regex on it to > determine if it's > > formatted correctly. > > > > I know there are some on phpclasses.org that actually check > the mx record > > and server of the domain, but I'm just looking for a good, > clean and fast > > email address syntax check. > > > > So, what is your favorite bit of code to do that? > > This class that I don't know if you seen also comes with > complex regex > for simple e-mail address validation: > http://www.phpclasses.org/emailvalidation -- Regards, Manuel Lemos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Making alternate rows of different colour
> > > Can someone please help me with the code? > >$cols = array('#ff','#00ff00'); >$i = 0; >while(your_loop_to_output_each_row) { > echo '$row_data'; >} -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Sessions or Cookies?
Agreed. Sessions are much more secure and convienient to use too. Since it's not reliant on the client to have cookies enabled, that's another benefit. Plus it's MUCH harder for a client to spoof/alter a session variable if you use the $_SESSION['myvar'] > -Original Message- > From: Chris Shiflett [mailto:[EMAIL PROTECTED]] > Sent: Friday, January 17, 2003 9:29 AM > To: Cesar Aracena; [EMAIL PROTECTED] > Subject: Re: [PHP] Sessions or Cookies? > > > --- Cesar Aracena <[EMAIL PROTECTED]> wrote: > > Should I use the no-so-secure old cookies method > > or should I start a new session every time a client > > drops in and handle each cart by session name or ID? > > My advice is to only use cookies to identify a Web client. > Any data you want to associate with that Web client (user > data, for example) should be stored on the server - > database, session store, etc. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to make id/name table into array?
Is there a better way to do this in PHP? It seems that a single number (key) and single name (value) would lend itself perfectly to an (indexed or associative) array. I would think there is some PHP API call that I'm unaware of that will just take the whole result set and stuff it into an array for me no? If not, there should be. Perfect for things like ListBoxes, or table lookups so you don't have to hit the database constantly with joins et. al. $sql = "SELECT id, name FROM mytable ORDER BY id"; if ( !($result = mysql_query($sql,$link)) ) { echo "failed\n"; } while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) $myarray[$row['id']] = $row['name']; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Strange anomolie with each() and mysql_fetch_array()
How come I *can* do these commands: $row = mysql_fetch_array($result,MYSQL_ASSOC); while(list($myVariableName,$sqlFieldName)=each($row)) { $$myVariableName = $sqlFieldName; } But I can't do this command? while(list($myVariableName,$sqlFieldName)=each(mysql_fetch_array($result ,MYSQL_ASSOC))) { $$myVariableName = $sqlFieldName; } Notice the only differenceis that the first one assigns the array to $row FIRST, whereas the second tries to avoid that extra call, especially since I know I'm only getting one row back. Hmmm? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Strange anomolie with each() and mysql_fetch_array()
> First, if you expect only a single row returned, why are you > using a while(){} construct? > Third, each() operates on succeeding elements of an array; > there are only two elements aparrently, > so what are you expecting eac() to do? Because that magic incantation that Rasmus taught me many years ago will take every field/column of the returned database row and make a variable named the same thing with the corresponding value. So, for example, I will get $customer_id = 5, $customer_name = "Joe Blow", etc... And when you have a pant load of fields in one row, it comes in very very handy. > Second, mysql_fetch_array() does not like to operate within > another function call. I've tried it on > multiple occasions; failed. That seems like a bug to me then. Hence the reason I bring it up. Seems to me there is no reason the second statement shouldn't work just as the first. > - Original Message - > From: "Daevid Vincent" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Thursday, January 23, 2003 11:38 PM > Subject: [PHP] Strange anomolie with each() and mysql_fetch_array() > > > How come I *can* do these commands: > > $row = mysql_fetch_array($result,MYSQL_ASSOC); > while(list($myVariableName,$sqlFieldName)=each($row)) > { $$myVariableName = $sqlFieldName; } > > But I can't do this command? > > > while(list($myVariableName,$sqlFieldName)=each(mysql_fetch_arr > ay($result > ,MYSQL_ASSOC))) > { $$myVariableName = $sqlFieldName; } > > Notice the only differenceis that the first one assigns the array to > $row FIRST, whereas the second tries to avoid that extra call, > especially since I know I'm only getting one row back. Hmmm? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Webyog Releases SQLyog 3.02
Dude. That freakin' form that asks for my email/name EVERY time has to go. Make that shit voluntary. It's annoying as hell, and is just forcing me (and others) to enter bunk info everytime we want an update to this product. > -Original Message- > From: Insanely Great [mailto:[EMAIL PROTECTED]] > Sent: Thursday, February 06, 2003 12:13 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Webyog Releases SQLyog 3.02 > > > SQLyog v3.02 - The definitive Windows Front End for MySQL, has been > released. It is a superfast, compact and easy to use Front > End for MySQL. A > must for MySQL & PHP developers. SQLyog is FREE! > > Some of the new features added in SQLyog 3.02 are - > > -- ODBC Import. The simplest and the most powerful tool to > import data from > any ODBC compliant database to MySQL. > -- Database Synchronization Tool. Bring your remote databases > in Sync with a > single mouseclick. > -- Connection Manager. > -- Manage relationships on InnoDB tables. All other options > fully InnoDB > compliant. > -- Column Reordering. > -- Copy databases between two MySQL hosts. > -- Insert/Update on the Resultset of a query. > -- Fully updated keyword list for syntax highlighting. > -- Picklist for Enum/Set values in Insert/Update Dialog. > -- Improved datagrid. Allows multiple row deletion. > -- Option to add column name while exporting data in CSV. > -- Multi selection of tables in export as SQL Scripts dialog. > -- Empty a database with a single click. > -- Show/Hide edit window. > -- Improved error messages. > -- Lot of bugfixes and enhancements. > > You can download the new SQLyog at > http://www.webyog.com/sqlyog/download.html. > > Send your comments, suggestions, feature request through their NEW > discussion board at http://www.webyog.com/forums/index.php > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] jumping between php and html or using echo for printing html-tags.
Fatal error: Call to undefined function: floatval() in /home/dae51d/public_html/examples/echotest.php on line 14 > -Original Message- > From: Chris Shiflett [mailto:[EMAIL PROTECTED]] > Sent: Thursday, February 06, 2003 2:40 PM > To: anders thoresson; [EMAIL PROTECTED] > Subject: Re: [PHP] jumping between php and html or using echo > for printing html-tags. > > > --- anders thoresson <[EMAIL PROTECTED]> wrote: > > Which is more efficient: > > Your first method is more efficient according to my quick > test, though I find myself preferring the second when I > write code due to the readability advantages. The > difference is small, however. Here is the code I used to > test, so you can try it out (and verify my method of > testing) for yourself: > > $foo = 'bar'; > > # TIME FIRST METHOD > list($microseconds, $seconds) = explode(' ', microtime()); > $start_time = floatval($seconds) + floatval($microseconds); > for ($i = 0; $i < 100; $i++) > { > echo "a href=\"" . $_SERVER['PHP_SELF'] . "?action=" . > $foo . "\">\n"; > } > list($microseconds, $seconds) = explode(' ', microtime()); > $end_time = floatval($seconds) + floatval($microseconds); > $total_time_first = $end_time - $start_time; > > # TIME SECOND METHOD > list($microseconds, $seconds) = explode(' ', microtime()); > $start_time = floatval($seconds) + floatval($microseconds); > for ($i = 0; $i < 100; $i++) > { > ?> > > } > list($microseconds, $seconds) = explode(' ', microtime()); > $end_time = floatval($seconds) + floatval($microseconds); > $total_time_second = $end_time - $start_time; > > # OUTPUT RESULTS > echo "First method took " . $total_time_first . " > seconds\n"; > echo "Second method took " . $total_time_second . " > seconds\n"; > ?> > > Chris > > -- > 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] How do I force a 'timeout' in a loop for that itteration, or conversley how to timeout a 'ping" request?
I'm trying to automate finding pingable domains given an IP or a domain. The problem is that some domains don't actually return "pings", and on Linux, it just sits there forever (ugh!). So... Can someone tell me how to 'abort' or 'timeout' an itteration of a loop. Maybe start a timer and then check if a number of millis has gone by? But it seems that won't work b/c PHP isn't threaded, it will just hang at the exec() command right? Converseley, anyone know how to force a /bin/ping to automatically timeout (sans hitting CTRL+C)? I 'man ping' but it didn't seem to have that option. Here is the code I'm using... $typeArray = array ('www' => false, 'ftp' => false, 'mail' => false, 'exchange' => false, 'owa' => false, 'dns' => false, 'dns1' => false, 'dns2' => false, 'dns3' => false, 'router' => false, 'firewall' => false, 'fw' => false, 'fw1' => false, 'sql' => false, 'db' => false, 'database' => false, 'crm' => false ); reset($typeArray); while ( list($key, $val) = each($typeArray) ) { $testDomain = $key.".".$domain; $pingtest = exec("/bin/ping -c 1 -q ".$testDomain); //echo "pingtest of ".$testDomain." = ".$pingtest."\n"; if ( strstr($pingtest,"rtt min") ) { $typeArray[$key] = gethostbyname($testDomain); echo "".$testDomain." (".$typeArray[$key].")\n"; $ipCounter++; } //sleep(3); } if ($ipCounter == 0) echo "No pingable domains found in our test list"; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: How do I force a 'timeout' in a loop for that itteration, or conversley how to timeout a 'ping" request?
On linux it says: -t ttl Set the IP Time to Live for multicasted packets. This flag only applies if the ping destination is a multicast address. > -Original Message- > From: Philip Hallstrom [mailto:[EMAIL PROTECTED]] > Sent: Friday, February 07, 2003 4:31 PM > To: Daevid Vincent > Cc: [EMAIL PROTECTED] > Subject: [PHP] Re: How do I force a 'timeout' in a loop for > that itteration, or conversley how to timeout a 'ping" request? > > > Not sure on linux, but on freebsd ping's man page says: > > -t timeout Specify a timeout, in seconds, before ping exits regardless > of how many packets have been recieved. > > On Fri, 7 Feb 2003, Daevid Vincent wrote: > > > I'm trying to automate finding pingable domains given an IP > or a domain. > > The problem is that some domains don't actually return > "pings", and on > > Linux, it just sits there forever (ugh!). So... Can someone > tell me how > > to 'abort' or 'timeout' an itteration of a loop. Maybe > start a timer and > > then check if a number of millis has gone by? But it seems > that won't > > work b/c PHP isn't threaded, it will just hang at the exec() command > > right? Converseley, anyone know how to force a /bin/ping to > > automatically timeout (sans hitting CTRL+C)? I 'man ping' > but it didn't > > seem to have that option. > > Here is the code I'm using... > > > > $typeArray = array ('www' => false, > > 'ftp' => false, > > 'mail' => false, > > 'exchange' => false, > > 'owa' => false, > > 'dns' => false, > > 'dns1' => false, > > 'dns2' => false, > > 'dns3' => false, > > 'router' => false, > > 'firewall' => false, > > 'fw' => false, > > 'fw1' => false, > > 'sql' => false, > > 'db' => false, > > 'database' => false, > > 'crm' => false > > ); > > > > reset($typeArray); > > while ( list($key, $val) = each($typeArray) ) > > { > > $testDomain = $key.".".$domain; > > $pingtest = exec("/bin/ping -c 1 -q ".$testDomain); > > //echo "pingtest of ".$testDomain." = > > ".$pingtest."\n"; > > if ( strstr($pingtest,"rtt min") ) > > { > > $typeArray[$key] = gethostbyname($testDomain); > > echo " > VALUE='".$typeArray[$key]."' CHECKED>".$testDomain." > > (".$typeArray[$key].")\n"; > > $ipCounter++; > > } > > //sleep(3); > > } > > if ($ipCounter == 0) > > echo "No pingable domains found in our test > > list"; > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to use fopen() with protected directory (i.e .htaccess)
How can I pass in a user/pw to an fopen() (or something similar)? I am trying to render a dynamic db/php page into a static .html page -- or more specifically, I'm trying to email me back an html version of a report page on remote servers. The reports are located behind an https:// Apache user/pass authenticated directory. I tried: $file = fopen("https://username:[EMAIL PROTECTED]/admin/report.php","r";) ; If I try to do something like: $file = fopen("/www/htdocs/admin/report.php","r"); But then the PHP isn't executed, it just dumps me the straight source code. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How can I have PHP set the linux system date/time?
Yep, I am trying to have a php web page change the linux system date/time, but obviously running into the snag that /bin/date, while "chmod 775" doesn't allow a user to set the date/time. Why is that, given the permissions? Sure it makes sense, but it's annoying. Ideas on how to circumvent this problem? -rwxr-xr-x1 root root26780 Jul 23 2001 /bin/date Seems to me that anyone should be able to use it then right? Where is the "write" portion defined? The 'info date' page says, "You must have appropriate privileges to set the system clock." But it doesn't say what that is or how to change them. If anyone cares, here's a nice bit-o-code: Change Time / Date New Date %02d\n",$i); } ?> / %02d\n",$i); } ?> / >2003 >2004 >2005 >2006 New Time %02d\n",$i); } ?> : %02d\n",$i); } ?> You entered an invalid date, so it was converted to ".$NewDateTime."\n"; ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How can I have PHP set the linux system date/time?
I'm not sure what I'm doing wrong... In changetime.php: $binDate = date ("mdhiY", mktime($hour,$minute,0,$month,$day,$year)); $execString = "/usr/bin/sudo /bin/date ".$binDate.""; //echo $execString.""; exec($execString); And then in /etc/sudoers: nobody ALL=NOPASSWD: /bin/date If I run the command (as daevid) "/usr/bin/sudo /bin/date 011304042003" for example, it works fine. Apache is running as nobody it seems: [daevid=pts/6]4:10am@dev:{/www/htdocs}> ps aux | grep "httpd" root 590 0.0 1.5 4996 1988 ?SFeb12 0:00 /www/bin/httpd -D nobody 592 0.0 2.9 5396 3704 ?SFeb12 0:01 /www/bin/httpd -D nobody 593 0.0 3.0 5524 3804 ?SFeb12 0:00 /www/bin/httpd -D nobody 594 0.0 3.0 5556 3856 ?SFeb12 0:01 /www/bin/httpd -D So What is the problem? Ideas? > -Original Message- > From: Marek Kilimajer [mailto:[EMAIL PROTECTED]] > Sent: Thursday, February 13, 2003 3:43 AM > To: Daevid Vincent > Cc: [EMAIL PROTECTED] > Subject: Re: [PHP] How can I have PHP set the linux system date/time? > > > You need root priviledges, that means /bin/date must run as root. You > can use sudo > > Daevid Vincent wrote: > > >Yep, I am trying to have a php web page change the linux system > >date/time, but obviously running into the snag that /bin/date, while > >"chmod 775" doesn't allow a user to set the date/time. Why is that, > >given the permissions? Sure it makes sense, but it's > annoying. Ideas on > >how to circumvent this problem? > > > >-rwxr-xr-x1 root root26780 Jul 23 2001 /bin/date > > > >Seems to me that anyone should be able to use it then right? Where is > >the "write" portion defined? The 'info date' page says, "You > must have > >appropriate privileges to set the system clock." But it > doesn't say what > >that is or how to change them. > > > >If anyone cares, here's a nice bit-o-code: > > > > > if ($year == "") $year = date("Y"); > > if ($month == "") $month = date("m"); > > if ($day == "") $day = date("d"); > > if ($hour == "") $hour = date("h"); > > if ($minute == "") $minute = date("i"); > > > > $NewDateTime = date ("m/d/Y H:i", mktime > >($hour,$minute,0,$month,$day,$year)); > > > > $binDate = date ("mdhiY", mktime > >($hour,$minute,0,$month,$day,$year)); > > exec("/bin/date ".$binDate); //TODO: um, yeah, how do you expect > >this to work? you have to be root to do this > >?> > > > > > >Change Time / Date > > > > > > > > > >New Date > > > > > for($i = 1; $i <= 12; $i++) > > { > > echo " > if ($month == $i) echo " SELECTED"; > > printf(">%02d\n",$i); > > } > > ?> > > / > > > > > for($i = 1; $i <= 31; $i++) > > { > > echo " > if ($day == $i) echo " SELECTED"; > > printf(">%02d\n",$i); > > } > > ?> > > / > > > > >?>>2003 > > >?>>2004 > > >?>>2005 > > >?>>2006 > > > > > >New Time > > > > > for($i = 0; $i <= 23; $i++) > > { > > echo " > if ($hour == $i) echo " SELECTED"; > > printf(">%02d\n",$i); > > } > > ?> > > : > > > > > for($i = 0; $i <= 59; $i++) > > { > > echo " > if ($minute == $i) echo " SELECTED"; > > printf(">%02d\n",$i); > > } > > ?> > > > > > > > > > > > > class=button> > > > > > > > > > > > > > if (!checkdate($month,$day,$year)) print "\nYou entered an > >invalid date, so it was converted to ".$NewDateTime."\n"; > >?> > > > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] I need examples of WRITING to XML wth PHP
I see tons of examples of how to read in an xml schema and use the variables and such, but how do I then change values and re-save the schema again? Can someone point me at a simple but function form that simply reads a .xml file, populates the form, and allows you to change values in the form and then resave the .xml file again. This seems like it should be so basic, yet I can't find anything... Thanks in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How do I set the timezone on redhat via PHP? Ie. How to convert GMT to symbolic link?
Given that I have a GMT offset via the select box below, how the hell do I turn that into a symbolic link to one of these files? How do I know which file to link too?!!! UGH. This is such a stupid way to set the timezone, why didn't RedHat just have a file with the offset in it? Something like "echo -0800GMT > /etc/timezone" would have been sufficient doncha think? PHP's date("O") function = "-0800". [dae51d=pts/0]12:50am@daevid:{/etc}> ll /etc/localtime lrwxrwxrwx1 root root 39 Dec 13 11:26 /etc/localtime -> /usr/share/zoneinfo/America/Los_Angeles [dae51d=pts/0]12:50am@daevid:{/etc}> ls /usr/share/zoneinfo/ Africa Australia Cuba Etc GMT0 Iceland Japan MST Poland right UCTzone.tab America Brazil EET Europe GMT-0 Indian Kwajalein MST7MDT PortugalROCUniversal Zulu Antarctica Canada EgyptFactory GMT+0 Iran Libya Navajo posix ROKUS Arctic CETEire GB Greenwich iso3166.tab MET NZ posixrules Singapore UTC AsiaChile EST GB-Eire Hongkong Israel Mexico NZ-CHAT PRC SystemVWET AtlanticCST6CDTEST5EDT GMT HSTJamaica Mideast Pacific PST8PDT Turkey W-SU And since I couldn't figure out a graceful way to do this programatically, I just typed them all out. Time Zone ";?> >GMT -12 Hours >GMT -11.5 Hours >GMT -11 Hours >GMT -10.5 Hours >GMT -10 Hours >GMT -9.5 Hours >GMT -9 Hours >GMT -8.5 Hours >GMT -8 Hours >GMT -7.5 Hours >GMT -7 Hours >GMT -6.5 Hours >GMT -6 Hours >GMT -5.5 Hours >GMT -5 Hours >GMT -4.5 Hours >GMT -4 Hours >GMT -3.5 Hours >GMT -3 Hours >GMT -2.5 Hours >GMT -2 Hours >GMT -1.5 Hours >GMT -1 Hours >GMT 0 Hours >GMT +0.5 Hours >GMT +1 Hours >GMT +1.5 Hours >GMT +2 Hours >GMT +2.5 Hours >GMT +3 Hours >GMT +3.5 Hours >GMT +4 Hours >GMT +4.5 Hours >GMT +5 Hours >GMT +5.5 Hours >GMT +6 Hours >GMT +6.5 Hours >GMT +7 Hours >GMT +7.5 Hours >GMT +8 Hours >GMT +8.5 Hours >GMT +9 Hours >GMT +9.5 Hours >GMT +10 Hours >GMT +10.5 Hours >GMT +11 Hours >GMT +11.5 Hours >GMT +12 Hours -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sessions and phplib.
Hello, I am using the phplib just for the sessions management and unfortunately this projects seems dead (no?), no official realise using the php4 session support. What's more, i am looking for a sessions library which could check the IP adress of users not only the cookie. In case of bad hats steal cookies... What I use in my current code is: page_open(array("sess" => "SIOVA_Session", "auth" => "SIOVA_Challenge_Auth", "perm" => "SIOVA_Perm")); $perm->check("user"); page_close() ; $auth->auth["perm"] == "admin" ;// and others privilege checks... $sess->delete() ; $auth->unauth(); $auth->logout(); etc... What do you think I should use instead of the phplib, do you think I should change what I use at this time which works full well :-/ I do want to use a library checking the cookies AND the IP adresses...to do something more secure. Thanks for you advises, Vincent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] DBA / DB2/3/ GDBM Failures
I've tried all of the DB libs and I can't get any of them to compile/work properly.. For GDBM I get : Driver initialization failed for handler: gdbm: Bad magic number For the rest I just get Driver initialization failed for handler: Where is db2 db3 etc.. Can anyone tell me what the the trick is to get this to work? Thanks! -M -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] 2 questions !
Hello, I didn't find in the doc how to: - Know the full path of the current directory. Like /var/www/to/the/path - Know under which user work apache, to know when I create a file whose file it is... Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: 2 questions !
Greg Beaver wrote: "Vincent M." <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hello, I didn't find in the doc how to: - Know the full path of the current directory. Like /var/www/to/the/path try using dirname(__FILE__) or dirname($_SERVER['PATH_TRANSLATED']) dirname($_SERVER['PATH_TRANSLATED'])is good for me. How can I know all these variables, for example, now I need to know the upload_max_filesize ! And later, for sure, I will have to know another config option of the server...wich can be access by such variable. How to know all these variable ? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] What ?
Hello, I am the bus stop boy. The business I was talking about is an php gallery editor. You can see mine in action here: My photos of Montreal: http://www.siova.net/photos/index.php?type=mtl&img=mtl_&diapo=0&pref_size=512&version=2 My photos of Toulouse, the city I was born in: http://www.siova.net/photos/index.php?type=tse&img=tse_&diapo=0&pref_size=512&version=2 Translation for better browsing: "Voir l'image suivante" -> "See the next image" "Voir l'image précédante" -> "See the forward image" "Chargement de l'image en cours...Veuillez patienter" -> "Loading image in progress...Please wait" Have you ever seen such a good gallere browser ? And look at my future concurent: http://www.photopost.com/ See photopost in action: http://www.fordf150.net/photopost Another future concurent: http://www.imagefolio.com That's it at this time. SeeYa, Vincent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Php and JavaScript
Valentin wrote: Hi, Is any way to write JavaScript code into PHP function or to send PHP's variables values to the JScript variables? Thanks, Of course, you can create dynamicaly javascript via php, ie: echo " var yourvar = $onephpvar ; " ; Is that what you were asking for ? Vincent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Php and JScript
Valentin wrote: Hi, Is any way to write JavaScript code into PHP function or to send PHP's variables values to the JScript variables? Thanks, Yes, I think there is a way to do so! ;-) Vincent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] define variables.
Hello, I do a lot of define like that: define ("_LANG1", "Server options"); define ("_LANG1", "Manage your system"); etc... And stuff like that: if($num == 1) { $mgs = _LANG1 ; }else if($num == 2) { $mgs = _LANG2 ; } etc... But I do want to avoid all these if and else, is there a way to do something like that: $mgs = _LANG.$num ; ? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] define variables.
Jason K Larson wrote: http://www.php.net/manual/en/function.constant.php $msg = constant('_LANG'.$num); HTH, -- Jason k Larson Strange it does not work if I do: $num = "_LANG".$num ; $msg = constant($num) ; echo $mgs ; //It does not display anything! But If I do it directly, it works: $num = "_LANG".$num ; echo constant($num) ; //It display the constant variable. Anyway it works :-) Thanks, Vincent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] RedHat 8.0 MySQL Problem
Wouldn't that technically be "downgrade", since RH8 ships with Apache 2.0 *smirk* But yes, however, keep in mind that when you do 'downgrade' you will run into the constant annoyance that up2date will always want to install a newer php and httpd (they don't even call it apache for the rpm grrr), so things like 'squirrelmail' and the other RH web config type programs will shit on you. So, keep that in mind, but if it is production environment, you prolly don't want to be running apache 2.0 just yet -- especially if youre doing SSL stuff. > -Original Message- > From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED] > Sent: Tuesday, March 04, 2003 10:44 PM > To: Darren Young > Cc: [EMAIL PROTECTED] > Subject: Re: [PHP] RedHat 8.0 MySQL Problem > > > Have you actually enabled the MySQL extension? You should > have a line in > your php.ini that says: > > extension=mysql.so > > By the way, the Apache that comes with RH8 when combined with > PHP does not > give you a production-quality solution. So if you are > running this thing > for any sort of important service, you really need to upgrade your web > server to Apache 1.3.27. > > -Rasmus > > On Tue, 4 Mar 2003, Darren Young wrote: > > > I have an app that runs just fine on RedHat 7.2 with > compiled Apache and > > PHP along with MySQL binaries installed from MySQL's site. > I have a new > > machine running RedHat 8.0 that is completely "generic", > i.e only RedHat > > Apache, PHP and MySQL RPM's installed. The error message > I'm getting is: > > > > [04-Mar-2003 23:38:46] PHP Fatal error: Call to undefined function: > > mysql_pconnect() in /var/www/html/zzmysql.php on line 49 > > > > That's in the app log file by the way, we all the errors > there. The page > > displayed is completely blank at the moment in time the error fires. > > > > > > Persistent MySQL connections are disabled in the RedHat RPM's? > > > > RPM's installed are currently (via rpm -qa): > > > > httpd-2.0.40-11 > > php-devel-4.2.2-8.0.7 > > php-imap-4.2.2-8.0.7 > > php-odbc-4.2.2-8.0.7 > > php-snmp-4.2.2-8.0.7 > > php-ldap-4.2.2-8.0.7 > > php-pgsql-4.2.2-8.0.7 > > php-4.2.2-8.0.7 > > php-manual-4.2.2-8.0.7 > > php-mysql-4.2.2-8.0.7 > > > > I'd really like to keep the RedHat install generic and > would prefer no > > compile from source for this app. The onIy other change > I've made is to > > copy the php.ini from the 7.2 machine over to /etc/php.ini > to get the > > config the same. If I restore the original php.ini back the page > > displays but the app just does not work. It seems as though > the mysql > > functions just don't work quite right. > > > > Thoughts would be most appreciated. > > > > thx. > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Global VARS.
Hello, To get ride of magic_quotes I do: function no_magicquotes() { global $HTTP_GET_VARS ; global $HTTP_POST_VARS ; global $HTTP_COOKIE_VARS ; if (get_magic_quotes_gpc()) { // Overrides GPC variables for (reset($HTTP_GET_VARS); list($k, $v) = each($HTTP_GET_VARS); ) $$k = stripslashes($v); for (reset($HTTP_POST_VARS); list($k, $v) = each($HTTP_POST_VARS); ) $$k = stripslashes($v); for (reset($HTTP_COOKIE_VARS); list($k, $v) = each($HTTP_COOKIE_VARS);) $$k = stripslashes($v); } } And it seems to work, But i have have a file like that: $VAR_mailadmin = "[EMAIL PROTECTED]" ; $VAR_urlgallery= "http://www.siova.net/paris2"; ; $VAR_categories[0]["title"] = "Montréal by Night" ; $VAR_categories[0]["name"] = "Mtl by night" ; $VAR_categories[0]["file"] = "montreal_by_night" ; ... And many others variables. And magic_quotes seems to work for global vars too. Is there a way to modify no_magicquotes() to make this function works with all global vars ? Another for...each...but how ? Thanks, Vincent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] wont display anything but a white page!!!
I have the same problem, and I've found that if you set error_reporting(E_ALL); at the top of the page you're working on, you will at least get some info. You may also set that in the /etc/php.ini file I also suggest you make a "phpinfo.php" page wich contains simply: And browse that to see all the PHP settings you have. Maybe you have a local vs. master conflict. Daevid. > -Original Message- > From: John W. Holmes [mailto:[EMAIL PROTECTED] > Sent: Saturday, March 08, 2003 5:49 PM > To: 'Karl James'; [EMAIL PROTECTED] > Subject: RE: [PHP] wont display anything but a white page!!! > > > > http://66.12.3.67/webdb/webdb13/assignment_1.phps > > > > Can anyone tell me why I only get a white page > > And no text to be on the browser? > > Is display errors turned on in php.ini? Usually you get a > page like then > when there was an error, but displaying it is not activated > in php.ini. > > ---John W. Holmes... > > PHP Architect - A monthly magazine for PHP Professionals. Get > your copy > today. http://www.phparch.com/ > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Easy Way.
Hello, Is there an easy way to change an integer to a 5 caracters string. For example: $i = 3 ; $j = 110 ; After having changed them: $i = "3" ; $j = "00110" ; Is there a php function to do so instead of doing this: if( ($i>0)&&($i<10)) { $i = "".$i ; } else if( ($i>9)&&($i<100)) { $i = "000".$i ; } else if( ($i>99)&&($i<1000)) { $i = "00".$i ; } etc... Thanks :-) Vincent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Easy Way.
Jason Sheets wrote: Hello, Use str_pad, the manual page is available at http://www.php.net/str_pad, a short example would be: $i = 3; $i = str_pad($i, 5, "0", STR_PAD_LEFT); This function is described in the PHP manual in the string functions section, the manual is an excellent place to go first when questions such as this arise. Yes I know, but it's not so easy to find to right function I need there are so many... ;-) Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] HTTP_POST_VARS empty!
Hello, I don't understand this code empty my HTTP_POST_VARS variable: if ((get_magic_quotes_gpc() == 1)) { switch ($REQUEST_METHOD) { case "POST": while (list ($key, $val) = each ($HTTP_POST_VARS)) { $$key = stripslashes($val); } break; case "GET": while (list ($key, $val) = each ($HTTP_GET_VARS)) { $$key = stripslashes($val); } break; } } This script is usefull to simulate get_magic_quotes_gpc to 0 but if I do it it empty my HTTP_POST_VARS and this code does not work: while(list ($key, $val) = each($HTTP_POST_VARS)) { echo "$key => $val"; } echo "Here we are...!!!..." ; It displays, "Here we are...!!!..." but nothing at all for $key and for $val How should I do to simulate get_magic_quotes_gpc to 0 without emptying HTTP_POST_VARS ? Thanks, Vincent. PS: If I delete the code ...(get_magic_quotes_gpc() == 1)...it works... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: HTTP_POST_VARS empty!
Vincent M. wrote: Hello, I don't understand this code empty my HTTP_POST_VARS variable: if ((get_magic_quotes_gpc() == 1)) { switch ($REQUEST_METHOD) { case "POST": while (list ($key, $val) = each ($HTTP_POST_VARS)) { $$key = stripslashes($val); } break; case "GET": while (list ($key, $val) = each ($HTTP_GET_VARS)) { $$key = stripslashes($val); } break; } } This script is usefull to simulate get_magic_quotes_gpc to 0 but if I do it it empty my HTTP_POST_VARS and this code does not work: while(list ($key, $val) = each($HTTP_POST_VARS)) { echo "$key => $val"; } echo "Here we are...!!!..." ; It displays, "Here we are...!!!..." but nothing at all for $key and for $val How should I do to simulate get_magic_quotes_gpc to 0 without emptying HTTP_POST_VARS ? Thanks, Vincent. PS: If I delete the code ...(get_magic_quotes_gpc() == 1)...it works... ok, It seems to empty the HTTP_POST_VAR variable when we parse it with while(list ($key, $val) = each($HTTP_POST_VARS)) { ... } So I can't do this while 2 times :-( and I need to do it several times! Does anyone know how to parse $HTTP_POST_VARS whithout emptying this variable ? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: HTTP_POST_VARS empty!
Vincent M. wrote: Vincent M. wrote: Hello, I don't understand this code empty my HTTP_POST_VARS variable: if ((get_magic_quotes_gpc() == 1)) { switch ($REQUEST_METHOD) { case "POST": while (list ($key, $val) = each ($HTTP_POST_VARS)) { $$key = stripslashes($val); } break; case "GET": while (list ($key, $val) = each ($HTTP_GET_VARS)) { $$key = stripslashes($val); } break; } } This script is usefull to simulate get_magic_quotes_gpc to 0 but if I do it it empty my HTTP_POST_VARS and this code does not work: while(list ($key, $val) = each($HTTP_POST_VARS)) { echo "$key => $val"; } echo "Here we are...!!!..." ; It displays, "Here we are...!!!..." but nothing at all for $key and for $val How should I do to simulate get_magic_quotes_gpc to 0 without emptying HTTP_POST_VARS ? Thanks, Vincent. PS: If I delete the code ...(get_magic_quotes_gpc() == 1)...it works... ok, It seems to empty the HTTP_POST_VAR variable when we parse it with while(list ($key, $val) = each($HTTP_POST_VARS)) { ... } So I can't do this while 2 times :-( and I need to do it several times! Does anyone know how to parse $HTTP_POST_VARS whithout emptying this variable ? Thanks. ok, reset($HTTP_POST_VARS) is my friend ;-) ++ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] how can I logout autamaitcally (using session)
Did you even read the docs on sessions? http://us4.php.net/manual/en/function.session-destroy.php http://us4.php.net/manual/en/function.session-unset.php http://us4.php.net/manual/en/function.session-unregister.php *sigh* Please people, think and at least do the simplest of searching on the site before firing off an email to 10,000 people on this list. > -Original Message- > From: sunwei [mailto:[EMAIL PROTECTED] > Sent: Tuesday, July 01, 2003 2:13 PM > To: [EMAIL PROTECTED] > Subject: [PHP] how can I logout autamaitcally (using session) > > > when the user close all the IE windows, should the session be > destroyed autamatically? > it seems in my website, the session is not destroyed > autamatically, so that other people > open the IE and see that he can access the website without > logging in. so what I should do? > > thanks a lot for any help or suggestion. > > wei sun > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Removed the bundled MySQL client library. (Sterling)
I found this in the ChangeLog of PHP5: Removed the bundled MySQL client library. (Sterling) What does that mean? We can't access MySQL anymore from PHP? Vincent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] DHCP web interface. New version.
Heya. I've just put up a new version of the DHCP web front end if anyone is using it or has a need for this type of thing. Major feature of this version: * a bug where if the arp table showed an "(incomplete)", I ignored the entry since the MAC is the hash key, many machines wouldn't show up as they kept over writing each other (of course, they were bunk anyways) * ping & nmap tests (if ping fails, nmap is used as a backup) this is useful for firewalls that may block ICMP * tests can be disabled for radically faster page rendering (off by default) * 10 minute refresh by default rather than 10 second. * SORTING! by IP now, rather than arp entries * many more icons (tivo, zaurus, replay, linux, notebook, servers, DAR, etc) * complete/incomplete tally * Name in config file is only used if dhcp doesn't show a name already This is also IMHO an excellent way for a beginer or advanced coder alike to see some very useful OOP/PHP coding as I use arrays of objects, sorting by variables IN the object (custom sort algorithm with key integrity), hashing, system calls, regex parsing, DHTML, etc. If anyone knows how to force the arp table to be current, that would help. Sometimes a machine is on the network, and I *know* for a fact it is, but it doesn't show up in "arp -n" *grumble*. Follow the link below. http://daevid.com/examples/dhcp/ Check out my resume. Hire me. ;-) http://resume.daevid.com/ N'joy. Daevid. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] DHCP web interface. New version.
I already to that with ping and nmap. The problem lies BEFORE getting the list. :) "Arp -n" is my master IP generator/table. So if the IP isn't in there, I don't know about it. I need a way to send a command line switch (which there isn't) or another call to force "arp" to rebuild it's cache. > -Original Message- > From: Tom Rogers [mailto:[EMAIL PROTECTED] > Sent: Tuesday, July 29, 2003 1:51 AM > To: Daevid Vincent > Cc: [EMAIL PROTECTED] > Subject: Re: [PHP] DHCP web interface. New version. > > > Hi, > > Tuesday, July 29, 2003, 2:40:55 PM, you wrote: > > > DV> If anyone knows how to force the arp table to be current, > that would help. > DV> Sometimes a machine is on the network, and I *know* for a > fact it is, but it > DV> doesn't show up in "arp -n" *grumble*. > > DV> Follow the link below. > DV> http://daevid.com/examples/dhcp/ > > DV> Check out my resume. Hire me. ;-) > DV> http://resume.daevid.com/ > > DV> N'joy. > > DV> Daevid. > > You could loop through your ip adddresses that you are interested in > and send a couple of pings. > That should force the arp cache to be current for those ip's that > exist > > -- > regards, > Tom > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] DHCP web interface. New version.
Well, a quick click on the URL I gave (http://daevid.com/examples/dhcp/) would immediately show you what it was (live on my server), but in a nutshell. I have a home LAN with many computers and other IP enabled devices -- two TiVos, replayTV, Dell Audio Reciever, Zaurus, 8 computers!, three notebooks, etc. (it's a big house!) and I'm an open wifi node. I wanted to know what was on my network easily and in real time, complete with the windows names for the computers. Then I kinda went buck-wild and added icons, custom names, ping/nmap tests, sorting by IP, etc Amazingly I couldn't find a tool -- command line or otherwise that did this seemingly simple task. I mean, windows has 'network neighborhood', but that's only good for windows machines or other conforming types. This comes in very handy for any LAN, but you have to put it on the machine that has the most 'arp' info. This is usually your DHCP server as it also reads the dhcp.leases file to harvest names and lease times. Pretty straight forward setup. Almost none in fact. Edit the .ini file with your mac addresses and icons you want to use (if any). Anyways, it's free and there for you if you want to see/play/use it. d > -Original Message- > From: Chris W. Parker [mailto:[EMAIL PROTECTED] > Sent: Monday, July 28, 2003 10:56 PM > To: Daevid Vincent; [EMAIL PROTECTED] > Subject: RE: [PHP] DHCP web interface. New version. > > > Daevid Vincent <mailto:[EMAIL PROTECTED]> > on Monday, July 28, 2003 9:41 PM said: > > > Heya. I've just put up a new version of the DHCP web front end if > > anyone is using it or has a need for this type of thing. > > New version? I din't even know you HAD a version. > > So for us people that have never heard of this, what exactly > does it do? > > > thanks, > chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] DHCP web interface. New version.
> > Pretty straight forward setup. Almost none in fact. Edit the .ini > > file with your mac addresses and icons you want to use (if any). > > Does this mean it doesn't go out, search your network, and then report > back with everything it's found? Do you mean that I have to manually > specify each device I want to list? Am I misunderstanding you? No. it *does* an 'arp -n' to find all the nodes on your network automatically. It also uses that info to determine your active interfaces (eth0, eth1, wlan0, etc...). So if your arp cache is up to date, then so is this. It shows if they are "(inactive)" by the ban circle. It shows ping and nmap results. (only namps if ping fails. Assumes nmap will pass if ping passes). The dhcp_map.ini is used ONLY for custom icons and for custom names if the MAC doesn't already have a name associated with it in /var/lib/dhcp.leases file. This is useful for machines that have static IP's on your network for example, or linux boxes that don't send that info (only windows boxes send/set names automatically). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] System() works on /usr/sbin commands
Add an entry to /etc/sudoers like so: nobody ALL=NOPASSWD: /bin/date Daevid Vincent http://daevid.com > -Original Message- > From: Marek Kilimajer [mailto:[EMAIL PROTECTED] > Sent: Thursday, July 31, 2003 3:02 AM > To: tirumal b > Cc: [EMAIL PROTECTED] > Subject: Re: [PHP] System() works on /usr/sbin commands > > > Check out sudo (man sudo), but you must be carefull. > > tirumal b wrote: > > > hello, > > > > yes the /usr/sbin commands require root permissions > > but is there any way to run these commands using > > system() through suid or something.please let me know > > > > Thank you > > > > __ > > Do you Yahoo!? > > Yahoo! SiteBuilder - Free, easy-to-use web site design software > > http://sitebuilder.yahoo.com > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Password storage system
Thanks, but I guess I forgot to mention it should be web-interface... http://passwordms.sourceforge.net/index.php For anyone wanting to look. > -Original Message- > Try PMS: Password Management System. I believe it can be found on > sourceforge. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] REQ: Password storage system
I'm in search of an 'enterprise level' password storage system. I have looked at phpMyPass and it looks promising, but the demo doesn't seem to have everything I want. http://freshmeat.net/releases/127316/ While this one says v2.0 http://www.phpmypass.paniris.com/ Says 1.0 ?? I need it to be multiuser, have different security levels/access, encrypt and decrypt on the fly (phpmypass has all the passwords in the rendered HTML page :-( ), grouping of passwords (i.e. 'internal servers', websites, banks, clients sites, personal, etc). Ideally it should use mod_auth_mysql for security. The storage should be encrypted so that even root can't see the passwords in the database without the decryption key. Perhaps use a strong crypto algorithm for the important fields, not just the pw. I'd like to store: common name, url, username, pw, notes, incept date, last mod date at least. I could build this myself, or I could take phpMyPass and run with it, but I thought I'd see if there were anything else out there before I build this. http://daevid.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Use PHP or MySQL for MD5 function
Well, IMHO it's better to use PHP. My reasoning is this: you want to hit the db and get out of there as quick as possible since you have limited threads. Plus, I try to keep my code as db agnostic as possible, so that it's portable. Having said that, if it's a quick project or something simple, I'd probably use the mysql version just for the ease of use factor. If you really care, just make a program like this and do some MD5() calls in both mysql and php to see which is faster. I'd be curious to know as well... You'll have to modify appropriately, and only do a single MD5 check because I think looping 1 mysql MD5 calls will be slower automatically since there is the connection to the db and stuff to contend with, so keep that in mind. Daevid Vincent http://daevid.com --- test --- blah version one: \t$time1 seconds\n"; echo "version two: \t$time2 seconds\n"; ?> > -Original Message- > From: Sid [mailto:[EMAIL PROTECTED] > Sent: Monday, August 25, 2003 1:25 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Use PHP or MySQL > > > Hello, > > This question has been lingering in my mind for some time - > Say we have a function such as MD5, which is available on > both PHP and MySQL? Which is faster - the PHP version or the > MySQL one. Have any benchmarks been made on this? We can use > the same question for say... arithmetic operations, string > contentation... > > Thanks in advance. > > - Sid > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Searching for a file.
Hello, I am looking for a way to search a file knowing the beginig of his name. For exemple, I know that the file I am looking for is: montreal_13_120.jpg But I just know: montreal_13 And I can't know _120.jpg So at this time I did this: $dirthumbs = $dir."/thumbs" ; $direc_src_obj2 = dir($dirthumbs) ; while($entry=$direc_src_obj2->read()) { if( substr($entry, 0, 15) == "$begining"){ $return[$i]["thumb"] = "$entry" ; break ; } } It works but it's not enough fast :-( For resume, is there a way to do something like that: ls montreal_13* without using the passthru function, I am looking for a native php function doing ls $mychar* Thanks, Vincent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Zip Way of life.
Hello, I'd like to uncompress to the Hard disk a zip file send by the browser. At this time I do this: function uncompresszip($zipfile) { copy($zipfile, dirname($_SERVER['PATH_TRANSLATED'])."/zip/zipfile.zip") ; } But I do not understand how to uncompress the zip file, I tried for exemple: $retour = readgzfile(dirname($_SERVER['PATH_TRANSLATED'])."/zip/zipfile.zip"); But as mentionned in the php doc it outputs the content of the zip file in the browser :-( How to uncompress a zip file in a directory ? I just want all the files which are in the zip file... Thanks, Vincent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Zip Way of life.
Marek Kilimajer wrote: readgzfile is for *.gz files. Either use zip file functions (rarely supported) or PclZip (http://www.phpconcept.net/pclzip/index.en.php) No, it works with .zip files too, I just don't know how to manage it :-( -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Zip Way of life.
You could use the exec() or shell_exec() and just do it via command line method... > -Original Message- > From: Vincent M. [mailto:[EMAIL PROTECTED] > Sent: Wednesday, March 19, 2003 12:36 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Zip Way of life. > > > Hello, > > I'd like to uncompress to the Hard disk a zip file send by > the browser. > > At this time I do this: > > function uncompresszip($zipfile) { >copy($zipfile, > dirname($_SERVER['PATH_TRANSLATED'])."/zip/zipfile.zip") ; > } > > But I do not understand how to uncompress the zip file, I > tried for exemple: > $retour = > readgzfile(dirname($_SERVER['PATH_TRANSLATED'])."/zip/zipfile.zip"); > > But as mentionned in the php doc it outputs the content of > the zip file > in the browser :-( > > How to uncompress a zip file in a directory ? I just want all > the files > which are in the zip file... > > Thanks, > Vincent. > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Zip Way of life.
David T-G wrote: Vincent, et al -- ...and then Vincent M. said... % % Marek Kilimajer wrote: % >readgzfile is for *.gz files. ... % No, it works with .zip files too, I just don't know how to manage it :-( You mentioned wanting the "files" (note the plural) in the zip file. AFAIK gunzip can unzip an archive containing a single file, but if you have more than one in there then you need to use an actual unzip tool (like, say, unzip :-) While a class or a built-in command might be nice, if you just want to get them out then a simple system call might be the easiest way to go. HTH & HAND :-D Yes but gunzip does not work when there are more than one file in the zip file and unzip is not installed by on Unix servers. :-( -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Zip Way of life.
Daevid Vincent wrote: You could use the exec() or shell_exec() and just do it via command line method... Yes but gunzip does not work when there are more than one file in the zip file and unzip is not installed by default on Unix servers. :-( -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Zip Way of life.
> zip file and unzip is not installed by on Unix servers. :-( So either install it on the servers that need it, or distribute the un/zip exe with your package in your projects local directory -- this also saves you having to deal with different versions on different servers that may not always do what you expect. At least this way it's a controlled environment. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Zero Fill -> Number Format
Just an observer, but I love how you each had a different way of accomplishing this task! ;-) And Mike, looks like you have some re-writing to do now that Martin and Kevin showed you a WAY simpler (and faster) way to accomplish what you did. LOL. http://daevid.com > -Original Message- > From: Martin Towell [mailto:[EMAIL PROTECTED] > > sprintf/printf("%7d", $num) -Original Message- >From: Kevin Waterson [mailto:[EMAIL PROTECTED] > >print str_pad($something, 7, "0", STR_PAD_LEFT); -Original Message- From: Mike Brum [mailto:[EMAIL PROTECTED] This is what I did for a dynamic zero-fill for renaming batches of files: // Get "Zero Padding" For New Image Names $zero_padding = strlen(count($image_array)); foreach($image_array as $temp){ $n++; $n_length = strlen($n); for($i = 0; $i < ($zero_padding - $n_length); $i++){ $n = "0" . $n; } $new_name = $image_inbox . "/" . $newName . "-" . $n . ".jpg"; rename("$image_inbox/$temp", $new_name); } I'm not sure if this will be applicable to your situation, but it works perfectly for me since it will zero-fill for any length of numbers and pad the shorter numbers appropriately. > -Original Message- > From: Harry.de [mailto:[EMAIL PROTECTED] > Sent: Thursday, March 20, 2003 10:09 AM > To: [EMAIL PROTECTED] > Subject: [PHP] Zero Fill -> Number Format > > > How can I put out a Zero Fill for numbers > The result should be > > $something=26; > echo $something; > > e.g. > 026 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Is there a way to access all the variables in my script?
Is there some global array or something that contains all the variable names (not even values per se) that are used in my script. Here's the scenario. Like most of you, I do a lot of mySQL db work. So I tend to use this: if (mysql_num_rows($result) > 0) { $row = mysql_fetch_array($result,MYSQL_ASSOC); while(list($myVariableName,$sqlFieldName)=each($row)) { $$myVariableName = $sqlFieldName; } } So now I have a bunch of variables all named say, $company_name, $company_id, $company_phone, etc... What I want to do is make a function that can step through all the $company_ variables and unset them all. (I imagine I'll just string compare to "company_" and then prefix the result with $$, then set = "", etc. you get the idea) I suppose I could re-write all my code and use the $row['company_id'] method instead then clear $row[] but it would be nice to know if there is a way to do this 'my way' as well... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Test the server.
Hello, Is there anyway to check these two things: - If the server is an Unix server. - If a command is available on the server. For exemple, I need to test if the shell command unzip is avalaible to do: exec("unzip ...something...") ; So I can test if exec is available doing: if(function_exists(exec)) { ... } But how to test if a shell command is available on the server and if the server is an Unix-like server ? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Test the server.
Sebastian wrote: put this in a .php file: it'll tell you what OS, (usually) check if safe mode is on.. if it's on then usually you can't "exec" anything. cheers, - Sebastian Yes I know but my aim is to make a php script which checks automaticly if the php and the shell functions I need are available. Vincent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: how to pass variable for $_GET
Don't know if you realize this or not, but when you pass the variables, you DO NOT enclose them in ' marks... So... http://blah.com/myscript.php?date=2003-2-1%2000:00:01'%20AND%20'2003-3-1%202 3:59:59&othervar=1234 Then on your myscript.php page, $_GET['date'] will equal "2003-1-3 00:00:01 AND 2003-3-10 23:59:59" (sans the " marks) $_GET['othervar'] will equal "1234" The browser pads the spaces with %20 If you really do need the ' marks, put them in the myscript.php page where needed like this: $sql = "SELECT * FROM foo WHERE blah = '".$_GET['othervar']."'"; > -Original Message- > From: DomIntCom [mailto:[EMAIL PROTECTED] > Sent: Sunday, March 23, 2003 2:08 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Re: how to pass variable for $_GET > > > thanks - found a solution... both method's worked for me > > > "Nate" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > stripslashes("\'2003-1-3 00:00:01\' AND \'2003-3-10 23:59:59\'"); > > > > "Domintcom" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > ok - found urldecode which is now giving me the following; > > > > > > \'2003-1-3 00:00:01\' AND \'2003-3-10 23:59:59\' > > > > > > original string; > > > > > > '2003-1-3 00:00:01' AND '2003-3-10 23:59:59' > > > > > > > > > "Domintcom" <[EMAIL PROTECTED]> wrote in message > > > news:[EMAIL PROTECTED] > > > > ok - I know how to pass these variables by appending > variables to the > > > link. > > > > however, I'm trying to pass the following string; > > > > > > > > '2003-1-1 00:00:01' AND '2003-3-20 23:59:59' > > > > > > > > now - when I pass it what I get is the following; > > > > > > > > date='2003-2-1%2000:00:01'%20AND%20'2003-3-1%2023:59:59' > > > > > > > > it seems what I'm going to have to do is replace %20 > with a space, but > > I'm > > > > unclear of how to do that with php. > > > > > > > > thanks, > > > > > > > > Jeff > > > > > > > > > > > > > > > > > > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Using include() or require() with PDF module
Two things come to mind... First, make sure the file is indeed being included/required and you don't have your paths messed up. Second, make sure you have the PDF stuff compiled into PHP. Make a page with as the only thing in it, then load it in your web browser and find the words "PDF" in there. I've not used PDF myself, so that's about the extent of my help. Sorry. d > -Original Message- > From: Bill Hudspeth [mailto:[EMAIL PROTECTED] > Sent: Monday, March 24, 2003 11:50 AM > To: [EMAIL PROTECTED] > Subject: [PHP] Using include() or require() with PDF module > > > I wish to use the include() and/or the require() functions to > include a > block of PHP multiple times in my file. The block contains code for > outputting PDF elements. Although other external code (functions for > example) are successfully referenced using these commands, > the PHP's PDF > functions don't seem to work. > > Any ideas? > > > > -- > 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] What am I not understanding about $GLOBALS['myvar'] vs global $myvar?
How come this function works, but the one below does not?? function clearContactVars() { global $contact_id; $contact_id = ""; global $contact_timestamp;$contact_timestamp = ""; global $contact_incept; $contact_incept = ""; global $contact_dept_table_id;$contact_dept_table_id = ""; global $contact_fname;$contact_fname = ""; global $contact_lname;$contact_lname = ""; global $contact_title;$contact_title = ""; global $contact_phone;$contact_phone = ""; global $contact_email;$contact_email = ""; global $contact_address1; $contact_address1 = ""; global $contact_address2; $contact_address2 = ""; global $contact_city; $contact_city = ""; global $contact_state;$contact_state = ""; global $contact_zip; $contact_zip = ""; global $contact_country; $contact_country = ""; global $contact_notes;$contact_notes = ""; } This one does NOT work the way I would expect it to? function clearContactVars() { foreach ($GLOBALS as $key => $value) { if ( substr($key,0,8) == "contact_" ) { //echo "GLOBALS['$key'] = $value\n"; $GLOBALS['$key'] = ""; } } clearPostVars(); } (this is located in an require() file and do I even need to do this?): function clearPostVars() { foreach ($_POST as $key => $value) { //echo "_POST['$key'] = Value: $value\n"; $_POST['$key'] = ""; } } I use these variables on a web page like so: Phone: So after a successful insert/update/whatever, I need to clear the fields. The only other relevant part is that at the top of each page in a require() file, I have this: reset ($_POST); while (list ($key, $val) = each ($_POST)) { //echo "$key => $val\n"; $$key = $val; } But it doesn't make sence to me that the first function does in fact clear the variables, when the second one does not. I thought that would be even more direct, since "global $contact_id" from what I read is only a reference to the global variable named $contact_id. Which in effect should be exactly $GLOBALS['contact_id'] right? http://www.php.net/manual/tw/migration4.variables.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] What am I not understanding about $GLOBALS['myvar'] vs global $myvar?
Actually I didn't. ;-) $GLOBALS[$key] is incorrect and depricated AFAIK. $GLOBALS['$key'] (with the single quotes) is the proper way to write these types of associative arrays/hashs. For shits and giggles however I tried your way and it made no difference to the code. Still didn't work right. > -Original Message- > From: Marek Kilimajer [mailto:[EMAIL PROTECTED] > Sent: Wednesday, March 26, 2003 1:16 PM > To: Daevid Vincent > Cc: [EMAIL PROTECTED] > Subject: Re: [PHP] What am I not understanding about > $GLOBALS['myvar'] vs global $myvar? > > > > > Daevid Vincent wrote: > > >This one does NOT work the way I would expect it to? > > > > function clearContactVars() > > { > > foreach ($GLOBALS as $key => $value) { > > if ( substr($key,0,8) == "contact_" ) { > > //echo "GLOBALS['$key'] = $value\n"; > > $GLOBALS['$key'] = ""; > > > I did not read your whole message, but you very likely mean > > $GLOBALS[$key] = ""; > (no single quotes) > > > } > > } > > clearPostVars(); > > } > > > > > > > > > -- > 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] Protecting Code source.
Hello, I'd like to sell an application to 24$ US and I have to protect my source code. But I don't want to make my customer install anything on the server to be able to run my application. So the Zend encoder seems good for me: http://www.zend.com/store/products/zend-encoder.php "Or, make it easy for your customers to run Zend-encoded files by bundling your application with the Zend Optimizer freeware." The only trouble is the price (960$), it's a little expensive for the student I am :-/ Does anyone know any other less expensive way to protect my source code ? Thanks, Vincent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Protecting Code source.
John Wards wrote: On Thursday 27 Mar 2003 7:31 pm, Vincent M. wrote: The only trouble is the price (960$), it's a little expensive for the student I am :-/ Does anyone know any other less expensive way to protect my source code ? http://www.ioncube.com/ They have a web based version that you do on a per file basis and is much cheaper for small jobs Cheers John Wards SportNetwork.net The problem is that: http://www.ioncube.com/loader_download.php : "The loader can be installed by either adding a single line to the php.ini file" I don't want my customers to have to edit the php.ini and what's more, some of them don't have an access to it... :-( -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Microsoft SQL Server varchar(500) field text concatenated at 255 characters.
http://www.mysql.com/doc/en/CHAR.html VARCHAR can only be 255 characters in length. Here's some useful info: # BIGINTUNSIGNED = 8 Byte = = 18446744073709551615 # INT UNSIGNED = 4 Byte = = 4294967295 # MEDIUMINT UNSIGNED = 3 Byte = FF = 16777215 # SMALLINT UNSIGNED = 2 Byte = = 65535 # TINYINT UNSIGNED = 1 Byte = FF = 255 # BIGINTSIGNED = -9223372036854775808 to 9223372036854775807 # INT SIGNED = -2147483648 to 2147483647 # MEDIUMINT SIGNED = -8388608 to 8388607 # SMALLINT SIGNED = -32768 to 32767 # TINYINT SIGNED = -128 to 127 # TINYTEXT = 255 # TEXT = 65535 # MEDIUMTEXT = 16777215 # LONGTEXT = 4294967295 > -Original Message- > From: Scott Houseman [mailto:[EMAIL PROTECTED] > Sent: Friday, March 28, 2003 3:35 AM > To: [EMAIL PROTECTED] > Subject: [PHP] Microsoft SQL Server varchar(500) field text > concatenated at 255 characters. > > > Hi There. > > I am using PHP 4.3.0 on WIN32 to query data from a Microsoft > SQL Server. > One field I am requesting is type VARCHAR size 500. For some > reason, PHP > is returning only the first 255 characters of the text from > that field. > > If I change the field type to TEXT, all of the data in that > field is returned. > > Unfortunately, an ASP application is also using that > database, and when I change > the field type to TEXT, it pukes completely. > I would rather try to resolve the issue in PHP than waste my > time looking at ASP code. > > Has anyone got an idea why this might be hapenning? > > Many thanks. > > Scott > -- > Scott Houseman > Senior Software Developer > Junk Mail Publishing (Pty) Ltd > Tel. +27 12 342 3840 x3806 > Fax. +27 12 342 1842 > Mob. +27 82 491 8021 > > > -- > 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] So many functions!
Hello, There so many functions in php that I can't find the one I need. I have a table like that: $lang["english"]["category"]= "Category" ; $lang["english"]["backpage"]= "Go to the back page" ; $lang["english"]["nextpage"]= "Go to the next page" ; ... $lang["francais"]["category"]= "Catégorie" ; $lang["francais"]["backpage"]= "Aller à la page précédente" ; $lang["francais"]["nextpage"]= "Aller à la page suivante" ; ... And I need to extract "english" and "francais". As it, when I will add another language such as "espanol", it will be automatic... Any idea ? Thanks, Vincent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Submit Image Button
Anyone know if this annoying behaviour will ever be 'fixed' in future HTML specs? I can't believe what a glaring oversight this is that the 'value' doesn't get GET/POSTED like with a normal 'submit' button... WTF were they thinking? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] RE: newbie Dynamic Drop down lists using mysql
Not that this hasn't been coverd a million times already Bobby -- check the archives... function ListboxMatch($size, $name, $query, $matchtothis) { $items = 0; //echo "".$query.""; if ( $qry = mysql_query($query) ) { if (mysql_num_rows($qry) > 0) { echo "\n"; if ($size == 1) echo "\t\n"; while (list($value, $text, $description) = mysql_fetch_row($qry)) { $items++; echo "\t"; echo stripslashes($text); if ($description) echo " (".stripslashes($description).")"; echo "\n"; } echo ""; } else echo "No data for Listbox\n"; mysql_free_result($qry); } else echo "Listbox cannot be built because of an invalid SQL query."; return $items; } // end ListboxMatch > -Original Message- > From: Bobby Rahman [mailto:[EMAIL PROTECTED] > Sent: Thursday, April 03, 2003 5:34 PM > To: [EMAIL PROTECTED] > Subject: [PHP] RE: newbie Dynamic Drop down lists using mysql > > > > > > Hiya > > Im looking for any tutorials/snippets of code to show me how > to code a > dynamic drop down box/list in a php form. > > e.g a drop down menu of all current users (I assume this will need to > connect to mysql db and select all usernames from table user > and place in > the menu. > > here what I have so far > $connection = db_connect(); > $querystring = ("select username from user"); > $db_result = mysql_query($querystring); > > (if mysql_num_rows($db_result)) > { > while ($row = mysql_fetch_row($db_result)) >{ > print("$row[0]"); >} > } > else > { > print("No users created yet"); > } > > > ?> > > Any URLS will be much appreciated. > > Thanks > > Bob > > _ > Express yourself with cool emoticons http://www.msn.co.uk/messenger > > > -- > 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] Found a bug in 4.2.3 re: and echo vs.
Here, try this bullshit... I can't upgrade to a more recent version as I'm not in control of the server, but I've tried it with both 4.1.2 and 4.2.3 on linux with a RH install. Can anyone confirm or dispute this bug exists in later versions? How does a parsing error like this go un-noticed for so long? Obviously I took out all the interesting stuff in the page and so that can't be blamed. This is about as bare skeleton test case as you can get. *sigh* snip "; } function alarmLightMySQL() { echo alarmLightYMD(); } ?> FUCKED UP PHP Bug #1234170238741023 PHP Version 4.1.2 PHP Version 4.2.3 Why the FUCK doesn't this work "; echo "".alarmLightMySQL().""; echo "this fails!"; echo ""; } ?> YET THIS DOES! this works snip "Ezekiel 25:17. The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he who in the name of charity and goodwill shepherds the weak through the valley of darkness, for he is TRULY his brother's keeper and the finder of lost children. And I will strike down upon thee with GREAT vengeance and FU-U-U-URIOUS anger, those who attempt to poison, and destroy my brothers! And you will KNOW my name is the Lord, when I lay my vengeance upon thee!" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Found a bug in 4.2.3 re: and echo vs.
Mmm. I'm still not following and not completely convinced. Changing "echo alarmLightYMD();" to simply "alarmLightYMD();" in the bottom function doesn't print anything in the table cell at all (for the first test case). While your idea at first makes sense and does seem like a newbie mistake (and you are correct, I do have nested "echo" statements come to think of it). What I don't get is why it's not consistent. "Expanding" the relevant lines, it should be like this: echo "".(echo "").""; Which fails, and the other line would be (which works): "); ?> In my book, they're both double echoing the output if you will... Are you with me on that? So again, why does the second one work and the first one doesn't? > -Original Message- > From: Philip Hallstrom [mailto:[EMAIL PROTECTED] > Sent: Friday, April 04, 2003 5:20 PM > To: Daevid Vincent > Cc: [EMAIL PROTECTED] > Subject: [PHP] Re: Found a bug in 4.2.3 re: and echo vs. > > > It's a coding error... at least I think so. > > change alarmLightMySQL just return the results not "echo" > them... echoing > them doesn't make much sense inside another echo statement... > > On Fri, 4 Apr 2003, Daevid Vincent wrote: > > > Here, try this bullshit... > > > > I can't upgrade to a more recent version as I'm not in > control of the > > server, but I've tried it with both 4.1.2 and 4.2.3 on > linux with a RH > > install. Can anyone confirm or dispute this bug exists in > later versions? > > > > How does a parsing error like this go un-noticed for so long? > > > > Obviously I took out all the interesting stuff in the page > and so that can't > > be blamed. This is about as bare skeleton test case as you can get. > > > > *sigh* > > > > snip > > > > > function alarmLightYMD() > > { > > return ""; > > } > > > > function alarmLightMySQL() > > { > > echo alarmLightYMD(); > > } > > ?> > > > > > > FUCKED UP PHP Bug #1234170238741023 > > > > > > > > PHP Version 4.1.2 > > PHP Version 4.2.3 > > > > Why the FUCK doesn't this work > > > > > > > for ($i = 0; $i < 10; $i++ ) { > > echo ""; > > echo "".alarmLightMySQL().""; > > echo "this fails!"; > > echo ""; > > } > > ?> > > > > > > > > > > YET THIS DOES! > > > > > > > > > > > > this works > > > > > > > > > > > > > > snip > > > > > > > > "Ezekiel 25:17. The path of the righteous man is beset on > all sides by the > > inequities of the selfish and the tyranny of evil men. > Blessed is he who in > > the name of charity and goodwill shepherds the weak through > the valley of > > darkness, for he is TRULY his brother's keeper and the > finder of lost > > children. And I will strike down upon thee with GREAT vengeance and > > FU-U-U-URIOUS anger, those who attempt to poison, and > destroy my brothers! > > And you will KNOW my name is the Lord, when I lay my > vengeance upon thee!" > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Found a bug in 4.2.3 re: and echo vs. [solved]
HH! Now that makes perfect sense. Thank you Rasmus for that indepth reply and also the , vs . "trick" > -Original Message- > From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED] > Sent: Friday, April 04, 2003 10:11 PM > To: Daevid Vincent > Cc: [EMAIL PROTECTED] > Subject: RE: [PHP] Re: Found a bug in 4.2.3 re: and echo > vs. > > > You are getting completely mixed up. Simplifying your example: > > function foo() { echo "foo"; } > > $a = "".foo().""; > > Will you agree that this is bogus code? foo() is not going to return > anything, so the resulting value of $a is going to be "". > Correct? But while that assignment is happening the foo() > function echoes > something, so you will see "foo" in the output, but it has > nothing to do > with what ends up in $a. Nothing changes when you change the > code to be: > > function foo() { echo "foo"; } > > echo "".foo().""; > > The parser is going to build a string to be echoed since you used the > string concatenation operator (dot). While building that > string one of > the components happen to output something, so that something will get > output. Then the string that was built will be output. So > what you see > is: > > foo > > Perhaps it is clearer if we make the function return something: > > function foo() { echo "foo"; return "bar"; } > > echo "".foo().""; > > What do you think the output will be here? We build a string > out of the > components, but while building, foo() happens to echo "foo", then we > finish constructing the string and output the final string. > So the result > is: > >foobar > > As someone else pointed out, if you use commas here, things > change a bit: > > function foo() { echo "foo"; } > > echo "",foo(),""; > > The comma syntax for echo is basically a shortcut for executing echo > multiple times. The above is equivalent to writing: > > echo ""; > echo foo(); > echo ""; > > In this case things will be output in the correct order as we are no > concatenating a bunch of parts to make a single string before > echoing it > in this case. > > -Rasmus > > On Fri, 4 Apr 2003, Daevid Vincent wrote: > > > Mmm. I'm still not following and not completely convinced. > > > > Changing "echo alarmLightYMD();" to simply > "alarmLightYMD();" in the bottom > > function doesn't print anything in the table cell at all > (for the first test > > case). > > > > While your idea at first makes sense and does seem like a > newbie mistake > > (and you are correct, I do have nested "echo" statements > come to think of > > it). What I don't get is why it's not consistent. > "Expanding" the relevant > > lines, it should be like this: > > > > echo "".(echo "").""; > > > > Which fails, and the other line would be (which works): > > > > "); ?> > > > > In my book, they're both double echoing the output if you > will... Are you > > with me on that? > > > > So again, why does the second one work and the first one doesn't? > > > > > -Original Message- > > > From: Philip Hallstrom [mailto:[EMAIL PROTECTED] > > > Sent: Friday, April 04, 2003 5:20 PM > > > To: Daevid Vincent > > > Cc: [EMAIL PROTECTED] > > > Subject: [PHP] Re: Found a bug in 4.2.3 re: and echo > vs. > > > > > > > > > It's a coding error... at least I think so. > > > > > > change alarmLightMySQL just return the results not "echo" > > > them... echoing > > > them doesn't make much sense inside another echo statement... > > > > > > On Fri, 4 Apr 2003, Daevid Vincent wrote: > > > > > > > Here, try this bullshit... > > > > > > > > I can't upgrade to a more recent version as I'm not in > > > control of the > > > > server, but I've tried it with both 4.1.2 and 4.2.3 on > > > linux with a RH > > > > install. Can anyone confirm or dispute this bug exists in > > > later versions? > > > > > > > > How does a parsing error like this go un-noticed for so long? > > > > > > > &g
RE: [PHP] RE: newbie alternate row colours in dynamic table
Wow you guys are going about that way more complicated than it needs to be: $i = 0; echo ""; Then it just alternates and takes care of itself (plus you get a nice little index counter as well as a bonus if you want to use $i DÆVID. "A good friend will come and bail you out of jail...but a true friend will be sitting next to you in the holding cell, laughing and saying -'That was fucking awesome!'" > -Original Message- > From: Bobby Rahman [mailto:[EMAIL PROTECTED] > Sent: Saturday, April 05, 2003 2:09 PM > To: [EMAIL PROTECTED]; [EMAIL PROTECTED] > Subject: Re: [PHP] RE: newbie alternate row colours in dynamic table > > > > > Hiya people > > After a lot of soul searching, exploring the web and help > from many people I > came up with this simple solution: > > Thank you Chris for explaining the toggle $colorset. In the > end I decided > this made life alot simplier. > > (clearly the brackets have to be correctly aligned) > > while( $row = mysql_fetch_array($db_result) ) > { > echo(" > > " . $row['bugid'] . " > > "); > if ( !isset($c) ) > { > $c = "bgcolor=#FF"; > echo $c; > } > else > { > unset($c); > } > } > > > > > >From: Chris Hayes <[EMAIL PROTECTED]> > >To: [EMAIL PROTECTED] > >Subject: Re: [PHP] RE: newbie alternate row colours in dynamic table > >Date: Sat, 05 Apr 2003 22:32:17 +0200 > > > >At 22:14 5-4-2003, you wrote: > > > > > >>Hiya I have a dynamic table and am trying to get the rows to be two > >>different alternate colours. well Ive looked at a couple of > snippets of > >>this colour code and previous mails regarding this. Im having major > >>troubles intergrating any of these suggestions with my > code. Can anyone > >>suggest where I am going wrong. Main problems are > >>1. where to put the loop for changing the colour > (complicated due to the > >>loop retrieving data from db)i.e in the do loopin the > while loop? > >Within the loop that prints the rows, whcih is usually a > while loop. But > >that depends on your preferences. > > > > > >>2. Also how to echo my rows in the colours.(something like > this I think) > >>print ""$db_fetch['bugid']; ?>; > >> > >> > >>e.g here is the code snippet for alternate coloured rows > >>$trcolor="#F0F8FF"; > >>while ($myrow = mysql_fetch_array($result)){ > >>$colorset=0; > >>if ($trcolor=='#F0F8FF'){ > >>$trcolor='#B0C4DE'; > >>$colorset=1; > >>} > >>if ($colorset==0){ > >>if ($trcolor=='#B0C4DE'){ > >>$trcolor='#F0F8FF';} > >>} > >>print ""; > >>} > >I see that you are using a helping variable $colorset. > >I have a problem reading your code in email, as i do not see > hte indents > >well, so i restructure it here with _ underscores to make > the indents > >survive the email program. > > > > > >$trcolor="#F0F8FF"; //1 > > > >while ($myrow = mysql_fetch_array($result)) > >{ > >___$colorset=0; > >___if ($trcolor=='#F0F8FF')//1 > >___{$trcolor='#B0C4DE'; //2 > >$colorset=1; > >___} > > > >___if ($colorset==0) > >___{ if ($trcolor=='#B0C4DE') //2 > >__{$trcolor='#F0F8FF'; //1 > >__} > >___} > > > >print ""; > >} > > > >Lets walk through. > >In the 1st walk, > >1a) you enter with color#1 and colorset=0. > >2b) the first 'if' then sets it to color#2 and colorset=1 > >3c) The second if sees that both conditions are true and set > the color back > >to color#1. > > > >So the first row prints color1. > > > >Ok. The code remembers the values, which are color#1 and colorset1. > >In the next walkthrough, > >2a) the colorset is set to 0 to start with. > >At this moment you have the exact situation as with 1a). > > > >do you see that? it would be much easier to see what is > happening if you > >would have only colorset toggling its value and just before > printing, > >decide what the color is as a result of the value of colorset. > >Give it a try! > > > >Basically: > > > >$colorset=0; > > > >while () > >{ toggle collorset (toggle: if 1 then 0 and opposite) > > if colorser=0 color=ff else color=a > > print color. > >} > > > >Chris Hayes > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >-- > >PHP General Mailing List (http://www.php.net/) > >To unsubscribe, visit: http://www.php.net/unsub.php > > > > > _ > Surf together with new Shared Browsing > http://join.msn.com/?page=features/browse&pgmarket=en-gb&XAPID > =74&DI=1059 > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] RE: newbie alternate row colours in dynamic table -- timed tests
I had to know... ;-) Output: version one:0.56761503219604 seconds version two:0.3099730014801 seconds version three: 0.36320495605469 secondss So the boolean (V2)is faster: Mine is slightly slower by a 'smidge' (0.06 seconds) Top one is cleanest but slower. --- test --- \n"; $time_start = getmicrotime(); $tf = TRUE; for ($i = 1; $i < $ITERATIONS; $i++) { $tf=!$tf; ($tf) ? "'C7D0E2" : "E3E8F0"; } $time_end = getmicrotime(); $time2 = $time_end - $time_start; echo "version two: \t$time2 seconds\n"; $time_start = getmicrotime(); $r = 0; for ($i = 1; $i < $ITERATIONS; $i++) { (($r++ % 2 == 0) ? "'C7D0E2" : "E3E8F0"); } $time_end = getmicrotime(); $time3 = $time_end - $time_start; echo "version three: \t$time3 seconds\n"; ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Timing test of the parser... Makes no difference
It seems that it makes almost no difference if you switch in and out of the parser or stay within it... Does this seem like a fair test? Having said that, I would suggest always using the first method as it's much cleaner to read and color coding works in most editors. -- output --- version one:0.098537087440491 seconds version two:0.096035003662109 seconds --- test --- blah version one: \t$time1 seconds\n"; echo "version two: \t$time2 seconds\n"; ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to secure a download ?
Hello, Is there any way to launch a download of a Zip file to the user without a link. The user must not know where the file is on the server. The transfert of the file must be made by a php file with special headers, no ? header("Content-type: zip"); or something... Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Downloading a file.
Hello, To download a file after a form like that: Do you want to download? If he wants to download, in the file downloadit.php, there is: header("Content-type: application/octet-stream\n"); header("Content-Disposition: attachment; filename=mysoft-1.0-truc.zip"); header('Cache-Control: public'); header("Content-transfer-encoding: binary\n"); header("Content-length: " . filesize($path) . "\n"); $fp=fopen($path, "r"); fpassthru($fp); But, with IE, it saves the file with [] as: mysoft-1.0[1]-truc.zip And with Netscape 7.x, it saves the file with the .php extension: mysoft-1.0-truc.zip.php Does anyone know what to do to make it saved as: mysoft-1.0-truc.zip And I would like to display a page telling "Thanks for download" or something...but if I had to the end: header("Location: http://www.mywebsite.com/thanks.html";) ; I does not work :( Does anyone know how change the location and is there is anyway to know if the download has been perfomed 'till the end... Thanks, Vincent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] need config file parsing code.
I am writing an open source web page that I can't believe doesn't exist already. basically i want to see all the DHCP clients on my network AND their nice windows names -- that is the tricky part -- I can't find a tool that does that part. GRRR... Anyways, here is what I have so far if you want to see it: http://daevid.com/examples/dhcp/index.php To match up the names however I need to parse the /var/lib/dhcp/dhcp.leases file and map the "client-hostname" tag to the proper MAC address. So my question is, does anyone have some code (PHP preferred obviously, but any language should work or be portable) that will take a file of the form below and split it into the chunks required. Or anything even close? For example, a 'chunk' would be between the { and } . I'm sure I can figure this out, but before I go re-inventing the wheel, thought someone might have done this already to some degree. lease 192.168.1.3 { starts 1 2003/06/16 07:38:55; ends 1 2003/06/16 07:48:55; binding state active; next binding state free; hardware ethernet 00:80:45:31:d8:29; } lease 192.168.1.6 { starts 1 2003/06/16 07:39:27; ends 1 2003/06/16 07:49:27; binding state active; next binding state free; hardware ethernet 48:54:e8:26:23:38; uid "\001HT\350"; client-hostname "jme"; } when the script is finished I'll post it up for anyone to use on their own servers... by the way, does anyone know why "arp -n" (what i'm using) shows machines that are NOT even turned on? like my notebook shows up despite having been off for several hours? Is there a way to get a real time list of the machines on my network? I thought that's what arp did, but apparently not. :( d
RE: [PHP] need config file parsing code.
Off the top of your head huh? Damn... That's some code you churned out there. Just glanced through it, but I'm impressed you took that much time! Thanks! I'll clean it up and give it a go. d > -Original Message- > From: Lars Torben Wilson [mailto:[EMAIL PROTECTED] > Sent: Monday, June 16, 2003 2:45 AM > To: Daevid Vincent > Cc: 'PHP-General' > Subject: Re: [PHP] need config file parsing code. > > > On Mon, 2003-06-16 at 01:14, Daevid Vincent wrote: > > So my question is, does anyone have some code (PHP > preferred obviously, > > but any language should work or be portable) that will take > a file of > > the form below and split it into the chunks required. Or > anything even > > close? For example, a 'chunk' would be between the { and } > . I'm sure I > > can figure this out, but before I go re-inventing the wheel, thought > > someone might have done this already to some degree. > > > > lease 192.168.1.3 { > > starts 1 2003/06/16 07:38:55; > > ends 1 2003/06/16 07:48:55; > > binding state active; > > next binding state free; > > hardware ethernet 00:80:45:31:d8:29; > > } > > lease 192.168.1.6 { > > starts 1 2003/06/16 07:39:27; > > ends 1 2003/06/16 07:49:27; > > binding state active; > > next binding state free; > > hardware ethernet 48:54:e8:26:23:38; > > uid "\001HT\350"; > > client-hostname "jme"; > > } > > I just banged this off the top of my head. Little error > checking but you > should be able to see where to add it. It should be tweakable > for what > you need, at least to get you going. > > error_reporting(E_ALL); > ini_set('display_errors', true); > > class LeaseParser { > // List designators valid within lease blocks here. > // Add/modify/remove to suit. > var $_valid_items = > array('starts 1', > 'ends 1', > 'binding state active', > 'next binding state', > 'hardware ethernet', > 'uid', > 'client-hostname'); > > // Stores any errors we generate during the run. Theses can be > output > // directly by calling showErrors(); > var $_errors; > > // Storage for the contents of the lease file while it's being > working on. > var $_file_contents; > > // Stores the parsed lease array. > var $_leases; > > // Put any options you want to define in here, and use setOption() > to modify > // it. > var $_options = > array('file_name' => ''); > > > // Private method. Attempts to load the leases file. > function _loadFile() { > if (!$fp = fopen($this->_options['file_name'], 'r')) { > $this->_errors[] = "LeaseParser::_loadFile(): > Failed to load > {$this->_options['file_name']}"; > return false; > } > > if (!$file = fread($fp, > filesize($this->_options['file_name']))) > { > $this->_errors[] = "LeaseParser::_loadFile(): > Failed to read > {$this->_options['file_name']}"; > return false; > } > > $this->_file_contents =& $file; > > return true; > } > > > // Private method. Attempts to parse the loaded file > contents into a > usable format. > function _parseFile() { > if (empty($this->_file_contents)) { > $this->_errors[] = "LeaseParser::_parseFile(): No leases > file data to parse."; > return false; > } > > $f_temp = explode('}', $this->_file_contents); > > $leases = array(); > > foreach ($f_temp as $lease_record) { > // echo ""; > // print_r($lease_record); > if (!preg_match('/^\s*lease > (([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3}))/i', > $lease_record, $lease_matches)) { > continue; > } > // echo "{$lease_matches[1]}\n"; > $leases[$lease_matches[1]] = array(); > $working_lease =& $leases[$lease_matches[1]]; > foreach ($this->_valid_items as $valid_item) { > $matches = array(); > $pattern = "/ *({$valid_item}) (.*)\n/i"; > // echo "Checking for $valid_item; $pattern\n"; >
[PHP] preg_replace problem
Hi, I am having this problem with preg_replace. I want the following thing but I can't understand what regular expression I should put. I want to replace all occurences of a given **whole** word into a string. For example: I want "A dog jumped over a ladder" to become "A dog jumped over a ladder". I **don't** want: "A dog jumped over a ladder" to become "A dog jumped over a ladder". You understand what I mean? I can't do that will str_replace, but I know it would be quite easy with preg_replace. Can someone help me? Thanks Vincent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How do I get the exit code of an external program?
I wish to use Ping to test if some IP addresses are up... Now I could run the command and parse to find various string components like this: [EMAIL PROTECTED] bin]# ping -n -c 3 -w 2 -q 192.168.1.60 PING 192.168.1.60 (192.168.1.60) from 192.168.1.1 : 56(84) bytes of data. --- 192.168.1.60 ping statistics --- 2 packets transmitted, 0 received, 100% loss, time 1012ms [EMAIL PROTECTED] bin]# ping -n -c 3 -w 2 -q 192.168.1.4 PING 192.168.1.4 (192.168.1.4) from 192.168.1.1 : 56(84) bytes of data. --- 192.168.1.4 ping statistics --- 2 packets transmitted, 2 received, 0% loss, time 999ms rtt min/avg/max/mdev = 0.322/0.340/0.358/0.018 ms but it would be much more efficient if I could just use the built in exit codes that 'ping' provides as per 'man ping': "If ping does not receive any reply packets at all it will exit with code 1. If a packet count and deadline are both specified, and fewer than count packets are received by the time the deadline has arrived, it will also exit with code 1. On other error it exits with code 2. Otherwise it exits with code 0. This makes it possible to use the exit code to see if a host is alive or not." So it seems to me there needs to be another PHP function like exec(), shell(), etc. that is the equivillent of the php exit() function but for external programs. One that simply returns the integer exit code of an executed shell program... http://daevid.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
FW: [PHP] How do I get the exit code of an external program?
-Original Message- From: Daevid Vincent [mailto:[EMAIL PROTECTED] Sent: Sunday, June 22, 2003 8:05 PM To: 'Don Read' Subject: RE: [PHP] How do I get the exit code of an external program? > -Original Message- > From: Don Read [mailto:[EMAIL PROTECTED] > Sent: Sunday, June 22, 2003 7:58 PM > To: Daevid Vincent > Cc: PHP Lists > Subject: Re: [PHP] How do I get the exit code of an external program? > > > > On 23-Jun-2003 Daevid Vincent wrote: > > I wish to use Ping to test if some IP addresses are up... > Now I could run > > the command and parse to find various string components like this: > > > > > > > > So it seems to me there needs to be another PHP function > like exec(), > > shell(), etc. that is the equivillent of the php exit() > function but for > > external programs. One that simply returns the integer exit > code of an > > executed shell program... > > > > > > exec(), system(), & popen()/pclose() will return exit code. > > The manual is your friend. http://us3.php.net/manual/en/function.exec.php string exec ( string command [, array output [, int return_var]]) exec() executes the given command, however it does not output anything. It simply returns the last line from the result of the command. However, you are correct in that there is the optional parameter that I've never used before. Thanks for pointing that out... http://us3.php.net/manual/en/function.system.php string system ( string command [, int return_var]) system() is just like the C version of the function in that it executes the given command and outputs the result. If a variable is provided as the second argument, then the return status code of the executed command will be written to this variable. The problem is that system want's to dump the output to the screen!!! I need a command that will allow me to execute/system the command "silently" and then *I* can do something based upon the exit code... function active_nMap() { $test = exec("/usr/bin/nmap -sP ".$this->IP); if ( strstr($test,"1 host up") ) $this->active = true; else $this->active = false; return $this->active; } function active_ping() { $test = `ping -n -c 1 -w 1 -q $this->IP`; if ( strstr($test,"100% loss") ) $this->active = false; else $this->active = true; return $this->active; } function active_ping_exit() { //http://us3.php.net/manual/en/function.system.php $test = system("ping -n -c 1 -w 1 -q $this->IP", $code); if ( $code == 0 ) $this->active = true; else $this->active = false; return $this->active; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] DHCP client web page
Okay, my dhcp client web page is pretty much done... http://daevid.com/examples/dhcp/ The .tgz file is linked at the bottom if you want it. This was also an extreme amount of work just to simply see the active leases and 'client-hostname' associated with an IP/MAC?! Seems to me there should have been a tool included with dhcpd that does this at the command line. *sigh* Much thanks to Lars Torben Wilson for the dhcpd.leases parser. - What I don't understand is why my dhcpd.leases file doesn't have an entry for my notebook (10.10.10.69) yet I specifically put this entry in /etc/dhcpd.conf host orinoco.daevid.com { hardware ethernet 00:02:2D:3C:7C:FB; fixed-address 10.10.10.69; } So I do get assigned the IP and everything works from a network standpoint, but why doesn't the /var/lib/dhcp/dhcpd.leases file have an entry that should look something like: lease 10.10.10.69 { starts 1 2003/06/23 08:40:11; ends 1 2003/06/23 08:50:11; binding state active; next binding state free; hardware ethernet 00:02:2D:3C:7C:FB; client-hostname "locutus"; } Yet I don't. :( In fact, it seems that ANY devices that I assign an IP using the MAC (such as TiVo, Replay, other servers), don't have entries in the dhcpd.leases file?! Why is that? Is this a bug or by design? I'm running a RedHat 8.0 system with the following RPMs: dhcpcd-1.3.22pl1-7 dhcp-3.0pl1-26 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] free web host needed.
On a 'non sarcastic' note... Perhaps the original poster should just set up their own linux box and run it off their home cable/dsl line. I've been doing it for years and it works wonderfully. I'm even now a free-node on the Seattlewireless.net network for people in the hood who need a quick bit-fix (the amount of bandwidth they consume in the 1 hour or less they squat is negligible and I encourage all of you to open your wifi nodes up (with a good firewall ruleset of course)). I digress... I host several virtual domains/hosts for various friends of mine for free. So, it's not unheard of that you could find or ask someone to host you. When I started out in 1995, my local ISP liked my domain name (I used to own "TheMatrix.com" which was the name of my recording studio and hosted me for free). You can also look around in your community. Fe. The bay area has some free hosting solutions that are funded by the state for non-profit orgs. So, say you set up a "Coping with Fibromyalgia" website, they will give you the space and host you. This has carried up here to Seattle as well. Anyways, if you're looking for a free host, then you prolly aren't doing a site with that much traffic. If you start to make money with your site, then you'll have the funds to pay a real ISP. http://daevid.com > -Original Message- > From: Jerry M. Howell II [mailto:[EMAIL PROTECTED] > Sent: Tuesday, June 24, 2003 7:31 AM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Expensive WEB HOST NEEDED! > > > > > -Original Message- > > > From: Jay Blanchard [mailto:[EMAIL PROTECTED] > > > Sent: 24 June 2003 13:20 > > > To: Denis 'Alpheus' Cahuk; [EMAIL PROTECTED] > > > > > > [snip] > > > Like I said, I need a web host. > > > It MUST support PHP, mySQl and sending emails, optional. > > > It shouldn't have any ads (pop-ups, ads), but I will > allow if it has > > > watermarks (SMALL! watermarks). > > > It should be TOTALY FREE! > > > [/snip] > You must be kidding. You probably will find one that supports > one or two > of these features for free but anyplace thats free will probably have > banners and mabe even watermarks. Most anyone can probably > send you to a > cheep place as prices have droped since I started but what your asking > is for someone not to make a living? Kinda unreasonable. > Anyways, I try > and avoid these threads as they waste mucho bandwith but here I am :) > > -- > Jerry M. Howell II > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP script in C SHELL
Do this: snip- #!/bin/php(or wherevery you have the php executable binary stored) >8)&0xFF; } ?> snip- chmod 755 myfile.php Then just execute "myfile.php" as any other program. > -Original Message- > From: Marcos [mailto:[EMAIL PROTECTED] > Sent: Wednesday, June 25, 2003 6:18 AM > To: [EMAIL PROTECTED] > Subject: [PHP] PHP script in C SHELL > > > I need to execute the archive php below in the server Apache, but I > perceived that I obtain the waited result if I use csh (C > shell) and not > using bash, somebody could say me as to execute this script in csh? > > $pipe = "$username\n$password\n"; > $pwauth = "/usr/local/apache/bin/pwauth"; > if($cmd = popen ($pwauth, "w")) { > fwrite($cmd, $pipe); > $status=(pclose($cmd)>>8)&0xFF; > } > > Thank's > > Marcos > [EMAIL PROTECTED] > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.491 / Virus Database: 290 - Release Date: 18/06/03 > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Forms
Additionally, you could put this in a header file or the top of your page: reset ($_GET); while (list ($key, $val) = each ($_GET)) { //echo "$key => $val\n"; $$key = $val; } reset ($_POST); while (list ($key, $val) = each ($_POST)) { //echo "$key => $val\n"; $$key = $val; } reset ($_SESSION); while (list ($key, $val) = each ($_SESSION)) { //echo "$key => $val\n"; $$key = $val; } So you can leave register_globals = off and get mostly the same functionality (and security issues if you're worried about them too). > -Original Message- > From: Petre Agenbag [mailto:[EMAIL PROTECTED] > Sent: Monday, June 30, 2003 7:14 AM > To: Simon Chappell > Cc: [EMAIL PROTECTED] > Subject: Re: [PHP] Forms > > > Have you checked register_globals = on/off in your php.ini? > If register_globals=off, then you must access your POST variables by: > > $_POST['whatever']; > > and your get (the stuff you put at the end of your URL's): > > $_GET['whatever']; > > > On Mon, 2003-06-30 at 15:48, Simon Chappell wrote: > > Hi can anyone help me with this? > > > > I have been failing to get any forms working with PHP now I > have run out of > > ideas? Having bought 3 books the latest one being php & mysql for > > dummies(which might be appropriate for me) I am still > failing at this hurdle. > > > > the following script is a classic example taken straight > out of the book, I > > get round the $PHP_SELF problem ok but then all the script > does is loop back > > to itself? > > > > > > > > > > SQL Query Sender > > > > > > > $user="root"; > > $host="localhost"; > > $password=""; > > > > /* Section that executes query */ > > if (@$form == "yes") > > { > >mysql_connect($host,$user,$password); > >mysql_select_db($database); > >$query = stripSlashes($query) ; > >$result = mysql_query($query); > >echo "Database Selected: $database > > Query: $query > > Results > > "; > >if ($result == 0) > > echo("Error " . mysql_errno() . ": " . > mysql_error() . ""); > > > >elseif (@mysql_num_rows($result) == 0) > > echo("Query completed. No results returned."); > >else > >{ > > echo " > > > > "; > > for ($i = 0; $i < mysql_num_fields($result); $i++) > > { > > echo("" . mysql_field_name($result,$i) > . ""); > > } > > echo " > > > >"; > > for ($i = 0; $i < mysql_num_rows($result); $i++) > > { > > echo ""; > > $row = mysql_fetch_row($result); > > for ($j = 0; $j < mysql_num_fields($result); $j++) > > { > > echo("" . $row[$j] . ""); > > } > > echo ""; > > } > > echo " > > "; > >} > >echo " > > > > > > > >value=\"New Query\"> > >value=\"Edit Query\"> > > "; > >unset($form); > >exit(); > > } > > > > /* Section that requests user input of query */ > > @$query = stripSlashes($query); > > if (@$queryButton != "Edit Query") > > { > >$database = " "; > >$query = " "; > > } > > ?> > > > > ?form=yes method="post"> > > > > > >Type in database name > > > > $database ?> > > > > > > > > >Type in SQL query > > echo $query > > ?> > > > > > > > > value="Submit > > Query"> > > > > > > > > > > > > > > > > Any ideas would be greatly appreciated as I am floundering badly! > > > > Simon > > > > > -- > 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] Apache 2 support broken?
With php 4.2.2 I get this when trying to compile with apache 2 support: Making all in apache2filter /bin/sh /usr/local/download/apache/php-4.2.2/libtool --silent --mode=compile gcc -I. -I/usr/local/download/apache/php-4.2.2/sapi/apache2filter -I/usr/local/download/apache/php-4.2.2/main -I/usr/local/download/apache/php-4.2.2 -I/usr/site/include -I/usr/local/download/apache/php-4.2.2/Zend -I/usr/local/include -I/usr/local/pgsql/include -I/usr/local/download/apache/php-4.2.2/ext/xml/expat -D_REENTRANT -D_THREAD_SAFE -I/usr/local/download/apache/php-4.2.2/TSRM -I/usr/local/include/pth -g -O2 -pthread -DZTS -prefer-pic -c php_functions.c php_functions.c:93: syntax error *** Error code 1 Stop in /usr/local/download/apache/php-4.2.2/sapi/apache2filter. *** Error code 1 Stop in /usr/local/download/apache/php-4.2.2/sapi/apache2filter. *** Error code 1 Stop in /usr/local/download/apache/php-4.2.2/sapi. *** Error code 1 I grabbed a CVS version of PHP and during configure it lets me know that I need apache 2.0.40 -- since the latest release of Apache 2 is 2.0.39 I'm not sure what to do there.. Does that mean the latest apache 2 devel source? Someone toss me a clue stick please! -Mitch -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Credit Card Validation With Expiration Date
> I'm looking for an algorithm or a free PHP Script which enable me > to verify > expiration date with a credit card number. > > Does anybody knows this ? It doesn't existcredit card number alogrithms do not use the expiry date in their formulas (at least I'm not aware of any that are). Also there is no way to actually check if a credit card is valid without using a company that keeps an online database of active credit cards. The most you can do is verify that the number provided could potentially be a credit card...and even then the expiry date has no algorithm attached to it...as long as it is past the present date there's no way to consider it invalid without cross-referencing against a database of active cards. Sincerely, Craig Vincent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Need help with Apache and .htaccess vs. directive. -- SOLVED
Tim, you are my father! That was it. That stupid trailing /* Making it: instead of: worked > -Original Message- > From: Tim [mailto:[EMAIL PROTECTED]] > Sent: Thursday, August 08, 2002 11:36 PM > > > What if you remove the /* from the directory-path in the > directive? If > /home/epiller/public_html/vrexhibits/* doesn't match > /home/epiller/public_html/vrexhibits that would explain why > it didn't work in the .htaccess file (because the > AllowOverride wouldn't be > applied) and why the directive didn't apply. Just a guess. > > - Tim > > > -Original Message- > > On Thu, Aug 08, 2002 at 06:16:03AM -0700, Daevid Vincent wrote: > > > > I'm baffled. Using the example I found here: > > http://www.devarticles.com/content.php?articleId=143&page=3 > > > > I have a working site here: > > http://daevid.com/examples/vrexhibits/vrbooth > > > > There is a .htaccess file in the vrexhibits directory that contains: > > > > ForceType application/x-httpd-php > > > > And of course the PHP file named "vrbooth" in the same dir as > > illustrated above. > > > > Now... > > > > I'm trying to have a virtual host of the same site basically here > > (this is running on the SAME server!): > > > > http://www.vrexhibits.com/vrbooth > > > > Why doesn't that page show up correctly. It is speweing out > the source > > code instead. If I rename the page to vrbooth.phtml and reload, it > > works fine, but of course, that isn't what I want/need. > > > > I had the same .htaccess file and everything. Then I tried > it without > > the .htaccess and moving the directive into the VirtualHost > > section (for security as well), but still it spews out > code. Ugh. What > > am I missing here? It is as if the .htaccess file was totally being > > ignored and it's also being ignored or over-ridden in here too > > somehow. > > > > > > DocumentRoot /home/epiller/public_html/vrexhibits > > ServerName VRExhibits.com > > ServerAlias www.VRExhibits.com *.VRExhibits.* > > User epiller > > Group epiller > > > > Options All +Includes > > AllowOverride All > > Order allow,deny > > Allow from all > > > > ForceType application/x-httpd-php > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Help needed about queries with MySQL, thanks.
> I have a MySQL database (called "sessions") with a auto-increment > INT field called "sessionID". I try to check if there is already > a record in this database with a given sessionID, which is called > $sessionID in PHP. I use this query, which must be wrong (but I > cannot find out why !!!) : > >SELECT * FROM sessions WHERE sessionID = $sessionID Although this may or may not help depending on your code (please post it if you still haven't found a solution...it's the best way for us to help. Try SELECT * FROM sessions WHERE sessionID = '$sessionID' Although if $sessionID contains an integer (which I assume is would) the quotes aren't needed, you never know. Some OSes are quirky. Also you may want to add an echo mysql_error(); line after your initial mysql_query to see if perhaps there's a problem with PHP communicating with MySQL. Sincerely, Craig Vincent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php