Re: [PHP] Re: logic operands problem
I don't really get it. This is a select statement working with the datas of one table. A field of a record (namely "page" here) can only take one value, so it is totally nonsense to give XOR for that field. I think you want to select two different recordsets: one with page 1 and 3, and another with 2 and 3, am I right? SanTa - Original Message - From: "Ashley Sheridan" To: "Merlin Morgenstern" Cc: "Peter Ford" ; Sent: Monday, December 07, 2009 12:39 PM Subject: Re: [PHP] Re: logic operands problem On Mon, 2009-12-07 at 12:37 +0100, Merlin Morgenstern wrote: Peter Ford wrote: > Merlin Morgenstern wrote: >> Hello everybody, >> >> I am having trouble finding a logic for following problem: >> >> Should be true if: >> page = 1 OR page = 3, but it should also be true if page = 2 OR page = >> 3 >> >> The result should never contain 1 AND 2 in the same time. >> >> This obviously does not work: >> (page = 1 OR page = 3) OR (page = 2 OR page = 3) >> >> This also does not work: >> (page = 1 OR page = 3 AND page != 2) OR (page = 2 OR page = 3 AND page >> != 1) >> >> Has somebody an idea how to solve this? >> >> Thank you in advance for any help! >> >> Merlin > > > Surely what you need is xor (exclusive-or) > I can't believe a programmer has never heard of that! > > (page==1 XOR page==2) AND page==3 > HEllo Peter, thank you for your reply. I know about XOR, but unfortunatelly I might not know how to use it properly OR it is not aplicable on SQL. I am trying to retrive data: SELECT * FROM test WHERE ((page = 1 XOR page = 2) OR page = 3) I know this is not php, but I thought the logic should be the same in this case?! Regards, Merlin This will likely retrieve all the records in the table. Is that what your tests have shown? Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] header problem
Usually, when I have to redirect the user AFTER headers has been sent (like showing an error message), I write this: location=page_to_send.html But this will redirect the user at once. If you want the user to read the page, you should do something in Javascript with setTimeout(func,timeout) function. BR, SanTa - Original Message - From: "George Langley" To: Sent: Thursday, September 10, 2009 8:39 AM Subject: Re: [PHP] header problem Hi Blueman. As soon as ANYTHING has been drawn to the browser, you cannot use a header command. So you need to work through all of your code, and ensure that all of your logic that could result in a header call is run BEFORE you send any html code. Is going to be tricky if mixing html and php calls. George On 10-Sep-09, at 12:27 AM, A.a.k wrote: hello I recentrly uploaded my project from localhost to a hosting and found many errors and warnings which didnt have in local. one of the most annoying one is header('Location xxx'). I have used header to redirect users from pages, and kinda used it alot. i know about the whitespace causing warning, but most of the pages i'm sending users got html and php mixed so i'm confused about how to remove whitespace in a html/php file. the error is : Warning: Cannot modify header information - headers already sent by here is a simple example, user update page : if($valid) { $msg='111'; $user->dbupdate(); header("Location: /admin/index.php?msg=$msg"); } else { foreach($errors as $val) echo ''.$val.''; } and on admin index i get $msg and display it. .. //lots of stuff '; break; case '421':... } ?> // more html and php how can i fix this? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Where is interbase.dll?
Hi, I downloaded PHP 5.3.0, and since then I can't use fbird_connect. When I inspected the installed files, I realized that php_interbase.dll is not there! Where is it? Or where can I get it? SanTa
[PHP] Character encoding
Hi, I have a mysql database, which the users can insert comments. As the users can be from different countries, with different character encoding, the mysql table can contain various special characters. How can I be sure to display these comments properly? I've found the mb_convert_encoding, and for some characters it works okay, but there are some really special characters which displayed as a '?'. Does anybody know some workarounds? Thanks, SanTa
[PHP] Structure of PHP files
Hi, It isn't really a programming question, but rather a structural. Let's suppose I have a PHP page, which is built by other PHP files' includes. Which is the better approach: in a switch-like statement I include the required PHP files, which contain all the functions, and the HTML code to provide the functionality, or create a base PHP file which contains all the funcionality, and the PHP files only contain calls for these functions, and the HTML code? I think the previous method gives more control and it is more repairable, but the later method gives more modularity. With your experiences, what method gives the better overall usability? Thanks, SanTa
Re: [PHP] Writing to a file
The classic method is: 1.) read the whole file into an array of strings. 2.) search for the last line 3.) insert a string BEFORE the last line. 4.) write back the whole file to the same name Classic file handling does allow you to append to the end of a file, or recreate as a whole. Usually these types of editing must be done in memory, because file handling does not allow inserts, deletes. SanTa - Original Message - From: "Jason Carson" To: Sent: Friday, July 03, 2009 12:01 PM Subject: [PHP] Writing to a file Hello everybody, How would I go about writing stuff to a file but in between the tags? Example, say I have config.php as follows... How would I go about adding stuff at the end of the file, but before the ?> tag? -- 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] Self-Process php forms or not?
Well, if you keen on separating business from presentation (which is usually a good practice), you can always do this: So you can call in fact the processing page, the real presentation can be in another PHP file, as well as the processing functions. Of course, instead of PrintForm() you can actually implant the real HTML code. And by the way, if you keep the form and the processing parts in one file, and create the form like this: you can name your file as you want, it will work without rewriting the page. SanTa - Original Message - From: "MEM" To: "'Sándor Tamás (HostWare Kft.)'" ; "'PHP-General List'" Sent: Friday, April 24, 2009 3:03 PM Subject: RE: [PHP] Self-Process php forms or not? So, on your opinion, we can call that method, on some circumstances, a good practice? What about the moto: "let's separate business from presentation?" Thanks once again, Márcio -Original Message- From: Sándor Tamás (HostWare Kft.) [mailto:sandorta...@hostware.hu] Sent: sexta-feira, 24 de Abril de 2009 13:53 To: 'PHP-General List' Subject: Re: [PHP] Self-Process php forms or not? I think the main advantage is that if something goes wrong processing the datas, you can show the form again without redirecting again. And if you have to change the behavior of the page, you have to change only one file instead of two. SanTa -- 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] Self-Process php forms or not?
I think the main advantage is that if something goes wrong processing the datas, you can show the form again without redirecting again. And if you have to change the behavior of the page, you have to change only one file instead of two. SanTa - Original Message - From: "MEM" To: "'PHP-General List'" Sent: Friday, April 24, 2009 2:34 PM Subject: [PHP] Self-Process php forms or not? I'm trying to understand the advantages behind opting by using a Self-Process PHP Form, instead of having a form and then point the action of the form to another .php page. Can anyone point me some resources about this. Why using one instead of another. What are the main advantages? Regards, Márcio -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP-MYSQL Question
This isn't PHP but mysql question. You didn't mention that the table itslef is created or not. If not, then it is probably a mysql error, maybe your installation of mysql doesn't support INNODB. SanTa - Original Message - From: "abdulazeez alugo" To: Sent: Tuesday, April 07, 2009 3:05 PM Subject: [PHP] PHP-MYSQL Question Hi guys, Please can anyone tell me what I'm doing wrong with the code below? It keep returning unsuccessful. $result=mysql_query("CREATE TABLE table2(table2_id INT NOT NULL PRIMARY KEY AUTO_INCREMENT, table1_id INT NOT NULL, name VARCHAR(100) NOT NULL, school VARCHAR(100) NOT NULL, comment TEXT NOT NULL, entrydate TIMESTAMP NOT NULL, FOREIGN KEY(table1_id) REFERENCES table1(table1_id)) ENGINE = INNODB" ); if($result){ print"Successful";} else {print "Unsuccessful";} Thanks in advance. Cheers. Alugo Abdulazeez. _ Drag n’ drop—Get easy photo sharing with Windows Live™ Photos. http://www.microsoft.com/windows/windowslive/products/photos.aspx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Silly question - include vs. eval
Yes, Rob is right. My original question is about the difference between the processing of a file-based site with include() OR eval(). In that case, if I understood it correctly, the results are the same. But! If the included pages contain functions, classes, etc. With eval(), can I use them? With include(), I know I should be able to use them. But in some mysterious cases I don't have access to a function. If I cut out from the included file, and put in on the file which includes that, just before (or after) the includ(), I don't have any problem with it. The next step, that if I include a file in a function, can I use the functions wrote in the included file? As I know, include just makes a copy-paste, so if I use it IN a function, then all function will be in function scope, am I right? SanTa - Original Message - From: "Robert Cummings" To: "Virgilio Quilario" Cc: "Sándor Tamás (HostWare Kft.)" ; Sent: Wednesday, March 11, 2009 1:55 PM Subject: Re: [PHP] Silly question - include vs. eval On Wed, 2009-03-11 at 20:49 +0800, Virgilio Quilario wrote: >> Hi, >> >> I wondering what is the difference between include(), and eval(' >> ?>'.file_get_content().' >> >> If there is something I should be aware, please, let me know. > > Use include since it allows a cache like eAccelerator or APC to work. > Eval never gets cached. Also, include let's the engine do the opening, > reading, closing of the file while also parsing and running the > contents > in one fell function call (yes I know it's not a function). What you > have above, using eval, is a bastardization of cleanliness and > succinctness of code. > > Cheers, > Rob. hi, eval is useful when your php code is stored in database. read here http://www.php.net/manual/en/function.eval.php for details. I'm going to go out on a limb here... it would probably make your application faster if you used a file based cache for content to be eval'd and then included the cached file instead. Then whatever accelerator is in play can do it's thing on the code. But the poster didn't ask about content in general, he asked about the difference between include and eval'ing content acquired from a file. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Silly question - include vs. eval
Hi, I wondering what is the difference between include(), and eval(' ?>'.file_get_content().'
Re: [PHP] Code Not entering the value in the Database
Did I miss something, or you really left the execution of the last $sql? After you put the 'INSERT INTO...' string in $sql, you have to mysql_query it, or you won't get any result. SanTa - Original Message - From: "Chris Carter" To: Sent: Tuesday, January 20, 2009 3:34 PM Subject: [PHP] Code Not entering the value in the Database Hi, My code is not giving error but not doing the desired action. I need to append a value in database just when the user logs in after entering the username and password. So I am not presenting the user with a account but just a thank you page. Steps: 1) User enters the user name and password 2) The login form contains a hidden field with a data 3) After hitting the Submit button the username and password is checked. 4) The hidden data is entered in the database. 5) A mail is sent to the user and he gets a Thank You page. 6) If verification fails then he gets a registeration page. Here is the code, I have been struggling with: What exactly am I missing. Thanks in advance, Chris -- View this message in context: http://www.nabble.com/Code-Not-entering-the-value-in-the-Database-tp21564252p21564252.html Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Finger
Hi, My problem is that how I can know that a valid e-mail address is exists on the mail server? Is there some PHP function, or protocol, or something? Thanks, SanTa
Re: [PHP] Firebird Backup
Sure, you're right. I wouldn't normally do this, but this is the only way. I took a look at ibWebAdmin. It simply calls the host machine's Firebird gbak utility. So I had to know the exact path to this utility on the linux based web server. But I don't know. In fact I don't have any access to this machine, only FTP and of course, web. The PHP installation doesn't even let me to do exec_command(). SanTa - Original Message - From: "Lester Caine" To: Sent: Wednesday, January 07, 2009 9:07 AM Subject: Re: [PHP] Firebird Backup Sándor Tamás (HostWare Kft.) wrote: Hi, I don't know if it's Firebird or PHP question. Bit of both - probably worth moving to the firebird-php list http://groups.yahoo.com/group/firebird-php/ I want to use remote administration on one of my pages, at least do a backup for a Firebird database. Because the database file is located on a different intranet machine, I have to use service manager to do backup. So I tried: $svc_mgr = ibase_service_attach(FBSERVER, FBUSER, FBPASS); if ($svc_mgr) { $bkp = ibase_backup($svc_mgr, $source_db, $dest_file, IBASE_BKP_NO_GARBAGE_COLLECT, true); } ibase_service_detach($svc_mgr); The bad thing: if I include "server:" in $source_db string, it gives me an "unkown ISC 0 error". When I simply put the database alias in $source_db, it freezes the whole apache, but at least it starts the backup... Then, when I turn off verbose, it does nothing at all, but gives back a "true" value. So I think the closest solution is the second one, but does anybody have any idea why it shuts down apache? And what can I do to prevent this? I use Firebird 2.1, PHP 5.2.8 and Apache 2.2.3 on WinXP (as a development environment) ibase_backup is not something we would use normally. I think that things have advanced somewhat since the function was created, and I suspect it simply does not know about those changes. I've not checked what ibWebAdmin does currently :( One of the nice features of Firebird is the ability to backup while still working with the database, and so it's more normal to have backup happening as a background task, or via one of the management tools. -- Lester Caine - G8HFL - Contact - http://lsces.co.uk/lsces/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk// Firebird - http://www.firebirdsql.org/index.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Firebird Backup
Hi, I don't know if it's Firebird or PHP question. I want to use remote administration on one of my pages, at least do a backup for a Firebird database. Because the database file is located on a different intranet machine, I have to use service manager to do backup. So I tried: $svc_mgr = ibase_service_attach(FBSERVER, FBUSER, FBPASS); if ($svc_mgr) { $bkp = ibase_backup($svc_mgr, $source_db, $dest_file, IBASE_BKP_NO_GARBAGE_COLLECT, true); } ibase_service_detach($svc_mgr); The bad thing: if I include "server:" in $source_db string, it gives me an "unkown ISC 0 error". When I simply put the database alias in $source_db, it freezes the whole apache, but at least it starts the backup... Then, when I turn off verbose, it does nothing at all, but gives back a "true" value. So I think the closest solution is the second one, but does anybody have any idea why it shuts down apache? And what can I do to prevent this? I use Firebird 2.1, PHP 5.2.8 and Apache 2.2.3 on WinXP (as a development environment) Thanks, SanTa -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First record not diplaying
Yes, the error is here. You get the record count with a mysql_fetch_assoc(), which reads the first record, and then step onto the next one. So the first record's datas will disappear at the next mysql_fetch_assoc() line (which can be found in your while loop). You should NOT fetch the first record, unless you fetch it in a variable to process datas at a later time. SanTa - Original Message - From: "Gary Maddock-Greene" To: Sent: Monday, December 22, 2008 3:49 PM Subject: Re: [PHP] First record not diplaying Thanks Dan, So my error is here? $colname_rsSearch = "-1"; if (isset($_GET['product_name'])) { $colname_rsSearch = $_GET['product_name']; } mysql_select_db($database_sondia_lighting, $sondia_lighting); $query_rsSearch = sprintf("SELECT * FROM products WHERE product_name LIKE %s", GetSQLValueString("%" . $colname_rsSearch . "%", "text")); $rsSearch = mysql_query($query_rsSearch, $sondia_lighting) or die(mysql_error()); $row_rsSearch = mysql_fetch_assoc($rsSearch); $totalRows_rsSearch = mysql_num_rows($rsSearch); -- - Gary Maddock-Greene ""Dan Shirah"" wrote in message news:a16da1ff0812220635j6a77c35ga2e74588671dc...@mail.gmail.com... > Hi, I seem to have a bug in my code but can't see why. My first record does not display when I run a search. Can anyone spot what I have done wrong? Thanks if (0 == $totalRows_rsSearch) { echo "Sorry no products were found"; } else { echo "Please click on a product for further information."; while ($row_rsSearch = mysql_fetch_assoc($rsSearch)){ echo " - Gary Maddock-Greene Is this another one of your classes? I see your email address links to a web page created for a class. Without the rest of the code (the code above what you have placed) and the end of the echo line you have provided, all any of us can do is a guess. However one thing to note, this list was not created to help you with your homework and with the previous postings you have written, it is pointedly answering different places you have stumbled in your work and haven't checked your book, the online resources, or a TA. Wolf Like Wolf said...we need more code :) My "guess" would be that you probably have the default value of your row count set to start at 1...but the results of an array start at 0...therefore your first row is being cutoff? -- 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] First record not diplaying
How do you know the record count for the query? SanTa - Original Message - From: "Gary Maddock-Greene" To: Sent: Monday, December 22, 2008 3:02 PM Subject: [PHP] First record not diplaying Hi, I seem to have a bug in my code but can't see why. My first record does not display when I run a search. Can anyone spot what I have done wrong? Thanks if (0 == $totalRows_rsSearch) { echo "Sorry no products were found"; } else { echo "Please click on a product for further information."; while ($row_rsSearch = mysql_fetch_assoc($rsSearch)){ echo " - Gary Maddock-Greene -- 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] Variable name for constants?
... and in that way, you can create the name of the constant as you please: $VAR_IMG = 'HOME'; define('IMG_HOME', 'pic.jpg'); echo(constant('IMG_'.$VAR_IMG)); SanTa - Original Message - From: "clive" <[EMAIL PROTECTED]> To: "PHP LIST" Sent: Thursday, December 11, 2008 9:18 AM Subject: Re: [PHP] Variable name for constants? I dont think you can do that with a constant, but you can do this a normal variable: I stand under correction form my previous email, it can be done: define('TEST', 'the value of constant TEST'); $var= 'TEST'; echo constant($var); -- 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] Help with IF ELSE
In fact, if I have to redirect, and I am not sure about headers are sent or not, I usually do: print('window.location=somewhere.php'); That way I can always do the redirection. SanTa - Original Message - From: "Andrew Ballard" <[EMAIL PROTECTED]> To: "David Stoltz" <[EMAIL PROTECTED]> Cc: Sent: Friday, December 05, 2008 3:52 PM Subject: Re: [PHP] Help with IF ELSE On Fri, Dec 5, 2008 at 6:42 AM, David Stoltz <[EMAIL PROTECTED]> wrote: I turned on error reporting (ALL) as you suggested. Nothing is being sent to the browserstill doesn't work if the recordset isn't empty. I'm wondering, is there any other way to do a redirect in PHP? Thanks That is how you do redirects in PHP. I believe you've got several solutions to your actual problem by now (I like tedd's with either md5 or sha1), but since you asked... There is a note in the documentation for header() that says HTTP/1.1 requires absolute URIs instead of relative ones as those in your example. You can also pass the response code in the third parameter (in which case you can use the 303 SEE OTHER code that was intended for the typical redirect rather than the 302 FOUND that most sites use), but it isn' t necessary since PHP automatically sets a 302 on a Location: header when the parameter is empty. http://www.php.net/header Andrew -- 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] Help with IF ELSE
The solution is addslashes(). This function adds a backslash before special characters in a string. http://php.net/manual/en/function.addslashes.php SanTa - Original Message - From: "David Stoltz" <[EMAIL PROTECTED]> To: Sent: Friday, December 05, 2008 1:19 PM Subject: RE: [PHP] Help with IF ELSE The problem turned out to be, since I'm using the MCRYPT function to encrypt the password, once in a while the encrypted password will have a bad character: ßt¦?rDþž’Q…ß±– For example, the above has ’ This stops the PHP processing cold when executing the query to insert that string - no errors at all - just stops processing - and I do have display_errors turned on. So then, how does one store this type of string? I can't do a string replacebut there must be a way... If anyone has come across this, please let me know... Thanks! -Original Message- From: Sándor Tamás (HostWare Kft.) [mailto:[EMAIL PROTECTED] Sent: Friday, December 05, 2008 6:59 AM To: php-general@lists.php.net Subject: Re: [PHP] Help with IF ELSE You should check if php.ini has display_error off. This can prevent all error message to be shown. SanTa - Original Message - From: "David Stoltz" <[EMAIL PROTECTED]> To: "Richard Heyes" <[EMAIL PROTECTED]> Cc: Sent: Friday, December 05, 2008 12:42 PM Subject: RE: [PHP] Help with IF ELSE I turned on error reporting (ALL) as you suggested. Nothing is being sent to the browserstill doesn't work if the recordset isn't empty. I'm wondering, is there any other way to do a redirect in PHP? Thanks -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Richard Heyes Sent: Thursday, December 04, 2008 3:17 PM To: David Stoltz Cc: php-general@lists.php.net Subject: Re: [PHP] Help with IF ELSE I'm new to PHP - I'm trying to figure out what is wrong with a simple IF ELSE block I have...if the recordset $rs is empty (login fails), the 1st part of the block works, and redirects the user to default.php - but if the login works, and $rs is not empty, the 2nd "else" part does not work, and does not redirect to menu.php - I just get a blank white screen on the login.php page (where this code is) You could try setting error_reporting() to full before you do anything, it may help, and it's always prudent to use it that way: Additionally, redirects fail when you've sent output to the browser, even if its just whitespace. Your code looks OK, but check for it. The error reporting thang may help you with that. -- Richard Heyes HTML5 Graphing for FF, Chrome, Opera and Safari: http://www.rgraph.org (Updated November 29th) -- 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] Help with IF ELSE
For your original problem: If you're unsure if you've sent something to the browser BEFORE the header(), you should check it with header_sent(). This function returns true if something has been sent to the browser. SanTa - Original Message - From: "David Stoltz" <[EMAIL PROTECTED]> To: "Richard Heyes" <[EMAIL PROTECTED]> Cc: Sent: Friday, December 05, 2008 12:42 PM Subject: RE: [PHP] Help with IF ELSE I turned on error reporting (ALL) as you suggested. Nothing is being sent to the browserstill doesn't work if the recordset isn't empty. I'm wondering, is there any other way to do a redirect in PHP? Thanks -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Richard Heyes Sent: Thursday, December 04, 2008 3:17 PM To: David Stoltz Cc: php-general@lists.php.net Subject: Re: [PHP] Help with IF ELSE I'm new to PHP - I'm trying to figure out what is wrong with a simple IF ELSE block I have...if the recordset $rs is empty (login fails), the 1st part of the block works, and redirects the user to default.php - but if the login works, and $rs is not empty, the 2nd "else" part does not work, and does not redirect to menu.php - I just get a blank white screen on the login.php page (where this code is) You could try setting error_reporting() to full before you do anything, it may help, and it's always prudent to use it that way: Additionally, redirects fail when you've sent output to the browser, even if its just whitespace. Your code looks OK, but check for it. The error reporting thang may help you with that. -- Richard Heyes HTML5 Graphing for FF, Chrome, Opera and Safari: http://www.rgraph.org (Updated November 29th) -- 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] Help with IF ELSE
You should check if php.ini has display_error off. This can prevent all error message to be shown. SanTa - Original Message - From: "David Stoltz" <[EMAIL PROTECTED]> To: "Richard Heyes" <[EMAIL PROTECTED]> Cc: Sent: Friday, December 05, 2008 12:42 PM Subject: RE: [PHP] Help with IF ELSE I turned on error reporting (ALL) as you suggested. Nothing is being sent to the browserstill doesn't work if the recordset isn't empty. I'm wondering, is there any other way to do a redirect in PHP? Thanks -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Richard Heyes Sent: Thursday, December 04, 2008 3:17 PM To: David Stoltz Cc: php-general@lists.php.net Subject: Re: [PHP] Help with IF ELSE I'm new to PHP - I'm trying to figure out what is wrong with a simple IF ELSE block I have...if the recordset $rs is empty (login fails), the 1st part of the block works, and redirects the user to default.php - but if the login works, and $rs is not empty, the 2nd "else" part does not work, and does not redirect to menu.php - I just get a blank white screen on the login.php page (where this code is) You could try setting error_reporting() to full before you do anything, it may help, and it's always prudent to use it that way: Additionally, redirects fail when you've sent output to the browser, even if its just whitespace. Your code looks OK, but check for it. The error reporting thang may help you with that. -- Richard Heyes HTML5 Graphing for FF, Chrome, Opera and Safari: http://www.rgraph.org (Updated November 29th) -- 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] Picture downloading in IE
I don't think, because it happens on different machines, with different users. (one of them is a fresh install) SanTa - Original Message - From: Ramesh Thiruchelvam To: Sándor Tamás (HostWare Kft. ) Sent: Wednesday, December 03, 2008 12:05 PM Subject: Re: [PHP] Picture downloading in IE Hi Santa, It seems to be a problem in IE when damaged activex or a java object is in the cache. Try clearing your temporary internet files and see. http://support.microsoft.com/kb/810978 Kr, Ramesh On Wed, Dec 3, 2008 at 4:20 PM, Sándor Tamás (HostWare Kft. ) <[EMAIL PROTECTED]> wrote: Hi, I have a strange error / misfunction with PHP header and IE7. I render a JPG from a database BLOB to show it on a page. In Firefox, when the user clicks on the image, and selects "Save image as... ", (s)he can download it in JPG format. But when a user in IE7 does the same, (s)he only can getit in BMP. The header I sent is the same both case: header('Content-Type: image/pjpeg'); I tried to set Content-Disposition to "inline" or "attachment", set filename to different values, but get the same result. Now all I can say is "HEELP" :) Thanks, SanTa
[PHP] Picture downloading in IE
Hi, I have a strange error / misfunction with PHP header and IE7. I render a JPG from a database BLOB to show it on a page. In Firefox, when the user clicks on the image, and selects "Save image as... ", (s)he can download it in JPG format. But when a user in IE7 does the same, (s)he only can getit in BMP. The header I sent is the same both case: header('Content-Type: image/pjpeg'); I tried to set Content-Disposition to "inline" or "attachment", set filename to different values, but get the same result. Now all I can say is "HEELP" :) Thanks, SanTa
Re: [PHP] restricted file access
Through PHP you can access the filesystem, so the folder containing your documents doesn't even have to be on the website. I would do this way: Click here And in the PHP file: file_get_contents(DOCFOLDER . $_GET['filename']) or something like this. SanTa - Original Message - From: "Angelo Zanetti" <[EMAIL PROTECTED]> To: "'tedd'" <[EMAIL PROTECTED]>; Sent: Thursday, August 28, 2008 10:50 AM Subject: RE: [PHP] restricted file access Thanks for your reply. But what happens if the file is situated here: www.site.com/include/documents/file.doc and someone knows that path file somehow or they get a program to crawl the site. Then they would be able to get that file. How do we prevent that? Thanks in advance. -Original Message- From: tedd [mailto:[EMAIL PROTECTED] Sent: 27 August 2008 17:29 To: php-general@lists.php.net Subject: Re: [PHP] restricted file access At 4:13 PM +0200 8/27/08, Angelo Zanetti wrote: Hi all, We have a site and we have created an admin section where the admin can upload documents. We have made a user login section where they can view a list of the documents (from the DB) and download the file. We want to make the site however not allow ppl to type in the path of the document and retrieve the file. How is this accomplished? Are the documents stored in a hidden / non-web accessible directory? Or is this restricted with APACHE? Please advise Well...none of the above. I would have a php script deliver the files and not allow the user to see the path. Here's an example: http://php1.net/b/file-browser/index.php It would be a simple matter not to show the path but rather just show what's available to the user and then let the php script deliver the product to the user via a common url, like the demo does. In other words, the most that any user can get is the path to one spot where your script deposits the file for download. 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 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] Regexp to get paramname
Hi, I have these lines to get parameters' name to $regs, but I always get the first one twice. What do I do wrong? $sql = 'select * from hotsys where ALREND=:alrend and SYSKOD=:syskod'; eregi('(:[a-z,A-Z,0-9]+)', $sql, $regs); Thanks, SanTa -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Reporting mail as spam
Hi, I wrote a little registration routine, which will send a confirmation letter to the user with a random number in the message body (my site is on a host, so I can't write in the subject, and ask the user to reply), which can be clicked then, and my site will finish the registration. My big problem is, that this host inserts an X header to the mail which identifies my PHP script as the X-PHP. As I recognize, this header adds a huge number to the spam score. Is there any possibility, to reduce the other scores? By the way, what counts most in a spam? Thanks, SanTa
Re: [PHP] www. not working
"A form" of the web existing long before that depending on your definition of the web. To me it's a way for people to share information. That would cover the BBS world which pre-dates LANs by some distance. Spider webs have existed for many a year... Yeah, but when was the last time you saw porn on one of them?!! Do you know Black Widow? :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Tool for programmer team
It depends. If the project built up of slightly different modules, putting the coders on a big, white table seems to be a good idea. But if the modules are completely different, you should separate them, so each of them can be focused on their own subject. In this case, you have to have some people to make the whole project as one, seeing other programmers' works to combine. There are many tool you can use to manage the project. (I personally like open tools, like OpenProj which compatible with Microsoft Project, and if you want to have version controlling, I can suggest Microsoft Visual SourceSafe, or JEDI VCS). Each of them can handle a variety of subjects. OpenProj can organize jobs, and resources. Microsoft VSS and JEDI VCS are version controlling systems, which can handle the code itself, you can check-out modules, make changes, then check-in, so others can use your module as well. (and if you screwed something, you can change back to a previous version). I hope you can use these advices. And I think, your question is not definitely PHP question ... :) SanTa - Original Message - From: "Ronald Wiplinger" <[EMAIL PROTECTED]> To: "php-general" Sent: Tuesday, January 22, 2008 8:40 AM Subject: [PHP] Tool for programmer team What is a good tool to coordinate a team of programmers efficiently? To give each one a different part of the project is a start, but it needs to get combined at some points to be a working project. Not to debug code you have written was a hint, to see actually bugs as a bug and not as a feature. Some hinted let programmer be on different places, others say put them together on a big table, ... Where can I find more information about that subject? bye R -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to create multipart e-mail bodies?
Thanks, but unfortunately my ISP does not implemented PEAR, and uses PHP 4.3.10. - Original Message - From: <[EMAIL PROTECTED]> To: ""Sándor Tamás (HostWare Kft.)"" <[EMAIL PROTECTED]> Cc: Sent: Friday, December 07, 2007 12:07 PM Subject: Re: [PHP] How to create multipart e-mail bodies? Hi! You should take a look at... http://pear.php.net/package/Mail http://pear.php.net/package/Mail_Mime http://pear.php.net/manual/en/package.mail.mail-mime.php !!! http://pear.php.net/manual/en/package.mail.mail-mime.example.php !!! This should give you a perfect intro... My 2 cents. Rob - Ursprüngliche Nachricht ----- Von: "Sándor Tamás (HostWare Kft.)" <[EMAIL PROTECTED]> Datum: Freitag, Dezember 7, 2007 12:04 pm Betreff: [PHP] How to create multipart e-mail bodies? An: php-general@lists.php.net Hi, I don't know if it is a PHP question, but I give it a try. I've been trying this subject for a while, but with less success. Now I can create mail bodies like this: Content-Type: multipart/alternative; boundary="-=Part233475926a47beb07.46978329" ---=Part233475926a47beb07.46978329 Content-Type:text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Disposition: inline Hi there! ---=Part233475926a47beb07.46978329 Content-Type:text/html; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Disposition: inline Hi there! This will be fun! ---=Part233475926a47beb07.46978329-- But my mail client can't show any part of it. When I take a look at the source code, I can see that it recognise the boundaries, but somehow for some reason it doesn't show it. Any idea? Thanks, SanTa -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to create multipart e-mail bodies?
Hi, I don't know if it is a PHP question, but I give it a try. I've been trying this subject for a while, but with less success. Now I can create mail bodies like this: Content-Type: multipart/alternative; boundary="-=Part233475926a47beb07.46978329" ---=Part233475926a47beb07.46978329 Content-Type:text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Disposition: inline Hi there! ---=Part233475926a47beb07.46978329 Content-Type:text/html; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Disposition: inline Hi there! This will be fun! ---=Part233475926a47beb07.46978329-- But my mail client can't show any part of it. When I take a look at the source code, I can see that it recognise the boundaries, but somehow for some reason it doesn't show it. Any idea? Thanks, SanTa -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php