[PHP] PHP 4.4.7RC1 Release
The first release candidate of PHP 4.4.7 is now available for download here: http://downloads.php.net/derick/php-4.4.7RC1.tar.bz2 (2ff585134f85fa992af7d953e4645810) http://downloads.php.net/derick/php-4.4.7RC1.tar.gz (72c25db4e65ae8a985914472403a5f83) The focus or this release is twofold, number of we are continuing to stabilize the language. The second goal was to improve the security of the language through an internal audit as well as by addressing previously unknown bugs identified by MOPB. As you can imagine both these goals result in a rather extensive set of changes, so testing to make sure no new bugs or regressions were introduced is critical. Therefore I would like to ask everyone, over the next few weeks to give this RC a shot with your code base to ensure there are no problems. I want to make 4.4.7 go out as soon as possible given the security improvements that it brings, with the next RC slated at just over 2 weeks from today (April 26th) and the final in early May. If you come across any problems feel free to identify them by replying to this e-mail or creating a bug report on http://bugs.php.net. Derick Rethans -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about OO design
# [EMAIL PROTECTED] / 2007-04-09 15:29:01 -0700: (I'm dealing with PHP4.) class User { var id; var name; var email; var balance; var accrual; var is_manager; function User($user_id) { $this-id = $user_id; $this-name = get_name(); // ... $this-accrual = get_accrual(); } function get_name() { // get name from db $sql = ...; $db = DB::singleton(); $db-execute($sql); } That static call on DB makes User tightly coupled to DB. This class won't work without the other. Aggravated by the multiple calls. Jochem cut the number down to 1 by doing the work in the constructor, but that doesn't remove the dependency, just makes it easier to remove eventually. The usual technique is to pass the database connection to the constructor: class User { function User($data_source, $user_id) { $this-ds = $data_source; $this-id = $user_id; $this-_fetch_data(); } var $ds, $id; function _fetch_data() { $this-ds-execute(...); } } Now, the User class is completely independent of the DB class. You can use User with any other class that has the same interface as DB. Of course, the more abstraction you provide, the more versatility you get, so you definitely don't want to have any SQL embedded in the business logic or classes as generic as User. I'll leave the issue of abstracting away data acquisition as an exercise for the reader. What about the places where you instantiate the User class? You would now need to change every new User($id) to at least new User($dbconn, $id) You can (and should) solve that by encapsulating the User instantiation. The tight coupling problem applies to all classes, including User. The industry standard technique to solve this is to use a creation or factory method: class UserFactory { function UserFactory($dbconn) { $this-dbconn = $dbconn; } var $dbconn; function create($id) { return new User($this-dbconn, $id); } } $uf = new UserFactory($dbconn); ... $user = $uf-create($id); And to prevent creating multiple instances of a single user (but you're screwed in PHP anyway): # NOTE: not bothering with references at all class Users { function Users($factory) { $this-factory = $factory; } var $factory; var $users = array(); function get($id) { if (!isset($this-users[$id])) { $this-users[$id] = $this-factory-create($id); } return $this-users[$id]; } } $users = new Users($factory); ... $user = $users-get($id); The classes follow two simple principles: Don't Repeat Yourself and Single Responsibility Principle (DRY, SRP). Sticking to them yields tremendous benefits in my experience, as does No Hardwiring, Please. Recommended reading: Design Patterns, Gamma et al.; Test-Driven Development by Example, Beck; Patterns of Enterprise Application Architecture, Fowler, C++ User's Journal archives. Also, did I mention that Singleton has turned a bit sour since its publication in Design Patterns, and is now considered an antipattern? Quoting one of the authors of the book: : It is a bad sign that the only pattern you mentioned was Singleton. : This shows you don't understand how to construct GUIs very well. : Singleton is a weak pattern, and whenever people start with : Singleton, it is a sign of a bad design. : : -Ralph Johnson -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: 0x9f54
how do you do string comparison in utf-8? say the user entered a chinese string the browser and you need to search for the string in the MySQL table using PHP. -- .~. Might, Courage, Vision, SINCERITY. http://www.linux-sxs.org / v \ Simplicity is Beauty! May the Force and Farce be with you! /( _ )\ (Ubuntu 6.10) Linux 2.6.20.6 ^ ^ 19:46:01 up 4 days 2:37 0 users load average: 1.00 1.00 1.00 news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Evaluating strings...
= is for assigment == is for typeless comparison (meaning 1 will be equal to '1', '' will be equal to 0) === is for type comparision (meaning 1 will only be equal to 1, '' will only be equal to '', and TRUE will only be equal to true) -- itoctopus - http://www.itoctopus.com Anthony J. Maske [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hey, Thanks for the quick response on Retrieving parameters... This is another that has me stumped... if (trim($Line) = 'body') { $InBody = true; } elseif (trim($Line) = '/body') { $InBody = false; } $Line is a line from a html file, I'm trying to parse through it to ignore everything but the body section. When I run the above I get the following... Fatal error: Can't use function return value in write context in C:\wwwRoot\anthony.maske\cfr.php on line 43 If I do this... $Tag = trim($Line); if ($Tag = 'body') { $InBody = true; } elseif ($Tag = '/body') { $InBody = false; } Why won't the later work? What am I missing in the first snip... Thanks again...! Anthony -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Retrieving parameters passed from .html...?
yup, $_GET to get stuff from the URL $_POST to get stuff from the form $_SESSION to get stuff from the session $_FILES in case you have files in your form, they will be stored here -- itoctopus - http://www.itoctopus.com Anthony J. Maske [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] See... the second I sent this I took a sip of red-bull and my brain cleared up... $topicID = $_GET['showtopic']; Right? Anthony J. Maske [EMAIL PROTECTED] http://home.comcast.net/~ajmaske -Original Message- From: Anthony J. Maske [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 10, 2007 8:33 PM To: PHP General Subject: [PHP] Retrieving parameters passed from .html...? Hey all, My first post here..., new to php and so far doing great picking it up... but, tonight I'm having a brain fart... How do you pick up (read) the parameters passed into a php script from an html file? Given... http://somewhere/dosomething.php?showtopic=9 How do you read or get the value showtopic and the value of 9? I know this is simple but I'm pulling my hair out here... Thanks! Anthony -- 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] MD5 bot Question
At 7:50 PM -0500 4/10/07, Richard Lynch wrote: On Sun, April 8, 2007 11:12 am, tedd wrote: chose from. Unless, there is something here that I don't understand (which very well could be), I can't see how anyone, without massive computer resources, could break that. Am I wrong? You are wrong. The Tijnema! solution of memorizing every single image would fail. Then I'm right, because that's what I was saying. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Retrieving parameters passed from .html...?
itoctopus wrote: yup, $_GET to get stuff from the URL $_POST to get stuff from the form $_SESSION to get stuff from the session $_FILES in case you have files in your form, they will be stored here and $_REQUEST to get $_GET, $_POST, and $_COOKIE all in one -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Retrieving parameters passed from .html...?
clive wrote: itoctopus wrote: yup, $_GET to get stuff from the URL $_POST to get stuff from the form $_SESSION to get stuff from the session $_FILES in case you have files in your form, they will be stored here and $_REQUEST to get $_GET, $_POST, and $_COOKIE all in one If you're going to suggest things like that please explain the dangers. By using $_REQUEST you cannot be sure where a particular variable came from. This is less important with $_REQUEST than it was with register_globals, but it's still important to note for new users. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MD5 bot Question
At 8:11 PM -0500 4/10/07, Richard Lynch wrote: On Tue, April 10, 2007 7:47 am, tedd wrote: Your use of metaphor is quite colorful, but if you if change a single pixel in an image, then you change the MD5 signature -- that is what I was talking about -- and that is not wrong. Unless I look at enough images to figure out that you are just changing N random pixels, and I construct a distance function to compute how different image A is from image X, where I already know X points up http://php.net/imagecolorat can be used to do exactly this. In fact, I've done that to break a CAPTCHA that had random noise pixels added to the text. Actually, I was able to remove the noise first and then compute distance function for character by character analysis of the text on the image. I do not understand why you are obsessing on the MD5 crack when it's probably not the weapon that would be chosen, unless your CAPTCHA is so lame that it's susceptible to an MD5 crack... If it's not that lame, then the attacker just doesn't use an MD5 signature, and employs another technique. Have we not been through this whole thread enough times already? Apparently not enough times because, no offense, you missed the point. We are not talking about how one could break this type of captcha, we were talking about how this captcha could be broken by a MD5 method and what steps could be taken to make it unbreakable by that method. It was a learning exercise as to the scope and use of MD5. That's it -- that's all. See the subject line. If you want to talk about other ways to break this type of captcha, then pease do. I am sure that I could learn a lot from you -- and I expect to do so. But please don't infer that we are obsessing about a topic we are discussing; or that my work is lame when it was designed to test one point; or state that I'm wrong because you didn't understand what I said in context. That's not constructive nor right. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] downloading an image
tthe image does not display although it exists in the table 'images' This calls the download script ? $property_id = $_SESSION['property_id'] ; $query = SELECT * FROM images WHERE property_id='$property_id'; $result = mysql_query($query); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo $id= $row['id']; echo $title= $row['title']; $link = download.php?id=$id; } ? img src=?php echo $link; ?/ this is the download script id = $_GET['id']; $query = SELECT name, type, size, content FROM images WHERE id ='$id'; $result = mysql_query($query) or die(mysql_error()); list($name, $type, $size, $content) = mysql_fetch_array($result); header(Content-length: $size); header(Content-type: $type); echo $content; exit; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MD5 bot Question
At 7:52 PM -0500 4/10/07, Richard Lynch wrote: On Sun, April 8, 2007 11:26 am, tedd wrote: The way I figure it, in an image I have 72 dot per square inch -- so, in one square inch that's 5,184 places for me to store a 24 bit key. To me, that's a lot of places to hid my Easter egg -- is that not enough? No. If the egg is visible to a human, a computer program can be crafted to see the egg as well. Again. I am talking about MD5 and you're talking about something else. Please read. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MD5 bot Question
At 8:36 PM -0500 4/10/07, Richard Lynch wrote: With millions of different images and more being added, it presents a considerable challenge to crack. I think not... You only have to find 10,000 people who hate MS and give each of them 200 unique images to identify. Well actually, all one would need to do is to setup a asirra captcha and have people solve it. Then in the background tag which is cat/dog and store. I estimate that one could easily identify 12 images in 20 seconds, 36 per minute. As such, identification of two million pictures would take less than 1000 man hours. So you are right -- it's not the formidable problem I thought. FOr that matter, the images are coming from Petfinder, according to their blurb... How tough could it be to find the same bytes in an image in Petfinder and then detect the cat or dog tag on their website -- assuming they have categorized their Petfinder images by species/genus? Good point. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] downloading an image
[snip] tthe image does not display although it exists in the table 'images' [/snip] http://www.google.com/search?hl=enq=display+image+from+blob+PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Array remove function?
On 4/10/07, Richard Lynch [EMAIL PROTECTED] wrote: http://php.net/array_flip followed up an unset, followed by another array_flip, I guess... What if you have an array like this: Array ( [0] = Array ( [0] = 1 [1] = 2 [2] = 2 [3] = 2 [4] = 2 [5] = 4 ) [1] = 4 [2] = 2 [3] = 4 ) And i want to remove the 4, but i don't know 1 and 3. using array_flip wouldn't work because of my multi-dimensional array. But what if i'm using array_search? will it return 1 only? will it return 5? Why in the world you'd architect the array with a value when you need to unset by value in the first place is beyond me, though... Sometimes you end up with such arrays, where you need to have non-unique values first, so you store them in the value, and then you need to remove some of the non-unique values. But it's a multi-dimensional array... Tijnema On Tue, April 10, 2007 2:52 pm, Tijnema ! wrote: On 4/10/07, Richard Lynch [EMAIL PROTECTED] wrote: http://php.net/unset That works when you know the key, but will that work when you only know the value? Tijnema On Tue, April 10, 2007 2:49 pm, Tijnema ! wrote: Hi, Is there currently a function that removes a key/value from an array? I use this code right now: function array_remove($array,$remove,$remove_value = true) { foreach($array as $key = $value) { if($remove_value $value != $remove) { $new_array[$key] = $value; } elseif (!$remove_value $key != $remove) { $new_array[$key] = $value; } } return $new_array; } array_remove(array(1=2,2=3),2,true); // array (2=3) array_remove(array(1=2,2=3),2,false); // array (1=2) Anyone knows if there already exists such function? Else should i create future request? Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Retrieving parameters passed from .html...?
At 2:48 PM +0200 4/11/07, clive wrote: itoctopus wrote: yup, $_GET to get stuff from the URL $_POST to get stuff from the form $_SESSION to get stuff from the session $_FILES in case you have files in your form, they will be stored here and $_REQUEST to get $_GET, $_POST, and $_COOKIE all in one I wouldn't recommend using $_REQUEST -- it can be problematic in a couple of ways. 1) You don't know where the data came from; 2) One (GET or POST) takes precedence over the other -- I don't remember which at the moment. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Retrieving parameters passed from .html...?
tedd wrote: I wouldn't recommend using $_REQUEST -- it can be problematic in a couple of ways. 1) You don't know where the data came from; 2) One (GET or POST) takes precedence over the other -- I don't remember which at the moment. 2) It depends on your php.ini setting, specifically: variables_order = EGPCS E = Environment G = GET P = POST C = Cookie S = Built-in Variables The default php.ini will have POST over-write GET (as it goes from left to right, the new values (on the right) replacing those from the left) Cheers, Rich -- Zend Certified Engineer http://www.corephp.co.uk Never trust a computer you can't throw out of a window -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP editor
Hi all, I beleive this is in the realm of php (I have learned my lesson from last time). Does anyone have recomendation for any free (I.E. permanently free not 30 day trial) of a good php editor. The ones i am seeing all only allow usage for a limited time. Kind Regards Jonathan Kahan Systems Developer Estrin Technologies, inc. 1375 Broadway, 3rd Floor, New York, NY, 10018 Email: [EMAIL PROTECTED] Web: http://www.estrintech.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP editor
[snip] I beleive this is in the realm of php (I have learned my lesson from last time). Does anyone have recomendation for any free (I.E. permanently free not 30 day trial) of a good php editor. The ones i am seeing all only allow usage for a limited time. [/snip] Eclipse Notepad 2 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP editor
Check Out Easy Eclipse http://www.easyeclipse.org/site/home/ Quoting Jonathan Kahan [EMAIL PROTECTED]: Hi all, I beleive this is in the realm of php (I have learned my lesson from last time). Does anyone have recomendation for any free (I.E. permanently free not 30 day trial) of a good php editor. The ones i am seeing all only allow usage for a limited time. Kind Regards Jonathan Kahan Systems Developer Estrin Technologies, inc. 1375 Broadway, 3rd Floor, New York, NY, 10018 Email: [EMAIL PROTECTED] Web: http://www.estrintech.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] PHP editor
Jonathan Kahan wrote: Hi all, I beleive this is in the realm of php (I have learned my lesson from last time). Does anyone have recomendation for any free (I.E. permanently free not 30 day trial) of a good php editor. The ones i am seeing all only allow usage for a limited time. STFA, STFW, notepad, textpad, whateverpad. look what I find after googling for 5 seconds: http://www.php-editors.com/review/ *you* have to decide if you like an editor, nobody else can do it for you. this topic comes almost weekly and it's rather boring - go search and find *lots* of totally abitrary, rose-tinted opinions about what the best freaking editor is. Kind Regards Jonathan Kahan Systems Developer Estrin Technologies, inc. 1375 Broadway, 3rd Floor, New York, NY, 10018 Email: [EMAIL PROTECTED] Web: http://www.estrintech.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP editor
On Wed, 2007-04-11 at 10:12 -0400, Jonathan Kahan wrote: Hi all, I beleive this is in the realm of php (I have learned my lesson from last time). Does anyone have recomendation for any free (I.E. permanently free not 30 day trial) of a good php editor. The ones i am seeing all only allow usage for a limited time. You should really search the archives... but I personally recommend: joe ( http://sourceforge.net/projects/joe-editor/ ) Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: 0x9f54
OK, I've spent five minutes to try to understand what you're doing. There're something I don't understand: 1. You use dbase_open(/home/bt/canton.DBF,0); which seems that you open a database file directly. Well, I don't do like this. I use mysql_connect(localhost, username, some_password) but I suppose this isn't important or relevant. 2. You seem to read something from one table and reinject them into some other table. Am I correct? Anyway, since I don't have your data, I can't see or guess where the problem is. You know what, when you try to ask for help, it's always nice to just give the reduced and minimalistic test case. I mean, if you're launching a big trunk of code to others' face and hope they help, don't be disappointed that they can't help. We're all volunteers and we would just spend as less time as possible to help others. We're not supposed to spend a lot of time to solve your problem. So, tell us what didn't work. Make up a reduced case, eg reduce the table to just the problem column, show us the problem query. You know, on doing a reduced case, sometimes you are able to spot the problem yourself immediately. This is also the way you should learn if you're to become a real programmer: strict and organized. I've told you in a previous post but perhaps you didn't catch it. Try your query in MySQL Query Browser and see if you've got the same problem first. HTH Man-wai Chang wrote: Well, show us a part of your code. Do var_dump($value) before you enter it into the database, and see if it still says 0x9f54. The error: string(2) Duplicate entry '' for key 1 ? class MYSQL { private $fhandle; var $row; function MYSQL($host,$db,$usr,$pwd) { $this-fhandle=new mysqli($host,$usr,$pwd,$db) or die(mysqli_error($this-fhandle)); $this-query(set names 'big5'); } function query($sql_str) { $this-row=mysqli_query($this-fhandle, $sql_str) or die(mysqli_error($this-fhandle)); } function affected_rows() { return mysqli_affected_rows($this-row); } function num_rows() { return mysqli_num_rows($this-row); } function fetch_assoc() { return mysqli_fetch_assoc($this-row); } function __destruct() { mysqli_close($this-fhandle); } function begin_tran() { mysqli_autocommit($this-fhandle, FALSE); } function commit() { mysqli_commit($this-fhandle); mysqli_autocommit($this-fhandle, TRUE); } function rollback() { mysqli_rollback($this-fhandle); mysqli_autocommit($this-fhandle, TRUE); } } function showcode($cChar) { return [.dechex(ord(substr($cChar,0,1)))...dechex(ord(substr($cChar,1,1))).]; } $target=new MYSQL(localhost,testing,root,testing); $fhandle=dbase_open(/home/bt/canton.DBF,0); if ($fhandle) { $reccount=dbase_numrecords($fhandle); echo input count: .$reccount.\n; $target-query(show tables like 'canton';); if ($target-num_rows()0) $target-query(drop table canton); $target-query( create table canton ( . big5 char(2) not null, . thekey char(6), . canton char(10), . changjei char(10), . touched integer, . primary key (big5) . ) character set big5; ); for ($ii=1; $ii=$reccount; $ii++) { $row=dbase_get_record_with_names($fhandle,$ii); $ss=$row['BIG5']; echo var_dump($ss); $target-query(select * from canton where big5='.$ss.'); $yy = $target-num_rows(); if ($yy0) { $query=update canton set touched= . $row[TOUCHED] . where big5=' . $ss . ';; } else { $query=insert into canton ( . big5, . thekey, . changjei, . canton, . touched . ) values ( . '$ss', . '.$row[THEKEY].', . '.$row[CHANGJEI].', . '.$row[CANTON].', . $row[TOUCHED] . );; } $result=$target-query($query); if (! $target-row) echo showcode($ss); } $result=$target-query(select count(*) as cnt from canton); $yy
[PHP] Re: downloading an image
Verify that your $type is a correct mime type. Ross wrote: tthe image does not display although it exists in the table 'images' This calls the download script ? $property_id = $_SESSION['property_id'] ; $query = SELECT * FROM images WHERE property_id='$property_id'; $result = mysql_query($query); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo $id= $row['id']; echo $title= $row['title']; $link = download.php?id=$id; } ? img src=?php echo $link; ?/ this is the download script id = $_GET['id']; $query = SELECT name, type, size, content FROM images WHERE id ='$id'; $result = mysql_query($query) or die(mysql_error()); list($name, $type, $size, $content) = mysql_fetch_array($result); header(Content-length: $size); header(Content-type: $type); echo $content; exit; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: downloading an image
yes it is image/jpeg Roberto Mansfield [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Verify that your $type is a correct mime type. Ross wrote: tthe image does not display although it exists in the table 'images' This calls the download script ? $property_id = $_SESSION['property_id'] ; $query = SELECT * FROM images WHERE property_id='$property_id'; $result = mysql_query($query); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo $id= $row['id']; echo $title= $row['title']; $link = download.php?id=$id; } ? img src=?php echo $link; ?/ this is the download script id = $_GET['id']; $query = SELECT name, type, size, content FROM images WHERE id ='$id'; $result = mysql_query($query) or die(mysql_error()); list($name, $type, $size, $content) = mysql_fetch_array($result); header(Content-length: $size); header(Content-type: $type); echo $content; exit; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] UPDATE and redirect
Hi all, I'm new to this list and new to php programming so sorry if I do something wrong here :) Ok, now to my problem. I've created a query to update a mysql db, and it isn't working, and it's not throwing me any errors, so I need some help to figure out what's wrong here. My code follows : ? if($_GET['act'] = 'a'){ $action = 1; } else if ($_GET['act'] = 'd'){ $action = 0; } $id = $_GET['id']; mysql_connect(localhost,,) or die (mysql_error()); mysql_select_db (taiomara_emailList); $email_Query = mysql_query(UPDATE 'tb_emails' SET 'bol_active' = $action WHERE `auto_id` = $id); mysql_close(); ? The page is executed, but it don't update the table ... I've tried with the '' and without it ( the phpmyadmin page is where I got the idea of using the '' ). Any clues ? Also, how can I make a redirect after the query has run ? TIA Marcelo Wolfgang -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP editor
You could always opt to use emacs or vi. Jonathan Kahan [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi all, I beleive this is in the realm of php (I have learned my lesson from last time). Does anyone have recomendation for any free (I.E. permanently free not 30 day trial) of a good php editor. The ones i am seeing all only allow usage for a limited time. Kind Regards Jonathan Kahan Systems Developer Estrin Technologies, inc. 1375 Broadway, 3rd Floor, New York, NY, 10018 Email: [EMAIL PROTECTED] Web: http://www.estrintech.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] UPDATE and redirect
marcelo Wolfgang wrote: Hi all, I'm new to this list and new to php programming so sorry if I do something wrong here :) Ok, now to my problem. I've created a query to update a mysql db, and it isn't working, and it's not throwing me any errors, so I need some help to figure out what's wrong here. My code follows : ? if($_GET['act'] = 'a'){ $action = 1; } else if ($_GET['act'] = 'd'){ $action = 0; } $id = $_GET['id']; mysql_connect(localhost,,) or die (mysql_error()); mysql_select_db (taiomara_emailList); $email_Query = mysql_query(UPDATE 'tb_emails' SET 'bol_active' = $action WHERE `auto_id` = $id); I think you want to use back ticks for the table and column names, not single quotes. (On my keyboard this is to the left of the '1' key) Another good idea when having query problems is to put the query into its own variable and echo it out.. like: $sql = UPDATE `tb_emails` SET `bol_active` = $action WHERE `auto_id` = $id; echo $sqlbr/\n; mysql_close(); ? The page is executed, but it don't update the table ... I've tried with the '' and without it ( the phpmyadmin page is where I got the idea of using the '' ). Any clues ? Also, how can I make a redirect after the query has run ? TIA Marcelo Wolfgang -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] UPDATE and redirect
marcelo Wolfgang skrev: Hi all, I'm new to this list and new to php programming so sorry if I do something wrong here :) Ok, now to my problem. I've created a query to update a mysql db, and it isn't working, and it's not throwing me any errors, so I need some help to figure out what's wrong here. My code follows : ? if($_GET['act'] = 'a'){ $action = 1; } else if ($_GET['act'] = 'd'){ $action = 0; } Don't use =, use == (or in some cases ===). = is for assignment. Also, what if $_GET['act'] is neither 'a' or 'd'? $id = $_GET['id']; Again, what if $_GET['id'] is null? mysql_connect(localhost,,) or die (mysql_error()); mysql_select_db (taiomara_emailList); $email_Query = mysql_query(UPDATE 'tb_emails' SET 'bol_active' = $action WHERE `auto_id` = $id); Use backticks if you think you need them In this case you don't $sql = UPDATE `tb_emails` SET `bol_active` = $action WHERE `auto_id` = $id; echo DEBUG: $sql; $email_Query = mysql_query( $sql ); This is how to get the error: if ( !$email_Query ) echo mysql_error(); mysql_close(); ? The page is executed, but it don't update the table ... I've tried with the '' and without it ( the phpmyadmin page is where I got the idea of using the '' ). Any clues ? Also, how can I make a redirect after the query has run ? header(Location: http://www.foobar.com;); Will work as long as you don't print out any output whatsoever to the browser before this line of code. TIA Marcelo Wolfgang /T -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] downloading an image
Ross wrote: tthe image does not display although it exists in the table 'images' This calls the download script ? $property_id = $_SESSION['property_id'] ; $query = SELECT * FROM images WHERE property_id='$property_id'; $result = mysql_query($query); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo $id= $row['id']; echo $title= $row['title']; $link = download.php?id=$id; } what do you see when you stick the src url in the address bar of your browser? and what response headers do you get from the download.php? ? img src=?php echo $link; ?/ this is the download script id = $_GET['id']; $id = $_GET['id']; ^ | \- missing $ ??? and then your not doing any input cleaning: if (!isset($_GET['id']) || (($id = intval($_GET['id'])) 1)) die('eat and die'); $query = SELECT name, type, size, content FROM images WHERE id ='$id'; $result = mysql_query($query) or die(mysql_error()); list($name, $type, $size, $content) = mysql_fetch_array($result); header(Content-length: $size); header(Content-type: $type); echo $content; and does $content actually contain image data? exit; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHp Install problems on debian linux
Hi all am having issues with a little problem regarding php5 installation on a debian linux machine. while trying to install php5 and supported modules I get the following error messages, what can i do to get rid of them and continue with the installation ? The following packages have unmet dependencies: libapache2-mod-php5: Depends: libc6 (= 2.3.2.ds1-21) but 2.3.2.ds1-18 is to be installed Depends: libxml2 (= 2.6.16) but 2.6.11-5 is to be installed php5-cli: Depends: libc6 (= 2.3.2.ds1-21) but 2.3.2.ds1-18 is to be installed Depends: libxml2 (= 2.6.16) but 2.6.11-5 is to be installed php5-curl: Depends: libc6 (= 2.3.2.ds1-21) but 2.3.2.ds1-18 is to be installed Depends: libcurl3 (= 7.13.1-1) but it is not installable Depends: libidn11 (= 0.5.13) but it is not installable php5-dev: Depends: autoconf but it is not installable Depends: automake1.4 but it is not installable Depends: libssl-dev but it is not installable Depends: libtool but it is not installable Depends: shtool but it is not installable php5-gd: Depends: libc6 (= 2.3.2.ds1-21) but 2.3.2.ds1-18 is to be installed Depends: libgd2-xpm (= 2.0.33) but 2.0.28-3 is to be installed Depends: libpng12-0 (= 1.2.8rel) but 1.2.5.0-7 is to be installed php5-imap: Depends: libc6 (= 2.3.2.ds1-21) but 2.3.2.ds1-18 is to be installed php5-ldap: Depends: libc6 (= 2.3.2.ds1-21) but 2.3.2.ds1-18 is to be installed php5-mhash: Depends: libc6 (= 2.3.2.ds1-21) but 2.3.2.ds1-18 is to be installed Depends: libmhash2 but it is not going to be installed php5-mysql: Depends: libc6 (= 2.3.2.ds1-21) but 2.3.2.ds1-18 is to be installed php5-odbc: Depends: libc6 (= 2.3.2.ds1-21) but 2.3.2.ds1-18 is to be installed Depends: unixodbc but it is not installable php5-xsl: Depends: libc6 (= 2.3.2.ds1-21) but 2.3.2.ds1-18 is to be installed Depends: libxml2 (= 2.6.16) but 2.6.11-5 is to be installed Depends: libxslt1.1 (= 1.1.12) but 1.1.8-5 is to be installed E: Broken packages - Never miss an email again! Yahoo! Toolbar alerts you the instant new Mail arrives. Check it out.
Re: [PHP] UPDATE and redirect
Hi, It's fixed, I think the problem where at the '==' ... I have to remember that in PHP this is like ActionScript. Also, what if $_GET['act'] is neither 'a' or 'd'? Again, what if $_GET['id'] is null? The only way to not be 'a' or 'd' or to be null is if someone mess with url, which should throw an error anyway and not run the query. The link that get me to this page where the code is executed is generated to have these options. Thanks for the reply's -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SQL Source Control
Hi all, I know a lot of you use various means for PHP source control (CVS, SVN, etc), which is all well and fine, but how do you manage source control on your databases? Say you've got an upgrade to a site, all of the new PHP files are controlled by SVN, so you can rollback at any time, but say the upgrade includes several key modifications to a MySQL table and perhaps the changing of some core data. How (if at all?!) do you handle the versioning of the database and data itself, so you can keep both PHP and SQL structure in sync? Cheers, Rich -- Zend Certified Engineer http://www.corephp.co.uk Never trust a computer you can't throw out of a window -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: SQL Source Control
Richard Davey wrote: Hi all, I know a lot of you use various means for PHP source control (CVS, SVN, etc), which is all well and fine, but how do you manage source control on your databases? Say you've got an upgrade to a site, all of the new PHP files are controlled by SVN, so you can rollback at any time, but say the upgrade includes several key modifications to a MySQL table and perhaps the changing of some core data. How (if at all?!) do you handle the versioning of the database and data itself, so you can keep both PHP and SQL structure in sync? Yeah this is a weak point in my chain too! I keep database schema's in a file which can start with a blank db and create all the tables allowing for modifications and updates etc. over time with new deployments. But if something breaks... rolling back is well. a pain I could use a backup file and MySQL binary logs to replay to the point prior to deployment/update if the world depended on it, but this would take several hours to do and so I really wouldn't say I relied on this method.. it's more disaster recovery! Any suggestions in this area would be interesting. Col -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: 0x9f54
Man-wai Chang wrote: how do you do string comparison in utf-8? say the user entered a chinese string the browser and you need to search for the string in the MySQL table using PHP. How? Of course in the usual PHP way! (Be warned that we're getting more and more off-topic. This is a PHP forum!) You have to make sure that the following conditions be true: 1. Your database tables are using utf8, at least the column in question. I've noticed that while I use VCHAR(n) as the data type, you simply use CHAR(n) (seen in your test.php.txt file). I'm not MySQL expert, so I don't know the difference between them. Concretely, you're creating a table like this: CREATE TABLE `t1` ( `name` varchar(45) character set utf8 NOT NULL default '', ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; 2. Everywhere in PHP, you're using UTF-8 to assure a consistency. Avoid making conversion to and from Big5, you'll get yourself trapped sooner or later. 3. In HTML, make sure that you've specified UTF-8 in HTTP header as well as in HTML header. 4. Getting data: the encoding in a URI is implicit, and some stupid/old browser doesn't know how to handle correctly utf-8. So, I'd suggest you to use POST instead of GET to avoid problem in URI encoding. Once all these conditions are unified, you should be able to do something like: SELECT * FROM t1 where name like '%明%'; to search for all strings containing the character 明. As a side note, this query works perfectly even if your strings contains other non Chinese characters. My table t1 contains Gillian Joe, 小明, 陳大明 , François 阿偉 and Emily 明美. You have to make sure that you're communicating this character in UTF-8 instead of Big5 to MySQL. Normally, if you have specified the charset in PHP, it's automatic. Good luck. -- * Zoner PhotoStudio 8 - Your Photos perfect, shared, organised! www.zoner.com/zps You can download your free version. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP editor
On Apr 11, 2007, at 9:17 AM, Jochem Maas wrote: Jonathan Kahan wrote: Hi all, I beleive this is in the realm of php (I have learned my lesson from last time). Does anyone have recomendation for any free (I.E. permanently free not 30 day trial) of a good php editor. The ones i am seeing all only allow usage for a limited time. STFA, STFW, notepad, textpad, whateverpad. look what I find after googling for 5 seconds: http://www.php-editors.com/review/ *you* have to decide if you like an editor, nobody else can do it for you. this topic comes almost weekly and it's rather boring - go search and find *lots* of totally abitrary, rose-tinted opinions about what the best freaking editor is. Obviously some people think this is NOT in the realm of php. Nonetheless, I think it's a relevant question and others have answered it well. It's up to you to decide which suits you best... and Google, can probably help you with that. For Mac (my main platform), I use TextMate, but it's not free. For PC, I use Crimson Editor, and it is free. Hope that helps. ~Philip Kind Regards Jonathan Kahan Systems Developer Estrin Technologies, inc. 1375 Broadway, 3rd Floor, New York, NY, 10018 Email: [EMAIL PROTECTED] Web: http://www.estrintech.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHp Install problems on debian linux
Despite the fact this question involves installing PHP5, it's actually a question about installing Debian packages. Maybe you should look into package managers for Debian. Personally I use dselect, and it usually auto selects any dependencies not already installed. PHP though, I install from source. Cheers, Rob. On Wed, 2007-04-11 at 08:08 -0700, Don Don wrote: Hi all am having issues with a little problem regarding php5 installation on a debian linux machine. while trying to install php5 and supported modules I get the following error messages, what can i do to get rid of them and continue with the installation ? The following packages have unmet dependencies: libapache2-mod-php5: Depends: libc6 (= 2.3.2.ds1-21) but 2.3.2.ds1-18 is to be installed Depends: libxml2 (= 2.6.16) but 2.6.11-5 is to be installed php5-cli: Depends: libc6 (= 2.3.2.ds1-21) but 2.3.2.ds1-18 is to be installed Depends: libxml2 (= 2.6.16) but 2.6.11-5 is to be installed php5-curl: Depends: libc6 (= 2.3.2.ds1-21) but 2.3.2.ds1-18 is to be installed Depends: libcurl3 (= 7.13.1-1) but it is not installable Depends: libidn11 (= 0.5.13) but it is not installable php5-dev: Depends: autoconf but it is not installable Depends: automake1.4 but it is not installable Depends: libssl-dev but it is not installable Depends: libtool but it is not installable Depends: shtool but it is not installable php5-gd: Depends: libc6 (= 2.3.2.ds1-21) but 2.3.2.ds1-18 is to be installed Depends: libgd2-xpm (= 2.0.33) but 2.0.28-3 is to be installed Depends: libpng12-0 (= 1.2.8rel) but 1.2.5.0-7 is to be installed php5-imap: Depends: libc6 (= 2.3.2.ds1-21) but 2.3.2.ds1-18 is to be installed php5-ldap: Depends: libc6 (= 2.3.2.ds1-21) but 2.3.2.ds1-18 is to be installed php5-mhash: Depends: libc6 (= 2.3.2.ds1-21) but 2.3.2.ds1-18 is to be installed Depends: libmhash2 but it is not going to be installed php5-mysql: Depends: libc6 (= 2.3.2.ds1-21) but 2.3.2.ds1-18 is to be installed php5-odbc: Depends: libc6 (= 2.3.2.ds1-21) but 2.3.2.ds1-18 is to be installed Depends: unixodbc but it is not installable php5-xsl: Depends: libc6 (= 2.3.2.ds1-21) but 2.3.2.ds1-18 is to be installed Depends: libxml2 (= 2.6.16) but 2.6.11-5 is to be installed Depends: libxslt1.1 (= 1.1.12) but 1.1.8-5 is to be installed E: Broken packages - Never miss an email again! Yahoo! Toolbar alerts you the instant new Mail arrives. Check it out. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP editor
Does Estrin Technologies, inc. provide its products free? All GOOD, worthwhile editors cost something. Personally, I use phpEdit. Jonathan Kahan wrote: Hi all, I beleive this is in the realm of php (I have learned my lesson from last time). Does anyone have recomendation for any free (I.E. permanently free not 30 day trial) of a good php editor. The ones i am seeing all only allow usage for a limited time. Kind Regards Jonathan Kahan Systems Developer Estrin Technologies, inc. 1375 Broadway, 3rd Floor, New York, NY, 10018 Email: [EMAIL PROTECTED] Web: http://www.estrintech.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP editor
On Wed, 2007-04-11 at 10:30 -0500, Philip Thompson wrote: Obviously some people think this is NOT in the realm of php. Nonetheless, I think it's a relevant question and others have answered it well. Relevant sure... but the answers are in the frickin' archives several times over. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dynamic web interface and size
On 4/11/07, Richard Lynch [EMAIL PROTECTED] wrote: 1000 pixels? Woof. Guess my 800x600 box is not in your market... 800x600 :| Using 1600x1200 here :) I like the idea,. because most sites are made for 800x600 and they are so small on my screen... Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP editor
On Apr 11, 2007, at 9:17 AM, Jochem Maas wrote: Jonathan Kahan wrote: Hi all, I beleive this is in the realm of php (I have learned my lesson from last time). Does anyone have recomendation for any free (I.E. permanently free not 30 day trial) of a good php editor. The ones i am seeing all only allow usage for a limited time. STFA, STFW, notepad, textpad, whateverpad. look what I find after googling for 5 seconds: http://www.php-editors.com/review/ *you* have to decide if you like an editor, nobody else can do it for you. this topic comes almost weekly and it's rather boring - go search and find *lots* of totally abitrary, rose-tinted opinions about what the best freaking editor is. Obviously some people think this is NOT in the realm of php. Nonetheless, I think it's a relevant question and others have answered it well. It's up to you to decide which suits you best... and Google, can probably help you with that. For Mac (my main platform), I use TextMate, but it's not free. For PC, I use Crimson Editor, and it is free. Hope that helps. ~Philip Kind Regards Jonathan Kahan Systems Developer Estrin Technologies, inc. 1375 Broadway, 3rd Floor, New York, NY, 10018 Email: [EMAIL PROTECTED] Web: http://www.estrintech.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php On both Win and Linux I use Zend Studio. Not free but it's worth every cent. Before I used HomeSite. Great tool too. If you use Linux Quanta+ is great tool too. Download EVERY editor you think and try it. What I like doesn't mean it's ok with you. Try even not free editors - it's worth testing, and you will find what do you really want from an editor. -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP editor
Robert Cummings wrote: On Wed, 2007-04-11 at 10:30 -0500, Philip Thompson wrote: Obviously some people think this is NOT in the realm of php. Nonetheless, I think it's a relevant question and others have answered it well. Relevant sure... but the answers are in the frickin' archives several times over. ditto. (hey let's frak not frick - as in 'do me one of those blond cylon chicks' ;-) Cheers, Rob. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL Source Control
Richard Davey wrote: Hi all, I know a lot of you use various means for PHP source control (CVS, SVN, etc), which is all well and fine, but how do you manage source control on your databases? Say you've got an upgrade to a site, all of the new PHP files are controlled by SVN, so you can rollback at any time, but say the upgrade includes several key modifications to a MySQL table and perhaps the changing of some core data. How (if at all?!) do you handle the versioning of the database and data itself, so you can keep both PHP and SQL structure in sync? lets forget that updating SQL schemas on massive DBs will likely take so much time that you will have to plan in downtime on the systems involved ... that's clearly out of the scope of this question. my strategy is also pretty weak in this regard but generally: I write my code in such a way that older code can run with newer db schemas, which basically means I add stuff but never remove it (tables, fields, etc) ... schema updates are always 'expansive'. If I'm feeling very tidy I'll create a seperate CVS module for the schema and updates/rollbacks. this involves writing sql files that update for each version of the project I have/will rollout ... and also sql files that perform the reverse/rollback actions between project versions. (when I'm being tidy I always do DB schema update when the major version number of a project changes) I end up with files named something like: v1-to-v2.sql v2-to-v3.sql v2-to-v1.sql v3-to-v2.sql then I include a script which I can call with the desired version number and it works out which sql files it needs to run and in which order (the current version is either stored in the DB or stored in a txt file outside of CVS) ... I have considered making this 'change version' script also automatically perform the required 'cvs up -r Foo' command on the actual project files but I have not got round to ever actually do it (time, money, inspiration, lackof) - maybe that brainfart inspires somewhat, then again maybe you'll pass out fom the smell :-) Cheers, Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Question on Portfoilo's
If you're working under an NDA or on code that doesn't belong to you, you'll most likely need to hit up the hobbiest side of programming to build your portfolio. Sit down, plan some app that would make your life easier (or someone else's), go through the design process, and then code it to implementation. It doesn't have to be perfect, but it has to be good enough to show off your abilities. It really doesn't matter if the app already exists, you're doing this simply for the sake of self improvement and to build your portfolio. That's where open source comes in nicely. You don't need to make it a full time job, but actively contributing to a project will allow you to say I played a good sized role in __. Matt Carlson [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] So i've been meaning to start a portfolio of some code, so that when I apply for a job, and they want code samples, I have something to show them. Unfortunately, at this time, most of my work is inside of a much larger application, or in code that belongs to my current employer (not a php job, just misc. things i've made). What kind of things do you guys have in your portfolio's/code samples that your provide to a potential employer? What things do you feel I should avoid when putting this kinda of thing together? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dynamic web interface and size
On Wed, 2007-04-11 at 17:44 +0200, Tijnema ! wrote: On 4/11/07, Richard Lynch [EMAIL PROTECTED] wrote: 1000 pixels? Woof. Guess my 800x600 box is not in your market... 800x600 :| Using 1600x1200 here :) I like the idea,. because most sites are made for 800x600 and they are so small on my screen... Get Opera, it has the cool zoom that Microsoft copied. I too use 1600x1200 res. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Bind IP with fsockopen
Thanks how would I handle the fgets line.. If I echo $sock I get resource ID #4 rather then the responce from the other computer. Before on my original script I returned the responce using fputs($fs, $domain\r\n); // send query $line = fgets($fs, 1024); // store reply echo $line; // output reply so far I have.. ?php $domain = 'internet.co.uk'; $sourceip = 'xx.xx.xx.xx'; // ip you want to bind to $sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); socket_bind($sock, $sourceip); socket_connect($sock, 'dac.nic.uk', 2043); // Write $request = $domain\r\n\n; // send request socket_write($sock, $request); // store reply echo $sock; //output reply?? socket_close($sock); // Close ? - Original Message - From: Richard Lynch [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, April 11, 2007 1:19 AM Subject: Re: [PHP] Bind IP with fsockopen fputs adds a newline, and you've got \r\n already, so your total output in the original is \r\n\n In the socket_bind one, you've got none of the \r\n stuff at all, much less \r\n\n On Tue, April 10, 2007 5:56 pm, [EMAIL PROTECTED] wrote: Im having trouble converting this snippet to use the bind_socket function. my original code is.. ? $domain = 'internet.co.uk'; $fs = fsockopen('dac.nic.uk', 2043, $errno, $errstr, 60); if (!$fs) { fclose($fs); } else { fputs($fs, $domain\r\n); $line = fgets($fs, 1024); echo $line; } ? I think im getting stuck on the fputs bit.. I have this which does not work.. ?php $domain = 'internet.co.uk'; $sourceip = 'xx.xx.xx.xx'; // ip you want to bind to $sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); socket_bind($sock, $sourceip); socket_connect($sock, 'dac.nic.uk', 2043); // Write $request = $domain\r\n; socket_write($sock, $request); //Read reply // Close socket_close($sock); ? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Bind IP with fsockopen
On 4/11/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Thanks how would I handle the fgets line.. http://www.php.net/socket_read If I echo $sock I get resource ID #4 rather then the responce from the other computer. Before on my original script I returned the responce using fputs($fs, $domain\r\n); // send query $line = fgets($fs, 1024); // store reply echo $line; // output reply so far I have.. ?php $domain = 'internet.co.uk'; $sourceip = 'xx.xx.xx.xx'; // ip you want to bind to $sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); socket_bind($sock, $sourceip); socket_connect($sock, 'dac.nic.uk', 2043); // Write $request = $domain\r\n\n; // send request socket_write($sock, $request); // store reply echo $sock; //output reply?? socket_close($sock); // Close ? - Original Message - From: Richard Lynch [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, April 11, 2007 1:19 AM Subject: Re: [PHP] Bind IP with fsockopen fputs adds a newline, and you've got \r\n already, so your total output in the original is \r\n\n In the socket_bind one, you've got none of the \r\n stuff at all, much less \r\n\n On Tue, April 10, 2007 5:56 pm, [EMAIL PROTECTED] wrote: Im having trouble converting this snippet to use the bind_socket function. my original code is.. ? $domain = 'internet.co.uk'; $fs = fsockopen('dac.nic.uk', 2043, $errno, $errstr, 60); if (!$fs) { fclose($fs); } else { fputs($fs, $domain\r\n); $line = fgets($fs, 1024); echo $line; } ? I think im getting stuck on the fputs bit.. I have this which does not work.. ?php $domain = 'internet.co.uk'; $sourceip = 'xx.xx.xx.xx'; // ip you want to bind to $sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); socket_bind($sock, $sourceip); socket_connect($sock, 'dac.nic.uk', 2043); // Write $request = $domain\r\n; socket_write($sock, $request); //Read reply // Close socket_close($sock); ? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- 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] Posting a variable
Hi, I am trying to pass a variable into a textfield and then pass the variable onto a php page for insertion into a Mysql database. However, I want to send the username of the person logging on. But instead php is taking the username of the logon information of the database. Which I obviously don't want for many obvious reasons. Oddly enough it echo's $username02 so it shouldn't be a pass down issue. But when the insert.php I also ask it to echo and it doesn't. Any suggestions? ?php require(config.php); $sql = SELECT `username`, `password` FROM `user_system`; $result = mysql_query($sql); $check = mysql_fetch_assoc($result); $username_to_check = mysql_real_escape_string($_POST['username']); $password_to_check = md5($_POST['password']); $username02 = mysql_real_escape_string($_POST['username']); if ($check['username'] != $username_to_check || $check['password'] != $password_to_check) { echo The username or password was wrong!; } else { echo 'The username and password was correct! form name=Your turn method=post action=insert.php table width=750 border=0 align=right cellpadding=0 cellspacing=0 tr td input name=username type=text value= $username02 /td /tr tr td width=372Question 1 /td td width=378div align=center select name=select1 size=1 option value=1Yes I strongly agree/option option value=2Yes I agree /option option value=3I disagree/option option value=4I strongly disagree/option /select /div /td /tr tr td height=87nbsp;/td tddiv align=center input type=submit name=Your turn /div /td /tr /table /form '; echo $username; echo $username02; } ? - The best gets better. See why everyone is raving about the All-new Yahoo! Mail.
Re: [PHP] Bind IP with fsockopen
Thanks Tijnema $line = trim(socket_read($sock, 1024)); was what I was after. Thanks - Original Message - From: Tijnema ! [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Wednesday, April 11, 2007 5:09 PM Subject: Re: [PHP] Bind IP with fsockopen On 4/11/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Thanks how would I handle the fgets line.. http://www.php.net/socket_read If I echo $sock I get resource ID #4 rather then the responce from the other computer. Before on my original script I returned the responce using fputs($fs, $domain\r\n); // send query $line = fgets($fs, 1024); // store reply echo $line; // output reply so far I have.. ?php $domain = 'internet.co.uk'; $sourceip = 'xx.xx.xx.xx'; // ip you want to bind to $sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); socket_bind($sock, $sourceip); socket_connect($sock, 'dac.nic.uk', 2043); // Write $request = $domain\r\n\n; // send request socket_write($sock, $request); // store reply echo $sock; //output reply?? socket_close($sock); // Close ? - Original Message - From: Richard Lynch [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, April 11, 2007 1:19 AM Subject: Re: [PHP] Bind IP with fsockopen fputs adds a newline, and you've got \r\n already, so your total output in the original is \r\n\n In the socket_bind one, you've got none of the \r\n stuff at all, much less \r\n\n On Tue, April 10, 2007 5:56 pm, [EMAIL PROTECTED] wrote: Im having trouble converting this snippet to use the bind_socket function. my original code is.. ? $domain = 'internet.co.uk'; $fs = fsockopen('dac.nic.uk', 2043, $errno, $errstr, 60); if (!$fs) { fclose($fs); } else { fputs($fs, $domain\r\n); $line = fgets($fs, 1024); echo $line; } ? I think im getting stuck on the fputs bit.. I have this which does not work.. ?php $domain = 'internet.co.uk'; $sourceip = 'xx.xx.xx.xx'; // ip you want to bind to $sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); socket_bind($sock, $sourceip); socket_connect($sock, 'dac.nic.uk', 2043); // Write $request = $domain\r\n; socket_write($sock, $request); //Read reply // Close socket_close($sock); ? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- 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] SQL Source Control
Jochem Maas wrote: lets forget that updating SQL schemas on massive DBs will likely take so much time that you will have to plan in downtime on the systems involved ... that's clearly out of the scope of this question. Yes, this was part of the problem (and reason for my original post). At the moment I'm dealing with a 2GB SQL database, with hundreds of modifications per minute. Rolling out new features always requires that we take the site down anyway, just so we can stablise the changes coming in and back-up the database. But this is more disaster recovery than version control, and doesn't get around a problem such as: running with a site upgrade (which expands an existing set of tables), taking new valid data from users into that new schema, plus into older un-touched tables, then needing to rollback for whatever reason - we're left with a horrendous 'merge' issue. I'm surprised (or rather, I'm unaware of) there is no native MySQL solution for this situation. Perhaps that's left to the bigger boys? Or maybe it's the main 'weak area' of most web developers :) - maybe that brainfart inspires somewhat, then again maybe you'll pass out fom the smell :-) It did actually. I'm thinking that perhaps I tag all data with the *version* of the site in which it was created. And tag schema updates in a similar way as you suggested. Still.. am amazed nothing more 'standard' exists. Cheers, Rich -- Zend Certified Engineer http://www.corephp.co.uk Never trust a computer you can't throw out of a window -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Design Dilemma - Database Data Abstraction
2007/4/10, Richard Lynch [EMAIL PROTECTED]: On Sat, April 7, 2007 11:49 am, Martin Alterisio wrote: The solution I presented is to access, and act upon, a database as if they were PHP arrays, meaning that a table is presented as an array of records. I don't quite get why you think this is any more fool-proof than using a database in the first place, but okay, I guess... It's not intended to be fool-proof, and I never said so. I said those-who-never-RTFM-proof, maybe some of those are fools, but many of those have not received the proper preparation in computer sciences, and maybe it's not their fault they can't read a manual meant for us coders to read. Anyway, if there is already an API that allows us to create objects that look and act like PHP arrays, why don't just use that API for something like an ORM? My dilemma is as follows: a PHP array is a construct more restricted than a DB table. In a PHP array the index is either an int or a string, in a table de index can be any combination of fields. Then, my problem is how to design coherently the indexing of the arrays that represent the DB tables. I could index by the order as they are presented by the DB: You have not specified any ORDER BY for the DB so far. Why should I impose an order if the implementation may want to decide this order. By definition, then, the order is UNDEFINED and the DB is free to return the result set in ANY order it finds convenient. And that's okay, and I shall use the order the DB finds convenient. $DB['users'][0] is the first user from the query SELECT * FROM users $DB['users'][1] is the second user from the query SELECT * FROM users etc.. But this have many cons. First, without a deterministic order, the array can change its logic order on the whim of the DB, nobody assures that the order will be kept after a modification is made to the data, and this can be confusing and error prone: Until you define an ORDER BY in the DB, there is no order, period. If the DB presents the result sequentially there is an order, even if it follows an undefined criteria. If you *DO* define an ORDER BY in the DB, you'll have to be able to write a PHP function which can duplicate that ORDER BY and http://php.net/usort the array, or dis-allow changes to the array that introduce new keys, and disallow using integer keys. Why? I just let the DB manage the order. To use usort I'll have to actually put the results in a real array, wasting memory, cpu time, and db access. $name1 = $DB['users'][3]['name']; $name2 = $DB['users'][5]['name']; $DB['users'][3]['name'] = $name2; $DB['users'][5]['name'] = $name1; The last sentence may not be writing to the adequate record. What's wrong here? For example, if the current order for the 'users' table is by the 'name' field, after the first write this order may have changed, then the record we'll be trying to write next won't be the one we intended to. If 5 isn't 5, then you are screwed from the get-go... That's why I don't like this indexing criteria. Another possible indexation could be by the value of the PK, but this also have some problems. First, it can be confusing if the PK is an autonumeric int, as this might be seen as a numeric indexation. Second, not all tables have only one field as PK (I can ask that all tables have at least a PK, but I can't ask that the PK is made of only one field). Exposing an auto_increment field to anything above the DB layer is almost always a Bad Idea (tm). Why? Or, what do you mean by exposing the auto_increment field? Show me one site that doesn't expose the value of this field (when needed) in the url. $user = $DB['users'][$userid]; // get $DB['users'][$userid] = $user; // update or insert $DB['users'][] = $userid; // insert unset($DB['users'][$userid]); // delete I think you will find that detecting the array changes and pushing them back down to the DB will be much more difficult than just providing an API to a database in some kind of normalized functions... That's the easy part, I'll just use the SPL interfaces. Sorry, I forgot to mention this in my first email as I explained in the following emails. There is also the problem with many-to-many relationships. If there was only one table that related two tables in this way, I could do the following: Well, yeah... You are going to have to have at least 2 if not 3 arrays to do that with any efficiency at all... Hey. Would you think I'll even propose this here if I didn't think I could guarantee at least the same efficiency as other ORMs? $DB['users'][$userid]['groups'] - groups where the user belongs $DB['groups'][$groupid]['users'] - the users of a group There would be a third table other than users and groups which doesn't show up. But, what to do when there is more than one relationship table for the same two tables? And if the relationship table also had some extra fields? You can't just call everything
Re: [PHP] Posting a variable
1- your mysql query statement is better to have a WHERE part too. 2- I would use mysql_fetch_row instead of mysql_fetch_assoc 3- in your form, you're using a single quote. anything in between single quotes will be printed as is. you need to close your single quote and print username and open another single quote. Like this: '...' . $username02 . '.' Or I personally would close my php, print the form in html and use ?php echo $username02; ? where you need the username. And then I would start another ? php section if I need it. Siavash Quoting Zhimmy Kanata [EMAIL PROTECTED]: Hi, I am trying to pass a variable into a textfield and then pass the variable onto a php page for insertion into a Mysql database. However, I want to send the username of the person logging on. But instead php is taking the username of the logon information of the database. Which I obviously don't want for many obvious reasons. Oddly enough it echo's $username02 so it shouldn't be a pass down issue. But when the insert.php I also ask it to echo and it doesn't. Any suggestions? ?php require(config.php); $sql = SELECT `username`, `password` FROM `user_system`; $result = mysql_query($sql); $check = mysql_fetch_assoc($result); $username_to_check = mysql_real_escape_string($_POST['username']); $password_to_check = md5($_POST['password']); $username02 = mysql_real_escape_string($_POST['username']); if ($check['username'] != $username_to_check || $check['password'] != $password_to_check) { echo The username or password was wrong!; } else { echo 'The username and password was correct! form name=Your turn method=post action=insert.php table width=750 border=0 align=right cellpadding=0 cellspacing=0 tr td input name=username type=text value= $username02 /td /tr tr td width=372Question 1 /td td width=378div align=center select name=select1 size=1 option value=1Yes I strongly agree/option option value=2Yes I agree /option option value=3I disagree/option option value=4I strongly disagree/option /select /div /td /tr tr td height=87nbsp;/td tddiv align=center input type=submit name=Your turn /div /td /tr /table /form '; echo $username; echo $username02; } ? - The best gets better. See why everyone is raving about the All-new Yahoo! Mail. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Posting a variable
On Wed, 2007-04-11 at 09:59 -0700, [EMAIL PROTECTED] wrote: 1- your mysql query statement is better to have a WHERE part too. 2- I would use mysql_fetch_row instead of mysql_fetch_assoc Ummm, why would you want to reduce clarity and maintainability by using mysql_fetch_row()? Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Design Dilemma - Database Data Abstraction
# [EMAIL PROTECTED] / 2007-04-09 19:45:41 -0300: Thanks but that's not what I'm looking for. As I said before, my problem isn't to find an implementation of an ORM, but that the concept I'm working on will use a very restricted API (array operations), and I'm having trouble to keep it coherent. Yeah, it's a bad idea, and doesn't work. Besides, what's with those funky ['s and ]'s? What are they for? I didn't bother to RTFM. -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Posting a variable
Quoting Robert Cummings [EMAIL PROTECTED]: On Wed, 2007-04-11 at 09:59 -0700, [EMAIL PROTECTED] wrote: 1- your mysql query statement is better to have a WHERE part too. 2- I would use mysql_fetch_row instead of mysql_fetch_assoc Ummm, why would you want to reduce clarity and maintainability by using mysql_fetch_row()? hmmm, I just remember in my php class a while back, my teacher didn't even bother teaching us about mysql_fetch_assoc, and when a student asked about it, he said don't bother using it, just use mysql_fetch_row so I ended up using this function ever since. I'm guessing he was wrong?? Thanks, Siavash Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- 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] Posting a variable
Robert Cummings wrote: On Wed, 2007-04-11 at 09:59 -0700, [EMAIL PROTECTED] wrote: 1- your mysql query statement is better to have a WHERE part too. 2- I would use mysql_fetch_row instead of mysql_fetch_assoc Ummm, why would you want to reduce clarity and maintainability by using mysql_fetch_row()? job protection ;-) Cheers, Rob. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] output gz compression
I am just curious if anybody else has this issue. My platform is OSX 10.4.9 using a custom compiled PHP 4.4.x (4.4.6 4.4.7RC1) I've tried using the php.ini setting zlib.output_compression = On and also ob_start(ob_gzhandler); directly. Each time I call up the page it crashes. On the server side I see this in the error log: [Wed Apr 11 13:57:49 2007] [notice] child pid 10608 exit signal Bus error (10) I even grabbed zlib and compiled that too to try and remedy this. phpinfo says I have 1.2.3: ZLib Supportenabled Compiled Version1.2.3 Linked Version 1.2.3 The best part is that I also have a 5.2.x install and I can use gz output just fine on that build. Any ideas? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Posting a variable
[EMAIL PROTECTED] wrote: Quoting Robert Cummings [EMAIL PROTECTED]: On Wed, 2007-04-11 at 09:59 -0700, [EMAIL PROTECTED] wrote: 1- your mysql query statement is better to have a WHERE part too. 2- I would use mysql_fetch_row instead of mysql_fetch_assoc Ummm, why would you want to reduce clarity and maintainability by using mysql_fetch_row()? hmmm, I just remember in my php class a while back, my teacher didn't even bother teaching us about mysql_fetch_assoc, and when a student asked about it, he said don't bother using it, just use mysql_fetch_row so I ended up using this function ever since. I'm guessing he was wrong?? Not 'wrong', but half the PHP developers out there would disagree with him apparently: http://www.php-mag.net/magphpde/magphpde_news/psecom,id,27094,nodeid,5.html Cheers, Rich -- Zend Certified Engineer http://www.corephp.co.uk Never trust a computer you can't throw out of a window -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Posting a variable
On Wed, 2007-04-11 at 10:53 -0700, [EMAIL PROTECTED] wrote: Quoting Robert Cummings [EMAIL PROTECTED]: On Wed, 2007-04-11 at 09:59 -0700, [EMAIL PROTECTED] wrote: 1- your mysql query statement is better to have a WHERE part too. 2- I would use mysql_fetch_row instead of mysql_fetch_assoc Ummm, why would you want to reduce clarity and maintainability by using mysql_fetch_row()? hmmm, I just remember in my php class a while back, my teacher didn't even bother teaching us about mysql_fetch_assoc, and when a student asked about it, he said don't bother using it, just use mysql_fetch_row so I ended up using this function ever since. I'm guessing he was wrong?? It's a terrible idea-- to grok the code you need to keep referring back to the query itself so that you can remember what index maps to what field. I guess that's not so much a problem if you export the row values to variables, but then again, why do in userspace what the mysql_fetch_assoc() function readily does for you in engine space? :) Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL Source Control
Richard Davey wrote: Hi all, I know a lot of you use various means for PHP source control (CVS, SVN, etc), which is all well and fine, but how do you manage source control on your databases? Say you've got an upgrade to a site, all of the new PHP files are controlled by SVN, so you can rollback at any time, but say the upgrade includes several key modifications to a MySQL table and perhaps the changing of some core data. How (if at all?!) do you handle the versioning of the database and data itself, so you can keep both PHP and SQL structure in sync? Cheers, Rich Rich, This is a well-known problem that comes from the fact that the database is an infrastructure component rather than a source component. You would have the same issue if you were to upgrade the operating system software, for example. What most people do is use their tool of choice to create the DDL/DML update scripts and put those under source control. To version the data you need to make database backups at well-understood times and grab the data files if appropriate. Rolling back a change is a matter of recovering the database and files to a point in time along with the sources. I don't know of any management tools for this part of it. Most larger organizations have different people responsible for the database and web tiers, so a single tool won't do. Some folks are trying to use ClearCase automation to manage a lot of it, but it's still a work in progress... In a smaller environment I would be inclined to create shell/whatever scripts to do the actual implementation. If you parameterize the connection/server details you can test the implementation in a QA environment before going live - less need for rollbacks that way. The shell scripts greatly reduce the chance of finger trouble which is key if your implementation is being done at some uncivilized hour or by rookies. If you want to truly embrace the New World, you can do all of this using Ant, which has built-in tasks for CVS/SVN as well as file movement, etc. It can also run shell scripts for the database stuff. ...Lori -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP textbook suggestions?
You're missing the point-- it's not that there is a practical difference in the examples, it's that there IS a difference, the students see it, and it is an extra point of confusion that isn't needed if one is being consistent. I completely recognize that the practical effects of the differences are small, but the learning effects of the inconsistencies is much larger, particularly with a group of students that are not techies, not geeks, not computer science or IT students... c On 4/10/07, LuKreme [EMAIL PROTECTED] wrote: On 6-Apr-2007, at 08:13, Chris Lott wrote: echo substr(abcdef, 1); So they naturally want to know-- why the double quotes? And there's no good logical reason for double quotes in the example-- and there are languages where the function could take a variable to be interpolated that DOES need double quotes-- so it is very confusing to them. But it's quite simple: it's a matter of preference, style, or just the mood of the programmer. Basically, there is NO difference between echo substr(abcdef, 1); echo substr('abcdef', 1); Oh sure, there is some number of nanoseconds difference in evaluation time, but that's meaningless as it is an insignificant amount of time (and takes millions and millions of iterations to make any perceivable difference). Use whichever you want. For me, I use mostly, and usually only use ' when I am enclosing 's to save myself having to escape them. On 5-Apr-2007, at 14:52, Chris Lott wrote: print 'The cost is ' . $cost; NOT print The cost is $cost; But that is certainly a silly destination to make. Both are perfectly valid and, in fact, I would argue the latter is better as it is clearer, cleaner, and shorter. echo substr('abcdef', 1); NOT echo substr(abcdef, 1); Both are perfectly fine. I'd use the latter myself as I tend to reserve the single quotes for enclosing strings containing double quotes, but that's just my preference. I certainly wouldn't deign to argue that my way was 'correct'. -- A: You can never go too far. B: If I'm gonna get busted, it is *not* gonna be by a guy like *that*. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Chris Lott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP textbook suggestions?
On 4/10/07, Richard Lynch [EMAIL PROTECTED] wrote: print 'The cost is ' . $cost; NOT print The cost is $cost; AND CERTAINLY NOT print (The cost is $cost); echo The cost is , $cost; If you're going to be this picky, you'd better write your own textbook... :-) Perhaps instead of a textbook, just use http://php.net/manual The manual is not nearly enough reference for a beginning students. You illustrate the problem with quotes in your example above-- why double quotes with no variable being interpolated? The . is the documented string operator for concatenation... that's one of the reasons I dislike the unneeded parentheses with the print function-- then I have to explain-- before I want to-- arguments to functions, which is necessary to explain the comma. c -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP editor
Using with CVS, PHP Eclipse no doubt http://download.eclipse.org/tools/pdt/downloads/?release=S20070401-RC3 Unzip and execute eclipse.exe.. It's free... No CVS.. can use Zend Studio.. but isn't free... My choose is Eclipse.. Jonathan Kahan [EMAIL PROTECTED] escreveu na mensagem news:[EMAIL PROTECTED] Hi all, I beleive this is in the realm of php (I have learned my lesson from last time). Does anyone have recomendation for any free (I.E. permanently free not 30 day trial) of a good php editor. The ones i am seeing all only allow usage for a limited time. Kind Regards Jonathan Kahan Systems Developer Estrin Technologies, inc. 1375 Broadway, 3rd Floor, New York, NY, 10018 Email: [EMAIL PROTECTED] Web: http://www.estrintech.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Design Dilemma - Database Data Abstraction
2007/4/11, Roman Neuhauser [EMAIL PROTECTED]: # [EMAIL PROTECTED] / 2007-04-09 19:45:41 -0300: Thanks but that's not what I'm looking for. As I said before, my problem isn't to find an implementation of an ORM, but that the concept I'm working on will use a very restricted API (array operations), and I'm having trouble to keep it coherent. Yeah, it's a bad idea, and doesn't work. If it is my idea that you think is bad and wouldn't work, I kindly ask if you could explain your thoughs throughly. If it is not, I would also like to know more about it, but if you fell it won't affect the thread of the discussion. Thanks. Besides, what's with those funky ['s and ]'s? What are they for? I didn't bother to RTFM. The operator [] is known as the array access operator, is used to refer to an item in an array through its index, which is contained inside the square brackets. It is possible to overload this operator, and the basic related actions (isset, unset, foreach), in PHP5.
[PHP] location of the PHP executable
Hi, I have looked in the documentation but can't find it: My PHP script (which is run from the command prompt - CLI) needs to know the file system location of the PHP executable. This is because it needs to run a second PHP script. I know about the which command but it's not available in all OSes, and that might not be the currently running executable anyway. I could prompt the user for this, but that seems kind of silly. Surely, there must be some way of looking it up automatically? Thanks, Mattias -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP editor
I use jEdit http://www.jedit.org/ and I like it ;) it's not specifically for php but for any kind of programming, and has nice plugins for several programming languages you might edit with it greets Zoltán Németh 2007. 04. 11, szerda keltezéssel 10.12-kor Jonathan Kahan ezt írta: Hi all, I beleive this is in the realm of php (I have learned my lesson from last time). Does anyone have recomendation for any free (I.E. permanently free not 30 day trial) of a good php editor. The ones i am seeing all only allow usage for a limited time. Kind Regards Jonathan Kahan Systems Developer Estrin Technologies, inc. 1375 Broadway, 3rd Floor, New York, NY, 10018 Email: [EMAIL PROTECTED] Web: http://www.estrintech.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] UPDATE and redirect
2007. 04. 11, szerda keltezéssel 16.57-kor Fredrik Thunberg ezt írta: marcelo Wolfgang skrev: Hi all, I'm new to this list and new to php programming so sorry if I do something wrong here :) Ok, now to my problem. I've created a query to update a mysql db, and it isn't working, and it's not throwing me any errors, so I need some help to figure out what's wrong here. My code follows : ? if($_GET['act'] = 'a'){ $action = 1; } else if ($_GET['act'] = 'd'){ $action = 0; } Don't use =, use == (or in some cases ===). = is for assignment. Also, what if $_GET['act'] is neither 'a' or 'd'? $id = $_GET['id']; Again, what if $_GET['id'] is null? and what if $_GET['id'] is something like 1; DROP TABLE tb_emails; ?? SQL injection just waits to happen greets Zoltán Németh mysql_connect(localhost,,) or die (mysql_error()); mysql_select_db (taiomara_emailList); $email_Query = mysql_query(UPDATE 'tb_emails' SET 'bol_active' = $action WHERE `auto_id` = $id); Use backticks if you think you need them In this case you don't $sql = UPDATE `tb_emails` SET `bol_active` = $action WHERE `auto_id` = $id; echo DEBUG: $sql; $email_Query = mysql_query( $sql ); This is how to get the error: if ( !$email_Query ) echo mysql_error(); mysql_close(); ? The page is executed, but it don't update the table ... I've tried with the '' and without it ( the phpmyadmin page is where I got the idea of using the '' ). Any clues ? Also, how can I make a redirect after the query has run ? header(Location: http://www.foobar.com;); Will work as long as you don't print out any output whatsoever to the browser before this line of code. TIA Marcelo Wolfgang /T -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: SQL Source Control
2007. 04. 11, szerda keltezéssel 16.19-kor Colin Guthrie ezt írta: Richard Davey wrote: Hi all, I know a lot of you use various means for PHP source control (CVS, SVN, etc), which is all well and fine, but how do you manage source control on your databases? Say you've got an upgrade to a site, all of the new PHP files are controlled by SVN, so you can rollback at any time, but say the upgrade includes several key modifications to a MySQL table and perhaps the changing of some core data. How (if at all?!) do you handle the versioning of the database and data itself, so you can keep both PHP and SQL structure in sync? Yeah this is a weak point in my chain too! I keep database schema's in a file which can start with a blank db and create all the tables allowing for modifications and updates etc. over time with new deployments. But if something breaks... rolling back is well. a pain I could use a backup file and MySQL binary logs to replay to the point prior to deployment/update if the world depended on it, but this would take several hours to do and so I really wouldn't say I relied on this method.. it's more disaster recovery! Any suggestions in this area would be interesting. yeah I have the same problem ;) I have two kind of SQL files: 1) SQL of the complete, blank DB structure - I store it for each main version (I should store it for each version if I wouldn't be so lazy... ;) ) 2) SQL instructions to upgrade from a DB version to another - I need these to upgrade working databases however I have no real solution for rollback, and if something is broken in a new version and I have to revert a working DB to an older state, well that's real serious trouble (and usually a lot of cursing and stuff like that) so, if anyone has a good solution I also would like to hear it :) greets Zoltán Németh Col -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] UPDATE and redirect
and what if $_GET['id'] is something like 1; DROP TABLE tb_emails; ?? SQL injection just waits to happen I think tha tit will be too much of a hacker effort just to kill a table of contact emails, and also he will have to guess ( is there other way ? ) the table name, but just to be on a safer side: - Is there a way to say that id can only be a number ? something like $id:Number = $_GET['id']? TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP Directory List Script Files over 2 GB
Does anyone else have any other ideas how to resolve this, I have tried multiple different methods all failed. Does the 2 GB limitation using filesize have an alternate method of producing the output. ? Thank you Logan for trying. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Design Dilemma - Database Data Abstraction
# [EMAIL PROTECTED] / 2007-04-11 16:34:27 -0300: 2007/4/11, Roman Neuhauser [EMAIL PROTECTED]: # [EMAIL PROTECTED] / 2007-04-09 19:45:41 -0300: Thanks but that's not what I'm looking for. As I said before, my problem isn't to find an implementation of an ORM, but that the concept I'm working on will use a very restricted API (array operations), and I'm having trouble to keep it coherent. Yeah, it's a bad idea, and doesn't work. If it is my idea that you think is bad and wouldn't work, I kindly ask if you could explain your thoughs throughly. You have explained my thoughts quite thoroughly in the thread opener. : I could index by the order as they are presented by the DB: : : $DB['users'][0] is the first user from the query SELECT * FROM users : $DB['users'][1] is the second user from the query SELECT * FROM users : etc.. That's a stillborn as soon as you care about what data the 0, 1, etc represents, for example when updating. Or, how is it supposed to support WHERE other than on the primary key? What if select * from atable produces more data than there's memory for? Operator overloading is syntactic sugar, coating over method calls, except there are additional restrictions for array keys over function parameters (in PHP). You still don't have the basics straight (identifying the rows), so why bother with operator overloading. Besides, what's with those funky ['s and ]'s? What are they for? I didn't bother to RTFM. The operator [] is known as the array access operator, is used to refer to an item in an array through its index, which is contained inside the square brackets. It is possible to overload this operator, and the basic related actions (isset, unset, foreach), in PHP5. I know, I was suggesting that no matter how idiot-proof you build it, a loving couple somewhere will have produced a bigger idiot. What's easy for an idiot to use is often a weak tool if you need to get a bit more serious, cf the problems with composite keys you described. Sure, Lego duplo is so idiot proof that a year old can bang two pieces each against the other cheerfully. You won't build a helicopter with it, however. You have trouble identifying behavior that would go naturally with the ArrayAccess interface. That suggests that such natural behavior might not exist, and a method-based interface would do your users better service. After all, fetchByPrimaryKey($id) says much more than [$key]. Etc etc.. -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] UPDATE and redirect
Marcelo Wolfgang wrote: and what if $_GET['id'] is something like 1; DROP TABLE tb_emails; ?? SQL injection just waits to happen I think tha tit will be too much of a hacker effort just to kill a table of contact emails, and also he will have to guess ( is there other way ? ) the table name, but just to be on a safer side: - Is there a way to say that id can only be a number ? something like $id:Number = $_GET['id']? TIA If your id should only have digits in it, use if (! ctype_digit($_GET['id'])) { print invalid parameter error message or exit or whatever; } This doesn't work with negative integers - it really checks to make sure that there are only digits, but it is very handy for validating GET or POST variables. There are other ctype functions as well... Lori -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] UPDATE and redirect
2007. 04. 11, szerda keltezéssel 17.36-kor Marcelo Wolfgang ezt írta: and what if $_GET['id'] is something like 1; DROP TABLE tb_emails; ?? SQL injection just waits to happen I think tha tit will be too much of a hacker effort just to kill a table of contact emails, and also he will have to guess ( is there other way ? ) the table name, but just to be on a safer side: - Is there a way to say that id can only be a number ? something like $id:Number = $_GET['id']? that was just an example, any kind of hacker SQL code can be put there... if $id should be a number typecast it to int like this: $id = (int) $_GET['id']; greets Zoltán Németh TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: SQL Source Control
Zoltán Németh wrote: yeah I have the same problem ;) I have two kind of SQL files: 1) SQL of the complete, blank DB structure - I store it for each main version (I should store it for each version if I wouldn't be so lazy... ;) ) 2) SQL instructions to upgrade from a DB version to another - I need these to upgrade working databases however I have no real solution for rollback, and if something is broken in a new version and I have to revert a working DB to an older state, well that's real serious trouble (and usually a lot of cursing and stuff like that) so, if anyone has a good solution I also would like to hear it :) No technical solution, but just put a Swear Box in the office and that way when a borkage happens you'll all have to put a £/$/€ in the tub with each curse you utter... It wont help but at least come Friday night you can all enjoy a few extra beers in the pub ;) Col -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] UPDATE and redirect
and what if $_GET['id'] is something like 1; DROP TABLE tb_emails; ?? SQL injection just waits to happen Something I just thought, he could do a drop table inside an update statement ? because the query is : UPDATE tb_emails SET bol_active = $action WHERE auto_id = $id so if he changed the $action or the $id, it will be inside the UPDATE, doesn't changing any of the variables to a DROP TABLE just give an error ? TIA Marcelo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] UPDATE and redirect
Marcelo Wolfgang wrote: and what if $_GET['id'] is something like 1; DROP TABLE tb_emails; ?? SQL injection just waits to happen Something I just thought, he could do a drop table inside an update statement ? because the query is : UPDATE tb_emails SET bol_active = $action WHERE auto_id = $id so if he changed the $action or the $id, it will be inside the UPDATE, doesn't changing any of the variables to a DROP TABLE just give an error ? TIA Marcelo No. That's why he put the semi-colon after the 1. It becomes update tb_emails set bol_active = $action where auto_id = 1; drop table tb_emails; That's two separate statements that will be happily executed if you're not careful. Try it (on a scratch table). Lori -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql if empty
At 5:53 PM -0700 4/10/07, Jim Lucas wrote: Anyways, here is the expanded version hopefully to your liking. ?php // do that db connection thing... // select you database $sql = SELECT Client FROM booked WHERE Name = 'larry' ; if ( ( $result = mysql_query($sql) ) === false ) { # Your request failed. Make up your own custom way of displaying the error. } else { if ( mysql_num_rows($results) 0 ) { while ( $row = mysql_fetch_assoc($result) ) { if ( isset($row['client']) !empty($row['client']) ) { echo $row['client'] . 'br /'; } } } else { echo 'No results found!'; } } ? Does this satisfy you? Actually, it's $result and not $results. Other than that, it works fine as far as I can tell. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP Directory List Script Files over 2 GB
Robert M wrote: Does anyone else have any other ideas how to resolve this, I have tried multiple different methods all failed. Does the 2 GB limitation using filesize have an alternate method of producing the output. ? Thank you Logan for trying. I think you'd better file a bug report to PHP. A lot of old/legacy applications were written in the period when Gigabytes is an astronomical number. They're not supposed to support such a big number and need a rewrite. PHP might be in this situation. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP Directory List Script Files over 2 GB
Well it looks like I am forced to use a different approach do to the limitations of PHP http://bugs.php.net/bug.php?id=27792 This Bug has been around now for HOW long now. Seems to me that it would have been addressed in the past few years, Gigabyte files have been around a long time. Maybe not for the average WEB server but for intranets wanting to display files and sizes well I cant complain too much , this has taught me quite a bit on how to do things using php. The sprintf(%u, filesize($file)) does not appear to resolve this issue either. Thanks to all -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] location of the PHP executable
Mattias Thorslund wrote: Hi, I have looked in the documentation but can't find it: My PHP script (which is run from the command prompt - CLI) needs to know the file system location of the PHP executable. This is because it needs to run a second PHP script. I know about the which command but it's not available in all OSes, and that might not be the currently running executable anyway. I could prompt the user for this, but that seems kind of silly. Surely, there must be some way of looking it up automatically? Thanks, Mattias What OS are you working with Assuming you are on a *nix box this should work #locate /php | grep /php$ this should give you locations that have /php as the end of the line on windows you could do this cd \ dir /s php*.exe -- Enjoy, Jim Lucas Different eyes see different things. Different hearts beat on different strings. But there are times for you and me when all such things agree. - Rush -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] WWE in Stamford, CT needs a kick ass PHP Developer!
You folks know anyone who fits this one? Description: Your task would be the maintenance and extension of our dynamic and cutting edge Intranet and Internet web sites written in PHP5. PHP/Mysql Experience: 3-4 years, where 1 year must be PHP5. Candidates must be well versed in: * PHP5 * Mysql * JavaScript * Web services * Object-oriented programming Candidates must show: * Experience working through an entire life cycle of a web-based application from concept, implementation, testing to maintenance. * Familiarity with application level network protocols (e.g., HTTP and/or SSL). * Excellent communication and relationship skills along with being a strong team player. * Demonstrable analytical problem-solving skills. * Ability to thrive in a high-pressured, unstructured, customer-oriented environment. Other skills: * AJAX * XHTML/HTML, CSS * Linux * Dreamweaver * Subversion * Unix Shell/Perl The link to apply is as follows. http://www.wwe-careers.com/wwe/jobboard/SearchPositions.asp?ShowJobID=61 1Keywords http://www.wwe-careers.com/wwe/jobboard/SearchPositions.asp?ShowJobID=6 11Keywords = Thanks, Pat Arbitrio Sr. Staffing Specialist World Wrestling Entertainment, Inc. 1241 East Main Street Stamford, CT 06902
Re: [PHP] location of the PHP executable
Don't you have to run locate -u first to generate the database before using locate? You can't just assume a database exists already can you? On 4/11/07, Jim Lucas [EMAIL PROTECTED] wrote: Mattias Thorslund wrote: Hi, I have looked in the documentation but can't find it: My PHP script (which is run from the command prompt - CLI) needs to know the file system location of the PHP executable. This is because it needs to run a second PHP script. I know about the which command but it's not available in all OSes, and that might not be the currently running executable anyway. I could prompt the user for this, but that seems kind of silly. Surely, there must be some way of looking it up automatically? Thanks, Mattias What OS are you working with Assuming you are on a *nix box this should work #locate /php | grep /php$ this should give you locations that have /php as the end of the line on windows you could do this cd \ dir /s php*.exe -- Enjoy, Jim Lucas Different eyes see different things. Different hearts beat on different strings. But there are times for you and me when all such things agree. - Rush -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP editor
For Win, I use either Notepad++ or PHP Designer (www.mpsoftware.org). For Linux I use Joe.
Re: [PHP] location of the PHP executable
Em Quarta 11 Abril 2007 18:50, Jarrel Cobb escreveu: Don't you have to run locate -u first to generate the database before using locate? You can't just assume a database exists already can you? If you can use locate, you can use which... =P BTW, do something to check OS then: IF OS == *nix THEN IF exists /usr/bin/which THEN which php ELSE IF exists /usr/bin/locate THEN IF db not exists THEN locate -u END-IF locate php | grep -iE php$ ELSE IF exists /usr/bin/find THEN find / -name php | grep -iE php$ ELSE cd / ls php -Rv END-IF END-IF END-IF ELSE cd \ dir php*.exe /s END-IF Check if I don't miss any END-IF... =P []s -- Davi Vidal [EMAIL PROTECTED] [EMAIL PROTECTED] -- Agora com fortune: rugged, adj.: Too heavy to lift. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL Source Control
Richard Davey wrote: Hi all, I know a lot of you use various means for PHP source control (CVS, SVN, etc), which is all well and fine, but how do you manage source control on your databases? Say you've got an upgrade to a site, all of the new PHP files are controlled by SVN, so you can rollback at any time, but say the upgrade includes several key modifications to a MySQL table and perhaps the changing of some core data. How (if at all?!) do you handle the versioning of the database and data itself, so you can keep both PHP and SQL structure in sync? Cheers, Rich One thing we do is add a table called 'versions' to each application, this table just has one row and a column for the schema version (and sometimes other stuff less important.) When the app runs it checks to ensure that its defined constant DBVERSION matches that of the database it is running against. This has actually helped out more than once, though not a solution to the actual problem. Travis Doherty -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP textbook suggestions?
On 11-Apr-2007, at 13:06, Chris Lott wrote: You're missing the point-- it's not that there is a practical difference in the examples, it's that there IS a difference, the students see it, and it is an extra point of confusion that isn't needed if one is being consistent. I have to disagree, and have had very little confusion myself in teaching php. I jsut explain it the way I use it. Use double quotes unless your quoted text is going to contain HTML with quotes; and as a bonus, php will expand variables in double quotes. I completely recognize that the practical effects of the differences are small, but the learning effects of the inconsistencies is much larger, particularly with a group of students that are not techies, not geeks, not computer science or IT students... Well, non-techie non-geeks are going to get very little out of learning to code php and are likely going to end up writing crap code with loverly security holes that bring ebservers to their knees and propagate millions of spam emails. Walk before you run, and all that. PHP is not a good choice as a 'learning' language precisely because it is so flexible. Much better to teach a much more rigid and concise language like obj- c or c++ if you want to teach programming to tyros. Heck, even perl. -- It was intended that when Newspeak had been adopted once and for all and Oldspeak forgotten, a heretical thought...should be literally unthinkable, at least so far as thought is dependent on words. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] location of the PHP executable
Jim Lucas wrote: Mattias Thorslund wrote: Hi, I have looked in the documentation but can't find it: My PHP script (which is run from the command prompt - CLI) needs to know the file system location of the PHP executable. This is because it needs to run a second PHP script. I know about the which command but it's not available in all OSes, and that might not be the currently running executable anyway. I could prompt the user for this, but that seems kind of silly. Surely, there must be some way of looking it up automatically? Thanks, Mattias What OS are you working with Assuming you are on a *nix box this should work #locate /php | grep /php$ this should give you locations that have /php as the end of the line on windows you could do this cd \ dir /s php*.exe Thanks Jim (and others) for the suggestions. I think they will be helpful if there isn't a way to do what I'm looking for: Ideally, I would like to get the location of the PHP executable that is actually executing the script. I'm thinking there would be some way to find out while the script is executing. Something like: ?php $executable_location = get_location_of_current_executable(); //fictitious function echo $executable_location .\n; ? Running it from the command line (again fiction): $ /my-location-of/php myscript.php /my-location-of/php $ I was hoping there's a function or $_SERVER property that would contain this? Thanks again, Mattias -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] location of the PHP executable
IF db not exists THEN locate -u END-IF I'd hate to see the time it'd take to create a first-time database... this could take awhile to run. -Original Message- From: Davi [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 11, 2007 6:10 PM To: php-general@lists.php.net Subject: Re: [PHP] location of the PHP executable Em Quarta 11 Abril 2007 18:50, Jarrel Cobb escreveu: Don't you have to run locate -u first to generate the database before using locate? You can't just assume a database exists already can you? If you can use locate, you can use which... =P BTW, do something to check OS then: IF OS == *nix THEN IF exists /usr/bin/which THEN which php ELSE IF exists /usr/bin/locate THEN locate php | grep -iE php$ ELSE IF exists /usr/bin/find THEN find / -name php | grep -iE php$ ELSE cd / ls php -Rv END-IF END-IF END-IF ELSE cd \ dir php*.exe /s END-IF Check if I don't miss any END-IF... =P []s -- Davi Vidal [EMAIL PROTECTED] [EMAIL PROTECTED] -- Agora com fortune: rugged, adj.: Too heavy to lift. -- 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] location of the PHP executable
Mattias Thorslund wrote: Jim Lucas wrote: ... $ /my-location-of/php myscript.php /my-location-of/php $ I was hoping there's a function or $_SERVER property that would contain this? have you tried looking for this info you want? I can't say for sure if it always exists but on the few boxes I tried I found and entry in both $_SERVER and $_ENV: _ = '/usr/bin/php' but that was only on linux. on windows (where my php cli install is a bit borked), I didn't find it but I did find PHPRC which points to the directory that the php executable lives in. these maybe of some use. then again what ever it is your trying to do with the php script you seem to need to run inside another instance of php could probably be run within the context of the calling script - if you run it inside a function you can stop any kind of variable scope clashes (assuming there are no symbol name clashes [e.g. duplicate functions/classes]): function runit() { include 'myscript.php'; } it's just a thought. Thanks again, Mattias -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] WWE in Stamford, CT needs a kick ass PHP Developer!
On Wed, 2007-04-11 at 17:43 -0400, Arbitrio, Pat wrote: Other skills: * Dreamweaver *ROFLMFAO* Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] WWE in Stamford, CT needs a kick ass PHP Developer!
On Wed, 2007-04-11 at 18:53 -0400, Robert Cummings wrote: On Wed, 2007-04-11 at 17:43 -0400, Arbitrio, Pat wrote: Other skills: * Dreamweaver *ROFLMFAO* Still *ROFLMFAO* Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] WWE in Stamford, CT needs a kick ass PHP Developer!
Robert Cummings wrote: On Wed, 2007-04-11 at 18:53 -0400, Robert Cummings wrote: On Wed, 2007-04-11 at 17:43 -0400, Arbitrio, Pat wrote: Other skills: * Dreamweaver *ROFLMFAO* Still *ROFLMFAO* I don't see what's so funny. there is great skill involved with becoming proficient in using Dreamweaver . . without commiting suicide in the attempt. Cheers, Rob. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] WWE in Stamford, CT needs a kick ass PHP Developer!
[snip] Robert Cummings wrote: On Wed, 2007-04-11 at 18:53 -0400, Robert Cummings wrote: On Wed, 2007-04-11 at 17:43 -0400, Arbitrio, Pat wrote: Other skills: * Dreamweaver *ROFLMFAO* Still *ROFLMFAO* I don't see what's so funny. there is great skill involved with becoming proficient in using Dreamweaver . [/snip] ROFLMMFAO -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] WWE in Stamford, CT needs a kick ass PHP Developer!
On Wed, 2007-04-11 at 18:03 -0500, Jay Blanchard wrote: [snip] Robert Cummings wrote: On Wed, 2007-04-11 at 18:53 -0400, Robert Cummings wrote: On Wed, 2007-04-11 at 17:43 -0400, Arbitrio, Pat wrote: Other skills: * Dreamweaver *ROFLMFAO* Still *ROFLMFAO* I don't see what's so funny. there is great skill involved with becoming proficient in using Dreamweaver . [/snip] ROFLMMFAO I think I peed my pants :B -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] WWE in Stamford, CT needs a kick ass PHP Developer!
- Original Message - From: Robert Cummings [EMAIL PROTECTED] To: Jay Blanchard [EMAIL PROTECTED] Cc: Jochem Maas [EMAIL PROTECTED]; php-general@lists.php.net Sent: Thursday, April 12, 2007 1:05 AM Subject: RE: [PHP] WWE in Stamford, CT needs a kick ass PHP Developer! On Wed, 2007-04-11 at 18:03 -0500, Jay Blanchard wrote: [snip] Robert Cummings wrote: On Wed, 2007-04-11 at 18:53 -0400, Robert Cummings wrote: On Wed, 2007-04-11 at 17:43 -0400, Arbitrio, Pat wrote: Other skills: * Dreamweaver *ROFLMFAO* Still *ROFLMFAO* I don't see what's so funny. there is great skill involved with becoming proficient in using Dreamweaver . [/snip] ROFLMMFAO I think I peed my pants :B me too :)) jm -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- 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] SQL Source Control
I'm surprised (or rather, I'm unaware of) there is no native MySQL solution for this situation. Considering it's not a mysql specific problem I'd be surprised if there was. Postgres lets you do database changes inside a transaction, eg: begin; alter table x add column y int; ... commit; but two problems with that: 1) mysql doesn't support it (nor do a lot of databases) even when using innodb (and using myisam is out of the question for this because it doesn't support transactions) 2) it won't help in a web environment because you can't rollback once the transaction has finished you are testing the changes and then find the problem. No easily solution unfortunately apart from writing 'undo' scripts or having a backup handy.. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with table in database and login scripts.
Karl James wrote: Team, I want to know if my table is setup correctly. I am creating a site where team owners control fantasy football teams. Imaginary teams. They can trade players, add and drop them as long as they are under the salary cap at all times. if not they are given a warning to make a different move or something along those lines. I have created a table for league_members. Can you tell me if I have this set up correctly. This will be for the register.php form Field Type Attributes Null Default Extra Action fantasyteamname varchar(30) No firstname varchar(20) No lastname varchar(30) No username varchar(10) No emailaddress varchar(50) No 0 address varchar(50) No city varchar(30) No state varchar(30) No zipcode tinyint(5) No 0 homephonenumber tinyint(4) No 0 mobilephonenumber tinyint(4) No 0 favoriteprofootballteam varchar(50) No 0 favoritecollegeteam varchar(50) No 0 I'd make fantasyteamname, favoriteprofootballteam, and favoritecollegeteam int's instead and have them as separate database tables. I'm sure many people are going to share the same favourite pro team and college teams so you could make a dropdown box with those options instead of making your users type them in ;) Fantasyteamname should go with the fantasy team details - not be with the user info so keep the team name with the other details, and just an id to link between them. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Bind IP with fsockopen
Hi ive tried \r\n\n and pretty much every other combination I can think of. But I still cant get it to return a line break. Otherwise the script is working though. - Original Message - From: Richard Lynch [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, April 11, 2007 1:19 AM Subject: Re: [PHP] Bind IP with fsockopen fputs adds a newline, and you've got \r\n already, so your total output in the original is \r\n\n In the socket_bind one, you've got none of the \r\n stuff at all, much less \r\n\n On Tue, April 10, 2007 5:56 pm, [EMAIL PROTECTED] wrote: Im having trouble converting this snippet to use the bind_socket function. my original code is.. ? $domain = 'internet.co.uk'; $fs = fsockopen('dac.nic.uk', 2043, $errno, $errstr, 60); if (!$fs) { fclose($fs); } else { fputs($fs, $domain\r\n); $line = fgets($fs, 1024); echo $line; } ? I think im getting stuck on the fputs bit.. I have this which does not work.. ?php $domain = 'internet.co.uk'; $sourceip = 'xx.xx.xx.xx'; // ip you want to bind to $sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); socket_bind($sock, $sourceip); socket_connect($sock, 'dac.nic.uk', 2043); // Write $request = $domain\r\n; socket_write($sock, $request); //Read reply // Close socket_close($sock); ? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql if empty
tedd wrote: At 5:53 PM -0700 4/10/07, Jim Lucas wrote: Anyways, here is the expanded version hopefully to your liking. ?php // do that db connection thing... // select you database $sql = SELECT Client FROM booked WHERE Name = 'larry' ; if ( ( $result = mysql_query($sql) ) === false ) { # Your request failed. Make up your own custom way of displaying the error. } else { if ( mysql_num_rows($results) 0 ) { while ( $row = mysql_fetch_assoc($result) ) { if ( isset($row['client']) !empty($row['client']) ) { echo $row['client'] . 'br /'; } } } else { echo 'No results found!'; } } ? Does this satisfy you? Actually, it's $result and not $results. Other than that, it works fine as far as I can tell. Cheers, tedd good catch, missed that. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] WWE in Stamford, CT needs a kick ass PHP Developer!
On Wed, April 11, 2007 6:00 pm, Jochem Maas wrote: Robert Cummings wrote: On Wed, 2007-04-11 at 18:53 -0400, Robert Cummings wrote: On Wed, 2007-04-11 at 17:43 -0400, Arbitrio, Pat wrote: Other skills: * Dreamweaver *ROFLMFAO* Still *ROFLMFAO* I don't see what's so funny. there is great skill involved with becoming proficient in using Dreamweaver . God knows I can't use it. I tried once, and in about 3 minutes crashed the dang thing just trying to drag some table borders around. This was a repeatable problem (every time I tried, about 3) so then I just gave up. But I'm the guy who took ~10 years to figure out that cramming more stuff into less screen real estate was a Bad Idea, and that some extra white space was a Good Thing. So there ya go. Ya gotta at least give him points for having the location in the Subject line, unlike *some* job posters. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP Directory List Script Files over 2 GB
On Wed, April 11, 2007 3:36 pm, Robert M wrote: Does anyone else have any other ideas how to resolve this, I have tried multiple different methods all failed. Does the 2 GB limitation using filesize have an alternate method of producing the output. ? Thank you Logan for trying. The first thing I'd recommend is writing a one-line test script that did: ?php echo filesize('/full/path/to/some/monster/file/here');? As it stands now, I just deleted your emails as they were MUCH too long... That said, PHP will handle INT only up to ~2 billion, so I don't quite know how it could come back as what you want, unless the function returns 'text' datatype, which I doubt... I do recall discussion of this and some kind of solutions from way back when... If nothing else, you could use http://php.net/exec to ask the OS how big the file is, and bypass filesize altogether. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php