[PHP] Re: About search engine usability
Jim Webber wrote: Hello I'm building a website with a search engine. Do you think it is more usable if the search interface had a search button? or do you think it will be more convenient to not have button to let the users just push enter to search. I would appreciate any comment regarding this, thanks. Not exactly PHP related, however.. Having the button there is an indicator that the user can do something. Even if they simply press return, the button lets them know something can be done. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Assign variable to a block of html code
php mail wrote: Hi All, Is it possible to assign variable to a block of html code ? Something like this : $myblokvar = table width=487 border=0 cellspacing=0 cellpadding=0 tr tdtable width=487 border=0 cellspacing=0 cellpadding=0 tr tdimg src=images/bartitle_login.gif alt=Login width=475 height=30 //td tdnbsp;/td /tr tr td class=produktable width=100% border=0 cellpadding=3 cellspacing=2 tr td class=katalog ?=$log_info? /td /tr /table/td tdnbsp;/td /tr tr td class=produknbsp;/td tdnbsp;/td /tr /table/td /tr /table ; Although example above is not working, what I want to achieve is something like that. Is it possible how can I do that ? Regards, Feris You can use Heredoc quoting for this. (http://uk2.php.net/types.string) - ?php $log_info = Your logged; $myblokvar = html table width=487 border=0 cellspacing=0 cellpadding=0 tr tdtable width=487 border=0 cellspacing=0 cellpadding=0 tr tdimg src=images/bartitle_login.gif alt=Login width=475 height=30 //td tdnbsp;/td /tr tr td class=produktable width=100% border=0 cellpadding=3 cellspacing=2 tr td class=katalog $log_info /td /tr /table/td tdnbsp;/td /tr tr td class=produknbsp;/td tdnbsp;/td /tr /table/td /tr /table html; echo $myblokvar; ? - Darren -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Assign variable to a block of html code
Xavier de Lapeyre wrote: You should try the HEREDOC structure. See link: http://php.net/heredoc It should look to something like: $myblokvar = EOF table blabla tr td Welcome $name to this website! /td /tr /table EOF; Xavier, You should test this before you send it.. it doesn't even parse! The closing EOF should not start with the . It should only be the identifier (EOF) followed by ; and a new line. - $myblokvar = EOF table blabla . EOF; - Darren No need of quotes or php start/end tags when placing a variable. To use it afterwards simply call the $mylokvar variable. Hope it helped! Xavier Web Developer Site: www.eds.mu -Original Message- From: Stephen Johnson [mailto:[EMAIL PROTECTED] Sent: jeudi 20 décembre 2007 07:43 To: php mail; PHP General List Subject: Re: [PHP] Assign variable to a block of html code What you have will work, you just need to escape out the double quotes in the html. On 12/19/07 7:38 PM, php mail [EMAIL PROTECTED] wrote: Hi All, Is it possible to assign variable to a block of html code ? Something like this : $myblokvar = table width=487 border=0 cellspacing=0 cellpadding=0 tr tdtable width=487 border=0 cellspacing=0 cellpadding=0 tr tdimg src=images/bartitle_login.gif alt=Login width=475 height=30 //td tdnbsp;/td /tr tr td class=produktable width=100% border=0 cellpadding=3 cellspacing=2 tr td class=katalog ?=$log_info? /td /tr /table/td tdnbsp;/td /tr tr td class=produknbsp;/td tdnbsp;/td /tr /table/td /tr /table ; Although example above is not working, what I want to achieve is something like that. Is it possible how can I do that ? Regards, Feris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: problem with pcode function
Ross wrote: I have this postcode selector working on my localhost but remotely it gives a parse error. It should only call the function when the postcode is submitted. Any ideas? The error is: Parse error: parse error, unexpected T_NEW in /homepages/3/d154908384/htdocs/legalsuk/consultants/nearest.php on line 26 ?php function pcaStoredNearest($origin, $units, $distance, $items, $account_code, $license_code, $machine_id) { //Build the url $url = http://services.postcodeanywhere.co.uk/xml.aspx?;; $url .= action=stored_nearest; $url .= origin= . urlencode($origin); $url .= units= . urlencode($units); $url .= distance= . urlencode($distance); $url .= items= . urlencode($items); $url .= account_code= . urlencode($account_code); $url .= license_code= . urlencode($license_code); $url .= machine_id= . urlencode($machine_id); //Make the request $data = simplexml_load_string(file_get_contents($url)); //Check for an error if ($data-Schema['Items']==2) { throw new exception ($data-Data-Item['message']); } //Create the response foreach ($data-Data-children() as $row) { $rowItems=; foreach($row-attributes() as $key = $value) { $rowItems[$key]=strval($value); } $output[] = $rowItems; } //Return the result return $output; } } ? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 / title/title ?php include ('../pageElements/doc_head.php'); ? style type=text/css table { width:400px; } th { text-align:right; text-decoration:none; font-weight:normal; } td{ width:400px; } /style link href=../css/lss.css rel=stylesheet type=text/css / /head body id=services div id=container ?php include ('../pageElements/header.php'); ? div id=content-top /div div id=content-middle /div Find Your Nearest Consultant by Entering Your Postcode Belowbr /br / form action= method=post input name=pcode type=text style=width:100px; input name= type=submit style=width:50px; /form /div div id=result ?php if (isset($_POST['pcode'])){ $result = pcaStoredNearest($pcode, 'MILES', 'STRAIGHT', '2', 'x', 'x', ''); echo $result[0]['description']; } ? /div /div Is your server running PHP5, the same as your localhost? Darren -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: 縁談はあるのに独身をやめない 女性達の本当の理由とは??
I completely agree there. Darren 独身貴族の生態系 wrote: ルックスが悪いわけじゃない。仕事を頑張りたいだけが理由じゃない。 「だったらなぜ?」それは当然の疑問です。リサーチの結果これほど性的に飢えた人種はいないという事実が発覚し分離改装となりました。 今回のご案内はこちらです! ■□■ 完全無料制・独身貴族攻略大全集 ■□■ 家庭を持つ安定 < 独身の自由な性生活 http://fochun.com/kouryaku/4/ 1・コミニティーとして使用するも良し・出会いのキッカケとして使用するも良し 2・独身貴族攻略大全集の名の下に集まった女性のみが参加。確実さは一目瞭然!独身だから電話だって何時でもOKよ。 3・全システム完全無料で利用できるので安心の中で近所のとコミュニケート出来る。 等の利点を兼ね備えてまったく新しいコミュニティとして分離改装いたしました! リニューアル記念として、簡単に取得できるフリーメールアドレス(yahoo・goo・hotmail)等での参加も可能となっておりますのでぜひこの機会にお試しくださいませ! http://fochun.com/kouryaku/4/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: A very strange loop!
Xell Zhang wrote: Hello all, I met a very strange problem today. Take a look at the codes below: for ($i = 'A'; $i 'Z'; $i++) { echo $i . ' '; } If you think the output is A-Z, please run it on your server and try. Who can tell me why the result is not A-Z? The result doesnt include the 'Z', as if $i = 'Z', then $i 'Z' would return false, so would leave the loop there before echoing it out. PHP seems to increment the alphabet by A, B, C Y, Z, AA, AB, AC So you could use: for ($i = 'A'; $i != 'AA'; $i++) { echo $i . ' '; } Using $i 'AA' doesn't seem to work either, which I find a bit odd. Hope that helps, Darren -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP vs Delphi Comparison?
Dan wrote: I'm looking for a way to introduce PHP to some Delphi programmers, so I thought a comparison would show them the major differences, but I can't find anything like that on the web. Anyone have an article like that or know of one? - Dan There's a HUGE list of differences, as they are 2 completely different languages designed for completely different reasons. One is compiled, and for desktop software, while the other is scripted and designed to only output text. It really is like comparing apples to oranges. Darren -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] UI toolkit
I'm really looking into using PHP as an all-round scripting language. I'm looking for a native looking UI toolkit, which takes PHP-GTK out the question. I've seen wxWidgets but I can't find any bindings for PHP, unless anybody knows of any that I can't find? Or, if anybody knows of any other native UI toolkits available for PHP? At least native linux and windows look. Darren -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Threading
I'm currently creating a socket cerver class, similar to Twisted for python. I have a simple socket server working now, but would like to extend it using threads. I've done a fair bit of research on threads in PHP in the past, but coming up to the conclusion that there is no way to have real multi threading in PHP. Would anybody here know of any way to use threads in PHP that I may have missed? I'm hoping to find a way that would work on most OS's without any major changes. Darren -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Form Data Filtering
kvigor wrote: Hello, I 'm checking form data for profanity but it only works if the $_POST['var'] is lowercase I was wondering if anyone knew how I could catch the profanity no matter what case it was. No matter if it was BAD or bad or mixed like BaD? Instead of the long way: if ($value == fuck || $value == shit || $value == whore || $value == shit || $value == bullshit || $value == ass || $value == asshole || $value == piss || $value == bitch || $value == bastard || $value == motherfucker || $value == pussy || $value == cunt || $value == slut || $value == hell || $value == goddamn || $value == skank || $value == Tit || $value == dick || $value == hoe) { $profanity[$field] = bad; } Any suggestions welcome. I find it hilarious how you've just posted as many dodgy words as you could to the list :) But try... $bad_words = array(word1, word2, word3); if(in_array(strtolower($_POST['val']), $bad_words)){ $_POST['val'] = bad; } Darren -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: does this code look like it would check a file extensions, and disallow php files or exe files to be attached
dave peaachepea wrote: ?php $filelinks=t3lib_div::_POST('file_name'); // the posting of the file name $exttypes = php3,php,exe; // list of extensions that shouldnt be used $fileextension = substr($filelinks,0,strpos($filelinks,.)); //get the extension after the . if ($fileextension == $exttypes['php']['php3']['exe']) { //if the file extension equals php, php3, or exe echo mime type doesn't work; //if the extension is php, php3, exe, than echo doesn't work } if ($fileextension != $extypes['php']['php3']['exe']) { //if the file extension doesn't equal php, php3, or exe than // store the file $filelinks = $this-storeFile(); } ? I'm not a programmer, and I'm very new at php so im sure there are errors and stupid logic in my code. It would be greatly appreciated if anyone here could critique and rip apart my code. thank you, -dave A bit easier: ?php // the posting of the file name // Not sure where your getting this from, some class? As long as it gets the filename. $filelinks = t3lib_div::_POST('file_name'); // list of extensions that shouldnt be used $exttypes = array(php3, php, exe); //get the extension after the . $fileextension = substr($filelinks, strpos($filelinks, .)+1, strlen($filelinks)); // is the extension in the list? if (in_array(strtolower($fileextension), $exttypes)) { // yes it is, so its not allowed echo mime type doesn't work; } else { // no its not, so the file is allowed $filelinks = $this-storeFile(); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Competition - Win a copy of Zend Studio
Robert Cummings wrote: On Thu, 2007-06-14 at 12:45 +0100, Stut wrote: Hi All, I've been asked to be a judge in a PHP competition, and I thought I'd let you all know about it. Zend have donated some prizes, including a copy of Zend Studio Professional with 1 year of support, so it's definitely worth entering. It's also quite a fun challenge IMHO. http://blog.assembleron.com/2007/06/14/php-programming-contest-win-zend-studio/ Is Zend Studio better than Joe? http://sourceforge.net/projects/joe-editor/ Cheers, Rob. Depends how you define better. Better = more features? Zend Studio Better = least system resources? Joe Better = IDE? Zend Studio Personaly, I would MUCH prefere Zend Studio over Joe. Darren -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: [BULK] [PHP] Redirecting to a parent page
Yamil Ortega wrote: Ok, but what happens if I change server and there is no more apache2 directory? Do I have to change all the headers in my 37 web pages? The same code in 37 pages??? Place the code in 1 page, and use require(my_code_page.php); where you need it in your scripts. You will only then have to change it in one place. Darren Thanks in advance Yamil -Mensaje original- De: clive [mailto:[EMAIL PROTECTED] Enviado el: Miércoles, 13 de Junio de 2007 05:37 a.m. Para: PHP General List Asunto: [PHP] Re: [BULK] [PHP] Redirecting to a parent page Yamil Ortega wrote: Lets say that I have the next structure on my web directory /file1.php /procces/file2.php /file3.php http://localhost/apache2/file1.php try this: header( refresh:'3'; url=./apache2/file3.php); Regards, Clive. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: any security problems with this?
Ross wrote: I have a page of functions that I include in my page head. In this I have a function to connect. I can then just call this on each page when i need it. Does doing it this way cause any potential security risks? function connect() { $host=localhost; $user=x; $password=xx; $dbname=x; $link = mysql_connect($host, $user, $password) or die ('somethng went wrong:' .mysql_error() ); mysql_select_db($dbname, $link) or die ('somethng went wrong, DB error:' ..mysql_error() ); } The function can only be run if you call it in one of your scripts, when the database is needed. The user has no way of calling the function or seeing the code, so there shouldnt be any security risks at all. Darren -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: any security problems with this?
Dave Goodchild wrote: Unless some server config error causes that stuff to be output on the page? I tend to put such functions in a .inc file and amend the .htaccess to prevent download. If you were to include or require the .inc page and an error was to occur, it would still be printed out. All error printing should be turned off an a production server anyhow. Darren -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: tail solution for PHP5 wanted
Michelle Konzack wrote: * * Do not Cc: me, because I am on THIS list, if I write here.* * Keine Cc: an mich, bin auf DIESER Liste wenn ich hier schreibe. * * Ne me mettez pas en Cc:, je suis sur CETTE liste, si j'ecris ici. * * Hello, I am working again on my PHP Admin interace an need a tail solution in PHP5 to show fetchmail and procmail in realtime. Does anyone have done this already and if yes, how? My ADSL router can do this but it use a crapy JavaScript which can show only logs UNDER 100 lines since it refresh the whole page once a second but I need at least the last 500 lines of logfiles. Greetings Michelle Konzack Systemadministrator Tamay Dogan Network Debian GNU/Linux Consultant read the file, and save the last position you read from in a session. when the page reloads, carry on reading from the saved position. Darren -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Printing MSSQL-Query ERROR description in PHP
karthi keyan wrote: Hi, Is there any way to print the reason why the query has been failed, like the way MySQL-PHP has mysql_error()? Regards, KARTHIK. - Download prohibited? No problem! CHAT from any browser, without download. I'm confused, mysql_error() does return the error description from mysql. Try running this query on one of your databases: $rs = mysql_query(SELECT non_existant_column WHERE some_column = 1) or die(mysql_error()); Running that will print out the error in the query. (Intended errors heres) Darren -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Printing MSSQL-Query ERROR description in PHP
Zoltán Németh wrote: 2007. 06. 5, kedd keltezéssel 11.38-kor Darren Whitlen ezt írta: karthi keyan wrote: Hi, Is there any way to print the reason why the query has been failed, like the way MySQL-PHP has mysql_error()? Regards, KARTHIK. - Download prohibited? No problem! CHAT from any browser, without download. I'm confused, mysql_error() does return the error description from mysql. Try running this query on one of your databases: $rs = mysql_query(SELECT non_existant_column WHERE some_column = 1) or die(mysql_error()); Running that will print out the error in the query. (Intended errors heres) the OP wants something similar to mysql_query for mssql. so mysql_query won't solve his problem. greets Zoltán Németh Darren Ah. You failed to mention anything about the mssql part. Perhaps search google for mssql error description? Just an idea... Other than that, thats my mssql help exhausted. Darren -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Printing MSSQL-Query ERROR description in PHP
look at the subject ;) that's how I guessed what he wants Woops, missed that. You have a good point there :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: local v remote
blueboy wrote: On my localhost this works fine $result= mysql_query(SELECT date_format(date, '%d/%m/%Y') as date, title, id, display FROM NEWS); while ($row = mysql_fetch_assoc($result)) { but on my remote i get a mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource Can someone expalin the problem? PHP version problem? No. It's MySQL problem. If it works fine locally, then make sure the table structure is the same on your remote database as it is on your local database. --- mysql_query(SELECT date_format(date, '%d/%m/%Y') as date, title, id, display FROM NEWS) or die(mysql_error()); --- Using that die statement will also help while debugging your script as it will print out any errors that are caused by your SQL statement. Which you then ask some mysql people if that is the case. Darren -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Sessions VS MySQL
Matt Fielding wrote: I've recently begun work on a web-based RPG game with some friends, and have recently been thinking about the best solution for loading and saving persistent variables like player life/stats and other information. I am both familiar with sessions and mysql for saving and loading variables, and that's not my question, but I am instead interested in which method would be more efficient to use. If the data is getting reloaded on each individual page, would it be more efficient on the system hosting the game to save certain numbers and variables in a session, or to reaccess the database each time it needs those numbers. My biggest concern with using sessions, is if someone were to exit the browser mid saves to the database, all information would be lost. Since it is web-based, there is no real way for me to be able to expect everyone to follow certain procedures to load/save, and I would really like to stay away from that as well, as it's not as user-friendly and intuitive as an auto-save feature. I guess my main question here is, are there ways to auto-save and guarantee data wouldn't be lost without having to load, read, write, and close a connection to mysql on each page load? Seems as you don't know if the user will close the browser between page loads, AND to be user friendly so that they don't have to click a save button, the ONLY way would be to save the game every time the page loads. So save all data to the database each page run. This will also help in that other players will beble use that data. Say if you needed the top scoring 10 players for example, the data is already saved in the database so it will be easy to find that out, with the most up-to date player data. Darren I appreciate any tips, insight, thoughts, stories, or help in absolutely any fashion that I can get. Even a tip of a nature outside my question related to my project would be great. it's my first project of this kind, and I'd like to avoid any problems I can, so I'm putting a lot of forethought into it all. Also, I'm the only coder, so to have to go back and rewrite a ton of code from one save method to another is just way too much work. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Return or not to return, that is the question
Chris Boget wrote: If there is no need to return a value then I don't do so. However, the function is going to process something, and surely you should check that the processing has succeeded or failed? This is precisely the point I was going to make. Unless an argument is passed in by reference for manipulation within the function, I can't think of a reason why you wouldn't want to return a value; true or false at the very least. You call a function to perform, well, a function. I would think that you would want to know whether or not the process within the function was successful, yes? thnx, Chris All depends on the function. function someFunc(){ $this-counter++; if($this-counter 100) $this-counter = 0; } Something that simple wont need a return at all. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] tinymce, php and mysql problem
Zoltán Németh wrote: 2007. 05. 29, kedd keltezéssel 10.29-kor blueboy ezt írta: Hi, I am using tinymce to save news articles with very basic html styling in a database. This works well upto a point but when I get over a certain number of characters and then the 'you have an error in your SQL syntax' error. I am saving in as a LONGBLOB so it should not be a data type mismatch. Any ideas? I'm almost sure this is an escaping issue. Do you use mysql_real_escape_string() on the stuff you store in the db? greets Zoltán Németh R. If the mysql_real_escape_string doesn't solve it (which I think it most likely will), echo out the SQL query its sending and post it here so we can take a look. Darren -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] System wide variable
Richard Lynch wrote: On Wed, May 23, 2007 4:27 am, Darren Whitlen wrote: John Comerford wrote: Not thought about the memory engine actually. Will give that a try and see how it turns out. Let us know. Finaly managed to get it going (uses AJAX which im not to great at..), and the database memory engine seems to be holding up fine. When it was reading/writing frm the file, after a short while I would start getting file is in use errors which using mysql now solves. I'd have GUESSED that MySQL would have just cached something that small and oft-used in RAM anyway, so a MySQL memory engine table wouldn't perform any better than the MySQL half of things. Better than the File System, probably, though that also may be getting cached... Think I'll leave the session_id idea then, if it locks it down per-script, the performance will pretty much die. It won't be any better than your own file-system calls, but you could do: ?php session_start(); //read-write $_SESSION here session_write_close(); //don't touch session here ? And it probably won't be any worse than the locking you presumably already have in your code... WHy is it sometimes MySQL and sometims file system? I'm changing the yShout script (http://yurivish.com/yshout/) so that it reads from a database, rather than the tx file it originaly used. And my bad, it checks the database every 3 seconds, not .5 :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Protecting MySQL Injection from PHP form
Jared Farrish wrote: On 5/25/07, Jason Pruim [EMAIL PROTECTED] wrote: I apologize for posting the entire add script, but I wasn't sure what was needed to check if I was doing it right or not. I figured in this case it was better to give to much info rather then not enough. My big main goal it to make this bit of software as secure/safe as possible. No apology necessary. As long as you're not posting 90 lines for a one-line question, you're ok. Regardless of what one person or another thinks, I find that it's often useful to see how other people approach problems and get around them. For instance, checking for character encoding is something I really have never done. I happen to think it's a useful best practice to use unit testing techniques to verify posted data, but some people (obviously) view this as overkill. To each his own. Now if only I could get a check box to show up so I can delete multiple people at one time :) But I'm still learning about that. I sure hope you're testing on test data, and not live data... Brings back bad memories :( -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Help with php server and sockets
Adz07 wrote: i want to set up a php server that can communicate with a client (CLI PHP Script). I can setup the server socket fine. What i need to know is whether it is possible for the client to call a function in the servers php code and the server return the data ready for the client to process?? To start, if anyone could tell me how to use a socket connection from a CLI client to a CLI server to retreive an array (it'll do for now :) if its even possible that is! Sorry if thats not the best explanation! Take a look at XML-RPC (www.xmlrpc.com). As Robert mentions, it is a standard protocol for communicating between languages/servers. Altho very bloated IMO, it should work fine within a CLI app. Darren -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: instant messenger php + ajax
Marco Sottana wrote: hi i am looking for an instant messenger for my web site i would like to enable also not register user to chat to the other not register user in my web site.. where i can find a source code like this ? Lots of the them out there.. google php ajax chat My personal favourite though has to be http://yurivish.com/yshout/ Bare in mind though, any PHP webserver based chat, will have a HUGE demand on the server. Check your bandwidth constantly, it's gonna increase. Darren -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: instant messenger php + ajax
Marco Sottana wrote: i would like a one to one chat .. no one to everybody - Original Message - From: Darren Whitlen [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Thursday, May 24, 2007 10:05 AM Subject: [PHP] Re: instant messenger php + ajax Marco Sottana wrote: hi i am looking for an instant messenger for my web site i would like to enable also not register user to chat to the other not register user in my web site.. where i can find a source code like this ? Lots of the them out there.. google php ajax chat My personal favourite though has to be http://yurivish.com/yshout/ Bare in mind though, any PHP webserver based chat, will have a HUGE demand on the server. Check your bandwidth constantly, it's gonna increase. Darren -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php So let me get the idea.. User comes onto the website, User talks to webmaster. Does the webmaster want to talk to everybody at the same time? Or just to one user at a time? Darren -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: two php scripts with same $_SESSION variables
Jean-Christophe Roux wrote: Hello, I have folder A with the following php script: ?php session_start(); $_SESSION['dummy']=10; echo $_SESSION['dummy']; ? in folder B (same level as A), there is ?php session_start(); echo $_SESSION['dummy']; ? when running the script in B, in can see the value 10. How can I make sure that the $_SESSION['dummy'] is not shared between the two scripts? I could change the name but that would not be convenient. Thank you We won't tell. Get more on shows you hate to love (and love to hate): Yahoo! TV's Guilty Pleasures list. http://tv.yahoo.com/collections/265 Session vars are available for every script that is run after the session has started. If you want to stop the session for te remainder of the script, you can use session_write_close(). http://uk2.php.net/session Darren -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] two php scripts with same $_SESSION variables
Jean-Christophe Roux wrote: Hello, Thank you for the answers. The issue is that the same codes are in folders A and B. When they are run from two different browsers, I am getting the behavior I 'd like to see with two session ids being created and therefore no sharing of $_SESSION variables. But when the two apps are opened inside the same browser, the $_SESSION variables are shared and that makes sense because session_id() returns the same value. It would be be nice that when the app in A is running and the user starts the app in B, in the same browser widow, the server and php are instructed to realize that this is a brand new session and assign a new session_id() which would solve my problem. Is there a way to achieve that? Regards, - Original Message From: Stut [EMAIL PROTECTED] To: Jean-Christophe Roux [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Thursday, May 24, 2007 7:34:24 AM Subject: Re: [PHP] two php scripts with same $_SESSION variables Jean-Christophe Roux wrote: I have folder A with the following php script: ?php session_start(); $_SESSION['dummy']=10; echo $_SESSION['dummy']; ? in folder B (same level as A), there is ?php session_start(); echo $_SESSION['dummy']; ? when running the script in B, in can see the value 10. How can I make sure that the $_SESSION['dummy'] is not shared between the two scripts? I could change the name but that would not be convenient. You'll have to change the name. The whole point of sessions is to allow scripts to share variables between requests. -Stut So what your saying, is that.. you want a webpage open twice but with different session_id? The only way to do that would be to create a session_id yourself, eg. session_id(time().rand(0,1000)); Then pass that id through your scripts via POST or GET, start the session using that ID. You can then start as many sessions as you like. Darren -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] two php scripts with same $_SESSION variables
Stut wrote: Jean-Christophe Roux wrote: Thank you for the answers. The issue is that the same codes are in folders A and B. When they are run from two different browsers, I am getting the behavior I 'd like to see with two session ids being created and therefore no sharing of $_SESSION variables. But when the two apps are opened inside the same browser, the $_SESSION variables are shared and that makes sense because session_id() returns the same value. It would be be nice that when the app in A is running and the user starts the app in B, in the same browser widow, the server and php are instructed to realize that this is a brand new session and assign a new session_id() which would solve my problem. Is there a way to achieve that? It's frickin' annoying! Why? Please don't top post! What you're wanting to do can be achieved by setting the path on the session cookies. You may be able to do this by calling ini_set to change session.cookie_path before calling session_start. -Stut - Original Message From: Stut [EMAIL PROTECTED] To: Jean-Christophe Roux [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Thursday, May 24, 2007 7:34:24 AM Subject: Re: [PHP] two php scripts with same $_SESSION variables Jean-Christophe Roux wrote: I have folder A with the following php script: ?php session_start(); $_SESSION['dummy']=10; echo $_SESSION['dummy']; ? in folder B (same level as A), there is ?php session_start(); echo $_SESSION['dummy']; ? when running the script in B, in can see the value 10. How can I make sure that the $_SESSION['dummy'] is not shared between the two scripts? I could change the name but that would not be convenient. You'll have to change the name. The whole point of sessions is to allow scripts to share variables between requests. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Get your own web address. http://us.rd.yahoo.com/evt=49678/*http://smallbusiness.yahoo.com/domains/?p=BESTDEAL Have a HUGE year through Yahoo! Small Business. http://us.rd.yahoo.com/evt=49678/*http://smallbusiness.yahoo.com/domains/?p=BESTDEAL Stut.. I've only been here one day, and I think I'm right in saying that your the one around here that gets annoyed really easy ;) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Protecting MySQL Injection from PHP form
Jason Pruim wrote: Hi Everyone, I think I have found away to prevent SQL code injection into my database and just wanted to get everyones comments on my method. ?PHP include 'defaults.php'; // Setting error message variable to nothing $errmsg = ; // Check form info if (!isset($_POST['FName']) || empty($_POST['FName'])) $errmsg .=PPlease enter your name/P; if (!isset($_POST['LName']) || empty($_POST['LName'])) $errmsg .=PPlease enter your address/P; if (!isset($_POST['Add1']) || empty($_POST['Add1'])) $errmsg .=PPlease enter your city/P; if (!isset($_POST['City']) || empty($_POST['City'])) $errmsg .=PPlease enter your state/P; if (!isset($_POST['State']) || empty($_POST['State'])) $errmsg .=PPlease enter your zip code/P; if (!isset($_POST['Zip']) || empty($_POST['Zip'])) $errmsg .=PPlease include your zipe code/P; if (!isset($_POST['subName']) || empty($_POST['subName'])) $errmsg .=P Please enter your submitter name/P; // Tell script what to do if there is a error message if ($errmsg!= ) { echo $errmsg; echo a href=\javascript:history.back();\Please go back and fill out the missing fields/a; exit; } else { echo psuccess: all fields were filled out/p; } $FName= $_POST['FName']; $LName= $_POST['LName']; $Add1= $_POST['Add1']; $Add2= $_POST['Add2']; $City= $_POST['City']; $State= $_POST['State']; $Zip= $_POST['Zip']; $Date= $_SERVER['REQUEST_TIME']; $Record= \t; $subName= $_POST['subName']; $subEmail= $_POST['subEmail']; $subPhone= $_POST['subPhone']; $chkMember=serialize($_POST['chkMember']); $chkAdd=serialize($_POST['chkAdd']); $chkDel=serialize($_POST['chkDel']); echo $FName First NameBR; $link = mysqli_connect($server, $username, $password, $database) or die('Could not connect: ' . mysql_error()); echo 'Connected successfully BR'; //mysqil_select_db('legion') or die('Could not select database' . mysql_error()); echo 'DB selected BR'; //Create the statement $stmt = mysqli_prepare($link, INSERT INTO current VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)); mysqli_stmt_bind_param($stmt, 'sss', $FName, $LName,$Add1, $Add2, $City, $State, $Zip, $Date, $Record, $subName, $subEmail, $subPhone, $chkMember, $chkAdd, $chkDel); //Add the record mysqli_stmt_execute($stmt); printf(%d Row Inserted.\n, mysqli_stmt_affected_rows($stmt)); //Close the statement mysqli_stmt_close($stmt); ? The reason I am echoing $FName just above the link was a debugging tool to make sure that it was filling at least SOME of the field properly before inserting them into the database. Also, just for planning purposes, I do plan on adding authentication to the form (Which I think I can do and track with sessions) but I have alot more reading to do before I can get that right. One other thing... What I did to test it was in the $FName field I typed: Jason; SELECT * FROM table; and it inserted the value, but didn't execute the code, Am I correct in thinking that I'm fairly safe from the bad people and the stupid users? I cannot see any sql-injection protection in your code anywhere? Seems as your using mysqli, take a look at the mysqli_real_escape_string() function. You need to run each _POST variable throught it. $FName = mysqli_real_escape_string($_POST['FName']); Or if your post data only contains data to be entered into the database, you might consider running everything through the function to make things easier: foreach($_POST as $k = $v) $_POST[$k] = mysqli_real_escape_string($v); Darren -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] System wide variable
Hi, I have a PHP script that reads and updates either a small file or a mysql database. This script is called from several places every .5 seconds. I would like to move this file to a variable for extra speed as the file is causing a few problems being accessed so many times. Is it possible to have a writeable variable that has the scope of EVERY script that is run through the parser? Thanks, Darren -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] System wide variable
Stut wrote: Darren Whitlen wrote: I have a PHP script that reads and updates either a small file or a mysql database. This script is called from several places every .5 seconds. I would like to move this file to a variable for extra speed as the file is causing a few problems being accessed so many times. Is it possible to have a writeable variable that has the scope of EVERY script that is run through the parser? Not really. Your options are basically 1) use the database instead of the file, or 2) try memcached (Google for it). -Stut Hmmm caching really isnt an option here as the data is always changing. Just a wild idea here.. would it cause major overhead if a script was to start a session, update some session vars, then switch to a common session_id that each script can access? Then use that session to store to my info. Would that cause any obvious problems? Darren -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] System wide variable
John Comerford wrote: How about a table using the mysql memory engine ? Darren Whitlen wrote: Hi, I have a PHP script that reads and updates either a small file or a mysql database. This script is called from several places every .5 seconds. I would like to move this file to a variable for extra speed as the file is causing a few problems being accessed so many times. Is it possible to have a writeable variable that has the scope of EVERY script that is run through the parser? Thanks, Darren From - Wed Not thought about the memory engine actually. Will give that a try and see how it turns out. Think I'll leave the session_id idea then, if it locks it down per-script, the performance will pretty much die. Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Include???
Dan Shirah wrote: Okay, I think I'm doing everything right, but for whatever reason my include isn't working. ?php echo $_POST['status_code']; if ($_POST['status_code'] = C) { include ('complete_save.php'); } ? The echo of my status_code retruns the correct value so the if should trigger. This is my include page: ?php echo test; ? VERY simple, but for some reason is not working change this line: if ($_POST['status_code'] = C) { to this: if ($_POST['status_code'] == C) { You need 2 equal signs when comparing. Darren -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php