Re: [PHP] Linux Question
You might solve this by providing different style sheet to on linux running browsers: if(ereg('Linux',$_SERVER['HTTP_USER_AGENT'])) { echo ''; } else { echo ''; } conbud wrote: Hey. This really isnt a PHP question. but what fonts do you reccomend using so they look decent on linux. Mainly looking for a good font that will look nice in MoZilla and Galeon. Almost all the fonts Ive used so far appear really tiny or really bold and not very good to read. -Lee -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Insert file into sql server binary field.
Read the file, addslashes(), and then insert it Naif Al-Otaibi wrote: How can I insert a file into a binary field in sql server 2000. Do I need some function in the query like upload or just read the file and insert it. Thanks, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Insert file into sql server binary field.
Never heard of that, in fact, addslashes escapes also NUL, so it must be binary, and BLOB is like TEXT, except for comparison is case sensitive in BLOB. And what if the file contains malicious code - it might come from remote user's upload Sterling Hughes wrote: Read the file, addslashes(), and then insert it Rather, read the file, don't touch addslashes, then insert it. AddSLashes is not for binary data... -Sterling Naif Al-Otaibi wrote: How can I insert a file into a binary field in sql server 2000. Do I need some function in the query like upload or just read the file and insert it. Thanks, -- 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] Creating mySql search feature.....
You first need to separate the words and then build your query: $words = explode(' ',$S_For); $cond=''; foreach($word as $str) { $cond .= " $S_From LIKE '%$str%' AND "; // replace AND with OR if you want ANY word } // remove trailing AND(last 4 chars) or OR(last 3 chars) $cond = substr($cond, 0, strlen($cond) - 4); // this is for AND And I hope you check the value of $S_From if it is valid Cookra wrote: Hi all, Need a little help here been at this for a while now... I have a database holding a table which in turn holds a collection of fields I need to search. Ive set up search form that sends the variable $S_For and $S_From, these variables represent the following: $S_For = the search keyword itself $S_From = the column which I need to search Ive created this and it works fine for single words, the problem as you may of guessed is when I enter a string of words ie: apple - works fine orange - works fine apple orange - doesnt Any help would be ideal - Databse = clientacc Table = hospitality - Everything else works on my site apart from this search feature.. please help! Regards R -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php and caching
Provide a back_to_the_form link and pass all values, then on the form assign them to the fields. Alex wrote: Hi, I have a few pages on my site that contains dynamical content that must be "processed" each time the page is loaded. But I'd also want to allow the users to be able to use the back button of their browser to go back to forms and that these forms still contain the information they entered (instead of being cleared). Can someone give me a hint on how to accomplish this if there's a way to do it? Thanks, Alexandre Soares -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Insert file into sql server binary field.
I would notice the difference, but computers don't understand text, it is just data for them, and they represent it the same way (there is no special file type for text and binary in filesystem either). The only difference is in case sensitivity - taken from mysql manual. You can also store binary objects in text. Chris Shiflett wrote: --- Marek Kilimajer <[EMAIL PROTECTED]> wrote: BLOB is like TEXT In what way? BLOB is binary large object. Text is ... text. One is binary, and the other is ASCII. The only similarity I can think of is that they both represent data. However, the format is completely different. Open up a binary file in a text editor, and then do the same with a regular text file. I think you will notice a significant difference. Or, consider the representation of 16 in binary versus ASCII: binary - 1 ascii - 0011000100110110 As Sterling mentioned, using addslashes() on binary data is a bad idea. The same can be said for any string operations intended for ASCII data. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: File Write Permission Errors - HELP! URGENT!!!
If you want to create a file, the directory must be writeable to the server proces, so if the directory is owned by you do chmod o+w chat Phil Powell wrote: I did just that. Permissions are set the /chat folder as it is in all other folders. This is the first time I've ever done fopen with "w" and I can't get it to write, always getting "unable to access" errors. I want to be able to create the file if it does not exist. It works for me to do "r" in all other folders with the same permissions as /chat. Phil "Craig" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... you must give the same permissions to the folder also. "Phil Powell" <[EMAIL PROTECTED]> wrote in message 0ca201c2947e$44690a80$dcbe6444@scandinawa1bo6">news:0ca201c2947e$44690a80$dcbe6444@scandinawa1bo6... Hi I have the following code that breaks: // PLACE NICK INTO NICKNAMES.TXT AND START OFF MESSAGES.TXT $fileID = fopen($path . "/nicknames.txt", "a") or die("Could not open " . $path . "/nicknames.txt"); chmod($path . "/nicknames.txt", 0755); fputs($fileID, $nickname . "\n"); fflush($fileID); fclose($fileID); $fileID = fopen($path . "/messages.txt", "a") or die("Could not open " . $path . "/messages.txt"); fputs($fileID, "*** WELCOME \"" . $nickname . "\" TO THE ROOM ***"); fflush($fileID); fclose($fileID); I am getting the following error: Warning: fopen("/users/ppowell/web/chat/nicknames.txt", "a") - Permission denied in /users/ppowell/web/chat/chat.php on line 163 I am attempting to write onto the files if they exist, if not, create them on the fly. I need the solution in the next 5 minutes - sorry, kind of an emergency! If anyone can help, please tell me what to do, the PHP manuals are not giving me a clear solution as to how to write to a file that does not yet exist that has to have the permissions of 0755 for both files. Thanx Phil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Upgrade issues
Check the owners of directories and files, they must be the same as for /usr/local/www/v-webs/games.savage.za.org/html/index.php, then it should work under safe mode too. Chris Knipe wrote: if (file_exists("themes/$ThemeSel/modules/$name/$mod_file.php")) { $modpath = "themes/$ThemeSel/"; } I don't get it? Warning: Unable to access themes/DeepBlue/modules/News/index.php in /usr/local/www/v-webs/games.savage.za.org/html/index.php on line 46 Line 46 is the if statement If you have using a new php.ini file, perhaps you can compare it with an old one and see if there's anything different--might give you a hint. Yeah, and no. It's FreeBSD-Ports, my php.ini is unchanged. FreeBSD installs the new / updated ini files as ini-dist, so hence, nothing on my settings has changed. I did also check to verify this, and it is indeed the correct ini file, with the correct settings... But then again, perhaps the problem is somewhere else... (i.e. file is not there, permissions, etc.) Yes the file does not exist. But isn't that why file_exists() is there? Right, I might be typing faster than I am thinking... :) Still, just make sure that PHP is using the php.ini file that you think it's using. The file that _you_ check didn't change but _php_ might be looking somewhere else... Of course, I could be wrong--haven't used FreeBSD/Ports--only linux. As ridiculous as this sounds... Turning of safe mode made the warning go away. Now, I guess the question is, 1) is this a bug in the file_exists() function, or 2) does the default warning levels increase when operating under safe mode? Either way, this never happened to me before, and is only now happening since upgrading from 4.2.1 to 4.2.2... Rather peculiar I think... -- me -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] & in Query String
Get mailed also $_SERVER['HTTP_USER_AGENT'], I would like to see which browser does that. & should get translated to &, but not vice versa Jonathan Rosenberg wrote: I have a page with thumbnail pictures that can be clicked on to see a larger picture. Each picture is hyperlinked as follows I access the 'pic' & 'caption' attributes with $_GET['pic'], etc. Pretty standard stuff. I have PHP set up so that error messages get mailed to a specified mail account. Every so often I get the following error message: Undefined index: caption In file /home//show_pic.php, line 64 page: /show_pic.php?pic=gb3.jpg&caption=Some+Text The problem is obviously (I think) that the $_GET['caption'] is failing. What I can't figure out is why the '&' got turned into '&'. Is a browser doing this? -- Jonathan Rosenberg Tabby (RB), Lynx (RB), Licorice, Tigger, Jet, Belle http://www.tabbysplace.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] array manipulations
if all you might have there is 'error', try if(array_search('error',$array) === FALSE) { echo 'not ok'; } if you might have different strings, do $result='ok'; foreach($array as $v) { if($v) { $result ='not ok'; break; } } Mattia wrote: Can anyone suggest an ELEGANT way to find out if an array is made of empty strings or not? example $a = Array( '' , '' , '' ); //ok $b = Array( '' , '' , 'error' ); // not ok $c = Array( 'error' , '' , 'error' ); // not ok tia Mattia -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Confirm message box
I use this javascript code: function confirmAction(question, uri) { if(confirm(question)){ document.location=uri + '&confirm=1'; } return false; } create link like this: delete If user has javascript enabled, on delete.php you will get $_GET['confirm']=1, and you know the action has been confirmed and go straight to deleting. If user has no javascript, you won't receive $_GET['confirm'], thus you know you need to confirm the action using php/html. PS: even if you don't need parameters to your script, add at least ? for it to work. Wilmar Perez wrote: Hello guys I have an script that just shows a list of names brought from a data base as this: name 1 name 2 etc... I want to have the following: name 1 Delete name 2 Delete etc... And when the user hits the Delete link a pop up dialog box (javascript style) asks for confirmation. I guess this is a simple task but being my first time mixing php and javascript variables I'm a bit confused. It would be nice if someone could point me at an example or a tutorial that may help me (I already did some searching but couldn't find anything useful). Thanks a lot *** Wilmar Pérez Network Administrator Library System Tel: ++57(4)2105962 University of Antioquia Medellín - Colombia 2002 *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Identifying users
Try http://www.xpenguin.com/ip-atlas.php Craig wrote: Anyone know off of hand - Is there a reliable/semi-reliable way of looking users up by country. e.g - On the likes of altavista or google, I have noticed that if you type in www.altavista.com and you are in the uk, it will redirect to uk.altavista.com, and google aswell for certain countrys. Anyone any Ideas? Craig -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to do this in PHP ? If it is then, how ?
Using javascript you can change the src of image. So you start with blank image, and if onchange event handler finds out the input field has two chars, changes the src of the image to say show_image.php?id=input.value Axis Computers wrote: Hi, I was wondering if this is possible to in PHP ... I am developing an application for a pizza place, where touch typing interface is much faster than using the mouse, so I was wondering if I can develop an interface with a calculator style keypad, and the codes entered (using something like STDIN in Perl), are automatically compared to the MySQL database to provide realtime feedback to the user, such as code 32 is hawaian pizza, and after the user enters code 32 Hawaian pizza get's displayed as feedback ... and then awaits for some other input such as size, etc... i.e. x- 32 Hawaian pizza14" $ 12 xx xxx Total = Thanks in advance, Ricardo Fitzgerald AXIS Computers Web development __ Omni ICQ#: 37031810 Current ICQ status: + More ways to contact me __ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sorting files in directory
Yes, you do. Add each dir to an array, sort the array, then loop through it printing the dirs out. Nick Wilson wrote: Hi all, I have several directories filled with files written like this: * 02-09-19-filename.etc * 02-10-02-anotherfile.whatever How does php order these files if read from the directory and printed to the screen? -- I need them in date order, do I need to sort them somehow? Many thanks... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirecting after changing server's IP address!
Is the connection still valid after changing the IP? I think this should work: You should run your perl script from within shutdown function, so it is run after the connection is closed and any output is sent to the browser. Send header('Refresh: 5; url=http://NEW_IP/next_page.php'); to redirect the browser after five seconds, also print some html informing the user he will be redirected, then exit. Your shutdown function will be called, and you can change the ip Adharsh Praveen R wrote: hai php-general, I want to know how can I redirect the browser to contact to a new ip address of the same server. In Detail I have a server say 192.168.1.10 (eth0) running apache.( Linux Machine running Apache). I contact the server through a client(Browser), through this client I change the IP address of the server, from 192.168.1.10 to 192.168.1.15. (After entering IP Address in the text field and clicking on the button save I call a perl script which calls ifconfig to change the address,perl script is called with exec() ). After few seconds I get "Page cannot be found" message as the browser tries to contact the old IP address. How can I make the client point to the new IP address of the same server? I can show the code also. Please help. regards, adharsh. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sorting files in directory
Justin French wrote I think PHP reads them in date created order, or something else... The order is not guarantied, it just happens to be so. I suppose most filesystems return files in the order they were added to the directory, but also reuse the space left after deleting a file. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] controlling ownership on file uploads ...
Besides what was said before, you don't even need to delete it, it will be deleted when your script is done. If you want to keep it, you have to move it elsewhere. Kenn Murrah wrote: Greetings. I've written a simple form to allow my clients to upload files to me, and it works fine EXCEPT that the uploaded file is owned by "www" and I while I can read the file, I don't have the necessary permissions to delete it when done ... Since this site is being hosted elsewhere, is there a way I can control ownership so that I can delete the file? I've written my ISP/web hoster and received no response -- usually that's their subtle way of telling me I should ask the PHP quiestion here :-) Any and all help would be appreciated. Thanks, kenn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Bad File Mode?
You can stat (get filesize, modification time, permissions) only local files - download it first and then get its filesize if you need it. Steve Keller wrote: I'm still trying to get a file posted to another server, but I seem to have run across an odd snag, and I was hoping someone can point out where I've gone wrong. Here's the code: $data = "mtype=XMLDOC&outfile=true"; $dataFile = "http://www.healthtvchannel.org/courses/pay/data/test.xml";; $fileSize = filesize($dataFile); $fp = fopen($dataFile, "rb"); $strFile = fread($fp, $fileSize); fclose($fp); $osbURL="https://partners.netledger.com/SmbXml";; $ch = curl_init(); $res = curl_setopt($ch, CURLOPT_POST, 1); echo "Set Post: ".$res; $res = curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); echo "Set Follow: ".$res; $res = curl_setopt($ch, CURLOPT_VERBOSE, 1); echo "Set Verbose: ".$res; $res = curl_setopt($ch, CURLOPT_URL, $osbURL); echo "Set URL: ".$res; $res = curl_setopt($ch, CURLOPT_POSTFIELDS, $data."&mediafile=".$strFile); echo "Set Postfields: ".$res; $res = curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); echo "Set ReturnTransfer: ".$res; $result = curl_exec($ch); curl_close($ch); echo $result; ?> What I'm getting is Warning: stat failed for http://www.healthtvchannel.org/courses/pay/data/test.xml (errno=2 - No such file or directory) in /usr/local/www/vhosts/healthtvchannel.org/htdocs/courses/pay/posttest.php on line 20 I'm positive the file exists, and if I cut and paste the URL from the error to a browser window, I can see the file. What am I doing wrong? -- S. Keller UI Engineer The Health TV Channel, Inc. (a non - profit organization) 3820 Lake Otis Pkwy. Anchorage, AK 99508 907.770.6200 ext.220 907.336.6205 (fax) Email: [EMAIL PROTECTED] Web: www.healthtvchannel.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] **** Converting dynamic webpages into static HTML pages
Easy and intuitive are all the programs that allow you to download the whole website http://download.com.com/3150-2071-0.html?tag=dir Ron Stagg wrote: I have an interesting challenge. I have built an online product catalog that is driven entirely by the contents of the product database (MySQL). The entire catalog is implemented in a single PHP script (catalog.php). The dynamic nature of this implementation allows the catalog script to generate hundreds of product description pages. Now, my client has requested that I give him the ability to generate a static version of the catalog so that he can burn it onto a CD for distribution at trade shows. He wants the CD to be a snapshot of the catalog. Furthermore, he wants to be able to generate this "snapshot" frequently so that pricing info on the CD will be current. To accommodate this, the process for generating the snapshot must be easy and intuitive. My plan of attack is to generate static HTML files by running the catalog script once for each product in the database. Here is my quandary; instead of echoing the output to a buffer for Apache to send off to the client, I need the script to output to a file. I do not want to write a second version of catalog.php that writes everything to file. There must be an easier way to do this. Is there a way I can access the output buffer that Apache sends to the client? Any other ideas? Thanks, Ron -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] printing screen without the print dialog
No, this is not possible - security restrictions Duky Yuen wrote: I am having this problem, I want to print something directly to my printer without having that print dialog. What to do know? Is this possible? Duky -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session problems again
Check your session files (usually in /tmp) if they are what they are supposed to be Jason Romero wrote: --when using session registered variables --i can only get them to save as session variables for one page --then on the next page they are gone --far as i can tell the variables are not getting written over or unset --and the session is not gettting destroyed --any other ideas what it might be? i tried the seggestions you guys had and i came up with one more question does the session cookie.cookie_lifetime have anything to do with the amount of time that session variables can be stored the session.use_cookies is on and register.globals is turned on however session.cookie_lifetime is set to 0 so would this affect the session variable lifetime? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multidimensional arrays (more and more...)
if [$number] is unique, use it as the key: // $issue[]["number"] = "number"; -- removed $issue[$number]["headline"] = "headling"; $issue[$number]["writers"] = "writers"; $issue[$number]["list"] = "list"; $issue[$number]["senttosubscribers"] = "0"; $issue[$number]["month"] = "05"; $issue[$number]["year"] = "2003"; $issue[$number]["description"] = "description"; then sorting by the the number will be simple (ksort) Mako Shark wrote: Wow. This goes way beyond simply printing multidimensional arrays. Here's some sample data: $issue[]["number"] = "number"; $issue[]["headline"] = "headling"; $issue[]["writers"] = "writers"; $issue[]["list"] = "list"; $issue[]["senttosubscribers"] = "0"; $issue[]["month"] = "05"; $issue[]["year"] = "2003"; $issue[]["description"] = "description"; What I need to do now is count(), sort() by number, and loop through this array. I read that PHP is screwy when counting and sorting multidimensional arrays, but they *have* to have come up with a method, right? __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Detecting email bounces sent by the mail function?
Added to this: you won't receive the immediately, so you are not able to tell the user that sending the mail has failed. DL Neil wrote: Hello Ade, Is it possible to detect with PHP whether an email sent using the PHP 'mail' function has bounced back or has not been delivered? I currently all ready check the email address using the 'ereg' function before the mail function is called, but this only checks the format is valid beforehand. Yes, and No! If you use the ReturnPath header SOME/most email servers will bounce msgs that they can't deliver to an actual mailbox back to you (others drop such msgs onto an Admin somewhere, lose them in the ether (the msgs not the Admins...) etc, etc). Accordingly, use a distinct address for this/email filing rules. Opt-in email schemes which send a welcome/confirm email to new customers do so for this reason - the only way to verify an email address is to use it (and get some feedback from the addressee). Of course, once you have 'located' a new user, you still have to cope with those who close email accounts without advising you... It's a wonderful world! =dn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to do this in PHP ? If it is then, how ?
In the browser it might look something like this: Pizza place
function add(n) {
document.pizza.num.value=document.pizza.num.value + n;
if(document.pizza.num.value.length!=2) {
document.pizzaimage.src='blank.jpg';
} else {
// alert("Pizza is " + document.pizza.num.value);
document.pizzaimage.src='show_image.php?img_id=' + document.pizza.num.value;
}
}
Additional information (size, weitht ...) can be provided in the image Axis Computers wrote: Thanks for replying, Now I know it's possible to do it, but I still don't know how can I develop such interface, I will do it in php and mysql, but I need a little guidance with the way to do it I just can't figure out how ... Thank you Ricardo Fitzgerald -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] includes & globals
Is it not set or is it empty? Try adding this code to menu function after global $LOCATION; if(!isset($LOCATION) die('$LOCATION is not set!'); Cesar Aracena wrote: Hi all, I'm making a site with a dynamic menu based on IF statements and DB queries, but have this little problem which I can't understand the reason. My programming method is based upon an application.php file which controls the hole site and paths, template files for the header & footer and main PHP files which includes all the needed files that I mentioned before. As an example of this, the header TITLE tag has a variable to take a different title for each page and after that, I put a $LOCATION variable to tell the menu() function which page is being displayed (different menus for products, about us, etc.) but the menu() function (fetched from a library) is not recognizing this $LOCATION variable. I'm declaring it as a GLOBAL inside the function, but nothing happens. Here's part of my code: This is part of my product's index.php file: require ("../application.php"); $TITLE = "Joyería Mara"; $LOCATION = ""; include ("$CFG->templatedir/header.inc"); ?> WIDTH="100%" HEIGHT="100%"> BORDER=0 CELLSPACING=0 CELLPADDING=15 WIDTH="100%"> menu(); ?> === And this is the menu() function: function menu(){ GLOBAL $LOCATION; if ($LOCATION = "productos"){ GLOBAL $MENU_NAME, $MENU_BACK, $MENU_LINK, $CFG; $MENU_NAME = "Nosotros"; $MENU_LINK = "".$CFG->wwwroot."/nosotros"; $MENU_BACK = "66"; menu_def(); unset($GLOBALS['MENU_BACK'], $GLOBALS['MENU_NAME'], $GLOBALS['MENU_LINK']); GLOBAL $MENU_NAME, $MENU_BACK, $MENU_LINK; $MENU_NAME = "Productos"; $MENU_LINK = "".$CFG->wwwroot."/productos"; $MENU_BACK = "99"; menu_def(); unset($GLOBALS['MENU_BACK'], $GLOBALS['MENU_NAME'], $GLOBALS['MENU_LINK']); GLOBAL $MENU_NAME, $MENU_BACK, $MENU_LINK; $MENU_NAME = "Regístrese"; $MENU_LINK = "".$CFG->wwwroot."/registrese"; $MENU_BACK = "66"; menu_def(); unset($GLOBALS['MENU_BACK'], $GLOBALS['MENU_NAME'], $GLOBALS['MENU_LINK']); GLOBAL $MENU_NAME, $MENU_BACK, $MENU_LINK; $MENU_NAME = "Contacto"; $MENU_LINK = "".$CFG->wwwroot."/contacto"; $MENU_BACK = "66"; menu_def(); unset($GLOBALS['MENU_BACK'], $GLOBALS['MENU_NAME'], $GLOBALS['MENU_LINK']); } else if ($LOCATION = "nosotros"){ echo "hi"; } else{ echo "none"; } } == Any thoughts? Thanks Cesar L. Aracena [EMAIL PROTECTED] [EMAIL PROTECTED] (0299) 156-356688 Neuquén (8300) Capital Argentina -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] page auto reload after new window closed
This would prevent nonjavascript browsers from submiting the form. Better would be to use the page that comes after submiting: Form submited successfully Form submited successfully Ernest E Vogelsinger wrote: At 09:21 02.12.2002, Michael P. Carel said: [snip] Sorry for this kind of post but i cant find a better mailing list for javascript. I have a problem in refreshing my php page script. Im using javascript to open new window for editing purposes. But i want my opener opener page to auto reload upon submit in my new window. [snip] Use JavaScript, for example. There is a window property called "opener" which is a handle to the window which opened the popup. Upon form submit, you could:
function submitForm(form) {
document.forms[form].submit();
window.opener.location.reload();
window.close();
return true;
}
...within your form code... ...your form contents... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] some data output formatting and grouping question...
you got the results, now loop it, and if you find Y is different from the previous one, print it: $previous=''; while($row=mysql_fetch_array($res) { if($row['Y']!=$previous) echo "$row[Y]"; echo "$row[X]"; } Victor wrote: I just have a fucking mental block; I cannot at all conceive the necessary syntax to or even the theoretical algorithm that I need, to do the following: Consider the following table: U | X | Y --|---|-- me|001|0a me|002|0a me|003|0a me|002|0b me|003|0b me|004|0b ..|...|.. then the code says: SELECT * FROM Y WHERE U = me So now what? - remember I do not know the value of Y, so it has to be an automatic thing; I can't just say ... WHERE U = me AND Y = a. I want this output: 0a 001 002 003 ___ () 0b 002 003 004 How the hell do I do that? I can't think of the goddamn' syntax! __ Post your free ad now! http://personals.yahoo.ca -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do I run a command as root?
As your server process run as nobody or apache, you need a wrapper setuid root program that will execute the command you want, but you must be very carefull so it is not exploitable. Luke van Blerk wrote: Hi I'm trying to find out how to run a command on the server as root. Does anybody know how to do this? Thanks Luke -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Disable refresh?
Ernest E Vogelsinger wrote: This will not stop the user from hitting the "Back" button and refreshing the form... If the user wants it he can do it even with your method. My point is he don't do it unintentionally, so I use just the Location method -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to get/wait for user-input?
For console app you can use readline functions Martin Thoma wrote: Hello! I'm using a PHP-script as a small console-app. Is the only way to give parameters to it the $QUERY_STRING, or can I wait for the user to input something (like scanf in C)? I couldn't find anything in the docs, so perhaps this is not possible?! Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing arguments to the same script
what abou using action=questions instead of questions=1, then you can use array: $links=array('questions'=>"Questions link content will go here", 'samples'=>"Samples link content will go here", echo $links[$_GET['action']] this would be neater. Troy May wrote: Thanks for responding. I think I'm still doing something wrong. Take a peek: if(isset($_GET['questions'])) { echo "Questions link content will go here"; } elseif(isset($_GET['samples'])) { echo "Samples link content will go here"; } elseif(isset($_GET['rates'])) { echo "Rates link content will be here"; } elseif(isset($_GET['contact'])) { echo "Contact information will go here."; } else { echo "Main content goes here."; } The only thing that EVER gets displayed is the final else. (Main content goes here.) What am I doing wrong? Once again, the links are in this format: Any ideas? -Original Message- From: John W. Holmes [mailto:[EMAIL PROTECTED]] Sent: Sunday, December 01, 2002 7:39 PM To: 'Troy May'; 'PHP List' Subject: RE: [PHP] Passing arguments to the same script I'm sure this is easy, but I'm drawing a blank. I need to have links at the bottom of the page that passes arguments to the same script (itself) when it gets reloaded. How do we do this? I have the links like this now: How do I determine what is passed? I need to do an "if" statement with different outputs depending on the argument. if ($samples) { do something } if(isset($_GET['samples'])) { do something } ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Howto: run local script to update remote script
You need to open http connection to the server from you local php: http://server/script.php?password=yoursecretstring','r'); fclose($f); ?> in the script.php check the password and then $_SERVER['REMOTE_ADDR'] eriol wrote: I was wondering how I could have a local PHP (4.2.3) script running on Apache 1.3.27 / WinXP Pro send my current local IP address to a remote server running PHP 4.1.2, RedHat 7.3 & Apache 1.3.26.. In the Linux based script, I'd want it to basically display my current IP address to friends who know the remote URL to connect to my FTP/HTTP server(s) and grab mp3s, etc.. I'm a complete newbie, and in my php.net/google.com searches the only thing I've come across is something called a CRON Job.. From my little experience and understanding, I've always thought a Cron Job was something that only was valid on *nix platforms and not Win32.. Am I mistaken? My remote linux server has a dedicated IP, although my Win32 machine obviously doesn't.. I assume this would make it easier to communicate from local to remote? From my little understanding, I assume the local script would need to place my IP address in a variable (within say: ipaddy.inc) and the remote script would be updated as the variable was read from ipaddy.inc when someone visited the page..? If anyone could point me to a tutorial, function name(s) or offer some code to get me started, I'd greatly appreciate it.. Apache & PHP load on my local (Win32) machine when it boots and it's always running.. I just can't get past the auto-run-a-local-php-script area for the most part.. TIA.. Take care.. peace.. eriol -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [SEMI-OT] Making secure flash high scoring?
If you mean the score cannot be cheated, the answer is no. You can make only more obscure. Leif K-Brooks wrote: Sorry for the semi-ot post, but this is both a flash and php question, and I'm not a member of any flash lists, so I decided to post it here. Anyway, I have a game site with virtual pets, virtual shops, user accounts, etc. One feature request I get alot is flash games. I could find someone to make them, but I'm not sure about ways of making the score submitting secure. Any thoughts? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Creating dynamic names for images
I use this function: function sec_move_uploaded_file($tmp_name,$dir, $name) { if(file_exists($dir.'/'.$name)) { $ext=strrchr($name,'.'); $basename=substr($name,0,strlen($name)-strlen($ext)); $i=2; while(file_exists($dir.'/'.$basename.$i.$ext) ) { $i++; } $name=$basename.$i.$ext; } //echo "copying $tmp_name to $dir/$name"; return ( $r=move_uploaded_file($tmp_name, $dir.'/'.$name) ? $name : $r); } Davíð Örn Jóhannsson wrote: I have a situation where I allow users to upload images, and I store the names of the images in a database and the images I store in a some folder on the server, but what I would like to do is to dynamically create names for the images and dont ever have to worry about if this name exists and with out having to got to the trouble of asking the user to change tha name of the file. So dose some one have a nice litle solution for this problem. Thanks, David -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Copy question
No, you can use ftp functions. Evandro Sestrem wrote: Hi, Can I use the copy function to copy a file to a remote computer? Ex: // copy a file from my computer to a remote computer copy('c:\teste.txt', '200.xxx.xx.xx/temp/teste.txt') How can I do it? Thanks in advance, Evandro Sestrem -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Repeating Decimals
0.3 Stephen wrote: Hello again, This is another PHP mathematical question. How can I display a bar over a number (overline) if it's a repeating decimal? When the user types in 1 by 3, they get 0.. I want it to display as 0.3 with the 3 overlined. How can I do this keeping in mind that not all numbers will be repeating decimals? Thanks, Stephen Craton http://www.melchior.us "What is a dreamer that cannot persevere?" -- http://www.melchior.us -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP query to javascript array
for numbers: jsarray= new Array(); for strings: jsarray= new Array(""); Christian Ista wrote: Hello, Could you tell me how to transform a PHP query result to a javascript array ? Same question, if you want to store several field from the query to the javascript. Christian, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to loop diplays of 4 column of items, every row?
asuming $res holds your query result: $col=0; echo ''; while($img=mysql_fetch_array($res)) { if($col==0) echo ''; echo " "; $col++; if($col==4) { echo ''; $col=0; } } if($col!=0) str_repeat('', 4 - $col); echo ''; Not tested Wee Keat [Amorphosium] wrote: Hi all... I've tried to figure this one out but I'm really having a headache now. So, I really need your help. Situation: I have a database of images and its own thumbnails created using GD. It worked wonderfully. Problem: I want to display ONLY thumbnails in table form, incrementing in rows of 4 columns. By this I mean that I want to write a script which loops in a way that it displays 4 pictures withdrawn from the database into a row, and then for the next 4 images, displays them into the next row. If you don't understand see the gif below... a script that displays 4 pictures across first ( arrow 1) , then goes to the next row and displays the next 4 ( arrow 2). I can't work out how can i structure my loop to do this. Question: Can all the gurus out there please give me a pointer? I really can't work out the logic or systematic flow of scripting this one. Thank you so much in advance! Yours, Wee Keat Chin -- "Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe." - Albert Einstein -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail function() with MS
Your ISP should set it up, if not, I believe there is a class that can comunicate with SMTP server directly, check www.phpclasses.org Anthony Ritter wrote: Hi, I'm using MS Win 98 and my ISP has PHP installed on a MS server. I'd like to display a HTML form box on my site for users to type in a message utilizing the PHP mail() function. I've tested this using Apache on my drive with a html form and a php script to receive the data and it works fine - but when the site goes live it will be hosted with an ISP with a MS server - not Apache. Is it possible to utilize the PHP mail function under these conditions? I was led to believe that I could change the configurations in my php.ini file from: SMTP: localhost to SMTP: mail.yourisp.com Greatly appreciate your advice. Thanking all in advance. Tony Ritter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP adding slash to MySql results
You ISP turned magic_quotes_runtime on, use set_magic_quotes_runtime() to override it. Kevin Lowe wrote: Hi, I have just noticed a problem reading MySql data with PHP running as an apache module. Basically, any data retrieved from MySql that contains a single quote (and no doubt other characters too) is displayed with a slash in it when printed by PHP. For example: $surname = "O'Brien"; print "$surname"; displays - O'Brien - while $surname=mysql_result($result,0,"surname"); print "$surname"; displays - O\'Brien - even thought doing a select from the shell shows that is stored in mysql without the slash My ISP reciently upgraded from 4.12 to 4.2.2 and i wonder if this has anything to do with this, as these scripts did not ass slashes in print outputs before and have not been changed. I'm sure this is some PHP configuration thing, but magic quotes are off, and in any case I assumed this applied to incoming data only? What do I need to change and can I do this within a .htaccess file so it can easily be applied to all my scripts without changing them? Many thanks, Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Output of MySQl sorted query to text or Word file.
newline in windows is "\r\n" - $newline="\r\n"; [EMAIL PROTECTED] wrote: I found all this and have worked on getting the file output and formated to my (actually my boss') liking. The text file gets formatted just fine when read in Linux but the newlines appear as blocks when viewing in Windows. I've included the scipt that reads and formats the output below. What do I need to use to create real linefeeds or new lines when viewing under windows? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Editor Browser View? (Beginner Question)
Simply make a test directory on your provider's webserver and test the changes there Paul Lazare wrote: A Company Programmed my Homepage in PHP. Now I want to make simple changes like changing some text. And I want to try it alone, so I got myselv PHPEdit. I copied the complete Homepage on my harddisc to work on it tiht PHP Edit and everthing works fine. But how can I see the result of the changes (without uploading it the provider again)? I allready tried to click on "new browser" and it is opening an empty browser... sorry for the beginner question. Am I in the right newgroup for this question? greetings, paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] changing endianness
Hello, Does anyone know a way to change endianness of a binary string? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP shell scripting not working right?
You don't have ./ in your $PATH so you must type ./test.php to execute it Leif K-Brooks wrote: I'm trying to do shell scripting in PHP. I have PHP installed in /usr/bin/php. I have the following script: #!/usr/bin/php -q print "Success!\n"; ?> It's saved as test.php and CHMODed to 777. When I type "test.php" at the command line, it says: bash: test.php: command not found When I type "test", it acts like I just hit enter. Typing "/usr/bin/php -q test.php" does work. Does anyone know what I'm doing wrong? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Error 155 using exec - please help !
Take a look at http://cvs.php.net/co.php/php4/php.ini-dist The part that should you look at is Resource Limits (max_execution_time,memory_limit) and set up your php.ini accordingly. [EMAIL PROTECTED] wrote: Here is what i do to parse a file with a perl script from PHP to get a formatted output from the file : error_reporting(E_ALL); $cmd="/pathto/dump.pl \"".$HTTP_POST_VARS["filename"]."\" 2>&1"; $res=exec($cmd,$tab,$err); With small files all goes fine, but when parsing a big file i get the 155 error code in $err, while PHP doesn't report any error ($tab stays empty) Of course if I launch the same command directly from the shell, all goes fine even with very very big files. Where can i find more info about that error code ? Is it returned by perl, sh, Apache or PHP ? Probably because of some memory limit, where can i tune that memory limit ? I'am on FreeBSD4+Apache 1.3+PHP4 apache module+perl 5 Thanks for any help. David. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help for Undefined variable
You have error reporting set to display notices, either set your error_reporting to error_reporting = E_ALL & ~E_NOTICE or use if (isset($Array) && eregi($Pattern, $Array["URL"])) { New B wrote: Please help! I am a beginner of php, I got an error from my own webpage: Notice: Undefined variable: Array in C:\Inetpub\wwwroot\php\HandleForm.php on line 23 Please enter a valid Web address! Below is my code: function WriteToFile ($URL, $Description) { /* Function WriteToFile takes two arguments--URL and Description--Which will be written to an external file. */ $TheFile = "C:\Inetpub\wwwroot\php\data.txt"; $Open = fopen ($TheFile, "a"); if ($Open) { fwrite ($Open,"$URL\t$Description\n"); fclose ($Open); $Worked = TRUE; } else { $Worked = FALSE; } return $Worked; }// End of WriteToFile Function. ?> Using Files /* This page receives and handles the data generated by "form.html". */ $Pattern = "(http://)?([^[:space:]]+)([[:alnum:]\.,-_?/&=])"; if (eregi($Pattern, $Array["URL"])) { <-That is line 23 $Replace = "http://\\2\\3\"target=\"_new\";>\\2\\3"; $Array["URL"] = eregi_replace($Pattern, $Replace, $Array["URL"]); $CallFunction = WriteToFile ($Array["URL"], $Array["Description"]); if ($CallFunction) { print("Your submision--$Array[URL]--has been received!\n"); } else { print ("Your submission was not processed due to a system error!\n"); } } else { print ("Please enter a valid Web address!\n"); } ?> Thanks, New B -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [php] INSERT INTO
For 40 variables I would recomend keeping them in a single array and then loop the array: $vars['part1']='something'; $vars['part2']='something else'; foreach($vars as k => $v) { $vars[$k]=addslashes($v); } John Taylor-Johnston wrote: Yes I'm reading the FM :) http://www.php.net/manual/en/ref.mysql.php I should know this. How will I PHP this SQL into my MySQL table? INSERT INTO testals VALUES ($part1, $part2, $part3, $part4); I'm particularily concerned aboute single quotes. How do I escape them? Should I? Here is what I think is right. --snip-- $myconnection = mysql_connect($server,$user,$pass); mysql_select_db($db,$myconnection); $query = "INSERT INTO testals VALUES (addslashes($part1), addslashes($part2), addslashes($part3), addslashes($part4));"; mysql_query($query); mysql_close($myconnection); --snip-- That's it, right? I have about 40 variables. I wanted to run the code through here before I start. Thanks, John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] need help with sessions
You don't need to call session_start twice. And you are right, the problem is in that line: you want to show your login screen if both $_POST['uid'] and $_SESSION['uid'] are not set, therefor instead of OR use AND. Anders Thoresson wrote: Hi again, I'm still trying to understand sessions, and have made some progress during the afternoon, thanks to Ernest E. Vogelsinger. I'm at the moment trying to get a login-script up and running, but without 100 percent success. The script is split up in two major parts: bilder.php, which is the main script, and accesscontrol.php, which should check wether a valid username and password are entered or is already entered. The first time bilder.php is run, everything works fine. accesscontrol.php gets called, and since I've not logged in, a log in-form is displayed. I enter a valid username and password, which is checked in a MySQL-table and get the green light. But then the scripts forget that I've already logged in, and presents the log in-form over and over again. Since I'm new to this list, I'm not sure how big source code snippets that are needed and allowed to post. This time I make a rather long posting. If not ok, please let me know. bilder.php: # bilder.php include ("db_functions.php"); include ("html_functions.php"); include ("accesscontrol.php"); include ("bilder_functions.php"); session_start(); define ("INITIAL_PAGE", 0); define ("LOGOUT", 1); # start $title = "bilder"; $header = " "; html_begin ($title, $header); # if $action is empty, show the start page if (empty($action)) $action = INITIAL_PAGE; if(isset($_REQUEST["action"])) { $action = $_REQUEST["action"]; } # examine $action switch ($action) { case INITIAL_PAGE: accesscontrol(); menu(); break; case LOGOUT: accesscontrol(); logout(); break; default: die("Unknown action: $action"); } html_end(); ?> <*** bilder.php ends here ***> accesscontrol.php function accesscontrol() { # accesscontrol.php - include-file to control that user is logged in session_start(); # check if either $_POST['uid'] or $_SESSION['uid'] is set if(!isset($_POST['uid']) OR !isset($_SESSION['uid'])) { $title = "log in"; $header = " "; html_begin ($title, $header); ?> You are not logged in. To see the pictures you need a username and a password. If you don't have these, send a mailto:[EMAIL PROTECTED]";>mail. Name: Password: html_end(); exit; } # if either $_POST['uid'] or $_SESSION['uid'] is set, here is where one end up $_SESSION['uid'] = $_POST['uid']; $_SESSION['pwd'] = $_POST['pwd']; $uid = $_SESSION['uid']; $pwd = $_SESSION['pwd']; # db_connect is my own function to connect to my database db_connect ("XXX", "YYY", "ZZZ"); $sql = "SELECT * FROM users WHERE userid = '$uid' AND password = PASSWORD('$pwd')"; $result = mysql_query($sql); if(!$result) { error("An error occured while your username and password were processed.\\n"); } if(mysql_num_rows($result) == 0) { unset($_SESSION['uid']); unset($_SESSION['pwd']); $title = "log in - error"; $header = " "; html_begin ($title, $header); ?> Log in failure! Your username or password was wrong. Try again. html_end(); exit; } $_SESSION['username'] = mysql_result($result,0,"fullname"); } ?> <*** accesscontrol.php ends here ***> My non-educated guess is that there is something wrong with the line if(!isset($_POST['uid']) OR !isset($_SESSION['uid'])). Also, at the moment I have a session_start(); in both files. Right or wrong? Best regards, Anders -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Number of sessions
You can open the directory where your session files are stored and count the files beginig with "sess_" and are owned by apache, but this should be restricted on a shared host (and would give you the number of ALL opened sessions on that server anyway). You can set your own session handler. fragmonster wrote: Hello, Is there a way to count how many sessions are opened on a PHP web site? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with static call of method - class::method
From what I know about OOP, $this should be undefined if the method call is static. Mirek Novak wrote: Hi everybody, I've problem deciding whether is method call static or dynamic. How can I find it? mirek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mkdir() makes dir, but with wrong owner
Another option is to use ftp functions. John W. Holmes wrote: i had a few problems with mkdir() ane uploading files using php. i have a simple script, which is making a dir. but everytime, it makes a dir with totally wrong user. chown wont work. any expirience with this?? i have found some older posts considering this, but no real answers. i think, the problem is probably in httpd.conf (apche config file), but i am not sure. That's normal. PHP runs as the Apache user, so anything it creates will be owned by that user. Workaround is to use CGI mode or make the dir 777 so you can still access it. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Finding # of weekdays between 2 dates..
WFM: $nowdate = mktime(0, 0, 0, 4, 1, 2002); $futuredate = mktime(0, 0, 0, 5, 2, 2002); echo weekdaysBetween ($nowdate,$futuredate,2); I get 5 Chad Day wrote: I found this function in the list archives while searching on how to find the number of a weekday (say, Tuesdays) between 2 dates.. function weekdaysBetween ($timestamp1, $timestamp2, $weekday) { return floor(intval(($timestamp2 - $timestamp1) / 86400) / 7) + ((date('w', $timestamp1) <= $weekday) ? 1 : 0); } Sometimes it works, but I've come across a date while testing this that doesn't work, which makes me think there is some bug in the function that I'm not seeing. The 2 dates I am trying are: 01-04-2002 and 02-05-2002 There should be 5 Tuesdays: 01-08-2002 01-15-2002 01-22-2002 01-29-2002 02-05-2002 Yet the script only returns 4, leaving off 02-05-2002. $nowdate = mktime(0, 0, 0, $STARTMONTH, $STARTDAY, $STARTYEAR); $futuredate = mktime(0, 0, 0, $ENDMONTH, $ENDDAY, $ENDYEAR); That's how I'm generating the time stamps to pass to the function, and I've confirmed the dates I've entered are correct.. echo weekdaysBetween($nowdate, $futuredate, 2); Returns 4 .. can anyone assist? Thanks, Chad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Installing PHP on XP
I did 2 days ago - Apache 1.3.27 + PHP/4.2.3. Did you follow the other instructions too? What is the error saing? Todd Cary wrote: I have Apache running on Windows XP, however I am having problems installing PHP. My PHP directory is C:\Active_Php and the documents say that I should add the following lines to httpd.conf: LoadModule php4_module c:/Active_PhP/sapi/php4apache.dll AddModule mod_php4.c AddType application/x-httpd-php .php However, I get an error when Apache tries to load the dll. Has any successfully installed PHP and Apache on Windows XP? If so, what changes are made to the conf file? Todd -- Ariste Software, Petaluma, CA 94952 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unable to set permissions
You should check the owner. However, this is not a php question, you should really ask your ISP. You did not even tell what kind of file manager it is. Alberto Brea wrote: When I upload php and other files and set the permissions on my ISP's (CPanel) file manager screen, sometimes the new permissions are set, other times they reset back to 644 without my knowing (so a visitor is unable to access the website, as the php scripts don't execute), and others the screen just refuses to save the new settings. Could anybody tell me why is this? Thanks in advance and merry Xmas and new year to everyone. Alberto Brea -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Selecting what's for deletion
Make the "Delete" button a link with href="delcategory.php?catid=$catid", maybe with additional information so you can redirect the browser back to where it has been (page #, parent category ...) Cesar Aracena wrote: Hi all, I'm making the administration part of a site which handles categories, sub categories and products. Inside the "Categories" part, there's a "List categories" button which gives a list of the categories and sub categories when pressed. Along with each category, there's a "Delete" button that, when pressed, it's supposed to delete that category from the DB. The problem here is that the lists is made dynamically using a FOR loop and is being placed inside a FORM so the action is handled through an ACTION="" tag. Now, the ACTION tag points to a php file which deletes the desired row in the DB. The question is how to tell that php file (through GET or POST) which row to delete... My first shot was to name each "Delete" or submit button inside form like "delcategory?catid=0001" but then the POST wasn't reading that... Any thoughts? Thanks in advance, Cesar L. Aracena [EMAIL PROTECTED] [EMAIL PROTECTED] (0299) 156-356688 Neuquén (8300) Capital Argentina -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] language internationalisation
Look at projects where it is done already (e.g. PhpNuke) If the strings are static (simple translation of static strings), keep it in a file as variables or constants, for dynamic content you may use separate table for language independent information and another table for language dependent info, with corresponding id and language id. Example: table stocks: stock_id, price, quantity table stock_description: stock_id, language_id, name, description Html output: the user should have the necesery fonts installed, you just need to output the correct header about the charset being used, e.g. header('Content-type: text/html; charset='. $charset); or tag Denis L. Menezes wrote: Hello friends, As the subject suggests I am looking for language capabilitie on my php webpages. Can someone please tell me which is a good way? I thought that I could have a database, but if so, can MySQL: handle multiple languages in the fields(like chinese language)? if this is possible, what about the html output : does the user need to install some fonts etc ? Thanks very much Denis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CLI delay
sleep(); usleep(); Maciek Ruckgaber Bielecki wrote: Hi guys !! im starting on this list today so hello to everyone :-) i have been programming in php for 2 years now, so i hope i may be helpfull. on the other hand im quite new to CLI PHP, an here my first question on the list : has anyone an idea of how can i do some kind of decent delay (instead of some shell_exec doing pings) :-P thanks, regards ... -- "Few are those who see with their own eyes and feel with their own hearts." Albert Einstein - Maciek Ruckaber Bielecki -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php+gd 2.0.7 problems take 2
Check the gd library, you should likely install the one on the other machine cj wrote: Hi would any one know what the following error's are for/mean I am using gd 2.0.7 with gif support built in and php4.2.3 I am using the exact same gd version and php version as I used on another machine and it compiled with only minor problems, but these errors are different to the errors I got on the other machine. Thanks gcc -I. -I/usr/local/src/php-4.2.3/ext/gd -I/usr/local/src/php-4.2.3/main -I /usr/local/src/php-4.2.3 -I/usr/local/src/apache_1.3.26/src/include -I/usr/l ocal/src/apache_1.3.26/src/os/unix -I/usr/local/src/php-4.2.3/Zend -I/usr/lo cal/include -I/usr/local/src/gd-2.0.7gif/ -I/usr/local/src/php-4.2.3/ext/mys ql/libmysql -I/usr/local/pgsql/include -I/usr/local/src/php-4.2.3/ext/xml/ex pat -I/usr/local/src/php-4.2.3/TSRM -g -O2 -c gd.c && touch gd.lo gd.c: In function `zm_startup_gd': gd.c:303: `gdArc' undeclared (first use in this function) gd.c:303: (Each undeclared identifier is reported only once gd.c:303: for each function it appears in.) gd.c:304: `gdPie' undeclared (first use in this function) gd.c:305: `gdChord' undeclared (first use in this function) gd.c:306: `gdNoFill' undeclared (first use in this function) gd.c:307: `gdEdged' undeclared (first use in this function) gd.c: In function `zif_imagecreatetruecolor': gd.c:588: warning: assignment makes pointer from integer without a cast gd.c: In function `zif_imagecreatefromstring': gd.c:1093: `gdImageCreateFromGifCtx' undeclared (first use in this function) gd.c: In function `zif_imagecreatefromgif': gd.c:1235: `gdImageCreateFromGif' undeclared (first use in this function) gd.c:1235: `gdImageCreateFromGifCtx' undeclared (first use in this function) gd.c: In function `zif_imagegif': gd.c:1462: `gdImageGifCtx' undeclared (first use in this function) gd.c: In function `zif_imagecolorat': gd.c:1626: structure has no member named `tpixels' gd.c: In function `_php_image_convert': gd.c:3521: `gdImageCreateFromGif' used prior to declaration gd.c:3521: warning: assignment makes pointer from integer without a cast make[3]: *** [gd.lo] Error 1 make[3]: Leaving directory `/usr/local/src/php-4.2.3/ext/gd' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory `/usr/local/src/php-4.2.3/ext/gd' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/usr/local/src/php-4.2.3/ext' make: *** [all-recursive] Error 1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Nested Arrays
Simple: while($rows[]=mysql_fetch_array($res)) {} ($res is a mysql result resource) Beauford.2002 wrote: Thanks for the info, but maybe I didn't give enough info. I have a mysql database with up to 10 rows and 5 fields in each row.. I have been reading up on some of the array functions, but haven't been able to get anything to work. TIA - Original Message - From: "Weston Houghton" <[EMAIL PROTECTED]> To: "Beauford.2002" <[EMAIL PROTECTED]> Cc: "PHP General" <[EMAIL PROTECTED]> Sent: Thursday, December 26, 2002 6:19 PM Subject: Re: [PHP] Nested Arrays Sure... for the longwinded approach, just do this: $row1 = array("col1", "col2", "col3", ...); $row2 = array("col1", "col2", "col3", ...); $row3 = array("col1", "col2", "col3", ...); $row4 = array("col1", "col2", "col3", ...); $row5 = array("col1", "col2", "col3", ...); $main_array = array($row1, $row2, $row3, $row4, $row5); Obviously these could include key-value pairs in the arrays as well. Then to prove it to yourself: print_r($main_array); Cheers, Wes On Thursday, December 26, 2002, at 06:14 PM, Beauford.2002 wrote: Hi, Is there anyway to do a nested array, I have looked at the various array functions and can't figure this out (if possible). I want to be able to put each field of a row into an array, and then put that entire row and into another array. so when I display it, I would have: row1 - col1 col2 col3 col4 col5 row2 - col1 col2 col3 col4 col5 row3 - col1 col2 col3 col4 col5 row4 - col1 col2 col3 col4 col5 row5 - col1 col2 col3 col4 col5 etc. (depending on how many rows there are). TIA -- 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] Nested Arrays
Sorry, now I reminded myself this would cause a false element at the end of $rows, use this: while($tmp=mysql_fetch_array($res)) { $rows[]=$tmp; } Marek Kilimajer wrote: Simple: while($rows[]=mysql_fetch_array($res)) {} ($res is a mysql result resource) Beauford.2002 wrote: Thanks for the info, but maybe I didn't give enough info. I have a mysql database with up to 10 rows and 5 fields in each row.. I have been reading up on some of the array functions, but haven't been able to get anything to work. TIA - Original Message - From: "Weston Houghton" <[EMAIL PROTECTED]> To: "Beauford.2002" <[EMAIL PROTECTED]> Cc: "PHP General" <[EMAIL PROTECTED]> Sent: Thursday, December 26, 2002 6:19 PM Subject: Re: [PHP] Nested Arrays Sure... for the longwinded approach, just do this: $row1 = array("col1", "col2", "col3", ...); $row2 = array("col1", "col2", "col3", ...); $row3 = array("col1", "col2", "col3", ...); $row4 = array("col1", "col2", "col3", ...); $row5 = array("col1", "col2", "col3", ...); $main_array = array($row1, $row2, $row3, $row4, $row5); Obviously these could include key-value pairs in the arrays as well. Then to prove it to yourself: print_r($main_array); Cheers, Wes On Thursday, December 26, 2002, at 06:14 PM, Beauford.2002 wrote: Hi, Is there anyway to do a nested array, I have looked at the various array functions and can't figure this out (if possible). I want to be able to put each field of a row into an array, and then put that entire row and into another array. so when I display it, I would have: row1 - col1 col2 col3 col4 col5 row2 - col1 col2 col3 col4 col5 row3 - col1 col2 col3 col4 col5 row4 - col1 col2 col3 col4 col5 row5 - col1 col2 col3 col4 col5 etc. (depending on how many rows there are). TIA -- 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] executable
No, you cannot execute commands on the users machine. However, if you use the right content-type header and the user browser is set up to open movie streams in a player, you don't need it. Edward Peloke wrote: Hello all, Can php call an executable on the users machine? I have some divx movies and I want the user to be able to click on a link and the php page will open the divx player and start to stream the movie. is this possible? Thanks, Eddie -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Does PHP recognize multiple selections in a form?
^^ Then $_POST['submitID'] will be an array with selected options Micah Bushouse wrote: grrr... I am trying to get several values from a selection form field (using multiple) into PHP. Is this possible? The code I'm using to test this is below. After running the code and selecting more than one field, the last field (the greatest number) is the only one that shows up as the only input from the selection part of the form!! Is there any other way?? thanks, Micah $phpSelf = $_SERVER['SCRIPT_NAME']; $phpFile = $_SERVER['SCRIPT_FILENAME']; $phpName = 'Multiple Selection Test'; $phpTimeRan = date('H:i.s'); $a='a'; $b='b'; ?> [] @ bgcolor="#003300" cellpadding="4" cellspacing="0" border="4" bordercolor="#00" style="color:#ff;"> Item for ($i=0;$i<10;$i++) { echo ''.$i.''."\n"; } ?> echo ''; var_dump($_POST); echo ''; echo ''; highlight_file($phpFile); ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Nested Arrays
while($tmp=mysql_fetch_array($res)) { // now $tmp is now an array (as the function name suggests) $rows[]=$tmp; // by assigning to $rows[], we make $rows an array, adding array $tmp as the last element } and this makes it multidimensional Beauford.2002 wrote: Great. now can you explain why this works. I'm confused at how PHP knows this is a multidimensional array. I was trying something like $tmp[][]=???. TIA - Original Message - From: "Marek Kilimajer" <[EMAIL PROTECTED]> Cc: "Beauford.2002" <[EMAIL PROTECTED]>; "PHP General" <[EMAIL PROTECTED]> Sent: Friday, December 27, 2002 8:45 AM Subject: Re: [PHP] Nested Arrays Sorry, now I reminded myself this would cause a false element at the end of $rows, use this: while($tmp=mysql_fetch_array($res)) { $rows[]=$tmp; } Marek Kilimajer wrote: Simple: while($rows[]=mysql_fetch_array($res)) {} ($res is a mysql result resource) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] function misfunction
Besides what Michael and jason said, you seem not have the $tracking initialized (it is not an object). You need to call $tracking=new tracking(); somewhere in your code. Martin S wrote: I'm trying to redo a db lookup into a function. The function is placed in a class called tracking and declared thus: function setCurrentDevGroup($devID) { // start original routine $query = "SELECT dev_group FROM tracking WHERE (computer = $devID)"; $sth = $adb->prepare($query); if($sth) { $res = $sth->execute(); $resulttable = $sth->fetchrow_hash(); $lookuptable = $resulttable["dev_group"]; return($lookuptable); } //end original routine } This is called from the code as: $tracking->setCurrentDevGroup($this->ComputerID); // $this->ComputerID is // known as eg 5. In the page which relies on the value of setCurrentDevGroup I get: Call to a member function on a non-object in /www/htdocs/dev/include/irm.inc on line 2857 Line 2857 is the one starting "$tracking->" above. Obviously I'm doing something wrong here. What? Cheers, Martin S. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php+html help
still you forgot " ;-) Print "Organisation name : ".$row[OrgName]."\n"; R'twick Niceorgaw wrote: Print "Organisation name : size=\"5\">.$row[OrgName]."\n".""; - Original Message - From: "Denis L. Menezes" <[EMAIL PROTECTED]> To: "PHP general list" <[EMAIL PROTECTED]> Sent: Monday, December 30, 2002 11:10 AM Subject: [PHP] php+html help Hello friends, I have the following php output line that works fine : Print "Organisation name : ".$row[OrgName]."\n".""; However, I want this line to be in bold, red and size=5. I tried the following code but fails. Can someone please tell me what is wrong? Print "Organisation name : size="5">.$row[OrgName]."\n".""; Thanks Denis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: SELECTing a row by maximum value
You cannot mix grouping columns without a group by clause. This would work: SELECT * FROM MYTABLE order by ifield desc limit 1 Elna Moorhouse wrote: TRY: SELECT id,Max(ifield) from MYTABLE. What I don't understand is why you specify id=$id in the where clause. If you already specify the id as let say 1 then the max for that id will be 100 from your example below. "Richard Fox" <[EMAIL PROTECTED]> wrote in message 003901c2b034$0c563740$0700a8c0@mygroup">news:003901c2b034$0c563740$0700a8c0@mygroup... Hi, What would be a query to select a single record from a number of records in a table, depending on which one has the biggest value in an integer field? e.g something like: MYTABLE id ifield 1100 2200 3150 SELECT * FROM MYTABLE WHERE id=$id and MAX(ifield) should return id=2, ifield=200 (but this doesn't work, of course) Many thanks, Richard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Function misfunction - 2
You forgot global $adb; at the beginning of your function, or use $sth = $GLOBALS['adb']->prepare($query); Martin S wrote: NOW what am I doing wrong?? function setCurrentDevGroup($devID) { $query = "SELECT dev_group FROM tracking WHERE (computer = $devID)"; $sth = $adb->prepare($query); if($sth) { $res = $sth->execute(); $resulttable = $sth->fetchrow_hash(); $lookuptable = $resulttable["dev_group"]; } echo $lookuptable; // gives e.g. printers return $lookuptable; // will not return the value to } . . . setCurrentDevGroup($this->ComputerID); // calling function $query = "SELECT name FROM $lookuptable WHERE (ID = $this->ComputerID)"; //debug line echo $lookuptable; // gives an empty string. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] chunking a blob field. adding a large object chunk bychunk
You could do UPDATE table SET blob_field = CONCAT(blob_field, '$next_chunk') but I'm not sure if your sql server will not read the whole field into memory anyway. Mike Brancato wrote: if I wanted to read a very large object into a blob field, is there a way i could do it in 1MB chunks. using and UPDATE statement "field = field+'$data'". and just use fread to read 1MB at a time into $data. -- Mike Brancato -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Error
This is just a notice, somewhere in the code is something like this if($array['index']=='something') do_something(); but $array['index'] is undefined. Should be if(is_array($array) && array_key_exists('index',$array) && $array['index']=='something') ... (which is quite long). Another option is to set up error_reporting to E_ALL & ~E_NOTICE in your php.ini (you used php.ini-recomended, right?) Dale wrote: I was able to successfully install the php on my win2k server. I am, however, getting an error any time I try to initialize a variable. This is the error I am getting: Notice: Undefined index: adv_auth in ...\mysql\lib.inc.php on line 132 I am not sure as to whether I forgot to do something when I installed php or whether I need to somehow modify IIS so that variable initialization will work. Thank you. Sincerely, Dale -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Arrays of strings from regex
David Pratt wrote: Am working through document to collect pieces that match and then insert them into an array so they can be used to construct another file. Looking in my doc for lines like this: {\*\cs43 \additive \sbasedon10 db_edition;} {\*\cs44 \additive \sbasedon10 db_editor;} {\*\cs45 \additive \sbasedon10 db_email;} Wrote this regex to find them: ^\{\\\*\\?(cs[0-9]{1,3}) (.*)\\[a-z0-9]+ (.*);\}$ ^ I suppose this wants to eat the whole line, use ([^ ]*) - all except space, or switch to perl expressions with its ungreedy match Now looking for best method for getting the parts in parenthesis () into an array so it will contain these values by finding the above three lines: $matches [0][0][0] = cs43 , \additive \sbasedon10, db_edition $matches [1][1][1] = cs44 , \additive \sbasedon10, db_editor $matches [2][2][2] = cs45 , \additive \sbasedon10, db_email Thanks in advance for any pointers. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Making with $values!!!
escape $ with \, Alexander Guevara wrote: hi.. i have this and i cant get it work!!.. HERES THE CODE --- for ($i=1;$i<11;$i++){ echo" TEXT "; } --- so what i need is that the output in HTML shows tha value as is.. for example the output of the code above is like this (im going to show only the input part thats the one i need to resolve!) Remember the number depends on the $i.. i only showing one... thats what that code generates... what i need is like this: So in conclusion what i need is the "$nom1" for retrieving the value of that variable later if an error ocurrs during a trasanction: (when an error occurs and i have to go back to thhis page) Thanks in advance! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Function misfunction - 2
so you want $lookuptable=setCurrentDevGroup($devID); switch($lookuptable) { ... Martin S wrote: Jason Wong wrote: On Tuesday 31 December 2002 20:48, Martin S wrote: This is the function which should return e.g. "printers" for $lookuptable. But doesn't. function setCurrentDevGroup($devID) { global $adb; $query = "SELECT dev_group FROM tracking WHERE (computer = $devID)"; $sth = $adb->prepare($query); if($sth) { $res = $sth->execute(); $resulttable = $sth->fetchrow_hash(); $lookuptable = $resulttable["dev_group"]; // DEBUG echo $lookuptable; // this give the correct value So here $lookuptable contains the correct value (eg "printers") ?? Correct. At this point $lookuptable contains the value of dev_group. } return $lookuptable; } But something like: echo setCurrentDevGroup($devID); That gives the correct value as well. But I wanted it as a variable ($lookuptable) ... What I am trying to do is: setCurrentDevGroup($this->Computer); // call function and get a device group switch ($lookuptable) { case "computers": bla bla bla case "printers": yada yada yada } However, getting the inspired moment from your post, I tried switch (setCurrentDevGroup($this->Computer)) { case "computers": bla bla bla case "printers": yada yada yada } And now this part works at least. My understanding was that the function would return a value for $lookuptable which was useable in the code above. This is incorrect then? /Martin S. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] prevent session_replay
This is how it works, but you can tie session to a specific IP (still not 100% safe) scott wrote: hi I'm running PHP 4.2.3 as module with Apache 1.3.26 on OpenBSD 3.2 with the chroot turned off (as it stopped the php_mail() funtion working, but if anyone has the fix for that I will re-implement the jail again :o) I'm having some problems with sessions. I am not using cookies, as many people don't allow them to be set The main page starts a session, takes username and password, and if they are ok, it registers the users id from the db as a session variable using the $_SESSION['user_id'] = $user_id it then does a header redirect to another page, which at the moment for testing just displays the SID and all $_SESSION[vars] as the SID is being passed in the url, I am able to copy the http://url?SID from the browser window if I close the browser (which from reading the docs on sessions should end the session) and then re-open another browser (admittedly on the same machine/ip address) and post the http://url?SID back in, I get the page, and the $SESSION[vars] are still there !! it is reading them back out of the files in /tmp (if I edit these directly and paste the url?SID in, I get the new values I mannually put in !) :o( is there a official/approved method to prevent this from being done ? thankyou _scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] killing child process
Michael J. Pawlowsky wrote: Actually to kill all of them would not be hard Try something like ps -eaf | grep httpd | awk '{print $2}' actualy it will be named only other_script.php (it doesn't go through httpd). You can execute the scripts with a dummy parameter that will be a random string and grep for that in the above command. That will give you all the httpd processes...pipe that into kill Mike *** REPLY SEPARATOR *** On 02/01/2003 at 8:26 PM gamin wrote: Hello, Running PHP 4.0.6 on RedHat 7.2. I'm writing a command line script (called scirpt.php) and am using the backtick operator to start other processes from my script. $com_response = `./other_script.php` ; or #com_response = `wget `; I can kill scirpt.php easily but that wont kill other_script.php, there would be no problem killing one process manually, but i could have many scirpts starting from the main script. Killing them all would be a task. I could prefix their name them with 'ch_' and kill all these. But thats not the solution i'm looking for. Is there a way to make a process a child, so that when the parent termintaes/is terminated the child terminates also ? thx gamin. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help with form adding to database!!
|$sql = "INSERT into $table_name (f_name, l_name, username, password) Values ('$f_name', '$l_name', '$username', '$password')";| notice the single quotes Karl James wrote: Hey guys, I cant figure out whats wrong with this code. Im sure its syntax can some one take a look at it and Help me out What im trying to do is create a form for sign up. So that the values will be added to the table in the databse.. For log in purposes. Thanks Karl Here is the code. HYPERLINK "http://host.makethewebsecure.com/~admin12/do_adduser.phps"http://host.m akethewebsecure.com/~admin12/do_adduser.phps --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.434 / Virus Database: 243 - Release Date: 12/25/2002 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include/require vs performance
He likely ment that his local server is simply fast enough that any speed defference is unnoticeable, but on a shared host this might make some difference. Use include/require as you are more comfortable with it. Rasmus Lerdorf wrote: Is there, was there ever issue around including a lot files via include(). I am running things on a local server so it's hard to gauge. I don't understand that comment. includes/requires are always (well nearly anyway) local to the server regardless of where the request is coming from. So if you have a test box and it is fast enough for you, then go with it. -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Possible bug with PHP v4.1.1 and bits?
inverting value: $action = ($value==='1' ? '0' : '1' ); Daevid Vincent wrote: I'm not even sure how to classify this... Given: Where $Enabled is either a 0 or 1 as read from a database ( TINYINT(1) ); And echo "action = ".$_POST[action].""; if ($_POST[action] == "1" || $_POST[action] == "0") echo = "UPDATE Company SET Enabled = ".!(intval($_POST[action]))." WHERE CompanyID = $id"; (skipping all the obvious bits -- no pun intended) I cannot figure out how to simply make the 0 and 1 invert or negate or toggle as it were. When I submit the form, my output is: action = 0 UPDATE Company SET Enabled = 1 WHERE CompanyID = 89 action = 1 UPDATE Company SET Enabled = WHERE CompanyID = 17 I've tried all kinds of combinations, but whenever the action is 1 to begin with, the 'inverted' version is always blank or -2 when I would expect it to be 0. If I use echo = "UPDATE Company SET Enabled = ".~(intval($_POST[action]))." WHERE CompanyID = $id"; action = 1 UPDATE Company SET Enabled = -2 WHERE CompanyID = 17 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File Modification Date/Time
you must prepend $DirToCheck to $file: filemtime($DirToCheck . $file) Christopher J. Crane wrote: I am trying to parse through a directory and get the modification dates of the file. $DirToCheck = "tempdata/"; if ($handle = opendir($DirToCheck)) { while (false !== ($file = readdir($handle))) { echo " $file - Last Modified: " . date("F d Y H:i:s.", filemtime($file)) . "\n"; } closedir($handle); } ?> All the files are coming back with a date of December 31 1969 19:00:00. What am I doing wrong? The next step is I want to check if the file is older than 30 minutes and if so, I want to delete it. How would I go about that? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File Modification Date/Time
This should be right, $TimeDiff is in seconds. Christopher J. Crane wrote: Doyou know how to compare time. I would like to get the difference in time from now to when the file was last accessed. I was thinking something like this: $DirToCheck = "tempdata/"; echo "$Now\n"; $TimeNow = time(); if ($handle = opendir($DirToCheck)) { while (false !== ($file = readdir($handle))) { $FileTimeUnix = fileatime($DirToCheck . $file); $TimeDiff = $TimeNow - $FileTimeUnix; echo " $file - Last accessed: " . date("F d Y H:i:s.", fileatime($DirToCheck . $file)) . " - $TimeDiff\n"; if($TimeDiff > 1) { unlink($DirToCheck . $file); } $TimeDiff = 0; } closedir($handle); } ?> "Marek Kilimajer" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... you must prepend $DirToCheck to $file: filemtime($DirToCheck . $file) Christopher J. Crane wrote: I am trying to parse through a directory and get the modification dates of the file. $DirToCheck = "tempdata/"; if ($handle = opendir($DirToCheck)) { while (false !== ($file = readdir($handle))) { echo " $file - Last Modified: " . date("F d Y H:i:s.", filemtime($file)) . "\n"; } closedir($handle); } ?> All the files are coming back with a date of December 31 1969 19:00:00. What am I doing wrong? The next step is I want to check if the file is older than 30 minutes and if so, I want to delete it. How would I go about that? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] please help me, y have a error
Means php tried to access memory page address it did not have. Try to find out if it was php itself or a loaded module, then upgrade the offending part and see if it still happens again. Ysrael Guzmán wrote: this is the message of the ERROR: PHP has encountered an Access Violation at 012B7DE7 what this Ysrael Guzmán Meza -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Perl > PHP
Jurre Thiel wrote: That doesn't make any sense and has nothing to do with Perl, since PHP will magically convert perl.pl to 'perl.pl'. I think perl will be magically converted to perl and pl to pl, and those two strings concatenated together using . inbetween will be perlpl -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] web reload
TACKEL wrote: Hi, I have a php file that set up a cookie that receives from a form and also uses it. My problem is the first time the value is submitted via form. The cookie is setup but I cannot not use it so I'd need to reload the web after setting up the cookie. Myfile.php if ($form_value != "0"){ // you should use if(isset($form_value)) { setcookie("mycookie",$form_value,time() + 30660); $cookie=$form_value; // and no need to reload } $cookie = $HTTP_COOKIE_VARS["mycookie"]; Any suggestion? Thanks, Tackel. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] web reload
Yes, you are right $cookie = $HTTP_COOKIE_VARS["mycookie"]; should be in *else* part Jason Sheets wrote: This will always assign the value of $HTTP_COOKIE_VARS["mycookie"] to $cookie, overwriting the $cookie = $form_value assignment which is what you want if the page is being reloaded but is not what is desired on the first page load. Jason On Sun, 2003-01-05 at 09:50, Marek Kilimajer wrote: TACKEL wrote: Hi, I have a php file that set up a cookie that receives from a form and also uses it. My problem is the first time the value is submitted via form. The cookie is setup but I cannot not use it so I'd need to reload the web after setting up the cookie. Myfile.php if ($form_value != "0"){ // you should use if(isset($form_value)) { setcookie("mycookie",$form_value,time() + 30660); $cookie=$form_value; // and no need to reload } $cookie = $HTTP_COOKIE_VARS["mycookie"]; Any suggestion? Thanks, Tackel. -- 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] Fw: Session ID changes
Scott Fletcher wrote: "[-^-!-%-" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>. .. Hello all, I need some clarification. To my understanding, each visit to php site creates a UNIQUE Session ID (SID). Only when you call session_start() - this function checks for $_REQUEST[session_name()], if there is one, it is used, else it creates one. And, that ID stays constants until the browser is shutdown, or the session is specifically destroyed. Is this correct? If not, then please advise. Basicly yes, session cookie lifetime is controled by session_lifetime configuration directive, its default 0 means cookie is destroyed after the browser closes. I'm trying to develop a cookie-less, persistent, shopping cart, which saves the cart details, in a database. I need to associate each order (cart item) to the current session id. However, the session ID number, seems to change, everytime the page is reloaded. Is this how it works? Am i missing something? Session ID is stored as a cookie, or you have to pass SID constant in each link of your page that points to your site and also as a hidden field in forms. Please advise. Thanks. -john -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Far out!!!! More IIS problems.....
phpinfo will tell you which php.ini is used Scott Fletcher wrote: I tried various methods on IIS after configuring hte PHP.INI. Such as shutting down IIS, restarting IIS and rebooting hte machine. Here's one latest addition that I found to be very far out!! What I did was I renamed the php.ini to php1.ini and goes throught the procedures. Guess what the website still is the same. So, I renamed the php.ini back and make some changes in php.ini. Still the same result. I'm still working on it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ftp and www
There are many of them: http://www.hotscripts.com/PHP/Scripts_and_Programs/File_Manipulation/File_Management/ Mukta Telang wrote: Hi, I am told to " merge ftp and www " ! I cant understand what it means.. May be it means that it should be possible to browse ftp directory from a browser? What is php's support for ftp? Mukta -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] No input file specified. Please help.
Try using full URI, e.g. http://localhost/index.php David Scott wrote: I am running this file from a tutorial: Something Useful Tutorial echo $_SERVER["HTTP_USER_AGENT"]; ?> When this file is run from my webserver (IIS) I get a page that says: No input file specified. What can I do to get this working? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Forwarding POST info from a PHP script
David Barrett wrote: Think you may have misread the problem, or I am not good at explaining it ;-) I can receive POST variables fine, and GET. My problem is that when a frameset (which my script renders) contains a form, I need to retrieve the OUTPUT from the form's target (i.e. ACTION tag), so I need to send all the POST (or GET... but that is easy) data received by my script onwards to another. Does this make more sense? It makes sense, but your solution is messy. Still you can use curl -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Undefined index a different problem
Mekrand wrote: my problem is, i have a script that works well before php 4.2.3 its sth like that {.. for($i=0; $i should not be echo("$GLOBALS[$i]"); and it gives me notice that undefined index i. how can i solve this problem? thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Undefined index a different problem
These are not errors, but notices, you can get around it using: if(isset($i) && array_key_exists($GLOBALS, $i)) echo $GLOBALS[$i]; or you might prefer setting error_reporting to not display notices Mekrand wrote: thanks but this time it gives 2 error, undefined variable i, undefined index i for $GLOBALS[$i] "Marek Kilimajer" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Mekrand wrote: my problem is, i have a script that works well before php 4.2.3 its sth like that {.. for($i=0; $i ... } //2nd part { echo ("$i"); } now i changed second part as; echo("$GLOBALS[i]"); should not be echo("$GLOBALS[$i]"); and it gives me notice that undefined index i. how can i solve this problem? thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Issues w/ WHOIS and Fgets
try if(($packet = fgets($fp, 4096)) === false) die(...); instead. The same for array_push Ben Vaughn wrote: Hello, Long time reader, first time e-mailer :-). I am having a pretty strange issue with fgets and a socket, and was hoping that perhaps someone here can help me. First, my code: function dowhois($who) { $data = array(""); $whom = trim($who); $fp = fsockopen ("127.0.0.1", 43, $errno, $errstr, 30) or die("Could not open socket to proxy"); if (!$fp) { die("$errstr ($errno)\n"); } else { fputs ($fp, "$whom\r\n") or die("Could not write to socket"); while ($fp && !feof($fp)) { $packet = fgets($fp, 4096) or die("Could not read from socket"); array_push($data, $packet) or die("Could not push data into array"); } fclose ($fp); } return $data; } As you can see, this is a function that accepts a string as an argument and is supposed to open a connection to a local WHOIS server, query for that string and return the results in an array. Unfortunately, when I call this function I always trip the third die();, "Could not read from socket." fgets always trips this. I am running PHP 4.3.0. I will also share some things I have learned in the last two days worth of problem-solving: - If I use fread instead of fget, I can pull the data, although it looks pretty worthless (I need \n terminated to parse the output properly) - Changing $fp from blocking to non-blocking alleviates no problems - Changing the max line length to anything does not cause issues - I have turned on auto_detect_line_endings to no avail - I have a pretty much identical script that does an HTTP query and that works. 3rd party php scripts that use sockets also work. It seems that WHOIS is causing the problem? Thanks for any help anyone can provide! Regards, Ben -- Ben Vaughn Security Analyst Blackbird Technologies 703-796-1438 W / 703-868-5258 C [EMAIL PROTECTED] -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP and MySQL bug
@mysql_select_db("be"); -- this failed do echo mysql_error(); to see what went wrong Nuno Lopes wrote: I done a echo of Mysql_error and it returned: 'Nenhum banco de dados foi selecionado' (I have the mysql server in portuguese, but the translation is something like 'no db was selected') - Original Message - From: "David Freeman" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, January 05, 2003 10:29 PM Subject: RE: [PHP] Re: PHP and MySQL bug > @MYSQL_QUERY("UPDATE d SET h='$h' WHERE id='$id'"); // this > query doesn't work Personally, I'd call it bad programming practice to do a database update and not check to see if it worked or not. In this case, how are you determining that the query did not work? Are you manually checking the database? You don't have anything in your code to check the status of this query. Perhaps this might get you somewhere: $qid = @mysql_query("UPDATE d SET h = '$h' WHERE id = '$id'"); if (isset($qid) && mysql_affected_rows() == 1) { echo "query executed"; } else { echo "query failed: " . mysql_error(); } At least this way you might get some indication of where the problem is. CYA, Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] EOF: how to generate one in a string
$result = `echo | /path/prog $arg`; should work Jean-Christian Imbeault wrote: I am trying to use a command line program in Linux using this form: $result = `/path/prog $arg`; But this doesn't work as the program is expecting and EOF that never comes. If I use the program on the command line when I am finished entering all the data I need to hit return and then CTRL-D to give an EOF. How can I simulate this using the backticks? Thanks! Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Double entry into MySQL..
You should be able to get around it also by checking if $_SERVER[REQUEST_METHOD]=='HEAD' Timothy Hitchens (HiTCHO) wrote: When they first click on the file their browser will make a request for type, size etc then when it display's the dialog box on the screen of the client it will make another request to start the download. I get around this by putting the session id into the database and if it is double requested within 5 seconds to discard. So you will need to do a select, num_rows then if below 1 insert. Timothy Hitchens (HiTCHO) Open Platform Consulting e-mail: [EMAIL PROTECTED] -Original Message- From: Altug Sahin [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 8 January 2003 2:07 PM To: [EMAIL PROTECTED] Subject: [PHP] Re: Double entry into MySQL.. Another strange behaviour... When I send the name of the file to be downloaded to this script, it works (still makes a double entry into MySQL though) with GET method but it doesn't work if the file's name is sent with the POST method. Why? I am pulling my hair out here!!! Please help... Thanks again "Altug Sahin" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi here, I am sending a file to user's browser and logging the downloaded file into MySQL but everytime this script works, I see double entry in the MySQL table... Why is this happening? Any ideas? Thanks $today = date("Y-m-d"); $conn = db_connect(); if(!$conn) echo "Can't connect to database..."; $query = "INSERT INTO track_dl (dldate, email, file) VALUES ('$today', '[EMAIL PROTECTED]', 'file.ext')"; $result = mysql_query($query); if(!$result) echo "Can't execute query: " . mysql_error(); header("Content-type: application/pdf"); readfile("file.pdf"); exit(); ?> -- 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] EOF: how to generate one in a string
No, there is no such value as far as I know, you may try `/path/prog $arg < somefile`, but I doubt it will be different. What prog is it anyway. If it is passwd, I know this behaves somewhat different, but I think there is still some workaround, you should as at a linux list. Jean-Christian Imbeault wrote: Marek Kilimajer wrote: $result = `echo | /path/prog $arg`; should work That didn' work ... don't know why. Isn't there a way to say echo "EOF"? There must be a way to specify the ascii or hex value for EOF in an echo statement no? Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SERVER content
You did not see HTTP_REFERER likely because there was none Fritzek wrote: Hi folks, I've seen a lot phpinfo() on different platforms, different PHP versions with different web servers. Always the content of $_SERVER is different. i.e PHP4.3.0 on win32 with Apache2 doesn't show PATH_TRANSLATED and HTTP_REFERER. someone knows how to get a consitent content of $_SERVER? Or where and how can I configure my system to see the above? thanks in advance Fritz -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SERVER content
Fritzek wrote: Hmmm. What does it mean? Is PHP deciding at runtime which variable in $_SERVER have to be filled? PATH_TRANSLATED should always be filled because you always have a path where your script is located. Also HTTP_REFERER because in easiest case you refering on the same script at localhost (I guess). referer is set only if you get to the page by clicking a link or submiting a form (if the browser is not set up to do different). so it is not set if you select the page from a bookmark or write it directly to location bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP mySQL Syntax problem
MYSQL($Dbname, "INSERT INTO $Tbname_1 VALUES(1, 'John Doe', '$color')"); - single quotes around $color Jo Ann Comito wrote: I'm working in PHP4 and have suceeded in creating a mySQL table. I can fill the table using the INSERT command as follows: The above works fine. Here is the problem: Instead of specifying the color, red, green, etc. I would like to generate a random color and store it in a variable, then use the variable in the INSERT command. To simplify the code in this example, I have just assigned a color to the varialble. $color = "red"; MYSQL($Dbname, "INSERT INTO $Tbname_1 VALUES(1, 'John Doe', $color)"); $color="green" MYSQL($Dbname, "INSERT INTO $Tbname_1 VALUES(2, 'Jane Smith', $color)"); This syntax does not work. The table is created, but it has 0 rows. I have tried a multitude of variations, including ECHO $color '$color' \'$color\' {$color} etc. No combination I have tried works. Could some kind person please point me in the right direction? Thanks, Jo Ann -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do I get the entire data sended to the web server?
I don't think there is a single variable, but you can build it from various variables and functions: $_SERVER array: REQUEST_METHOD REQUEST_URI SERVER_PROTOCOL function getallheaders() |$HTTP_RAW_POST_DATA| |this should be all you need| Heiko Mundle wrote: Is it possible with php to print the http header and the attached data for a transmitted http request? How can I do this? an example of what I want to see: POST /cgi-bin/CgiMfc1?MyQuery%3dQData HTTP/1.1 Accept: text/* User-Agent: HttpCall Accept-Language: en-us Host: localhost:680 Content-Length: 98 000629EF2656+vs+%0d%0a143%2e114%2e37%2e22+vs+%0d%0aDEKGKIEG+vs+ %0d%0a000629ef2656+vs+%0d%0a2051586 Thanks Heiko -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] graph libs
http://www.aditus.nu/jpgraph/ Larry Brown wrote: Can anyone give any suggestions on the best/most intuitive tools or libraries for generating graphs with PHP? Larry S. Brown Dimension Networks, Inc. (727) 723-8388 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php