Re: [PHP] message to user after complete POST
hey, if you are just trying to give the user a feedback about the information sent, there is a Global variable for this, and it's the $_POST. When you receive the information on the script you called on the Action atribute of the form, via the $_POST global variable, you will test the information end echo the feedback on that script. Note that, unless you are using ajax (jquery, or any other javascript ajax method), when you post a form, you will be intantly redirected to the action path. then you have nothing to do in the source page. hope you got it. 2013/9/4 iccsi inu...@gmail.com I have a POST form and action itself like following form name=MyForm id=MyForm method=POST action=index.php /form I want to show success message when POST complete or error message if there is any. I would like to know are there any property or global variable I can check to show message to users. If not, it seems that the only solution is jQuery, since it has success function that jQuery call after POST. Your help and information is great appreciated, Regards, Iccsi, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Static utility class?
Hi, first, sorry for the bad English. Yes, at least, as far as I know, this is the perfect way to do what you want to do. Think like this: when you instanciate a class, you are allocating memory. If you don't need any information stored, then you don't need to allocate memory, right? So, it's is logic to have a class that you will call only one fragment when you need it, rather than load the entire class just for one method. Just be careful to organize your utility methods by by meaning. Don't put a method that make dating stuff and a method that write a random string in the same class. By doing so, you are breaking the object orientation purpose. 2013/9/4 Micky Hulse mickyhulse.li...@gmail.com Hi all! Example code: https://gist.github.com/mhulse/6441525 Goal: I want to have a utility class that contain utility methods which should have the option of being called multiple times on a page. I think my main goal is to avoid having to new things ... I don't really need to create an instance here (there's no need for a constructor in this case). Question: Is the above simple pattern a good way to have a class that calls static methods? To put it another way, is there any reason why I would not want to use the above code? Basically I want to wrap these simple functions in a nice class wrapper and have the ability to call them without having to jump through more hoops than is necessary. Are there any pitfalls to writing a class like this? Or, is this the standard way of writing a simple utility class for this type of situation? Please let me know if I need to clarify my questions. Thanks for your time?
Re: [PHP] htaccess to make html act as php suffixed files
Em Ter 11 Jun 2013 15:08:59 BRT, Matijn Woudt escreveu: On Tue, Jun 11, 2013 at 7:17 PM, Stuart Dallas stu...@3ft9.com wrote: On 11 Jun 2013, at 18:16, Tedd Sperling t...@sperling.com wrote: Hi gang: To get html pages to use php scripts, I've used: RewriteEngine on # handler for phpsuexec. -- this makes these prefixes considered for php FilesMatch \.(htm|html)$ SetHandler application/x-httpd-php /FilesMatch In a .htaccess file. However, it works on one site, but not on another -- any ideas as to why? At a rough guess there's an AllowOverride line in the main Apache config that's restricting what you can do in the .htaccess file. Or the .htaccess usage is not enabled at all in that site. ALSO, you have to be sure this site is using apache. Otherwise, .htaccess are not available. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Extremely slow cURL curl_exec execution/response with 5.4.13
Hi, The problem could be not related to php/curl, but related with dns resolve. Try to use the IP address. Regards. Rodrigo Mourao Webjump - www.webjump.com.br
Re: [PHP] Unexpected behavior of max() function
A solution to it is, if you can, enter the array itens without the commas, just array(100,110.453351020813,9); Em 11-12-2012 05:05, Andreas Perstinger escreveu: On 11.12.2012 07:48, Рогулин С.В. wrote: I encountered with unexpected behavior of max() function. When i pass a parameter ['100', '110,453351020813', '9'], this function gives answer '9' var_dump( max(array('100', '110,453351020813', '9')) ); // will output: // string(1) 9 As the output tells you, you are comparing strings and the character '9' is greater than the character '1' (at the beginning of the two other strings). Bye, Andreas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with my login script
Hello Thomas. The if are being evaluated in all iterations of the while, the problem is you didn't stop the loop when it finds what it's searching for. Try putting a break in the end of the if, them, when the condition match, the while will stop. And hey! You're using a lot of legacy code for one that is learning php. If you want, I can give you some tips to modernize your script ;) Regards, Rodrigo Silva dos Santos. Enviado por Samsung Mobile Thomas Conrad koopasfore...@gmail.com escreveu: I'm currently learning php and as a challenge, I'm creating a login script using text files to store the information (until I learn how to handle databases with php). The problem I'm having is the if statement in my while loop is only evaluated on the last iteration of the while loop, so its only comparing the last username in the file and no others. Heres the code: ?php session_start(); $users = file(../inc/users.inc.php); if($_POST['username'] $_POST['password']){ if(ereg(^[^@ ]+@[^@ ]+\.[^@ \.]+$, $_POST['username'])){ while(list($id ,$username) = each($users)){ if($_POST['username'] == $username){ $_SESSION['logged_in'] = 1; $_SESSION['username'] = $username; } } if($_SESSION['logged_in'] != 1){ $error = 2; } }else{ $error = 4; } }else{ $error = 3; } if($error){ header(Location: http://koopasforever.com/scripts/login.php?error=$error;); }else{ header(Location: http://koopasforever.com/;); } ? I have checked all my variables and they all contain the proper information Some help would be greatly appriciated, Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with my login script
Better solution than mine (that don't even make a code) As a Oo developer, a run away from using switch, so I should never use break too... Good to know. By the way, what's the problem with it? Enviado por Samsung Mobile Bálint Horváth hbal...@gmail.com escreveu: The problem was already solved. I forgot to send a copy to the list... Rodrigo, break!? Ohh man, it's a crazy idea... A developer DOES NOT use break at all (in a loop)... (switch is an exception) In the other hand Thomas, you should use while and count the lines and u need to test if username found... Yeah, this script is near to the good solution: ?php session_start(); $users = file(users.inc.php); if (!empty($_POST['username']) !empty($_POST['password'])) { if (filter_var($_POST['username'], FILTER_VALIDATE_EMAIL)) { $ui = 0; while ($ui count($users) $error != 0) { $user = explode(' ', trim($users[$ui])); if ($_POST['username'] == $user[1]) { $_SESSION['logged_in'] = 1; $_SESSION['username'] = $user[1]; $error = 0; } else{ $error = 2; } $ui++; } } else { $error = 4; } } else { $error = 3; } if ($error == 0) { print(redirecting); } else { print(error: . $error); } ? On Tue, Oct 2, 2012 at 8:52 AM, Thomas Conrad koopasfore...@gmail.comwrote: I'm currently learning php and as a challenge, I'm creating a login script using text files to store the information (until I learn how to handle databases with php). The problem I'm having is the if statement in my while loop is only evaluated on the last iteration of the while loop, so its only comparing the last username in the file and no others. Heres the code: ?php session_start(); $users = file(../inc/users.inc.php); if($_POST['username'] $_POST['password']){ if(ereg(^[^@ ]+@[^@ ]+\.[^@ \.]+$, $_POST['username'])){ while(list($id ,$username) = each($users)){ if($_POST['username'] == $username){ $_SESSION['logged_in'] = 1; $_SESSION['username'] = $username; } } if($_SESSION['logged_in'] != 1){ $error = 2; } }else{ $error = 4; } }else{ $error = 3; } if($error){ header(Location: http://koopasforever.com/scripts/login.php?error=$error;); }else{ header(Location: http://koopasforever.com/;); } ? I have checked all my variables and they all contain the proper information Some help would be greatly appriciated, Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with my login script
Make sense, I haven't ever realizad how old the code appears like when it haves a break. Fell like C. Livin' n' learnin'. Thanks! Enviado por Samsung Mobile Bálint Horváth hbal...@gmail.com escreveu: As a Oo developer, a run away from using switch - I don't understand this: OOP and switch could be good together and I also prefer switch eg. at action or page selection... break is an old stuff and not a nice solution (like goto)... killing a procedure!? -means wrong planning of an app! (and jumping in the code with goto also like this) On Tue, Oct 2, 2012 at 12:11 PM, Rodrigo Silva dos Santos rodrigos.santo...@gmail.com wrote: Better solution than mine (that don't even make a code) As a Oo developer, a run away from using switch, so I should never use break too... Good to know. By the way, what's the problem with it? Enviado por Samsung Mobile Bálint Horváth hbal...@gmail.com escreveu: The problem was already solved. I forgot to send a copy to the list... Rodrigo, break!? Ohh man, it's a crazy idea... A developer DOES NOT use break at all (in a loop)... (switch is an exception) In the other hand Thomas, you should use while and count the lines and u need to test if username found... Yeah, this script is near to the good solution: ?php session_start(); $users = file(users.inc.php); if (!empty($_POST['username']) !empty($_POST['password'])) { if (filter_var($_POST['username'], FILTER_VALIDATE_EMAIL)) { $ui = 0; while ($ui count($users) $error != 0) { $user = explode(' ', trim($users[$ui])); if ($_POST['username'] == $user[1]) { $_SESSION['logged_in'] = 1; $_SESSION['username'] = $user[1]; $error = 0; } else{ $error = 2; } $ui++; } } else { $error = 4; } } else { $error = 3; } if ($error == 0) { print(redirecting); } else { print(error: . $error); } ? On Tue, Oct 2, 2012 at 8:52 AM, Thomas Conrad koopasfore...@gmail.comwrote: I'm currently learning php and as a challenge, I'm creating a login script using text files to store the information (until I learn how to handle databases with php). The problem I'm having is the if statement in my while loop is only evaluated on the last iteration of the while loop, so its only comparing the last username in the file and no others. Heres the code: ?php session_start(); $users = file(../inc/users.inc.php); if($_POST['username'] $_POST['password']){ if(ereg(^[^@ ]+@[^@ ]+\.[^@ \.]+$, $_POST['username'])){ while(list($id ,$username) = each($users)){ if($_POST['username'] == $username){ $_SESSION['logged_in'] = 1; $_SESSION['username'] = $username; } } if($_SESSION['logged_in'] != 1){ $error = 2; } }else{ $error = 4; } }else{ $error = 3; } if($error){ header(Location: http://koopasforever.com/scripts/login.php?error=$error;); }else{ header(Location: http://koopasforever.com/;); } ? I have checked all my variables and they all contain the proper information Some help would be greatly appriciated, Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: problem with my login script
To break or not to break? that's the question... All that fight makes me (and, I think that Thomas too) learn a bit more about all of this. And for finish with all of it. I think that if something is not deprecated, is because it's is a good idea to use it somewhere. If the Language developers think that way, i will not discord. Regards. Em 02-10-2012 10:35, Thomas Conrad escreveu: My problem was solved no need to argue. I don't see why use a while loop with a count variable when it produces the same result as a foreach loop. As for using a break in the loop, I could add it but the loop is gonna stop anyway as soon as it hits the end of the array. I also didn't see the point in using the explode() function as long as I remove the (in my opinion) useless index numbers from the text file containing the username. The following code works as I expect it to: ?php session_start(); $users = file(../inc/users.inc.php); if(!empty($_POST['username']) !empty($_POST['password'])){ if(filter_var($_POST['username'], FILTER_VALIDATE_EMAIL)){ foreach($users as $row){ $row = trim($row); if($_POST['username'] == $row){ $_SESSION['logged_in'] = 1; $_SESSION['username'] = $row; } } if($_SESSION['logged_in'] != 1){ $error = 2; } }else{ $error = 4; } }else{ $error = 3; } if($error){ header(Location:); }else{ header(Location:); } ? users.inc.php: m...@email1.com m...@email2.com
Re: [PHP] base64_decode
Hello John. This code generates the following html: ? /div div id=footera href=http://web-hosting-click.com/; title=Web hostingWeb hosting/a !-- 27 queries. 0.561 seconds. -- /div ?php wp_footer(); ? /body /html ? Appears that is nothing dangerous, only unauthorized advertising. Em 02-10-2012 14:27, John Taylor-Johnston escreveu: Without anyone infecting their machines, can someone tell me what this is? I found a phishing site on my DreamHost server. DreamHost has been very helpful. We found a file containing this code. What is it? What does it contain? ?php eval(base64_decode('Pz4gPC9kaXY+DQo8ZGl2IGlkPSJmb290ZXIiPjxhIGhyZWY9Imh0dHA6Ly93ZWItaG9zdGluZy1jbGljay5jb20vIiB0aXRsZT0iV2ViIGhvc3RpbmciPldlYiBob3N0aW5nPC9hPg0KPCEtLSAyNyBxdWVyaWVzLiAwLjU2MSBzZWNvbmRzLiAtLT4NCjwvZGl2Pg0KPD9waHAgd3BfZm9vdGVyKCk7ID8+DQo8L2JvZHk+DQo8L2h0bWw+IDw/'));?
[PHP] Crudin - CRUD INterface Generator - Open Source Project
Hi, I am the creator of a open source project called Crudin (http://crudin.smarc.com.br/en) Crudin is a system for generation of fron-ends in the MySQL, writted in PHP Without needing to program nothing you get a complete platform with operations CRUD (Create, Read, Update and Delete) and much more Crudin mounts relations, to make upload of archives and images, treat fields enum/set and much more All you need is any MySQL database! Official Site: http://crudin.smarc.com.br/en Demonstration: http://crudin.smarc.com.br/demo username: demo password: demo Regards, Rodrigo A. Rodriguez Em 25/05/2012 18:01, php-general-h...@lists.php.net escreveu: Hi! This is the ezmlm program. I'm managing the php-general@lists.php.net mailing list. I'm working for my owner, who can be reached at php-general-ow...@lists.php.net. Acknowledgment: I have added the address rodrigo.alm...@gmail.com to the php-general mailing list. Welcome to php-general@lists.php.net! Please save this message so that you know the address you are subscribed under, in case you later want to unsubscribe or change your subscription address. --- Administrative commands for the php-general list --- I can handle administrative requests automatically. Please do not send them to the list address! Instead, send your message to the correct command address: For help and a description of available commands, send a message to: php-general-h...@lists.php.net To subscribe to the list, send a message to: php-general-subscr...@lists.php.net To remove your address from the list, just send a message to the address in the ``List-Unsubscribe'' header of any list message. If you haven't changed addresses since subscribing, you can also send a message to: php-general-unsubscr...@lists.php.net or for the digest to: php-general-digest-unsubscr...@lists.php.net For addition or removal of addresses, I'll send a confirmation message to that address. When you receive it, simply reply to it to complete the transaction. If you need to get in touch with the human owner of this list, please send a message to: php-general-ow...@lists.php.net Please include a FORWARDED list message with ALL HEADERS intact to make it easier to help you. --- Enclosed is a copy of the request I received. Return-Path:rodrigo.alm...@gmail.com Received: (qmail 71228 invoked from network); 25 May 2012 21:01:37 - Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 May 2012 21:01:37 - Return-Path:rodrigo.alm...@gmail.com Authentication-Results: pb1.pair.com smtp.mail=rodrigo.alm...@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rodrigo.alm...@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.170 as permitted sender) X-PHP-List-Original-Sender: rodrigo.alm...@gmail.com X-Host-Fingerprint: 209.85.220.170 mail-vc0-f170.google.com Received: from [209.85.220.170] ([209.85.220.170:33650] helo=mail-vc0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 99/12-55952-033FFBF4 forphp-general-sc.1337979632.kkandladimnlbpfgghko-rodrigo.almeid=gmail@lists.php.net; Fri, 25 May 2012 17:01:37 -0400 Received: by vcbfk1 with SMTP id fk1so781120vcb.29 forphp-general-sc.1337979632.kkandladimnlbpfgghko-rodrigo.almeid=gmail@lists.php.net; Fri, 25 May 2012 14:01:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=; b=pr0LaUP94qEFtqVrjJUCKGXGKNiuigd5BI0ssCxji9OJqseEa8Il97CEeIBpLqYAsb lEyn0yFWkSFZeAx+DW/hOmqYrj16OxHGNbnV2ZOQ1Kmuy0lIgzW1hhLaKa8Ml6zluxwZ RIlYr8ZffIzv5eCyMKGDsm6R66z5UvzeHbWZ9s24a3PCmp1AaMxdA129Q0H8Q+G3TR5J sSHR6lrRDq9Tm97NrxVdo/H+3DLDTCEk+R7bF8kaG2MXgmNEIRgfBuOcvz080TCqxyUV 43vyeyYD1Lsps7VbL2T+ZUqZ1M97Vhs/39qEtVcl60K6fIgMbzCAMHSZKD0M45kXtvDj nDbw== Received: by 10.220.215.136 with SMTP id he8mr409634vcb.13.1337979694087; Fri, 25 May 2012 14:01:34 -0700 (PDT) Return-Path:rodrigo.alm...@gmail.com Received: from [192.168.0.2] ([189.121.236.2]) by mx.google.com with ESMTPS id c17sm5994095vdj.11.2012.05.25.14.01.32 (version=SSLv3 cipher=OTHER); Fri, 25 May 2012 14:01:33 -0700 (PDT) Message-ID:4fbff327.7090...@gmail.com Date: Fri, 25 May 2012 18:01:27 -0300 From: Rodrigo de Almeida Rodriguezrodrigo.alm...@gmail.com User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: php-general-sc.1337979632.kkandladimnlbpfgghko-rodrigo.almeid=gmail@lists.php.net Subject: Re: confirm subscribe to php-general@lists.php.net References:1337979632.71180.ez...@lists.php.net In-Reply
Re: [PHP] password field validation
prueba con trim() : $pass=trim($_POST[PASSSWORD]); if (empty($pass)) { $GERROR=TRUE; } Atte. Rodrigo (09) 7 7996571 On Thu, Mar 12, 2009 at 4:05 PM, Jason Todd Slack-Moehrle mailingli...@mailnewsrss.com wrote: Hi All, I have an input field with type=password. I am trying to do some error checking to see if the user puts a value in after they submit the form (i.e not left it blank) Here is what I have: on form: Password: input id=PASSWORD name=PASSWORD type=password size=15 In PHP error checking: if (empty($_POST[PASSSWORD])) { $GERROR=TRUE;} even though I am putting characters in the field before I submit I am always getting TRUE returned. This same tactic works for other fields I have that I need to make sure they put values in, just I have never done this before with a password field. What am I doing wrong? I just want to make sure they put something there! -Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP 5.3.0alpha3
Lukas Kahwe Smith wrote: Hello! Johannes has packaged PHP 5.3.0alpha3, which you can find here: http://downloads.php.net/johannes/ Windows binaries thanks to Pierre, which are available here: http://windows.php.net/qa/ Please test it carefully, and report any bugs in the bug system, but only if you have a short reproducable test case. It seems unlikely that we will be able to release a beta this year. However we currently do not plan another alpha release unless we find larger issues in the namespace changes. Please also note that the documentation for namespaces has been updated already: http://php.net/namespace regards, Johannes and Lukas All links at http://windows.php.net/qa/ are 404. -- Rodrigo Saboya -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What is the practical use of abstract and interface?
Just adding one line to the topic... Interfaces are like C or C++ headers files. Them are used to another class(program in C) to call methods without care the implementation. In other hand abstract classes are (as the name says) an abstract way to use multiple specializations of the same group of classes. Like vehicle is an abstraction to car, motorbike, bike... with that you can use the method ride to all these vehicles using an vehicle variable pointing to an instance of car, motorbike or bike. Cheers. Rodrigo Reis. 2008/4/15, Jay Blanchard [EMAIL PROTECTED]: [snip] ...stuff... [/snip] The practical use of an abstract class is in its ability to define criteria for classes that inherit from it. How practical would it be to define a 'truck' class with 4 wheels and then define a 'car' class with 4 wheels when we could define an abstract class that defines vehicles with 4 wheels? Both of our classes can now inherit from that abstract class and we can define features only relevant to them. If you refactor diligently you will no doubt find places where you need to create abstract classes. The methods that are exposed by an object define the interface for that object. It is how everything outside of the object interacts with the object. You don't have to know how the method works all you need is the interfacelike the gas pedal on the car. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Atenciosamente, Rodrigo.
[PHP] Help with SSH2 persistent connection in php
Hi, I want to make an persistent connection via ssh2 to a server with php, but all I can get with the present API is an temporary connection that is lost at end of the script. Anyone have an idea of how I can save the Resource and reuse it on future scripts instead of having to reconnect over and over again? Thanks, Rodrigo.
Re: [PHP] Slashes, include, AJAX?
Nathan Nobbe wrote: On 10/25/07, *Rodrigo Poblanno Balp* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Nathan Nobbe wrote: On 10/25/07, *Rodrigo Poblanno Balp* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hi everybody! I'm building a small ajax app which consists of only 3 php files. index.php which contains all the app and has a couple of links. When a link is clicked an Ajax request is sent to the server (using prototype) to the url central.php with only one parameter 'id'. Depending on that parameter, central.php should look for the appropiate content, in this case link1.php. Then I return a JSON object with the things that should be updated on index.php So this is the pseudo-code: index.php html... body a href= onclick=[send the Ajax request using prototype with the id = 1]Link #1/a div id=theUpdatableDIV/div /body central.php html... body ?php [read the id parameter] switch(id){ case 1: //which is the only case for now!! //build the JSON object $output = array(title = Link #1 Title!, content=file_get_contents(link1.php));//here I read the last file which has the content to be updated asynchronously return [the JSON object based on $output]; break; } ? /body link1.php divWelcome to the content of link #1 which was updated using a href= ajax.org http://ajax.orgajax/a/div the JSON object is formed ok, now, my problem is that link1.php outputs like this: divWelcome to the content of link #1 which was updated using a href=ajax.org http://ajax.orgajax\/a\/div So at the moment I update the div id=theUpdatableDIV element on index.php, I get no real content, but a string with the strange slashes. I've tried: stripslashes, ereg_replace, str_replace and strtr to eliminate the wierd slashes. Can anybody tell how to do it right? how are you building the json object? i recommend json_encode(utf8_encode($dataToEncode)); if youre using php5. if youre using php4, try this: http://mike.teczno.com/JSON/JSON.phps also, you might want to check out firebug for firefox. it will let you easily analyze the interaction between the client and server. also, to verify that the json object youre generating is infact ok; run it through here: http://www.jslint.com/ -nathan Hi Nathan, I'm using php5, and I'm building the JSON object just like that, with the json_encode. The problem with using utf_encode apart from the original is that I get the \n\r for each line in the file read. Any suggestions? Thanx are you running windows? im guessing those are newline characters in windows format that arent getting interpreted correctly on the client side. you might try stripping out the newline characters prior to encoding the data. $jsonOut = json_encode(utf8_encode(str_replace(\r\n, '', $stringToEncode))); also, what are you trying to encode? if you are encoding arrays or objects (php that is) you will have to utf8_encode all the elements of those complex datums prior to handing them to json_encode() for the final output. -nathan Hi again Nathan, well I actually did that before, using the str_replace to eliminate al the windows \r\n, but the big problem isn't that the HTML code is being escaped too. I get something like divthis is the content\/div it seems like the '/' is being escaped, but I need it as HTML. Balpo
Re: [PHP] Slashes, include, AJAX? {SOLVED}
Nathan Nobbe wrote: On 10/26/07, *Rodrigo Poblanno Balp* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: I get something like divthis is the content\/div it seems like the '/' is being escaped, but I need it as HTML. how are you using the json object on the client-side after its sent by the server? below is a json snippet from an application of mine, many of the tags look the same as what youve shown (because theyve been encoded the same way). ive have not encountered the problem you have, that is, the escape characters do not pass though when i splice them into the DOM. im using the same encoding technique i recommended within PHP. on the client side i instantiate the json object as follows: var htmlUpdates = eval(( + transport.responseText + )); if you use a string directly on the client side, the escape characters will pass through, however, if you run it through eval(), the escape characters will be stipped out by the javascript interpreter. im not sure whats going on, but im starting to think its something on the client side.. -nathan {prevUpperNavId:0:0,nextUpperNavId:1:1,breadcrumb:,leftContent:p\nPHP is very interesting . One of it's greatest strengths is the gradient of development\npossibilities. A new PHP writer can easily publish their first dynamic page in a matter\nof minutes. Using PHP's integrated templating system, PHP scripts can be escaped at any time.\nSo escaping them simply outputs anything text directly as it appears in the script. By adding\nscript tags into large pages of code and dropping in PHP function calls, dynamic pages are easily\nobtained.br\/\nbr\/\nAlthough handy, this isnt often the greatest technique for developing highly reusable or readable code.\nPHP offers many options for templating HTML . This is just the beginning. As a PHP developer, you will\nfind yourself needing to know a lot of technologies.\n\/p,rightContent:div\np\n\tHere is a small list of terms and acronyms one might encounter working with PHP;\n\thow many do you recognize?\n\/p\n\tul\n\t\tli\n\t\t\tObject Oriented Programming\n\t\t\/li\n\t\tli\n\t\t\tDesign Patterns\n\t\t\/li\n\t\tli\n\t\t\tMVC\n\t\t\/li \n\t\tli\n\t\t\tORM\n\t\t\/li\n\t\tli\n\t\t\tZend\n\t\t\/li\n\t\tli\n\t\t\tCMS\n\t\t\/li \n\t\tli\n\t\t\tShared Nothing\n\t\t\/li\n\t\tli\n\t\t\tAJAX\n\t\t\/li\n\t\tli\n\t\t\tJSON \n\t\t\/li\n\t\tli\n\t\t\tUnit Test\n\t\t\/li\n\t\tli\n\t\t\tSOAP\n\t\t\/li\n\t\/ul\n\/div } Ok Nathan, that's correct. Once the object is decoded the \/ pairs go away. But this is something to note, only after it is decoded. I was testing only the creation of the JSON object and printing it, not the associative php array. So that's why I got the annoying \/. This is nothing to be afraid then, once the text is used, there's no need to think about the pairs. It is not even necessary to eliminate the \r\n windows puts in, that way the html snippet will be formated. Thank you very much for your help. This is now solved. Balpo.
[PHP] Slashes, include, AJAX?
Hi everybody! I'm building a small ajax app which consists of only 3 php files. index.php which contains all the app and has a couple of links. When a link is clicked an Ajax request is sent to the server (using prototype) to the url central.php with only one parameter 'id'. Depending on that parameter, central.php should look for the appropiate content, in this case link1.php. Then I return a JSON object with the things that should be updated on index.php So this is the pseudo-code: index.php html... body a href= onclick=[send the Ajax request using prototype with the id = 1]Link #1/a div id=theUpdatableDIV/div /body central.php html... body ?php [read the id parameter] switch(id){ case 1: //which is the only case for now!! //build the JSON object $output = array(title = Link #1 Title!, content=file_get_contents(link1.php));//here I read the last file which has the content to be updated asynchronously return [the JSON object based on $output]; break; } ? /body link1.php divWelcome to the content of link #1 which was updated using a href=ajax.orgajax/a/div the JSON object is formed ok, now, my problem is that link1.php outputs like this: divWelcome to the content of link #1 which was updated using a href=ajax.orgajax\/a\/div So at the moment I update the div id=theUpdatableDIV element on index.php, I get no real content, but a string with the strange slashes. I've tried: stripslashes, ereg_replace, str_replace and strtr to eliminate the wierd slashes. Can anybody tell how to do it right? Thank you! Balpo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Slashes, include, AJAX?
Nathan Nobbe wrote: On 10/25/07, *Rodrigo Poblanno Balp* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hi everybody! I'm building a small ajax app which consists of only 3 php files. index.php which contains all the app and has a couple of links. When a link is clicked an Ajax request is sent to the server (using prototype) to the url central.php with only one parameter 'id'. Depending on that parameter, central.php should look for the appropiate content, in this case link1.php. Then I return a JSON object with the things that should be updated on index.php So this is the pseudo-code: index.php html... body a href= onclick=[send the Ajax request using prototype with the id = 1]Link #1/a div id=theUpdatableDIV/div /body central.php html... body ?php [read the id parameter] switch(id){ case 1: //which is the only case for now!! //build the JSON object $output = array(title = Link #1 Title!, content=file_get_contents(link1.php));//here I read the last file which has the content to be updated asynchronously return [the JSON object based on $output]; break; } ? /body link1.php divWelcome to the content of link #1 which was updated using a href= ajax.org http://ajax.orgajax/a/div the JSON object is formed ok, now, my problem is that link1.php outputs like this: divWelcome to the content of link #1 which was updated using a href=ajax.org http://ajax.orgajax\/a\/div So at the moment I update the div id=theUpdatableDIV element on index.php, I get no real content, but a string with the strange slashes. I've tried: stripslashes, ereg_replace, str_replace and strtr to eliminate the wierd slashes. Can anybody tell how to do it right? how are you building the json object? i recommend json_encode(utf8_encode($dataToEncode)); if youre using php5. if youre using php4, try this: http://mike.teczno.com/JSON/JSON.phps also, you might want to check out firebug for firefox. it will let you easily analyze the interaction between the client and server. also, to verify that the json object youre generating is infact ok; run it through here: http://www.jslint.com/ -nathan Hi Nathan, I'm using php5, and I'm building the JSON object just like that, with the json_encode. The problem with using utf_encode apart from the original is that I get the \n\r for each line in the file read. Any suggestions? Thanx
[PHP] mail() silly question
I have a question that might be too silly for those of you who are PHP gurus. Here it comes: I had a mail (specifically in the headers) function call like this: $header = ; $header .= 'From: [EMAIL PROTECTED]; $header .= 'MIME-Version: 1.0\r\n; $header .= 'Content-type: text/html; charset=iso-8859-1\r\n; $header .= Reply-To: .utf8_decode($nombreVar). .utf8_decode($apellidosVar).$mailVar\r\n; $header .= X-Mailer: PHP/.phpversion().\r\n; $header .= X-Priority: 1; and the mail(...) function always returned TRUE, but the mail was NOT sent. After hours of... trial/error debugging, I noticed from an example that it should be: $header = ; $header .= 'From: [EMAIL PROTECTED]' . \r\n; $header .= 'MIME-Version: 1.0' . \r\n; $header .= 'Content-type: text/html; charset=iso-8859-1' . \r\n; $header .= Reply-To: .utf8_decode($nombreVar). .utf8_decode($apellidosVar).$mailVar\r\n; $header .= X-Mailer: PHP/.phpversion().\r\n; $header .= X-Priority: 1; Question: Why? What's the real difference between $header .= 'From: [EMAIL PROTECTED]' . \r\n; and $header .= 'From: [EMAIL PROTECTED]; ? If somebody knows, please let me know! Thank you in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Update site through email
Hy guys I'd like to know if there is a way to update a site through sending an email. Something like this, you send an email and the body of the email substitutes a text you use in your site. Igreat apreciate any help since I couldn't find anything on this topic. Thanks, doRodrigo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Paging Help
I have the following problem, I need to make a paging system to show results from search on a Mysql database. I found a class that should do the job but couldn't figure it out how to use it. Does anybody has an Idea of hos to do this? I thank in advance for any help you guys can provide me. Rodrigo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] HTTP ERRORS Boolean
Guys is there a way that I can call the func file(www.url.com) and get a result true if there is a page and false if the page doesnt exists (error 404)? the thing is I'm trying to retrieve a page but I cant be sure that it exists so I need my script to try to access it and if it cant access it then he should write something else. Thanks, Rodrigo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Cant work HTML echo loop
Hi guys Im here again, now I got this problem with a loop. The script is at the end of the message so you guys can review it. Now to the problem: I have a script that go to a site and try to access an url like www.domain.com/story/variable/ it should do the following: Try to open the page if it doesnt exist return false for the boolean check, If not should echo the page and add to the variable to be like: www.domain.com/story/1/ www.domain.com/story/2/ www.domain.com/story/3/ etc... I'm trying to echo all the pages in one html adding it after echoing it. It just return some strange values like z or a pund signal... Anyone off you guys up to the task? Thanks a lot... Rodrigo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Cant work HTML echo loop
i guys Im here again, now I got this problem with a loop. The script is at the end of the message so you guys can review it. Now to the problem: I have a script that go to a site and try to access an url like www.domain.com/story/variable/ it should do the following: Try to open the page if it doesnt exist return false for the boolean check, If not should echo the page and add to the variable to be like: www.domain.com/story/1/ www.domain.com/story/2/ www.domain.com/story/3/ etc... I'm trying to echo all the pages in one html adding it after echoing it. It just return some strange values like z or a pund signal... Anyone off you guys up to the task? Thanks a lot... Rodrigo ? $urlChapter = 1;//'/'.$_POST[chapter].'/'; $urlStory = '/s/'.$_POST[story]; $urlMain = http://www.domain.com;; $url = $urlMain.$urlStory.$urlChapter; $texto = file($url); $result2 = count($texto); $i = 0; while ($i $result2) { echo $texto[$i]; $i++; } while (@fopen(http://www.domain.com/s/$urlStory/$urlChapter/,r;)!=null) { $pega = @fopen($urlMain.$urlStory.$urlChapter,r); $pega = strip_tags($pega, 'p/pbr'); echo $pega; $urlChapter++; } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with form
Guys I'm getting the following problem: I have a form that asks for one variable that goes into the input box, this box is named chapter, and the box is in a form that is submited to another php, and this php should receive this variable and I should be abble to access it thru $chapter, but when I try to use the variable $chapter I get the following error: Notice: Undefined variable: chapter in c:\arquivos de programas\easyphp1-8\www\teste.php on line 6 This variable is concatenated into a string and is used to retrieve a certain page from a domain, if I initialize the variable in the second php script it goes ok, but if I try to use the one that should be passed thru the form I get the error above. Does anybody know what I'm doing wrong? The second script is bellow so you can understand my problem thank you guys: ? //$chapter = 1; $urlChapter = '/'.$chapter.'/'; $url = http://www.domain.com/s/2784825.$urlChapter;; $texto = file($url); $result2 = count($texto); $i = 0; while ($i $result2) { echo $texto[$i]; $i++; } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] String Manipulation
Hi guys I have the following intention and would really like to know if tis possible and if its possible how should it be done. I have a string that is something like this: INPUT TYPE=BUTTON Value='nbsp;nbsp;#171;nbsp;nbsp;' onClick=self.location='/s/979216/22/'SELECT title='chapter navigation' Name=chapter onChange=self.location = '/s/979216/'+ this.options[this.selectedIndex].value + '/';option value=1 1. Prologueoption value=2 2. First daysoption value=3 3. Drastic choiceoption value=4 4. Sowarocsoption value=5 5. Trainingoption value=6 6. Teneb/select How can I retrieve the Values and assign it to a variable, and next retrieve the name and assign it to another variable and so on... I'd like to get something like: 1 1. Prologue 2 2. First days 3 3. Drastic choice 4 4. Sowarocs 5 5. Training 6 6. Teneb and eacch of these should be in a variable, remembering that the number of variables is dynamic so it can be only one or 100. Thanks guys, Rodrigo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Retrieving Content
Hi guys, I'm trying to retrieve a certain variable from a site. Here it goes: The site has a SELECT box that is dynamicaly updated, I need to put a script running that will retrieve the specified SELECT with its contents, that are labels and values. Is there a way to retrieve the page and then select just one line of the code, discard the rest and then retrieve from this line the values? Here goes the SELECT : SELECT title='navigation' Name=navigating onChange=self.location = '/s/2318355/'+ this.options[this.selectedIndex].value + '/';option value=1 selected1. Nameoption value=2 2. Name/select I need to get something like this: $select = navigating; $label1 = 1.Name; $value1 = 1; $label2 = 2.Name; $value2 = 2; Remmembering that the SELECT is dynamic so I need also to check how many labels and values there are and store them into variables. I getting a really hard time doing this. I thank any imput you guys can give me. Thanx, Rodrigo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Retrieving Content
Actualy I went a slightly diffent way, I tried to use the file() like on the script below and I get the content of the whole page but when I try to get a single line from the array it all goes sideways. Here goes the script with the correct urls, remembering that I'm using it on the local server thats why I save it on the file to see if its getting the right content: $fc = file('http://www.fanfiction.net/s/979216/1/'); $f=fopen(some.txt,w); foreach($fc as $line) { if ($line[85]) { //look for $key in each line fputs($f,$line[85]); } //place $line back in file echo $line; } It shows the whole page but saves on the file something grambled that I cant identify what it is. Iknow that when opening the html result of the page that I need to get the content its the second SELECT, and its actually on line 86, but since the PHPEd dont use line 0 it should be right. Or I'm missing something... Thanks, Rodrigo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Retrieve output from HTML or PHP file
Can I do the below to an URL, like retrieving the output of a site and store it on a variable? Thanks, Rodrigo Hi Peter, Ah, I understand now. If the file echo'ed it's output you could do: ob_start(); include('file.php'); $output = ob_get_contents(); ob_end_clean(); or: $output = exec('script.php'); (but make sure you use escapeshellarg /or escapeshellcmd where applicable for security reasons). first method would be better, more robust and more portable. Peter Lauri wrote: Hi Chris, As I read in the documentation it only takes the content of the file. If there is a script in the file I want that to be fun first. A file like this: -- HTLM content ?php echo 'Hello World'; ? HTML content -- I want the result from my function to be -- HTLM content Hello World HTML content -- The file_get_contents('file.html') will give me -- HTLM content ?php echo 'Hello World'; ? HTML content -- Or am I not correct? Best regards, Peter Lauri -Original Message- From: Chris [mailto:[EMAIL PROTECTED] Sent: Monday, January 30, 2006 11:49 AM To: Peter Lauri Cc: php-general@lists.php.net Subject: Re: [PHP] Retrieve output from HTML or PHP file Hi Peter, Close :) file('file.html'); see http://www.php.net/file or file_get_contents('file.html'); see http://www.php.net/file_get_contents the 'file' function returns an array, 'file_get_contents' returns it as a string. Peter Lauri wrote: Best group member, I have a php script running and need to save the output from an HTML-file or PHP-file. What I want to do: $the_output = thenicefunction('file.html'); Any suggestions? /Peter -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Retrieving Content
I just discovered the problem I have to retrieve the output of the site and not the url since its dynamic. Ca I do it like retrieve the output of this url: www.tryout.com/1/2/ And of course store it on a variable? How to do it? I founr the func below but couldnt understand how to make it work with a url. Thanks guys, Rodrigo ob_start(); include('file.php'); // Could be a site here? What should I do to retrieve it from an url? $output = ob_get_contents(); ob_end_clean(); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Error: unexpected T_ELSE on line 14...?
Hi, You have two problems in these line: Harlequin said: if ($_SESSION[Authorised]=Yes); 1. The obvious ; at the end of the line. 2. $_SESSION[Authorised]=Yes it's different to write: $_SESSION[Authorised]==Yes Cheers, -- Rodrigo Castro Hernandez -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ASP to PHP language problems
On Wednesday 10 March 2004 18:54, Raditha Dissanayake wrote: Hi. There is an ADO simulator for PHP (i think it's called ADODB PHP but i can't remember the link). There is also a asp to php converter called (can you guess? ) asp2php. http://php.weblogs.com/ And Pear::DB must work too :P http://pear.php.net/package/DB http://www.onlamp.com/pub/a/php/2001/11/29/peardb.html -- roche -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re:Form CheckBox question
If you've echo-ed or printed an Array value, yes, you'll get 'Array' as result, try to var_dump the value, and check if it isn't all well. Rodrigo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to use file() function with an HTTPS:\\www.example.com
How to use file() function with an HTTPS:\\www.example.com ?php $lines = file ('https://www.example.com/'); foreach ($lines as $line_num = $line) { echo Line #b{$line_num}/b : . htmlspecialchars($line) . br\n; } ? Thanks a million! Rodrigo Nakahodo --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.518 / Virus Database: 316 - Release Date: 9/11/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] CURL - SSL
Anyone knows how to get a simple(HTML) https response using CURL session. Thanks a million!! Rodrigo Nakahodo --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.518 / Virus Database: 316 - Release Date: 9/11/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Connecting PHP to Jetty...
Hi all Has someone been able to have PHP connected to Jetty? Thanx... Rodrigo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Calling PHP from Java usign CGI...
Catalin I am also quite new to all this. I'll tell you a bit more about what I am trying to accomplish here. I am working on some project which has a a lot of code written in PHP and is going to need also a lot of code in JAVA. So, I was thinking that it would be great if we could have PHP connected to our servlet container and web server, which is Jetty. I looked in the mailing lists for info about this, and I found a servlet which connects (or at least tries) to PHP using CGI (Common Gateway Interface). The HttpURLConnection is algo a good idea. Still, it would be a lot better if I could just connect PHP to Jetty the same way PHP connects to Apache using CGI. Any idea on how to accomplish this? Thanx... Rodrigo Catalin Trifu [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, I didn't quite understood what you mean by CGI in this case, but if you reffer to calling a script which resides on a server via HTTP protocol, i suggest you take a look at the java.net.* package, You can use the java.net.URLConnection to connect to the PHP script and act as a client (like a browser) for it from your servlet. You should het the response from the script back through the getInputStream() ar any other method that suits you. Also take a look at java.net.HttpURLConnection which has more specific methods for dealing with HTTP. Once again, I may have misunderstood you, but I hope this is helpfull anyhow. Cheers, Catalin Rodrigo Reyes [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi all Has anyone been able to call php from a servlet (JAVA) using CGI interface? I am trying to do that here, and everything seems to work without problems, except that no data returns from the execution of my scripts. Any idea what could be happening? Is there information on how to configure the CGI variables in order to be able to call PHP? Thanx in advance... Rodrigo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Calling PHP from Java usign CGI...
Hi all Has anyone been able to call php from a servlet (JAVA) using CGI interface? I am trying to do that here, and everything seems to work without problems, except that no data returns from the execution of my scripts. Any idea what could be happening? Is there information on how to configure the CGI variables in order to be able to call PHP? Thanx in advance... Rodrigo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Session Login
Hi guys Im trying to build a login system with a diferential for na administration login and a partner, where a partner would have certain editing rights and the administrator would have editing rights for all the articles, but Im having problems with sessions, and Id like to know where could I get a good example of login with session MySql based. Rodrigo de Oliveira Costa http://www.ieg.com.br -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help with Filesize
How do i use the function filesize, because i´m using like: I just want associate the variable $body with a html file $file_name = 'c:/templates/resp_rep_efetiva_contrato.php'; $fd = fopen($file_name,r); line 27 $size = filesize($file_name); / Dá erro aqui $body = fread($fd, $size); $mail = mail($address, $subject, $body, $header); it keeps saind that: Warning: stat failed for c://templates/resp_rep_efetiva_contrato.php (errno=2 - No such file or directory) in line 27 but, the file exists because the fopen function works ok, I don´t known what to do Thanks in advance Equipe Pratic Sistemas Rodrigo Corrêa Fone: (14) 441-1700 [EMAIL PROTECTED] [EMAIL PROTECTED]
[PHP] Re: get the $email string
I don't know how do you get this answer, but try this: a href=email=$email? echo $row-name; ?/a/font/b/td Rafael Rodrigo Hi, i made a page to display some user details and then clicking on the user name it goes to another page to send a mail via mail() function. here is the line of the first page td width=20% align=centerbfont face=Arial size=1 color=#808080a href=mail_active.php?email=$email? echo $row-name; ?/a/font/b/td when click on user name, it goes to the mail_active.php?[EMAIL PROTECTED] on the mail_active.php page, how do I get the e-mail address to send? I mean, the mail function is mail ($to,$subject,$message,From: $sender); How can I take the $to string to be [EMAIL PROTECTED]? Miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How know from wich page you came from
Hi guys I need a way to know how to know from wich page the visitor came, something like: I wanna put in a php file a switch to do a certain action if the visitor came from a certain page, and something else if he came from a diferent one, this way I could write, update, insert, delete or anything I need from a single file. Thanks for any kind of input, Rodrigo
[PHP] PHP with JSP
Hello, I hava to develop a solution that use PHP and JSP. But the system has to use the same session. I´ve already installed the PHP integration with Java and it works. But I can´t find the class to call a session? Regards Rodrigo Rezende PHP Developer
[PHP] String to an Array
Hi guys, I got a string that I need to be transformed into na array of characters, something like: $str =im the one trying to do this; //this is the string I'd like to get an array that I can access something like $array[0] and get the value i . And this foward. Anyone have any clues on this? Thanks, Rodrigo
[PHP] Safe mode and safe_mode_exec_dir
Hello all, I'm having a bit of a problem making a particular configuration with PHP and Apache. Here's the deal: I want to have php running with safe mode, so i define safe mode = On on /etc/php.ini. I have this script that i need to execute two programas, with exec(). So, in apache, i define a directory directive, where i put php_admin_value safe_mode_exec_dir /some/path/bin, so that the scripts contained in the directory are able to execute binaries in /some/path/bin. I also define open_basedir to .. This doesn't work. In fact, defining safe_mode_exec_dir = /some/path/bin directly in /etc/php.ini doesn't work either. I noticed PHP was compiled with --with-exec-dir=/usr/bin, but i suppose that what we define in php.ini (at least) overrides that. I can only execute the bins with safe mode off... and i see nothing on the logs, because for what i can see php logs nothing if it cannot execute a program I'm using PHP 4.2.3 and Apache 1.3.23 (RedHat) Any help will be appreciated, Regards -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Encrypting a message
Hi guys I really need to find a way diferent from the functions that come with php like mcrypt, cause my server do not use these. I would really apreciate some sort of exemple, since I'm not being able to crack the thing. Since I'm trying not to simply change the characters from one to another, it more dificult. It would be usefull like to have 4 variables with the alphabet and the first letter were taken from the first variable and the second from the second variable, and this foward, my problem starts when the number of variables isn't enough for all letters to be changed, so how to start the fifth letter in the first variable instead to look for a fifth variable that isn't there? Thanks, Rodrigo
[PHP] Problems with a simple While-If condition
This is the fact: I'm building a homepage that can access a mysql database, and display the records within a certain condition. Following this it is verified if the sql result was empty then it should write a certain frase, if not it should write the records. I've got the worst part ok, the while that display the results, but the if isn't being verified, it writes the frase anyway. Please help, the code is right under the file name: indicador.php ? include db_dados.php; ? ? $sql = SELECT * FROM tb_tao WHERE area='$area'and status=1; $res = @mysql_query($sql,$id) ? ? echo table width='100%' height='100%' border='0' align='center' ? ? echo trtddiv align='center'Nenhum profissional cadastrado./div/td/tr; ? ? while ($row = mysql_fetch_array($res)) { ? ? echotrtdID Profissional/td; echotd.$row['id']./td/tr; echotrtdNome/td; echotd.$row['nome']./td/tr; echotrtdProfissão/td; echotd.$row['area']./td/tr; echotrtdBairro/td; echotd.$row['bairro']./td/tr; echotrtdTelefone/td; echotd.$row['telefone']./td/tr; echotrtdE-mail/td; echotd.$row['email']./td/tr; echotrtdTelefone Celular/td; echotd.$row['celular']./td/tr; echotrtdRegistro Profissional/td; echotd.$row['regprof']./td/tr; echotrtdEndereço/td; echotd.$row['endereco']./td/tr; echotrtdnbsp;/td; echotdnbsp;/td/tr; ? ? } ? ? echo/table; ? db_dados.php ? $id = mysql_connect(localhost,rodrigo,g3mston3)or die ('I cannot connect to the database.'); $con = mysql_select_db(db_tao); ?
[PHP] RE: Problems with a simple While-If condition With the statement
? include db_dados.php; ? ? $sql = SELECT * FROM tb_tao WHERE area='$area'and status=1; $res = @mysql_query($sql,$id) ? ? echo table width='100%' height='100%' border='0' align='center' ? ? $rodrigo=mysql_fetch_array($res); if($rodrigo=false){ echo trtddiv align='center'Nenhum profissional cadastrado./div/td/tr; } ? ? while ($row = mysql_fetch_array($res)) { ? ? echotrtdID Profissional/td; echotd.$row['id']./td/tr; echotrtdNome/td; echotd.$row['nome']./td/tr; echotrtdProfissão/td; echotd.$row['area']./td/tr; echotrtdBairro/td; echotd.$row['bairro']./td/tr; echotrtdTelefone/td; echotd.$row['telefone']./td/tr; echotrtdE-mail/td; echotd.$row['email']./td/tr; echotrtdTelefone Celular/td; echotd.$row['celular']./td/tr; echotrtdRegistro Profissional/td; echotd.$row['regprof']./td/tr; echotrtdEndereço/td; echotd.$row['endereco']./td/tr; echotrtdnbsp;/td; echotdnbsp;/td/tr; ? ? } ? ? echo/table; ?
RES: [PHP] Passing Variables from one php doc to another
I tried to use this way but it doesnt work I think its because it is a variable that I have to pass, something like: http://www.example.com/doo.php?dah=somethingdee=$somethingelse HELP Rodrigo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Phpmyadmin HELP!!!
Hi people, After I installed phpmyadmin on my computer that runs an Apache I've worked almost everything out. The only problem I seem to have is that when I create a Database I can't put more than 8 columns and if I do it simply doesnt accept it. Another problem that it looks like I'm having is that when I log into a database it shows all the tables in that database on my left but if I click on a table with more than 8 columns, that I created in the DOS, it simply doesnt show the details. HELP!!! I'm running: Windows XP Php 4.2.2 Apache 2.0.39 MySql 3.23.51 PhpMyAdmin 2.3.2 Thanks, Rodrigo
[PHP] Add content thru e-mail
Hi people, i'd like to know if there is a way to add content to a database thru sending an e-mail, and if there is how it would be done. Thanks, Rodrigo
[PHP] Mail() function
Hi guys I'm having the following problem: I have a mail() function that works by itself, coming from a html form, but when i tryied to put it inside a more complex script it doesn't work. The script is at the end of the message and it is suposed to receive data from a html form and use it to insert data into a mySql database, wich it does without problems, and it is suposed to send an e-mail to certain email with the info that was received from the form. The data is inserted without problem into the MySql database, but the e-mail is not sent to the email informed in the mail() script. Rodrigo SCRIPT: ? include db_dados.php; ? ? $sql=INSERT INTO tb_tao(nome, prof, area, tel, email, celular, registro, status) VALUES ('$nome','$prof','$area','$tel','$email','$celular','$registro','$status'); $res=@mysql_query($sql,$id); ? ? $Destino = [EMAIL PROTECTED]; $Remetente = Formulário de Cadastro; $Assunto = Profissional Adicionado; $Mensagem = teste; mail($Destino,$Assunto,$Mensagem,$Remetente); ? meta http-equiv=refresh content=1; URL=cadastrando.htm
[PHP] php mail()
Hi list, I trying to send mail using PHP's mail() function without success. My email is rejected because it goes with apache@localhost. I've tried everything put a diferent from in header etc. Does anyone have a clue My system is a RedHAT 7, PHP4.2.3, sendmail thank's n advance -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] wrong date
Hi! Someone knows why is this returning 1969-12-31 ??? $day = 13; $month = 10; $year = 2002; echo date(Y-m-d,mktime (0,0,0,$month,$day,$year)); And MySQL also does the same when I insert '2002-10-13' in a date field!!! ::: R o d r i g o M e u r e r [EMAIL PROTECTED] B a s e 5 1 - W e b p r o j e c t s Tel 51 3332.8813 / Fax 51 3321.1405 : : :www.base51.com.br: : : -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] parse html code
I want to enter an url, get the html code, and obtain from this all the referenced urls. Anybody knows the way to do that? Bergus
[PHP] Re: checkbox question
Why you can't use square brackets? Alex Shi [EMAIL PROTECTED] escribió en el mensaje [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... How to ontain data from a group of checkbox using same name? For example, in a form there're 6 checkboxes and all named as Interesting_Area. I know if put a pairs of square brackets at the end of the name then in php all the values of them can be ontained. However, for some reason I cannot use square brackets. Please help me out if anyone know how to do the trick. THanks! Alex -- --- TrafficBuilder Network: http://www.bestadv.net/index.cfm?ref=7029 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP e GD big files
Hi, I'm using GD to put a dinamic text in some buttons. The problem is that the original image that I use has 8k and after i put a black text it jumps to 20K. What I'm doing wrong? there's a way to compact this? Thank's -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] sort dinamic generated table
Hi, I have a resume system that put a rank in it resume at runtime. example: If you do a serach for each match that it finds it atribute 1 point, now I need to sort the generated list based in this rank, how can i do this, since this rank is dinamic and isn't in database?? Thank's -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Pass array in HTTP_POST_VARS question
If you are in a session you can register the array and it will be available on the next page, once you finish working with the array, just unregister the array. File1.php action= file2.php session_start(); session_register(foo); var $foo = array(); File2.php session_start(); Work with $foo session_unregister(foo); Paul Maine [EMAIL PROTECTED] escribió en el mensaje [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Is it possible to pass an array in a form post? If so, how do I reference the array on the next page? Thank You Paul php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] XML doubt
I don't know how to work with XML... I know that it's a good standard to pass information between computer or applications, but I don't know how to separe my data from my presentation on my PHP projects. I always use OOP, I organize all the data in databases and clases, but I always have to put some code on my presentation files, like index.php, viewstock.php, and it will be great if I can organize my projects so the presentation can be handled by any designersm, at this time I always have to make the changes on the presentation files because I am the one who know about PHP. Can you give some example about how to separate the data from the presentation using XML and databases? Or can you tell me about a project where I can see it? Thank you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] XML doubt
Ok, thank you just one more doubt Is it threading safe? For example: At 13:30:10 [Proccess 1] cliente request index.php At 13:30:11 [Proccess 1] index.php is putting the content of the querey into index.xml At 13:30:12 [Proccess 2]a new client request index.php At 13:30:13 [Proccess 2]a new instance of index.php is invoked and it starts to put the content of the query into index.xml, but [Proccess 1] is still working with index.xml What happends? Geoff Hankerson [EMAIL PROTECTED] escribió en el mensaje [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Forgot a step: (1C) make an xslt stylesheet which is basically just a beefed-up html page. Check out devshed.cm xml.com and w3c.org for info on xslt stlyesheets Geoff Hankerson wrote: Rodrigo Dominguez wrote: I don't know how to work with XML... I know that it's a good standard to pass information between computer or applications, but I don't know how to separe my data from my presentation on my PHP projects. I always use OOP, I organize all the data in databases and clases, but I always have to put some code on my presentation files, like index.php, viewstock.php, and it will be great if I can organize my projects so the presentation can be handled by any designersm, at this time I always have to make the changes on the presentation files because I am the one who know about PHP. Can you give some example about how to separate the data from the presentation using XML and databases? Or can you tell me about a project where I can see it? Thank you. 1. Convert sql queries into xml (I'm glad to send a copy of my class if you'd like) basically its: A. Loop over query as you normally would B. Loop through each column in a record for a query and make an xml compatible string like: record fieldname value /fieldname /record 2. Then just follow the xslt section of the php manual it's pretty straight forward Give it a shot, if you have trouble send specific questions to the list I and quite a few other will be glad to help -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP OOP
I have a problem, I can't create an array of classes into a class, for example: class one { var $a; function foo() { echo foo; } } class two { var $b; function initialize() { $b[0] = new one(); $b[1] = new one(); } } $test = new two(); $test-initialize(); $test-b[0]-foo(); //It doesn't work $test-b[1]-foo(); //It doesn't work Any suggestion? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP OOP
I made a mistake while I was writting the example, in my original code I wrote it as you did, with $this-b[0] = new one(); but it doesn't work. Thank you. Philip Hallstrom [EMAIL PROTECTED] escribió en el mensaje [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Not tested, but what if you change $b[0] = new one(); $b[1] = new one(); to: $this-b[0] = new one(); $this-b[1] = new one(); On Tue, 3 Sep 2002, Rodrigo Dominguez wrote: I have a problem, I can't create an array of classes into a class, for example: class one { var $a; function foo() { echo foo; } } class two { var $b; function initialize() { $b[0] = new one(); $b[1] = new one(); } } $test = new two(); $test-initialize(); $test-b[0]-foo(); //It doesn't work $test-b[1]-foo(); //It doesn't work Any suggestion? -- 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] Uploading file
You are doing wrong... you are checking for the temp file and after that you are deleting the temp file, you should copy the files first This is your code if(isset($UploadedFile)) { unlink($UploadedFile); // Here you are deleting the temp file print(Local File: $UploadedFile BR\n); print(Name: $UploadedFile_name BR\n); print(Size: $UploadedFile_size BR\n); print(Type: $UploadedFile_type BR\n); print(HR\n); } You should write something like this if(isset($UploadedFile)) { copy($UploadedFile, /uploaded_files/ . $UploadedFile_name); // Here we first copy the temp file to a secure path, you should change the /uploaded_files/ // path print(Local File: $UploadedFile BR\n); print(Name: $UploadedFile_name BR\n); print(Size: $UploadedFile_size BR\n); print(Type: $UploadedFile_type BR\n); print(HR\n); unlink($UploadedFile); // Now we can delete the temp file } Clemson Chan [EMAIL PROTECTED] escribió en el mensaje [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Thanks Juan, and other listers, I have this example, HTML HEAD TITLEFigure 7-3/TITLE /HEAD BODY ? //check for file upload if(isset($UploadedFile)) { unlink($UploadedFile); print(Local File: $UploadedFile BR\n); print(Name: $UploadedFile_name BR\n); print(Size: $UploadedFile_size BR\n); print(Type: $UploadedFile_type BR\n); print(HR\n); } ? FORM ENCTYPE=multipart/form-data ACTION=7-3.php METHOD=post INPUT TYPE=hidden name=MAX_FILE_SIZE value=4096000 INPUT NAME=UploadedFile TYPE=file INPUT TYPE=submit VALUE=Upload /FORM /BODY /HTML and the result is this after I uploaded a file Local File: /tmp/phpnYLV2J Name: 323lake.jpg Size: 48254 Type: image/pjpeg But I couldn't find the uploaded file, nor the /tmp/phpnYLV2J path. Do I normally do a copy after the upload? Can I just change the tmp path and filename when I upload? Thanks. --Clemson -Original Message- From: Juan Pablo Aqueveque [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 03, 2002 7:58 AM To: Clemson Chan; [EMAIL PROTECTED] Subject: Re: [PHP] Uploading file Hi friend, http://www.php.net/manual/en/features.file-upload.php And take a look to the User Contributed Notes --jp At 13:03 03-09-2002 -0700, Clemson Chan wrote: Hi, I am new to this group. I am trying to figure out how to let people to upload image files to my website. My ISP is using PHP 3 (I believe). If someone can give me simple example, that will be great. Thanks. --Clemson How can I tell what version of PHP is running on the system (linux)? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Juan Pablo Aqueveque [EMAIL PROTECTED] Ingeniero de Sistemas Departamento de Redes y Comunicaciones http://www.drc.uct.cl Universidad Católica de Temuco. Tel:(5645) 205 630 Fax:(5645) 205 628 -- 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] XML vs Everything Else
I'm writting an application, a control panel for a web site, and it will be great if I can separe data from presentation, I know that I have to work with XML and XSL but I didn't understand how it works. Can you give me a simple example? Let guess that a client request index.php, and I have index.xml for the data, index.xsl for the data transformation and index.php, how it works? Geoff Hankerson [EMAIL PROTECTED] escribió en el mensaje [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Can anyone direct me to a page with xml in use? Something that can help me grasp what its all about. I didn't understand xml at all until I started using it . I asked pretty much the same question as you (what is it good for?). Now I will almost always use xml in any app I work on. One application that is simply wonderful is xsl transformations. This allows you to take xml and transform it into html, wml, pdf, rtf , etc... What this ultimately means to me is seperation of presentation from logic and data which makes for a very flexible and easy to maintain application. I have made a php class to make a database query into xml in the form of: recordfieldname value /fieldname/record Now stuff I used to do that took a whole page to code nows uses about 5 lines. This is a real world benefit for me. Spend some time learning about xml and you won't regret it -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] search in serialized string
well, I my opinion is not the way to work, but like I said the work was done by other guy, and now I have the problem to solve. So i back to old question :-) How can I search with some precision in a serialized string? on 8/24/02 12:13 PM, DL Neil at [EMAIL PROTECTED] wrote: Rodrigo, Then the question to be asked is: is serialize()ing this data good design/technique, or is there a better way? Regards, =dn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] search in serialized string
I mean double ouch!!! :-) well.. 1 no, it's a select for the language (select name=language[]) and another to skill level 1b no separator it's stored as array. The array generated by language[] and skill[] are stored into another array, serialized and put into DB 2 yes. could be up to 5 2b again, none. only the array structure the field is a text. on 8/26/02 9:58 AM, DL Neil at [EMAIL PROTECTED] wrote: Rodrigo, Inherited problems = ouch! Sorry I don't keep old list msgs, perhaps you mentioned this before: does the language skills field contain: 1 both the language and the skill-level, eg English - Advanced 1b what separator is used between the two words? 2 more than one language/skill-level where applicable, eg English - Advanced, German - Intro. 2b what separator is used between language entries? What is the database field description in the table schema? Please advise, =dn well, I my opinion is not the way to work, but like I said the work was done by other guy, and now I have the problem to solve. So i back to old question :-) How can I search with some precision in a serialized string? on 8/24/02 12:13 PM, DL Neil at [EMAIL PROTECTED] wrote: Rodrigo, Then the question to be asked is: is serialize()ing this data good design/technique, or is there a better way? Regards, =dn -- 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] search in serialized string
Hi list, I have a form to post resumes. In one parte the user have a option to choose up to 5 languages and his knowledge in it. example : english: basic advanced My problem is that was stored serialized in the BD and now I need to do a search by language and knowledge. How can I do this. I've tried everything unsuccessfully. example: search english advanced. If the user have english basic and another advanced he/her appear in the search. Thank's in advance Rodrigo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] search in serialized string
Hi list, I have a form to post resumes. In one parte the user have a option to choose up to 5 languages and his knowledge in it. example : english: basic advanced My problem is that was stored serialized in the BD and now I need to do a search by language and knowledge. How can I do this. I've tried everything unsuccessfully. example: search english advanced. If the user have english basic and another advanced he/her appear in the search. Thank's in advance Rodrigo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] protect code or something like..
Hi list, I have a project that was develop in a partnership, now this partners doesn't so partners anymore :-/ My question is there's a way to create a protection that I can trace if the software was installed in other servers?? I mean not hide the code, but put an important include of the project in another server and generate a log of the acess to it, or anything that can tell me who is installed and running the system. Thank's Rodrigo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php to generate statiscs
Does anybody knows the link to this article or other that treats something like this. I couldn;t find it in devshed. Rodrigo on 6/2/02 3:57 PM, John Holmes at [EMAIL PROTECTED] wrote: Look into cross-tab queries (I think that's what they are called). There is a good article on Devshed.com about it. You can do a query like this SELECT SUM(IF(Gender='M'),1,0)) AS Male, SUM(IF(Gender='F',1,0)) AS Female FROM table That'll give you two columns, one named Male, one named Female, in the result set. The result set will have one row, containing the number of males in the database in the Male column, the number of females in the database in the second. You could probably do the majority of your statistic queries this way. ---John Holmes... -Original Message- From: Rodrigo Peres [mailto:[EMAIL PROTECTED]] Sent: Sunday, June 02, 2002 2:02 PM To: [EMAIL PROTECTED] Subject: [PHP] php to generate statiscs Hi list, Sorry if this is a off-topic, but I really don't know where to begin. I have a mysql database with about 20.000 records, now I need to build a statistics panel to show for example how many of this record are male, female, lives in determinated city, school graduation etc, everything grouped by sex and alone too, present the respectives percentages etc... How do I begin??? Can someone help?? thank's in advance Rodrigo Peres -- 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] php to generate statiscs
Hi list, Sorry if this is a off-topic, but I really don't know where to begin. I have a mysql database with about 20.000 records, now I need to build a statistics panel to show for example how many of this record are male, female, lives in determinated city, school graduation etc, everything grouped by sex and alone too, present the respectives percentages etc... How do I begin??? Can someone help?? thank's in advance Rodrigo Peres -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Function
Hi guys Im trying to use a function on na .inc file, how should I do? How should I write the function and what should I write on the file so that the function file is Included to be used on a function call on the php file? I appreciate any kind of sample code. Thanx, Rodrigo de Oliveira Costa
[PHP] Text file
Hi guys: What I need is a php file that will read a text file and show it on a html file. And it will also write to a text file, but at the end of the file. Thanx, Rodrigo de Oliveira Costa.
[PHP] Message isn't received in form mailer
Hi guys, I'm trying to send the contents of a form thru the php script under this message, but I'm not receiving the message itself, I just receive the message in blank. Just with the subject and the from. Does anybody know what the problem is? Thanks for the help, Rodrigo ?php $Destino = mailto:[EMAIL PROTECTED] [EMAIL PROTECTED]; $Remetente = $name $email; $Assunto = Form Domain.com; $Mensagem = $coments; mail($Destino,$Assunto,$Mensagem,From:$Remetente\n); header(Location:http://www.domain.com/success.htm;); ?
[PHP] Help with Bookmark
Hi guys I'm trying to make a online bookmark adress book, this bookmark adress book, would consist of the following: A text file named name.txt, that would content the name of each of the users. A text file named pass.txt, that would contain a non-secure password for each user. A text file for each user named loginbookmarks.txt containing the list of urls and hopefully an indicator, as in a hash, to call the bookmark by it's name. That's all, I've figured the first two but I can't seem to make the third one. Anyone can send me any ideas... Code hopefully. Thanks, Rodrigo
[PHP] Hashes in text files
Can I store Hashes in text files? If yes, how? Can I store a multi dimensional array in a text file? If not how should I do to store the data in one file and the pointer in another file? Thanx, Rodrigo
[PHP] phpMyAdmin
Hi guys, I need some help using the phpMyAdmin, I'm trying to create a table with three fields, one for the indexing of the database, the second for the logins and the third for the password. I get the following doubts: On the table of the phpMyAdmin there are the following fields: A field for the name of the field. A field for the kind of information that will be stored in the field (TINYINT,DOUBLE,TEXT...) A field for the size of the field. A field for the atributes of the field (BINARY, UNSIGNED, UNSIGNED ZERO FILL) A field for the null option (NULL, NOT NULL). A field for an information that I don't know... A field for the Extra(AUTO_INCREMENT). A selectable field named primary(check it or not). A selectable field named index(check it or not). A selectable field named unique(check it or not). A selectable field named Fulltext(Check it or not). The information that I would need would be what are the configurations that I have to put in each of these fields. And also I would need to know a php script to access the fields, and write to new fields. Thanx, Rodrigo
[PHP] phpMyAdmin
Hi guys, I need to know the script to insert some fields into the database. Like this: I need to get from a form the email, login, password and store it on the database. I'd like to know how this script would be. Code is apreciated. ;) Thanks, Rodrigo
[PHP] Help php MySql link
Hi guys, what I need is how to make the link between the php and the Database. Is this the code for it? ro something like that? Help me guys... If you could tell me what each command line do I'd appreciate it, cause I got almost all from a friend, but is incomplete. The code follows this message. $db = (localhost,databasename,databasepassword); mysql_select_db(your name?,$db); $result = mysql_query(select column1, column2 from domain, $db); echo column 1 - column 2;
[PHP] file() and macintosh line break
Hi list, I'm in a problem that is driving me crazy!!! I want open a file and puts each line into an array, but this files was created in macintosh!! so the file() can't recognize the end line and only outputs 1 element in array!! How can I solve it. I tried to fread() the file and eregi_replace the line breaks, it worked, but now I don't know how to use this to create the array! Thank's in advance Rodrigo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] build array dinamicaly
Hi list, I want to buil an multidimensional array with the results of Mysql, but I don't know how to do it. What I need is: SELECT name,adress from tbl_. array name will receive the names array adress will receive the adresses and array clientes will contain both, so when i try to access i will have something like $cliente['nome'][0] or $clientes['adress'][1] and so on. Someone can help??? Thank's in advace Rodrigo Peres -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to findout if the file is over
I've got the following problem: I'm trying to send a number of messages to a certain number of e-mails, the e-mails are writen in a text file and I need to findout when the file is over. The sample code is under this line , if someone can help me, I'd apreciate it. ?php $Emails = File('emails.txt'); $Remetente = Nome do remetente [EMAIL PROTECTED]; $Assunto = Assunto do E-mail; $Mensagem = $Anuncio; For ($Cont=0; $Cont != feof; $Cont++) { $Destino = $Emails[$Cont]; mail($Destino,Assunto,$Mensagem,From: $Remetente\n); } ?
[PHP] Append a line to a text file
I need to add a email to the text file that is already written, but I get the file writen over , so I always get only the last email send by the form. What I need is a form that get the e-mail and it writes the email at the end of a text file. Thanx, Rodrigo
[PHP] Append a line to a Text File
I still need to know how to do it, since the a+ or the a give me problems... I need to be able to add a line at the end of a text file thru sending the information (and by this I mean the e-mail to be writen) thru a form, and this new information should be added to the file at the end of it without overwriting it. Thanx, Rodrigo PS: If possible send a code for instruction. ;)
[PHP] append line to text file HELP !!!
Ok guys, this is the code and under it you can see what I get when I try to submit the form. ?php $file_pointer=file('emails.txt','a') || exit; $string_to_write = ($newmail).\n; $s=fopen($file_pointer,$string_to_write); $s=fclose($fp); ? Warning: Supplied argument is not a valid File-Handle resource in /home/restricted/home/h4ck3r/public_html/write.php on line 4 Warning: Supplied argument is not a valid File-Handle resource in /home/restricted/home/h4ck3r/public_html/write.php on line 6
[PHP] Last time Append line to text file
Ok, but I'm trying the following code wich is basicaly the same Miguel sent me and I still get the same message. Please excuseme for being so repetitive but Í don't seem to see where is the mistake, Sorry guys for the trouble. ?php $file_pointer = fopen('/public_html/emails.txt', a) || exit; $string_to_write = ($newemail) . \n; fwrite($file_pointer, $string_to_write); fclose($file_pointer); ? Warning: Supplied argument is not a valid File-Handle resource in /home/restricted/home/h4ck3r/public_html/write.php on line 4 Warning: Supplied argument is not a valid File-Handle resource in /home/restricted/home/h4ck3r/public_html/write.php on line 6
[PHP] using html select as array
Hi list, In my system I have multiples choices of language that user selects using drop down menus. So I've named this dropdows language[] and grab it as php array, and with looo i insert it into mysql as registers. But now i need to put a text field that the user can type any language that is not in the dropdown. my question is how can i know when this was typed when i do the select to update the user itens. I mean, when i select and populate your preferences to update, how can i know that this info is from the input text??? Thank's Rodrigo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] read text file into mysql
Hi list, I need to read a txt file and insert it lineas a record in mysql. My list in the format aa|b | cc | fff|hhdhdhdh|jsjjsjs in other words my separator is | and the lines have a return at the end of each one. I'm new to PHP, so can anyone help me with and Idea??? thank's in advance Rodrigo -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] include() and require() problem
List, I'm trying to include some .inc files in my project, but I got errors all time saying that this includes couldn't be found. I'm a newbie, so I can't understand what's happend, since it worked pretty good in my local machine and not in the ISP. I tried to speak to ISP many times but they couldn't solve to. My directorie structure is : HRM(directorie)-includes(directorie)-my inc files(to be included in files that is in the directorie HRM). Thank's Rodrigo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] multidimensional array
Hi list, In order to avoid many left joins I took an aproach that I didn't know if it's good, but I couldn't figure out another way. If my cliente has 10 phone numbers I buld an array, serialize it and store in database, so I didn't have to create another table. The problem is now I need to migrate the data to this format, how can I select the multiple data and put in multidimensional array at runtime to store again. for example I need to put all fileds with graduation and all fields with discipline with equal id in array named school serialize it and after insert in another table. Thank's Rodrigo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] multidimensional array
Hi list, In order to avoid many left joins I took an aproach that I didn't know if it's good, but I couldn't figure out another way. If my cliente has 10 phone numbers I buld an array, serialize it and store in database, so I didn't have to create another table. The problem is now I need to migrate the data to this format, how can I select the multiple data and put in multidimensional array at runtime to store again. for example I need to put all fileds with graduation and all fields with discipline with equal id in array named school serialize it and after insert in another table. Thank's Rodrigo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mail to authenticated smtp on WIN2K
Hi, I've tried the following script: ?php mail([EMAIL PROTECTED], 'Subject', 'Message', From: [EMAIL PROTECTED]); ? on PHP 4.1.2-32 with Apache on a Win2k machine. The ISP smtp is known as smtp in the Outlook send server acct and the smtp server requires requires authentication. If I ping it, I get the real smtp name, let's say ssmtp.domain.com, so I tried in php.ini (at the system dir): SMTP = smtp sendmail_from = [EMAIL PROTECTED] or SMTP = ssmtp.domain.com sendmail_from = [EMAIL PROTECTED] Neither option makes the above script work. Nor the numeric IP address itself. I get Server Error response. I suspect this is because of the authentication requirement. If this is so, is there a way to specify this authentication either in php.ini or in the script? Any input is greatly appreciated. Thanks. Rodrigo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] setcookie with array (was serialize)
Hi list, Regarding my last post about serialize, I've tried many things but couldn't make it function. I'm trying to store the data from a form in order to allow my user to stop the process of filling the form and retrieve later what was inserted before. Among many other thing I tried this little script only to test but didn't work. why?? if(isset($submit)) { $x = addslashes($HTTP_POST_VARS); $y = serialize($x); setcookie(posted,$y) } if($posted) { $w = unserialize($posted); $j = stripslashes($w); echo(count($j)); } The script aways returns 1, but I've submited 10 values. Thank's in advance Rodrigo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] serialize()
Hi list, I've already look at the php manual but couldn't figure out a way to use serialize to solve my problem. I have a form, with many fields like (name, age, adress, state), that I put a save button. This button allows my user to save the fields already filled in order to finish the form later. I thought in get the values submited by the save button and store it as cookie, them read it back later, but how can I store the fields in cookie with serialize and use it later to complety my fields again??? Thanks Rodrigo -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php array
Hi list, I think this could be an idiot question but I couldn't find an answer. I have 4 input text in a html, and I'd like to store them as a list, so I've named it Name[]. OK, php understand it as an array, but how can I make an validation code with javascript to know if the user didn't typed in this fields??? I couldn't do javascript recognize my name[] field Thank's in advance Rodrigo -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP regular expression
Hi list, I have a huge text file with many text on it. I'd like to know if someone can help in construct a regular expression to delete everything that not have this pattern Email: [EMAIL PROTECTED]. The part Email: is fixed and the email adress changes. I've tried many time to make the replace with PHP, but I'm very new to regular expression. Thank's Rodrigo -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] dynamic query string
Hi list, I have my data distribuited across 3 tables, that I'm using left join to retrieve data from them. Now I need to make a search system in this tables and I like, if possible, that someone can send me tips in how is the best way to concatenate the query string in order to do the search. The users will have about 8 types of options to search, age (18 - 25, 25-30..), gender, nationality. Thank's Rodrigo -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] bug with session or normal procedure???
Hi list, I'm developing an CMS, and I started a session with PHP 4.1.1 With I use this in javascript alert(document.forms[0].elements[0].name) it returns PHPSESSID and if i use alert(document.forms[0].elements[0].value), it returns a number. It's a bug??? I'm using IE5 in macos 9.2.2 Thank's in advance Rodrigo -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php