[PHP] Re: Is it possible to create a global namespace alias?
I'm assuming there is no way to make a global alias. Can anyone confirm/deny this? Matt Palermo wrote in message news:5e7b8989448b45dbbeeb6fb89b3f3...@rachet... Is it possible to create a global namespace alias in PHP or does the alias have to be defined in EVERY file that I use? Here is an example: file: main.php ?php use \this\is\my\custom\namespace\Item as nsItem; ? file: index.php ?php require_once “main.php”; // Attempt to use namespace alias defined in main.php file nsItem::test(); ? The above code doesn’t work for me. The namespace alias defined in the main.php file isn’t accessible in the index.php file. Is there a way to make the “nsItem” alias a “global” one, so that I don’t have to define it in EVERY file that I want to use? -Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Is it possible to create a global namespace alias?
Is it possible to create a global namespace alias in PHP or does the alias have to be defined in EVERY file that I use? Here is an example: file: main.php ?php use \this\is\my\custom\namespace\Item as nsItem; ? file: index.php ?php require_once “main.php”; // Attempt to use namespace alias defined in main.php file nsItem::test(); ? The above code doesn’t work for me. The namespace alias defined in the main.php file isn’t accessible in the index.php file. Is there a way to make the “nsItem” alias a “global” one, so that I don’t have to define it in EVERY file that I want to use? -Matt
[PHP] Is it possible to create a global namespace alias?
Is it possible to create a global namespace alias in PHP or does the alias have to be defined in EVERY file that I use? Here is an example: file: main.php ?php use \this\is\my\custom\namespace\Item as nsItem; ? file: index.php ?php require_once “main.php”; // Attempt to use namespace alias defined in main.php file nsItem::test(); ? The above code doesn’t work for me. The namespace alias defined in the main.php file isn’t accessible in the index.php file. Is there a way to make the “nsItem” alias a “global” one, so that I don’t have to define it in EVERY file that I want to use? -Matt
[PHP] Execute command line as a different user
My PHP is running as a user with limited rights. I'd like to execute a command line as a different user. I'm trying to delete a file and the PHP user doesn't have access to do this. I know the username and password for the admin user that has rights to delete a file. Is there a command I can use to make PHP run a delete command as the admin user? If so, how can I do this? Thanks, Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Execute command line as a different user
Okay, I'll have to look into that. I have very limited knowledge with shell scripts. You wouldn't have an example of one that can do what I need do you? Thanks, Matt Shawn McKenzie [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Matt palermo wrote: My PHP is running as a user with limited rights. I'd like to execute a command line as a different user. I'm trying to delete a file and the PHP user doesn't have access to do this. I know the username and password for the admin user that has rights to delete a file. Is there a command I can use to make PHP run a delete command as the admin user? If so, how can I do this? Thanks, Matt There are several ways on *nix systems. I would probably write a shell script to do the deletions and setuid of the script to root or a user with rights to delete the files. Then just exec() the shell script. On winbloze you can use the runas command. -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Execute command line as a different user
I'm using the following command and I'm not getting any feedback: exec(echo 'adminPass' | sudo -u adminAccount -S whoami, $f, $r); Both $f and $r don't contain any data. This leads me to believe that the command is not being run for whatever reason. Is there something wrong with this command? Is there a different way to do it? Thanks, Matt Matt palermo [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] My PHP is running as a user with limited rights. I'd like to execute a command line as a different user. I'm trying to delete a file and the PHP user doesn't have access to do this. I know the username and password for the admin user that has rights to delete a file. Is there a command I can use to make PHP run a delete command as the admin user? If so, how can I do this? Thanks, Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] FTP Copy
I've been looking on php.net, but can't find anything that covers this... Basically, I am using PHP FTP to connect to an FTP server and run some functions. I want to copy a directory on the FTP server to another directory on the FTP server. Since there isn't an ftp_copy() function, I have to use ftp_get() to bring the file to the local webserver temp folder, then use ftp_put() to place it into a different folder on the FTP server. This is quite a big pain, since the webserver is not on the same network as the remote FTP server, so it must download the file and then upload it to a different place (takes a long time). Is there an FTP that will just copy the file/folder from the FTP server without the need to download/upload it somewhere else? Thanks, Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Organizing a group project
Hello all. I'm the webmaster and developer of all the software and content at SweetPHP.com. I have a few ideas for some new scripts that I would love to work on, but don't have enough time to fully commit. I would love to start up a group effort for a few things and be part of a development team, this way, I get to help out, but I won't have to carry the entire load myself. I've seen the great products that come from great development teams. Up until this point I've pretty much just been developing software on my own. As a change of pace, I would love to start up a group project for a couple ideas I've had. Does anyone know of good sites that might be a starting point for something like this? Maybe a site where I could create the idea for a project and any interested people could sign up (or apply) to join the development team? I could announce it on my site, but I don't know if I have too many developers visiting, so that might not be the best way. If anyone has done anything similar to this in the past, please give me your feedback. I still plan on developing software on my own, but I'd love to opportunity work with and learn from other developers as well. Thanks, Matt Palermo http://sweetphp.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Beta Testers Wanted
Hey guys. I would like to first say thanks for all the help you have all given me in the past (especially in my early programming days). Once again, I would like to show my appreciation by offering an opportunity to use a new PHP program I have created. The program is called TotalXplorer. Basically it's an online file manager for your website that uses PHP's FTP functionality to perform actions on files/folders (this get's rid of the need to make them writable for PHP). The file manager also has a built-in file upload feature, file editor, mp3 music player (to play tracks directly from your site without downloading them first), and more. You can view the demo of it here: http://sweetphp.com/projects/TotalXplorer/ I'm looking for 5-10 people who would be willing to help test it out and give feedback about it. In exchange for this, you will receive a free copy of the software when it's ready to go. If you are interested, please let me know. This will be first come, first server, but please be willing to put in a little time with the testing of it. I have offered similar beta testing programs for some of the other scripts I have available at http://sweetphp.com and they have become very successful because of all your help. Thanks, Matt Palermo [EMAIL PROTECTED] http://sweetphp.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Custom Usort Function
Any ideas on how to accomplish this? Matt Palermo [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I'm try to sort a list of items using a usort function. Basically, I want it to sort in this order: Numbers (0-9) Letters (Aa-Zz) Other (anything else) To explain a little further, I want anything that starts with a number to show up first in the sorted list, then anything that starts with a letter, and finally anything that starts with some other character. My usort function I'm using now gives me results close to this, but it sorts it as follows (which is wrong for what I need): Numbers (0-9) Other (anything else) Letters (Aa-Zz) They are all sorted properly alphabetically, but not in the group order that I need them in. Here is the usort function I'm using right now: function myUsort($x, $y) { if(strtolower($x) == strtolower($y)) return 0; if(strtolower($x) strtolower($y)) return -1; return 1; } As I stated above, this provides me with the proper alphabetical results, but I need it tweaked. Basically this function will give a sorted list like this: 007 90210 __underscore abra-cadabra Zebra But I need the function to provide a sorted list like this: 007 90210 abra-cadabra Zebra __underscore Anyone know what I need to do to get these results? Please let me know. Thanks, Matt Palermo http://sweetphp.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Custom Usort Function
I'm try to sort a list of items using a usort function. Basically, I want it to sort in this order: Numbers (0-9) Letters (Aa-Zz) Other (anything else) To explain a little further, I want anything that starts with a number to show up first in the sorted list, then anything that starts with a letter, and finally anything that starts with some other character. My usort function I'm using now gives me results close to this, but it sorts it as follows (which is wrong for what I need): Numbers (0-9) Other (anything else) Letters (Aa-Zz) They are all sorted properly alphabetically, but not in the group order that I need them in. Here is the usort function I'm using right now: function myUsort($x, $y) { if(strtolower($x) == strtolower($y)) return 0; if(strtolower($x) strtolower($y)) return -1; return 1; } As I stated above, this provides me with the proper alphabetical results, but I need it tweaked. Basically this function will give a sorted list like this: 007 90210 __underscore abra-cadabra Zebra But I need the function to provide a sorted list like this: 007 90210 abra-cadabra Zebra __underscore Anyone know what I need to do to get these results? Please let me know. Thanks, Matt Palermo http://sweetphp.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: File Upload Max Size
Well, I would like to at least be able to upload a 10mb - 15mb file. I don't need it to upload files that are HUGE, just a reasonable size. zzapper [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Fri, 30 Sep 2005 01:19:01 -0400, wrote: Hello everyone. I'm basically building a PHP FTP client app. This app connects to an FTP server and allows the user to edit/delete files/permissions, etc. I've gotten to the point where I have started to create a file upload feature. The problem I have is that PHP only allows a 2mb maximum file upload, while normal FTP allows a much larger file to be uploaded. Don't want to depress you but I've had experience of other problems eg browser timeout -- zzapper Success for Techies and Vim,Zsh tips http://SuccessTheory.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: FTP Chmod problem
I'm using 5.0.something. Al [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Matt Palermo wrote: Hello everyone. I have a script where I am using FTP functions to chmod files/folders. I'm running into a problem with the ftp_chmod() function when trying to change the permissions of a directory. Here is the code I'm using: ftp_chmod($connId, 0777, $folder); The function almost works, but when I check the permission of the folder after it's run, the folder has 410 for permissions instead of 777. So, it is changing the permissions, but not to the correct value. Now when I use the following code, it seems to work fine: $chmodCmd = CHMOD 0777 .$file; ftp_site($connId, $chmodCmd); This properly changes the folder permissions to 777. Does anyone know why the ftp_chmod() function doesn't work correctly? As a side note, the ftp_chmod() function works correctly on a file, but not a directory. Any help is appreciated. Thanks, Matt Palermo http://sweetphp.com Which php version are you using? PHP 4x does not have ftp_chmod(); It does have ftp_site() -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] File Upload Max Size
Hello everyone. I'm basically building a PHP FTP client app. This app connects to an FTP server and allows the user to edit/delete files/permissions, etc. I've gotten to the point where I have started to create a file upload feature. The problem I have is that PHP only allows a 2mb maximum file upload, while normal FTP allows a much larger file to be uploaded. This app will be for a server where the user does not have access to change any php.ini settings. I'm basically looking for a way to upload large files (if needed) through my PHP FTP client app. This 2mb file limit is killing me here. Is there any way to get around this? I'm using the PHP built in FTP functions to do all the backend work for the app. I don't imagine there is an FTP function to use that will allow larger uploads is there? Please let me know if you have any suggestions. I really need to upload larger files, and since it's going to an FTP site, there shouldn't be too many size restrictions. Thanks, Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: FTP Chmod problem
It doesn't make sense to me that the function would work fine on a file and not work on a directory. Moreover, why would the ftp_site chmod command produce a working result and not the ftp_chmod? This seems strange to me. -Matt Raj Shekhar [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Matt Palermo [EMAIL PROTECTED] writes: ftp_chmod($connId, 0777, $folder); The function almost works, but when I check the permission of the folder after it's run, the folder has 410 for permissions instead of 777. So, it is changing the permissions, but not to the correct value. Now when I use the following code, it seems to work fine: $chmodCmd = CHMOD 0777 .$file; ftp_site($connId, $chmodCmd); This properly changes the folder permissions to 777. Does anyone know why the ftp_chmod() function doesn't work correctly? As a side note, the ftp_chmod() function works correctly on a file, but not a directory. Any help is appreciated. Some ftp server (like vsftpd) can be configure to change the mode of all uploaded files . There is a possibility that your server is configure to chmod your files (in vsftpd it is controlled by the file_open_mode option in the config file) -- Raj Shekhar blog : http://rajshekhar.net/blog home : http://rajshekhar.net Disclaimer : http://rajshekhar.net/disclaimer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] FTP Chmod problem
Hello everyone. I have a script where I am using FTP functions to chmod files/folders. I'm running into a problem with the ftp_chmod() function when trying to change the permissions of a directory. Here is the code I'm using: ftp_chmod($connId, 0777, $folder); The function almost works, but when I check the permission of the folder after it's run, the folder has 410 for permissions instead of 777. So, it is changing the permissions, but not to the correct value. Now when I use the following code, it seems to work fine: $chmodCmd = CHMOD 0777 .$file; ftp_site($connId, $chmodCmd); This properly changes the folder permissions to 777. Does anyone know why the ftp_chmod() function doesn't work correctly? As a side note, the ftp_chmod() function works correctly on a file, but not a directory. Any help is appreciated. Thanks, Matt Palermo http://sweetphp.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Copy Remote File to Local Server
I am writing a script that will read a file from a remote server and write it to the local server. It works fine except when large files are attempted. It times out and gives the error that the maximum execution time has been reached and the file will only be partially copied to the local server. Is there a way around something like this? Or perhaps could the script keep time of how long it has been running will reading/writing and then be able to continue writing to the partial file? Does anyone have any suggestions for this problem? Thanks, Matt Palermo http://sweetphp.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Getting server information
I am working on a script which will open a remote PHP file (located on one of my other website servers) and collect information that gets outputted from the remote file. I have it working now by using the fopen() function to open the file on the remote webserver. I am just wondering if it is possible to collect information and log the info with code in the remote file. I basically want to keep a log of all domains/servers/ip addresses that are accessing this remote file and store it in a database on the remote files server. Is it possible that when the guest script uses the fopen() function to access the PHP file, that when the remote PHP file gets executed it can log some information about the source server which is accessing it? If so, what kind of code would I need to place in the remote PHP file to obtain some of the information. Thanks, Matt Palermo http://sweetphp.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: empty() problem
How about: if($Game_Rating == ) $errors[] = You didn't enter the Online Status for the Game.; This should work for you. -Matt Ahmed Abdel-Aliem [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi Group Members i have a problem with function empty() i use it to check if user entered the form fields and store it in array for example : if (empty($Game_rating)) $errors[] = You didn't enter the Online Status for the Game.; the problem when the user enters 0 in the form field the empty function returns the error. can i use another function that doesn't return false when the 0 is passes ? any help plz ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Close all open tags in HTML text
I realize that I can use the strip_tags function to remove HTML. But I don't want to remove HTML tags. I just want to make sure all open HTML tags are closed. For example if they user submits HTML with a table tag and never closes it, then the rest of the page will look screwed up. I still want to allow them to use HTML, but I want to close tags that were left open by them. This way it allows them to use HTML and it won't screw up the rest of the page. Thanks, Matt Richard Lynch [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Matt Palermo wrote: I would like to leave any HTML in there, Do you *TRUST* the people typing the HTML to not attack your server, or others, with cross-site scripting attacks? If not, go re-read the manual about strip_tags, and pay particular attention to the second, optional, argument. but just make sure that ending tags exist, so it doesn't screw up the rest of the page. Strip tags would just wipe out the HTML rather than allowing it and ending it safely. Strip tags will allow you to wipe out *DANGEROUS* HTML which will make your web server a source of problems not only to you, but to me as well. Please use strip_tags to allow only the tags you *NEED* the users to be able to use. It will only take you seconds, and it will save you (and us) a lot of grief in the long run. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Close all open tags in HTML text
I would like to leave any HTML in there, but just make sure that ending tags exist, so it doesn't screw up the rest of the page. Strip tags would just wipe out the HTML rather than allowing it and ending it safely. Richard Lynch [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Matt Palermo wrote: I am allowing users to imput HTML code into a textarea. After they input this, I wany to output their HTML to the browser. In order for the document to be safe, I need to close all open HTML tags that have been left open by the user, along with any open comments. Is there a way to take an HTML string and add closing tags and comments to it if needed? After you use http://php.net/tidy to fix the HTML, use http://php.net/strip_tags to rip out all but the handful of tags you really want to allow them to use, most especially any JavaScript they might shove in to attack your (and my!) server. I *think* strip_tags rips out JavaScript. RTFM to be sure. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Close all open tags in HTML text
I am allowing users to imput HTML code into a textarea. After they input this, I wany to output their HTML to the browser. In order for the document to be safe, I need to close all open HTML tags that have been left open by the user, along with any open comments. Is there a way to take an HTML string and add closing tags and comments to it if needed? Thanks, Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] New Flash Chat Program
Hello everyone. Once again I would like to thank you for all your help. I have just completed a new program called TotalChat. It's a PHP/Flash/MySQL live chat system for your website. It's a great tool for providing live support to your site members. You can view the full product information here: http://sweetphp.com/nuke/modules.php?name=Script_Previewscript=6 As a thank you to all those who have helped me on here I am giving away 5 free copies of the program to the first 5 people who contact me about it. Thanks again for all your help guys. Great job! Matt Palermo [EMAIL PROTECTED] http://sweetphp.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Online Users
This looks like a good solution. What is the best way to list the current users, since the sesssionData seems to be serialized in the db or something? I just want to list out all the users from the db. Thanks, Matt http://sweetphp.com Greg Donald [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Fri, 2 Jul 2004 01:13:14 -0400, Matt Palermo [EMAIL PROTECTED] wrote: Is it possible to make a table of all logged in users session ids and then check to see if the session still exists every couple minutes? So every minute or two, it would go through the table and for each record it would get the session id, then check that session id to see if it's still in existance. Is this possible to do? This is simple to accomplish if you use database managed PHP sessions. You can override the default PHP session handling functions with session_set_save_handler() then you will know what users are logged in by what sessions are still active. Here's how I do it: My sessions.php that I require in all other scripts on the site: ?php if(ini_get('session.use_trans_sid')==0){ ini_set(session.use_trans_sid, 1); } $sessionDbHandler = ''; function sessionOpen($save_path, $session_name){ global $sessionDbHandler; if(! $sessionDbHandler = mysql_pconnect(DB_HOST, DB_USER, DB_PASS)){ die(Can't get sessionDbHandler: .mysql_error()); } return true; } function sessionClose(){ return true; } function sessionRead($key){ $sql = select sessionData from .TB_USER_SESSIONS. where sessionID = '$key' and sessionExpire UNIX_TIMESTAMP() ; $query = mysql_query($sql); if(mysql_num_rows($query)){ return mysql_result($query, 0, sessionData); } return false; } function sessionWrite($key, $val){ $value = addslashes($val); $sql = replace into .TB_USER_SESSIONS. ( sessionID, sessionData, sessionExpire ) values ( '$key', '$value', UNIX_TIMESTAMP() + .SITE_ONLINE_EXPIRE. ) ; return mysql_query($sql); } function sessionDestroy($key){ $sql = delete from .TB_USER_SESSIONS. where sessionID = '$key' ; return mysql_query($sql); } function sessionGarbageCollection(){ $sql = delete from .TB_USER_SESSIONS. where sessionExpire UNIX_TIMESTAMP() ; $query = mysql_query($sql); return sqlAffectedRows(); } session_set_save_handler(sessionOpen, sessionClose, sessionRead, sessionWrite, sessionDestroy, sessionGarbageCollection); session_start(); ? Some config.php variables: define('DB_HOST', 'localhost'); define('DB_DB', 'db_name'); define('DB_USER', 'db_user'); define('DB_PASS', 'db_pass'); define('TB_USER_SESSIONS', 'userSessions'); define('SITE_ONLINE_EXPIRE', 900); The table structure for userSessions looks like this: CREATE TABLE `userSessions` ( `sessionID` varchar(32) NOT NULL default '', `sessionData` text NOT NULL, `sessionExpire` int(10) unsigned NOT NULL default '0', PRIMARY KEY (`sessionID`) ) TYPE=MyISAM; When a user logs in you are probably already setting some kind of userID or userName, so make that a session variable if it is not already. Then it's just a matter of listing the userNames or userIDs out of the userSessions table. You might want to force session garbage collection at the top of each script by calling sessionGarbageCollection(). That will make the username listings more realtime. -- Greg Donald http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Online Users
Okay, I actually found out how to list the users, but you have the following line of code: define('SITE_ONLINE_EXPIRE', 900); What is the 900? Is that 900 seconds? Thanks, Matt http://sweetphp.com Matt Palermo [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] This looks like a good solution. What is the best way to list the current users, since the sesssionData seems to be serialized in the db or something? I just want to list out all the users from the db. Thanks, Matt http://sweetphp.com Greg Donald [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Fri, 2 Jul 2004 01:13:14 -0400, Matt Palermo [EMAIL PROTECTED] wrote: Is it possible to make a table of all logged in users session ids and then check to see if the session still exists every couple minutes? So every minute or two, it would go through the table and for each record it would get the session id, then check that session id to see if it's still in existance. Is this possible to do? This is simple to accomplish if you use database managed PHP sessions. You can override the default PHP session handling functions with session_set_save_handler() then you will know what users are logged in by what sessions are still active. Here's how I do it: My sessions.php that I require in all other scripts on the site: ?php if(ini_get('session.use_trans_sid')==0){ ini_set(session.use_trans_sid, 1); } $sessionDbHandler = ''; function sessionOpen($save_path, $session_name){ global $sessionDbHandler; if(! $sessionDbHandler = mysql_pconnect(DB_HOST, DB_USER, DB_PASS)){ die(Can't get sessionDbHandler: .mysql_error()); } return true; } function sessionClose(){ return true; } function sessionRead($key){ $sql = select sessionData from .TB_USER_SESSIONS. where sessionID = '$key' and sessionExpire UNIX_TIMESTAMP() ; $query = mysql_query($sql); if(mysql_num_rows($query)){ return mysql_result($query, 0, sessionData); } return false; } function sessionWrite($key, $val){ $value = addslashes($val); $sql = replace into .TB_USER_SESSIONS. ( sessionID, sessionData, sessionExpire ) values ( '$key', '$value', UNIX_TIMESTAMP() + .SITE_ONLINE_EXPIRE. ) ; return mysql_query($sql); } function sessionDestroy($key){ $sql = delete from .TB_USER_SESSIONS. where sessionID = '$key' ; return mysql_query($sql); } function sessionGarbageCollection(){ $sql = delete from .TB_USER_SESSIONS. where sessionExpire UNIX_TIMESTAMP() ; $query = mysql_query($sql); return sqlAffectedRows(); } session_set_save_handler(sessionOpen, sessionClose, sessionRead, sessionWrite, sessionDestroy, sessionGarbageCollection); session_start(); ? Some config.php variables: define('DB_HOST', 'localhost'); define('DB_DB', 'db_name'); define('DB_USER', 'db_user'); define('DB_PASS', 'db_pass'); define('TB_USER_SESSIONS', 'userSessions'); define('SITE_ONLINE_EXPIRE', 900); The table structure for userSessions looks like this: CREATE TABLE `userSessions` ( `sessionID` varchar(32) NOT NULL default '', `sessionData` text NOT NULL, `sessionExpire` int(10) unsigned NOT NULL default '0', PRIMARY KEY (`sessionID`) ) TYPE=MyISAM; When a user logs in you are probably already setting some kind of userID or userName, so make that a session variable if it is not already. Then it's just a matter of listing the userNames or userIDs out of the userSessions table. You might want to force session garbage collection at the top of each script by calling sessionGarbageCollection(). That will make the username listings more realtime. -- Greg Donald http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Online Users
I am trying to keep a MySQL table of all currently online users for a system I'm making. It's pretty simple to add the username to the list when they login, but I don't know how to remove their username when they leave (unless they click the logout button). Basically I want to be able to keep a list of all currently active users. So if they close out their browser, it will remove their name from the list (within a reasonable time frame). I'm basically trying to keep this list of online users for a chat application I'm building. Anyone have any suggestions on how to do this? Thanks, Matt http://sweetphp.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Online Users
Is it possible to make a table of all logged in users session ids and then check to see if the session still exists every couple minutes? So every minute or two, it would go through the table and for each record it would get the session id, then check that session id to see if it's still in existance. Is this possible to do? Thanks, Matt http://sweetphp.com Zareef Ahmed [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, If you are using a database on your server you can do this as follows: 1. Make a table named active_users(userid,last_access); 2. Record every visit of a user to any page. 3. you can delete the entries from this table on a condition like :: delete from active_users where last_access is less than (currenttime-MAX_EXPIRE_TIME) 4. Display row count of active_users to visitors. This is just a hint. Some knowldge of php/any database assumed , Revert back with any comment or problem. zareef ahmed --- Curt Zirzow [EMAIL PROTECTED] wrote: * Thus wrote Matt Palermo: they click the logout button). Basically I want to be able to keep a list of all currently active users. So if they close out their browser, it will remove their name from the list (within a reasonable time frame). I'm = Zareef Ahmed :: A PHP Developer in Delhi(India). Homepage :: http://www.zasaifi.com __ Do you Yahoo!? New and Improved Yahoo! Mail - 100MB free storage! http://promotions.yahoo.com/new_mail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Cron Job in vDeck
Hey guys. I was wondering if anyone knows how to go about creating a cron job using vDeck (that's what is installed on the server) that just accesses a PHP file and runs everything in the PHP file. Does anyone know how to go about doing something like this? Thanks, Matt http://sweetphp.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Link Management Software
Hey everyone. I just wanted to say thank you to everyone who has helped me out with various questions on here. I appreciate your help. I have just finished the first version a new PHP script called TotalLinker. This is a link management submission/management systems and has many more built in features. To show my appreciation for everyone who helps out on here, I am giving away 5 free copies to the first 5 people who email me and want it. You can view the full description of the software as well as view screen shots and a live demo by visiting this link: http://sweetphp.com/nuke/modules.php?name=Script_Previewscript=4 It will be on sale for half price over the next week or two, but you can get a free copy by being one of the first 5 people to email me for it. Thanks again for all your help! Matt Palermo http://sweetphp.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Changing maximum upload file size
Is there a way to change the maximum file upload size in a PHP script? Kind of like the way you can change the error reporting in a script, but I just want to adjust the max file upload size. Does anyone know if this can be done? Thanks, Matt Palermo http://sweetphp.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Changing maximum upload file size
Does this allow you to work with larger files than the maximum specified in the php.ini or just smaller ones? Thanks, Matt Palermo http://sweetphp.com Rachel Rodriguez [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] --- Matt Palermo [EMAIL PROTECTED] wrote: Is there a way to change the maximum file upload size in a PHP script? Kind of like the way you can change the error reporting in a script, but I just want to adjust the max file upload size. Does anyone know if this can be done? The PHP manual mentions just such a thing using the attribute MAX_FILE_SIZE in your form: http://us4.php.net/features.file-upload For server-wide limitiations, you'd need to additionally modify your php.ini file. = ~Rachel __ Do you Yahoo!? Yahoo! Domains - Claim yours for only $14.70/year http://smallbusiness.promotions.yahoo.com/offer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] HTML vs. Plain Text Input
Hey, I was wondering if anyone knows of any easy ways to detect for HTML input. I have a textarea box that I want users to be able to input either plain text or HTML code. I will later display this input data, so if the user input plain text then I will replace newline characters (\r\n, \n, \r) with br tags, but if they input HTML code I don't want to format it before displaying it. Basically is there an easy way to detect HTML code in inputs? If you have any suggestions, please let me know. Thanks, Matt http://sweetphp.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL Dump
Will this work on both a Windows and Unix server? Michal Migurski [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Is there an easy way to do a mysql dump routine written in php? I basically want to write a function to backup a database and have it create all the neccessary structures and data in the dump. I know phpMyAdmin will do this for me, but I want to write a function to do this incase the server doesn't have phpMyAdmin installed. Any ideas? Why not use the existing mysqldump command-line utility? function mysql_dump($db, $user, $pass) { return shell_exec(/path/to/mysqldump --user={$user} --password={$pass} --complete-insert --add-drop-table {$db}); } Or, skip PHP entirely and place a call to mysqldump with a suitable select-privilege-only username password in a cron job, if you're on a unix machine. I use the following shellscript to do periodic backups to RCS repositories in /usr/local/var/backups: #!/bin/sh if [ $# -ne 3 ]; then echo 'Usage:'; echo ' mysql-backup.sh db-user db-password db-name'; exit; fi; USER=$1; PASS=$2; DB=$3; MYSQLDUMP=/usr/local/bin/mysqldump; BACKUP_DIR=/usr/local/var/backups; SQL_FILE=$DB.mysql; RCS_FILE=$SQL_FILE,v; cd $BACKUP_DIR; $MYSQLDUMP --user=$USER --password=$PASS --complete-insert --add-drop-table $DB $SQL_FILE; the remaining lines can be ommitted if RCS isn't needed if [ ! -f $RCS_FILE ]; then echo import | rcs -q -i $SQL_FILE; else rcs -q -l $RCS_FILE; fi; echo mysql_backup.sh | ci -q $SQL_FILE; - michal migurski- contact info and pgp key: sf/cahttp://mike.teczno.com/contact.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Search MySQL and Match Whole Words
I was wondering if anyone knows how to do whole word searches in mysql. I have a search textbox that users can enter in multiple words to search for in the database, but things like the mysql LIKE match any part of a word. Is there a way to search for whole word matches only? Please let me know if you can help. Thanks, Matt http://sweetphp.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] MySQL Dump
Is there an easy way to do a mysql dump routine written in php? I basically want to write a function to backup a database and have it create all the neccessary structures and data in the dump. I know phpMyAdmin will do this for me, but I want to write a function to do this incase the server doesn't have phpMyAdmin installed. Any ideas? Thanks, Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Search MySQL and Match Whole Words
That will work if there is only one word in the column I'm searching, but the columns I'm searching are in paragraph form, so the = will not work there if I want to just match one word from the whole paragraph... Ligaya Turmelle [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] why not just use WHERE word = inputWord and skip the whole LIKE thing for an exact match? Is that what you mean? Respectfully, Ligaya Turmelle Matt Palermo [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I was wondering if anyone knows how to do whole word searches in mysql. I have a search textbox that users can enter in multiple words to search for in the database, but things like the mysql LIKE match any part of a word. Is there a way to search for whole word matches only? Please let me know if you can help. Thanks, Matt http://sweetphp.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regular Expressions
What exactly does this do: / (?=p|br) [^]+ /x It may work, I just want to understand what it's looking for. Thanks, Matt Curt Zirzow [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] * Thus wrote Matt Palermo ([EMAIL PROTECTED]): I have a page where I am stripping the html tags down. Basically, it will allow certain tags, but still strips out ALL attributs of the tag, so it works something like this: $allowed_tags = pbrstrongbiu; // State which tags are allowed $info = strip_tags($info, $allowed_tags); // Strip all unwanted tags out $allowed_tags = p|br|strong|b|i|u; // Convert tags for regular expression $info = preg_replace(/(?!.$allowed_tags.)[^]*/, '\1', $info); // Strip out all attributes from allowed tags You might wont to try a look behind assertion: / (?=p|br) [^]+ /x Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Regular Expressions
I have a page where I am stripping the html tags down. Basically, it will allow certain tags, but still strips out ALL attributs of the tag, so it works something like this: $allowed_tags = pbrstrongbiu; // State which tags are allowed $info = strip_tags($info, $allowed_tags); // Strip all unwanted tags out $allowed_tags = p|br|strong|b|i|u; // Convert tags for regular expression $info = preg_replace(/(?!.$allowed_tags.)[^]*/, '\1', $info);// Strip out all attributes from allowed tags This will strip all attributes out of those tags, so it will turn something like this p some stuff hereMy p tag/p into this pMy p tag/p. The above regular expression will handle this just fine. The only problem I am running into is when someone uses a less than sign in their input (). So when someone puts something like: 2 8 in their input it gets changed to this: 2 . How can I set it to only replace things when there is a and a matching for it? Anyone have any ideas? Thanks, Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Keep HTML tags, but strip attributes
I am building a system which allows users to post data. I want to allow them to use ONLY certain tags such as p, /p, b, /b, i, /i, etc... I want to allow them to use only these, and then strip out ALL attributes inside the tags. So if they input something like p junk=junk, it would switch it to just p. Anyone know of a way this can be done? Thanks, Matt Palermo http://sweetphp.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Keep HTML tags, but strip attributes
Okay, I have it all set to remove ALL tags and their attributes that I don't want. Now I just have to strip the attributes from any remaining tags. Anyone know of something that will strip all attributes from any tag, but leave the tag in tact? So p junk=junk would be p and /p more junk would be /p. I just need this to work for any tag, no just p. Any suggestions for this? Thanks, Matt Jochem Maas [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Matt Palermo wrote: I am building a system which allows users to post data. I want to allow them to use ONLY certain tags such as p, /p, b, /b, i, /i, etc... I want to allow them to use only these, and then strip out ALL attributes inside the tags. So if they input something like p junk=junk, it would switch it to just p. Anyone know of a way this can be done? regular expressions, heres an example: ?php $input = 'this divis some/div ub class=haxorbad/b/u HTML'; echo {$input}\n; $input = preg_replace('/\/?[^pbiu\/][^]*/', '', $input); echo {$input}\n; $input = preg_replace('/([pbiu])[^]*/', '\1', $input); echo {$input}\n; $input = str_replace('bad', 'good', $input); echo {$input}\n; ? you might also think about stripping script tags etc. try taking a look at some forum code (e.g. phpbb.com) to see how they do it. no doubt that some real regexp wizard could perform the above replacements in a single regexp but hopefully it gives you an idea... if your not yet familiar with regexps then I strongly recommend you read the relevant part of the manual - they are very handy things indeed. Thanks, Matt Palermo http://sweetphp.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Keep HTML tags, but strip attributes
This is what i have so far: $allowed = 'brpbiuliolulstrong'; $info = strip_tags($info, $allowed); $info = preg_replace('/([^])[^]*/', '\1', $info); This works for everything except the closing tags. It turns /p into /. Anyone know why? Thanks, Matt Jochem Maas [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Matt Palermo wrote: I am building a system which allows users to post data. I want to allow them to use ONLY certain tags such as p, /p, b, /b, i, /i, etc... I want to allow them to use only these, and then strip out ALL attributes inside the tags. So if they input something like p junk=junk, it would switch it to just p. Anyone know of a way this can be done? regular expressions, heres an example: ?php $input = 'this divis some/div ub class=haxorbad/b/u HTML'; echo {$input}\n; $input = preg_replace('/\/?[^pbiu\/][^]*/', '', $input); echo {$input}\n; $input = preg_replace('/([pbiu])[^]*/', '\1', $input); echo {$input}\n; $input = str_replace('bad', 'good', $input); echo {$input}\n; ? you might also think about stripping script tags etc. try taking a look at some forum code (e.g. phpbb.com) to see how they do it. no doubt that some real regexp wizard could perform the above replacements in a single regexp but hopefully it gives you an idea... if your not yet familiar with regexps then I strongly recommend you read the relevant part of the manual - they are very handy things indeed. Thanks, Matt Palermo http://sweetphp.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Image Storage
I am creating a system to allow users to upload images to the site. Would it be better to store the images in a MySQL table, or having it save the images to a directory on the server? Anyone have any suggestions on this? Pros? Cons? Thanks, Matt http://sweetphp.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Get MySQL table field names
How can I get the field names from a specified MySQL table? I don't need the data, I just want to get an array of the tables field names. Thanks, Matt http://sweetphp.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Make sure folder is writable
Is there a way to check a folder on the server to make sure a specified folder has write permissions? I'm writing an upload script, but I need to make sure the user gave the destination directory write permissions before I can copy the files to the new folder. Anyone got any ideas? Thanks, Matt http://sweetphp.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Recursive Select Box
Hey everyone. I'm looking for assistance/suggestions/answers on how to build a select dropdown box from data that needs to be pulled recursively from a MySQL database. Basically the situation is mainly for a dicussion thread system type of thing where I have categories nested inside categories, nested inside categories... Anyway, I want to be able to build a drop down box containing all the categories indented underneath it's parent category to look something similar to this: - Top Level Category - Nested Category - Lower level - Etc Top Level Category - Nested Category Top Level Category - Then the user will be able to select one from the dropdown menu. I have all the categories stored in a MySQL database called site_categories. The table is setup like this: __ | Cat_ID | Cat_Parent | Cat_Name | |-| |1 | 0 | Top Level 1 | |-| |2 | 1 | Nested 1| |-| |3 | 0 | Top Level 2 | |-| |4 | 2 | Nested 2| |-| Sorry for the bad pictures you hopefully you get the idea. Anything with a 0 Cat_Parent is a Top Level category. Then the others are all nested inside other categories that have the same Cat_ID as the nested categories Cat_Parent. I basically need help creating a properly indented dropdown menu box using this structure from the database. I assume I'm gonna have to use some sort of recursion here, but I'm not sure how to go about this. Please help if you can. Thanks, Matt http://sweetphp.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Recursive Select Box
No, i'm using a MySQL DB. Justin Patrin [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Matt Palermo wrote: Hey everyone. I'm looking for assistance/suggestions/answers on how to build a select dropdown box from data that needs to be pulled recursively from a MySQL database. Basically the situation is mainly for a dicussion thread system type of thing where I have categories nested inside categories, nested inside categories... Anyway, I want to be able to build a drop down box containing all the categories indented underneath it's parent category to look something similar to this: - Top Level Category - Nested Category - Lower level - Etc Top Level Category - Nested Category Top Level Category - Then the user will be able to select one from the dropdown menu. I have all the categories stored in a MySQL database called site_categories. The table is setup like this: __ | Cat_ID | Cat_Parent | Cat_Name | |-| |1 | 0 | Top Level 1 | |-| |2 | 1 | Nested 1| |-| |3 | 0 | Top Level 2 | |-| |4 | 2 | Nested 2| |-| Sorry for the bad pictures you hopefully you get the idea. Anything with a 0 Cat_Parent is a Top Level category. Then the others are all nested inside other categories that have the same Cat_ID as the nested categories Cat_Parent. I basically need help creating a properly indented dropdown menu box using this structure from the database. I assume I'm gonna have to use some sort of recursion here, but I'm not sure how to go about this. Please help if you can. Thanks, Matt http://sweetphp.com I'd suggest using a recursive function. (I'm assuming you're using PEAR DB...) function getSelect($db, $catParent = 0, $indent = '') { $sth = $db-query('SELECT * FROM categories WHERE Cat_Parent = '.$catParent); while($rec = $sth-fetchRow()) { echo 'option value='.$rec['Cat_ID'].''.$indent.$rec['Cat_Name'].'/option'; getSelect($db, $rec['Cat_ID'], $indent.' '); } } $db = DB::connect('mysql://user:[EMAIL PROTECTED]/db'); $db-setFetchMode(DB_FETCHMODE_ASSOC); echo 'select name=selectBox'; getSelect($db); echo '/select'; I think that will work ;-) -- paperCrane Justin Patrin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Create a zip archive from a folder
Hello. Does anyone know how I can easily create a zip archive from a folder on my server? I have a library class that will do this for a tar file (I just give it the folder name and the archive name and it creates the tar file for me very easily). I was wondering if there is anything really easy like this for creating zip files. Please let me know. Thanks, Matt http://sweetphp.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Email Forwarders
I have a hosted website which uses CPanel. I can login to CPanel and create as many email forwarders as I want. Is there a way I can write a PHP script to manage these email forwarders? For example, somebody registers on my site and they want to be added to the for a certain email address (as an email forwarder). How would I write a script that could access this email forwarders file and insert a new address to it (or delete one if that is the case)? Does anyone know if this can be done. I am trying to use these mail forwarders as a moch mailing list, so when an email is sent to a specific address, it will automatically be distributed to everyone on the forwarding list. Please help if you have any ideas or suggestions. Thanks, Matt http://sweetphp.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sort Array by date
I have a bunch of dates in the form: MM-DD- in an array and I want to sort them and display them in descending order. I have tried the usort() function below and it's not working. Can anyone help me out here? $menu_item = array(); $menu_item[] = 12-04-2003; $menu_item[] = 11-19-2003; $menu_item[] = 01-04-2004; $menu_item[] = 12-24-2003; $menu_item[] = 08-13-1982; // sorting function function date_file_sort($a, $b) { $a = strtotime($a); $b = strtotime($b); return strcmp($a, $b); } usort($menu_item, 'date_file_sort'); // output results for($x = 0; $x count($menu_item); $x++) { echo $menu_item[$x].br; } Here are the the results I get: 01-04-2004 08-13-1982 12-04-2003 11-19-2003 12-24-2003 Anyone know why these results seem totally random? Please help. Thanks, Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Communicating with remote server
I am writing a desktop application using PHP-GTK. I would like this program to be able to connect to a remote server, call some functions that I specify, and return the right information (most likely from a MySQL db). I have access to the server, so I can create any and all functions that I want, but I don't know how to connect to the remote server page and get all the results. I am new to cross-server comunication programming, so if anyone knows of a very detailed and easy to learn tutorial please send me the link. I would appreciate any help you are willing to offer. Thanks, Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Get value between 2 strings
Hello. I was wondering if anyone knew of a function to get the value between 2 strings. For example, lets say I have the following line: $line = I want the value between word ONE and word TWO. Please return it...; Now, I want to get everything between ONE and TWO. In this example it should return the value and word . Is there some sort of function I could use to easily do this? Please let me know if you have any ideas. Thanks, Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] MX lookup email verification on Windows
Does anyone know of a way to perform an MX lookup on a Windows server to perform an email verification? Any help on this would be great, since I can only find code for this that will work on *nix servers. Please let me know if you can help. Thanks, Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MX lookup email verification on Windows
Is there any way to accomplish this without the use of exec() or system() functions? Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Saturday 08 November 2003 03:39, Matt Palermo wrote: Does anyone know of a way to perform an MX lookup on a Windows server to perform an email verification? Any help on this would be great, since I can only find code for this that will work on *nix servers. Please let me know if you can help. If you've looked through the usual scripts repositories and haven't found anything useful then you can try: exec('nslookup xx'); and parse the results. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Whenever I date a guy, I think, is this the man I want my children to spend their weekends with? -- Rita Rudner */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Calendar Tool
Hey everyone. I am the creater of a PHP script called TotalCalendar (http://sweetphp.com/TotalCalendar/) and I am looking for a little advice and suggestions about making a tool for it. I want to build an application that users can download and install on their local machines which connects to a site's calendar (that site obviously would have to have TotalCalendar installed on it). This client application would connect to the site's calendar and retrieve all necessary info about different events located inside the calendar. Anyway, the advice I am looking for is where to start the application. PHP-GTK has been brought to my attention as a useful tool to build something like this, however, I have absolutely no experience with it. I was wondering if anyone could point me in the right direction for a detailed tutorial or applications that would help me build something like this. I have found a couple tutorials that show really simple things like creating buttons, but not much more than that. Please let me know if anyone can help me out with this. I am open for any type of suggestions for this building this tool. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Calendar Tool
Oops... The link to the site is: http://www.sweetphp.com/projects/TotalCalendar/ Sorry. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Using PHP with JAVA
I have been searching the web for ways to execute remote PHP files through the use of JAVA code, but I haven't had any luck. I have found many ways to call JAVA functions from a PHP script, but not the other way around. What I'm trying to accomplish is I want to build a JAVA application that will be run from a users local computer after installation and this JAVA program will connect to a url on my server (a url to a PHP script). This PHP script will be used to connect to the server's MySQL database and send some retrieved information back to the JAVA application on the users machine. I have been searching the web for hours trying to find a tutorial, or advice on how to accomplish this, but so far I have had no luck. If anyone has any advice or suggestions please let me know. Thanks, Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using PHP with JAVA
I don't neccessarily WANT to mix the 2 languages. I just have an application on my webserver that uses MySQL databases and the script is all written in PHP (which I am pretty good at). The only reason I want to use JAVA is so a user can download and install a program that I write (since JAVA is platform independant) that they can run on their local computers. This JAVA program will connect to the server (PHP files) and send back all the information to the JAVA app. This way, the user doesn't even have to go to the website for this script. They can just open the JAVA program and it will be passed all the neccessary information. I'm just a beginner in JAVA, so it will probably take me quite a while to figure out how to build a whole program like this. Eventually, I want it to be similar to the Gallery Remote program (found at: http://gallery.menalto.com/) for a PHP image gallery. I got a long way to go before I will have this created though, since I'm very new to JAVA (I'm much stronger in PHP). Anyway, I'm sure you get the idea. Matt Raditha Dissanayake [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, For this scenario, Ray's suggestion of SOAP is IMHO the best option. But just out of curiosity why do you want to mix the two languages? If you are familiar with java you might be better off doing your server side stuff using J2EE. Then you might be able to use Object Streams for your communications or RMI. Then there is the XMLEncoder class that was made availble with 1.4 better stop before someone shoots me down this is a PHP list after all :-) Matt Palermo wrote: I have been searching the web for ways to execute remote PHP files through the use of JAVA code, but I haven't had any luck. I have found many ways to call JAVA functions from a PHP script, but not the other way around. What I'm trying to accomplish is I want to build a JAVA application that will be run from a users local computer after installation and this JAVA program will connect to a url on my server (a url to a PHP script). This PHP script will be used to connect to the server's MySQL database and send some retrieved information back to the JAVA application on the users machine. I have been searching the web for hours trying to find a tutorial, or advice on how to accomplish this, but so far I have had no luck. If anyone has any advice or suggestions please let me know. Thanks, Matt -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha/megaupload/ Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using PHP with JAVA
I don't know much about that, but it definitely sounds better, escpecially since it's still PHP based. Do you know of any websites or tutorials I can go to to learn more about it? It sounds like a much better option. Thanks, Matt Ray Hunter [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Also, I would like to point out that you could possibly use php-gtk to do some gui applications. Since it has a windows and *nix port you can use that too. I have built a couple of apps with it that pull snmp data from routers with it that worked great. I also used a java installer to install the required files. Might be worth looking into since it is php based. -- Ray On Fri, 2003-10-24 at 12:20, Raditha Dissanayake wrote: hi, Great to hear that PHP is your language of choice. There are several SOAP libraries available and they come with good docs. However if you are building an image gallery type application, you will be able to do mos of the work just by using java.net package has has been pointed out. all the best Matt Palermo wrote: I don't neccessarily WANT to mix the 2 languages. I just have an application on my webserver that uses MySQL databases and the script is all written in PHP (which I am pretty good at). The only reason I want to use JAVA is so a user can download and install a program that I write (since JAVA is platform independant) that they can run on their local computers. This JAVA program will connect to the server (PHP files) and send back all the information to the JAVA app. This way, the user doesn't even have to go to the website for this script. They can just open the JAVA program and it will be passed all the neccessary information. I'm just a beginner in JAVA, so it will probably take me quite a while to figure out how to build a whole program like this. Eventually, I want it to be similar to the Gallery Remote program (found at: http://gallery.menalto.com/) for a PHP image gallery. I got a long way to go before I will have this created though, since I'm very new to JAVA (I'm much stronger in PHP). Anyway, I'm sure you get the idea. Matt Raditha Dissanayake [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, For this scenario, Ray's suggestion of SOAP is IMHO the best option. But just out of curiosity why do you want to mix the two languages? If you are familiar with java you might be better off doing your server side stuff using J2EE. Then you might be able to use Object Streams for your communications or RMI. Then there is the XMLEncoder class that was made availble with 1.4 better stop before someone shoots me down this is a PHP list after all :-) Matt Palermo wrote: I have been searching the web for ways to execute remote PHP files through the use of JAVA code, but I haven't had any luck. I have found many ways to call JAVA functions from a PHP script, but not the other way around. What I'm trying to accomplish is I want to build a JAVA application that will be run from a users local computer after installation and this JAVA program will connect to a url on my server (a url to a PHP script). This PHP script will be used to connect to the server's MySQL database and send some retrieved information back to the JAVA application on the users machine. I have been searching the web for hours trying to find a tutorial, or advice on how to accomplish this, but so far I have had no luck. If anyone has any advice or suggestions please let me know. Thanks, Matt -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha/megaupload/ Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha/megaupload/ Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sort an array of objects
I have an array of object for files on my site. The objects hold a file's name, size, extension, etc... I was wondering if anyone knows where I could find a relatively easy function for sorting the array of these objects by either name, size, etc... Please let me know if got any tips. Thanks a lot! Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Initial Value for Input Box
I have a form that a user can fill out. In the text input field I allow them to insert HTML tags with their input data. They can then submit the form for processing. The problem is that later on when they go to edit their inputs (I initialize the text input with their previously submitted input) and they have HTML tags with double quotes, the it will only put characters up to the first double quote inside the input box and the rest will go outside of it. I would like the text box to contain everything they previously submitted to be displayed there. Does anyone know of an easy way to allow the double quotes to be initially inserted into the input box? Please let me know. Thanks, Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Beta Testers Needed - Free software opportunity
First, I would like to thank all of you who have helped me with my questions in the past. I am going to return the favor by giving you an opportunity to receive a free copy of the latest version of a calendar program, called TotalCalendar. SweetPHP.com will be giving out free copies of this software to the first 5 people who agree to help with the beta testing and half-price copies to anyone else who helps beta test. After the beta testing phase is complete, all beta testers will receive the full, final version at no additional cost. If you would like to know more about this software, please visit: http://sweetphp.com/ There, you will find all the information, as well as a running demo of the software. If you would like to sign up and become a beta testing, please contact us at: [EMAIL PROTECTED] and we will send you the necessary information needed. Thanks again to everyone who has helped me out. Matt Palermo [EMAIL PROTECTED] http://sweetphp.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Unzipping Files
Yes, I do read the replies. I'm looking to get MORE information. This topic is very new to me, and I am just trying to find out all I can. So far people on the mailing list have been very generous with sharing information, but I am looking for the most details possible, since I am not very familiar with this subject. Matt -Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 05, 2003 11:45 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Unzipping Files On Wednesday 06 August 2003 10:19, Matt Palermo wrote: Yeah, I know someone mentioned using the exec for this, but I was wondering if anyone knew where I could find the command-line code for this to use in PHP... Anyone know? Do you not read the replies that you receive? I believe this question was asked and answered already: http://marc.theaimsgroup.com/?l=php-generalm=106005561004363w=2 -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Sometimes love ain't nothing but a misunderstanding between two fools. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Extracting Compressed Files
Does anyone know of easy ways to be able to extract all files/folders/subfolders from different types of compressed files (.zip, .tar.gz, etc.)? If anyone could help me out with this, I would really appreciate it. Thanks, Matt
RE: [PHP] Unzipping Files
I am doing this for a client, and he doesn't have the ZZIPlib installed, and would like to avoid it if possible. Any other ideas? Thanks, Matt -Original Message- From: Adam Alkins [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 05, 2003 8:24 PM To: Matt Palermo Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Unzipping Files Try the zziplib library, http://www.php.net/manual/en/ref.zip.php -- Adam Alkins http://www.rasadam.com Quoting Matt Palermo [EMAIL PROTECTED]: Anyone know where I can find tutorials or examples on how to use the gunzip, gzip, and other commands using PHP to work with compressed files? I would really appreciate it if someone could send me some links or examples of how to use them. My goal would be to be able to extract .zip, .gz, and other types of compressed files using a PHP script. Let me know if you can help. Thanks, Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Unzipping Files
Anyone know where I can find tutorials or examples on how to use the gunzip, gzip, and other commands using PHP to work with compressed files? I would really appreciate it if someone could send me some links or examples of how to use them. My goal would be to be able to extract .zip, .gz, and other types of compressed files using a PHP script. Let me know if you can help. Thanks, Matt
RE: [PHP] Unzipping Files
Yeah, I know someone mentioned using the exec for this, but I was wondering if anyone knew where I could find the command-line code for this to use in PHP... Anyone know? Thanks, Matt -Original Message- From: Mike Migurski [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 05, 2003 8:53 PM To: Matt Palermo Cc: 'Adam Alkins'; [EMAIL PROTECTED] Subject: RE: [PHP] Unzipping Files I am doing this for a client, and he doesn't have the ZZIPlib installed, and would like to avoid it if possible. Any other ideas? It has been mentioned before: use exec, or the backtick operator, and the command-line tools: unzip, bunzip, gunzip, etc. - michal migurski- contact info and pgp key: sf/cahttp://mike.teczno.com/contact.html -- 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] Extracting Compressed Files
Do you happen to know where I can find some examples or sample code for these? The exec function on php.net didn't go into much detail about extraction from compressed files. Anyone know of any good references? Thanks, Matt -Original Message- From: Jason Sheets [mailto:[EMAIL PROTECTED] Sent: Monday, August 04, 2003 11:46 PM To: Matt Palermo Subject: Re: [PHP] Extracting Compressed Files Use exec to execute the command line programs that deal with these archives. Namely tar and gz and bzip2 and zip/unzip. For single files that are compressed you can use PHP to decompress bzip2 and .gz files if you have compiled PHP --with-zlib and --with-bz2, otherwise you must use the command line tools. Jason Matt Palermo wrote: Does anyone know of easy ways to be able to extract all files/folders/subfolders from different types of compressed files (.zip, .tar.gz, etc.)? If anyone could help me out with this, I would really appreciate it. Thanks, Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Right Click Hyperlink
Does anyone know if there is anything in PHP or any other language that would allow a specific action to occur if a visitor right-clicked on a link. For example, they could left click on it an go to a specified page, and they could also right-click it to go to a different page. Anyone know of anything that can do this? Thanks, Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Using link to submit a form
//Just use this javascript function... echo script LANGUAGE=\JavaScript\ !-- function LetsSubmit(where) { document.forms[0].action = where; document.forms[0].submit(); } //-- /script ; // Then output the submit link like this... echo a href=\javascript:LetsSubmit('submit_page.php');\ ; // You can have multiple submit links that send it // to different pages just by changes the value // inside the (''), like this... echo a href=\javascript:LetsSubmit('another_page.php');\ ; //You should be able to do as many different links // with this function as you want. If you want a // button like this, you can also do this... echo input type=\submit\ value=\Rename Files\ name=\RenameButton\ onclick=\javascript:LetsSubmit('any_page.php');\ ; I spent a while trying to figure this one out myself, so I hope this helps you. Matt = Original Message From Tyler Longren [EMAIL PROTECTED] = Hi everyone, Can I replace Submit buttons on forms with a text button? I need to be able to click on a link: a href=index.php?option=editEdit/a and have it submit the form. The form only contains one field...does anyone know how to do this? I've been searching google for an answer, but couldn't find any info that really applies to my question. This isn't exactly a PHP related question, but php is hugely involved in this project. Thanks! Tyler Longren -- 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] Link acting as a submit button
I have tried this method as well, but I still seem to get the same error. I have the form tag put in there and everything, with this bit of script inside the tags, but still no luck. Is there an easier way to accomplish what I want to do? Please let me know if there is. Thanks. Matt = Original Message From Curt Zirzow [EMAIL PROTECTED] = * Thus wrote Matt Palermo ([EMAIL PROTECTED]): I am trying to create a submit button out of a hyperlink using the following code: (this is in a file called index.html) A href=javascript:go_where_my_variable_says('this.php');this page/a SCRIPT LANGUAGE=JavaScript !-- function go_where_my_variable_says(where) { document.forms[0].action = where; document.forms[0].submit(); } //-- /SCRIPT This works fine as an html document, however, when I try to echo the same code out in a PHP page, it gives me javascript errors. I am using the following to echo it out in PHP: echo A href=\javascript:go_where_my_variable_says('this.php');\this page/a SCRIPT LANGUAGE=\JavaScript\ !-- function go_where_my_variable_says(where) { document.forms[0].action = where; document.forms[0].submit(); } //-- /SCRIPT ; No need to echo out the statement, better to use this method so you dont have to escape each and every existing: // leave php to output html ? A href=javascript:go_where_my_variable_says('this.php');this page/a SCRIPT LANGUAGE=JavaScript !-- function go_where_my_variable_says(where) { document.forms[0].action = where; document.forms[0].submit(); } //-- /SCRIPT ?php // now back in php mode This displays the link fine for the submit hyperlink, but it gives the javascript error: Error: Object doesn't support this property or method. Code: 0 Like I said before, this code works perfectly fine if I have it an html document. Anyone got any ideas? With that being said I dont see a php problem here. Curt -- I used to think I was indecisive, but now I'm not so sure. -- 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] Link acting as a submit button
I just remembered (I'm not sure if it makes a difference) that I am using frames on this page. Does this matter at all? Thanks. Matt = Original Message From Matt Palermo [EMAIL PROTECTED] = Fixing the javascript that you specified still gave me the same errors... Got any more suggestions? Thanks for your help, Matt -Original Message- From: Jim Lucas [mailto:[EMAIL PROTECTED] Sent: Thursday, July 24, 2003 6:40 PM To: Matt Palermo Subject: Re: [PHP] Link acting as a submit button Your javascript is wrong. change this document.forms[0].action = where; to this document.forms[0].action.value = where; Jim Lucas - Original Message - From: Matt Palermo [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, July 24, 2003 3:35 PM Subject: [PHP] Link acting as a submit button I am trying to create a submit button out of a hyperlink using the following code: (this is in a file called index.html) A href=javascript:go_where_my_variable_says('this.php');this page/a SCRIPT LANGUAGE=JavaScript !-- function go_where_my_variable_says(where) { document.forms[0].action = where; document.forms[0].submit(); } //-- /SCRIPT This works fine as an html document, however, when I try to echo the same code out in a PHP page, it gives me javascript errors. I am using the following to echo it out in PHP: echo A href=\javascript:go_where_my_variable_says('this.php');\this page/a SCRIPT LANGUAGE=\JavaScript\ !-- function go_where_my_variable_says(where) { document.forms[0].action = where; document.forms[0].submit(); } //-- /SCRIPT ; This displays the link fine for the submit hyperlink, but it gives the javascript error: Error: Object doesn't support this property or method. Code: 0 Like I said before, this code works perfectly fine if I have it an html document. Anyone got any ideas? Thanks, Matt -- 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] Link acting as a submit button
Actually, I found out what the problem is. I have a normal submit button in the same page, however when I take out the submit button, the javascript code works fine. When I put the submit button back in, I get the error again. Is there a fix for this, or do I need to make the submit button into a link instead? Thanks, Matt = Original Message From Comex [EMAIL PROTECTED] = [EMAIL PROTECTED] Matt Palermo: I just remembered (I'm not sure if it makes a difference) that I am using frames on this page. Does this matter at all? Thanks. Matt No, it doesn't... well it shouldn't anyway. Check the source code of the outputted page. Is it exactly what you want it to be? If not, you might want to try using single quotes... -- 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] Link acting as a submit button
I found out that it works fine without the submit button that I had in there. When I take the submit button out, it works, if I put it back in there I get the error message again. Any ideas? Matt = Original Message From [EMAIL PROTECTED] = On Fri, 2003-07-25 at 05:30, Matt Palermo wrote: I just remembered (I'm not sure if it makes a difference) that I am using frames on this page. Does this matter at all? Thanks. Yes it matters tons with the javascript call. Here is some info on it...however, these questions are now javascript and not php... 1. make sure you pass in a valid page to your function. 2. make sure that you have a form that you are accessing. 3. make sure that when you access the form you are accessing the correct frame page. Example: when you set up the frames use the name attribute to assign names to the frames... so if you have a frame named frame1...then you can do this... frame1.document.forms[0].action.value = where; frame1.document.forms[0].submit; I might be off on this a little but that should get you started in the right direction. -- BigDog -- 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] Link acting as a submit button
Okay, I got it to work. I just put the id parameter in the submit button tag and it works fine now. Thanks for all your help guys... = Original Message From [EMAIL PROTECTED] = Why do you have a submit button and a link to submit the form. Dont u want them to use the submit button for the form? -- BigDog On Fri, 2003-07-25 at 09:02, Jay Blanchard wrote: [snip] I found out that it works fine without the submit button that I had in there. When I take the submit button out, it works, if I put it back in there I get the error message again. Any ideas? [/snip] Are you naming the submit buttons? Not just value, but id or name? You must keep them seperate. HTH! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Link acting as a submit button
I am trying to create a submit button out of a hyperlink using the following code: (this is in a file called index.html) A href=javascript:go_where_my_variable_says('this.php');this page/a SCRIPT LANGUAGE=JavaScript !-- function go_where_my_variable_says(where) { document.forms[0].action = where; document.forms[0].submit(); } //-- /SCRIPT This works fine as an html document, however, when I try to echo the same code out in a PHP page, it gives me javascript errors. I am using the following to echo it out in PHP: echo A href=\javascript:go_where_my_variable_says('this.php');\this page/a SCRIPT LANGUAGE=\JavaScript\ !-- function go_where_my_variable_says(where) { document.forms[0].action = where; document.forms[0].submit(); } //-- /SCRIPT ; This displays the link fine for the submit hyperlink, but it gives the javascript error: Error: Object doesn't support this property or method. Code: 0 Like I said before, this code works perfectly fine if I have it an html document. Anyone got any ideas? Thanks, Matt
RE: [PHP] Link acting as a submit button
Fixing the javascript that you specified still gave me the same errors... Got any more suggestions? Thanks for your help, Matt -Original Message- From: Jim Lucas [mailto:[EMAIL PROTECTED] Sent: Thursday, July 24, 2003 6:40 PM To: Matt Palermo Subject: Re: [PHP] Link acting as a submit button Your javascript is wrong. change this document.forms[0].action = where; to this document.forms[0].action.value = where; Jim Lucas - Original Message - From: Matt Palermo [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, July 24, 2003 3:35 PM Subject: [PHP] Link acting as a submit button I am trying to create a submit button out of a hyperlink using the following code: (this is in a file called index.html) A href=javascript:go_where_my_variable_says('this.php');this page/a SCRIPT LANGUAGE=JavaScript !-- function go_where_my_variable_says(where) { document.forms[0].action = where; document.forms[0].submit(); } //-- /SCRIPT This works fine as an html document, however, when I try to echo the same code out in a PHP page, it gives me javascript errors. I am using the following to echo it out in PHP: echo A href=\javascript:go_where_my_variable_says('this.php');\this page/a SCRIPT LANGUAGE=\JavaScript\ !-- function go_where_my_variable_says(where) { document.forms[0].action = where; document.forms[0].submit(); } //-- /SCRIPT ; This displays the link fine for the submit hyperlink, but it gives the javascript error: Error: Object doesn't support this property or method. Code: 0 Like I said before, this code works perfectly fine if I have it an html document. Anyone got any ideas? Thanks, Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] replacing everything between 2 strings
Is there a way to replace everything between 2 given strings if it exists? Say I have: $str = replace anything and everything in here.; Now I want to replace everything between the word replace and here., so the new string could read something like this: $str = replace NOTHING here.; So it keeps the two end points but just replaces everything in the middle with a new specified string. Please help me if you can. Thanks. Matt
RE: [PHP] replacing everything between 2 strings
That doesn't really help much... I think you just replied to the wrong post. That answer really doesn't have anything to do with my question, I don't think... Thanks anyway. Matt -Original Message- From: Daryl Meese [mailto:[EMAIL PROTECTED] Sent: Monday, July 21, 2003 8:09 PM To: Matt Palermo; [EMAIL PROTECTED] Subject: RE: [PHP] replacing everything between 2 strings look into opendir and readdir with opendir you can open a handle to a directory and use readdir in a loop to look at every file (fopen or whatever to load each file) then parse your files. readdir may help you verify the files you are working on at least have the right extension. Daryl -Original Message- From: Matt Palermo [mailto:[EMAIL PROTECTED] Sent: Monday, July 21, 2003 6:52 PM To: [EMAIL PROTECTED] Subject: [PHP] replacing everything between 2 strings Is there a way to replace everything between 2 given strings if it exists? Say I have: $str = replace anything and everything in here.; Now I want to replace everything between the word replace and here., so the new string could read something like this: $str = replace NOTHING here.; So it keeps the two end points but just replaces everything in the middle with a new specified string. Please help me if you can. Thanks. Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem adding value to session array
I have a session array that stores some values that I set. It holds all the inserted values, unless the value I want to insert has a space in it, then it only inserts the characters before the space into the array. It looks like this: // This works $sessionArray[1] = nospace; echo result: .$sessionArray[1];// result: nospace // This doesn't work $sessionArray[1] = with space; echo result: .$sessionArray[1];// result: with // should be result: with space Anyone know how to fix or avoid this from happening? Thanks, Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Input Submi Help
I have a script that contains a form which goes to page1.php on the click of a submit button. Inside the form are lots of checkboxes and things to fill out that get passed to page1.php. I want to put another button in there that send all the same names and values of the checkboxes to page2.php. Is this possible to have 2 buttons going to 2 different places, but using the same data for all other form elements? I would really appreciate any help I can get. Thanks. Matt
[PHP] Insert leading zeros
I have a string of digits that looks like something like these: 0025, 1234, 0001, 1003, and so on. They are all 4 digits in length. Then when I increment one of them by 1, I want to still have 4 digits for the value (it should insert the leading zeros if needed). Is there any type of function that will force the incremented value to be exactly 4 digits no matter what number it increments? Please let me know if there is a function that will insert these leading zeros or truncate it to 4 digits if necessary. Thanks. Matt
RE: [PHP] Insert leading zeros
Thanks a lot. It works like a charm! -Original Message- From: Curt Zirzow [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 8:45 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Insert leading zeros Matt Palermo [EMAIL PROTECTED] wrote: I have a string of digits that looks like something like these: 0025, 1234, 0001, 1003, and so on. They are all 4 digits in length. Then when I increment one of them by 1, I want to still have 4 digits for the value (it should insert the leading zeros if needed). Is there any type of function that will force the incremented value to be exactly 4 digits no matter what number it increments? Please let me know if there is a function that will insert these leading zeros or truncate it to 4 digits if necessary. Thanks. $var = sprintf(%04d, $var+1); Curt -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Get previous folder
Anyone know how I can stip off the end of a folder location, so that it will be a folder in the next level up? I want to turn something like this: /path/to/folder/MyFolder/ into somthing like this: /path/to/folder/ I just need to strip off the last folder and that is it. Can anyone help me out? I appreciate it. Thanks. Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] download hyperlink
Does anyone know how I can set a hyperlink to a file so that someone can download the file instead of viewing it in the browser? Please let me know. Thanks. Matt
RE: [PHP] linking with home directory
The XP and 2000 are two different machines. = Original Message From Matt Matijevich [EMAIL PROTECTED] = [snip] Like I said before, the style sheets load up fine on my Windows XP IIS server, but not the Windows 2000. In order to get it to work on the Windows 2000 IIS server, I have to link the style sheets relative to the folder I am working in, but I want to be able to move certain files into other directories without manually linking each one, so that's why I am linking them from the absolute home directory. [/snip] When you are testing the scripts, are testing them on the same machine that is serving the pages? If you are, does the XP server still link the style sheets correctly if you test the script from a different machine? Just trying to get a little more info. -- 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] linking with home directory
I have done that, and it displays the correct location. I don't know what else to do. Is there maybe something in the php.ini file? = Original Message From Mike Brum [EMAIL PROTECTED] = First, I'd create a simple test to see what the value of $newDir = $HomeDir.themes/.$ThemeFolder; print $newDir; And see what that yields. You might have a problem with your slashes. I find it extremely useful to have test variables print to the screen along the way to ensure that each new part of my code is receiving the correct information. It helps isolate where the problem data or logic lies. (becomes increasingly useful as you use many functions, classes, includes or just generally large scripts). -M -Original Message- From: mpalermo [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 09, 2003 11:37 AM To: [EMAIL PROTECTED] Subject: [PHP] linking with home directory is evaluating to with the string addition: // Path to script files (absolute file path) $HomeDir = c:/inetpub/wwwroot/MyScript/; // Name of style folder $ThemeFolder = default; //--- Then later in the page, I link the style sheet like this ---// echo link rel='stylesheet' type='text/css' href='.$HomeDir.themes/.$ThemeFolder./style.css' ; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] linking with home directory
I am testing it from the same machine for right now. = Original Message From Matt Matijevich [EMAIL PROTECTED] = I mean, when you actually call the script on the XP machine, where do you test it at? Do you use a browser that is on the XP machine that is running IIS, or do you do it from a different machine? Matt Palermo [EMAIL PROTECTED] 07/09/03 10:52AM The XP and 2000 are two different machines. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] return all non-tag characters
I want to be able to retrieve and return all character that are not located in html tags. For example: font size=\3\ color=\#336699\1234567/font or marquee1234567/marquee I would just like it to be equal to 1234567, but I would need it to work with any tags and attributes. Is there a way to just throw out everything from the to the and just keep everything that is NOT located inside any characters? Anyone have any ideas on how this can be done? Please let me know. Thanks, Matt
[PHP] print all variables
Could anyone tell me how to print all the variables and values from a submitted form, so that I can check them? Thanks, Matt
[PHP] working with forms
I have a forms page that a user will fill out. When it is submitted, it checks to see if any of the field entries entries are empty, and if so, it has a die() statement that has a link (javascript:history.back()) which sends the user back to the form page. However, when they go back to the form page, all the entries they made are erased and they need to redo everything. Is there and easy way to have them go back with all their previously inputted data still filled in? Let me know. Thanks, Matt
[PHP] session question
When a session is started on my server, it gets a name in the sessiondata folder like: sess_8sjg4893m9d0j43847dk4o5l2 I was just wondering if all sessions on ANY server start with sess_? Is this a PHP-wide default, or can it be changed (not that I want to change it, I just want to know if it can be changed)? Thanks, Matt
[PHP] create a chmod'd file
I have a script that creates a php file based on user input. I need this newly created file to have write permissions - chmod 777. How can I have the script create the file with these permissions already set? Is this possible? Thanks, Matt
Re: [PHP] create a chmod'd file
I am using the fopen(), then using fwrite() to write text to it. After this I am trying this command which doesn't work: chmod($filename, 0777); But, this doesn't work, and I'm not sure how to go about chmod'ing the file for these permissions so that it can be changed later on. Matt - Original Message - From: Alex Earl [EMAIL PROTECTED] To: Matt Palermo [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Friday, June 13, 2003 2:37 PM Subject: Re: [PHP] create a chmod'd file I have a script that creates a php file based on user input. I need this newly created file to have write permissions - chmod 777. How can I have the script create the file with these permissions already set? Is this possible? Thanks, Matt How are you creating the file? fopen()? touch()? Give a little more information please. Alex -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] create a chmod'd file
It just doesn't chmod the file. It doesn't produce errors except for later on in the script when it says it can't access the file with write permissions (but it should already be chmod'd by then). Thanks. Matt - Original Message - From: Jason Wong [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, June 13, 2003 2:59 PM Subject: Re: [PHP] create a chmod'd file On Saturday 14 June 2003 02:43, Matt Palermo wrote: I am using the fopen(), then using fwrite() to write text to it. After this I am trying this command which doesn't work: chmod($filename, 0777); But, this doesn't work, and I'm not sure how to go about chmod'ing the file for these permissions so that it can be changed later on. What does doesn't work mean? Does it blow up your computer? Or does it give an error message or what? -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Baker's First Law of Federal Geometry: A block grant is a solid mass of money surrounded on all sides by governors. */ -- 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] create a chmod'd file
How do I get the script to own the file? Are there special commands needed for this? Matt -Original Message- From: Jay Blanchard [mailto:[EMAIL PROTECTED] Sent: Friday, June 13, 2003 3:08 PM To: Matt Palermo; [EMAIL PROTECTED] Subject: RE: [PHP] create a chmod'd file [snip] It just doesn't chmod the file. It doesn't produce errors except for later on in the script when it says it can't access the file with write permissions (but it should already be chmod'd by then). Thanks. [/snip] What are the permissions of the script producing the file? Does it have the proper permission and does it 'own' the file? Most web interfaces/scripts operate as 'nobody' and therefore do not have permission to set file permissions...if you'll permit me to say so. HTH! Jay -- 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] create a chmod'd file
What is the umask()? What is that used for? How do I set that up right? Matt -Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED] Sent: Friday, June 13, 2003 3:08 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] create a chmod'd file On Saturday 14 June 2003 03:01, Matt Palermo wrote: It just doesn't chmod the file. It doesn't produce errors except for later on in the script when it says it can't access the file with write permissions (but it should already be chmod'd by then). Thanks. If chmod() fails I'm pretty sure it spits out an error, so if you've already cranked up error reporting and are 100% positive there's no error being reported then have a look at your umask() setting. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Q: What do you get when you cross a mobster with an international standard? A: You get someone who makes you an offer that you can't understand! */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] getting file contents
I have text a file which contains php code. I am using it as a template for some other pages. I want to take everything in that file and store it in a string or array and then output it all to an empty file (this will make both files look exactly the same). I am using the file_get_contents() function to do this, but it seems to have trouble because it looks like it is trying to execute the php code in the file I am trying to get. Anyone know of a better way to go about this? Thanks. Matt
Re: [PHP] getting file contents
I would just copy the file, but I am not sure how to copy the file and paste it in the same folder with a different name. Any advice you can give for that? Thanks. Matt - Original Message - From: Jason Wong [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, June 11, 2003 12:27 PM Subject: Re: [PHP] getting file contents On Wednesday 11 June 2003 23:54, Matt Palermo wrote: I have text a file which contains php code. I am using it as a template for some other pages. I want to take everything in that file and store it in a string or array and then output it all to an empty file (this will make both files look exactly the same). Any reason why you don't copy the file instead? I am using the file_get_contents() function to do this, but it seems to have trouble because it looks like it is trying to execute the php code in the file I am trying to get. Anyone know of a better way to go about this? Thanks. file_get_contents() does NOT try to execute anything in the file. If you think otherwise, show us your code. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Humor in the Court: Q: Are you qualified to give a urine sample? A: Yes, I have been since early childhood. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] slash trouble when editing text
I wrote a small script that creates a link to all the .php and .txt files in a given directory. When one of these links is clicked, it brings up another window with the files contents inserted into a text area. From there the user can edit the text file then click a submit button to make the changes. The problem is whenever the file contains quotes, when the file gets edited it puts a slash in front of every quote. Like this. // original .txt file these are quotes Then when the submit buttons is clicked, the file looks like this: // edited .txt file \these are quotes\ If submit is pressed again, then it will look like this: // twice edited file \\these are quotes\\ Does anyone know how I can avoid this from happening? Thanks. Matt
Re: [PHP] slash trouble when editing text
Will the stripslashes() remove the slashes that are supposed to be in the file? Because often times there are slashes in the file that need to be there. Matt - Original Message - From: CPT John W. Holmes [EMAIL PROTECTED] To: Matt Palermo [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, June 11, 2003 4:42 PM Subject: Re: [PHP] slash trouble when editing text Use stripslashes() to remove the slashes. Use htmlentities() on the text before you put it into the textarea, also. ---John Holmes... - Original Message - From: Matt Palermo [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, June 11, 2003 4:16 PM Subject: [PHP] slash trouble when editing text I wrote a small script that creates a link to all the .php and .txt files in a given directory. When one of these links is clicked, it brings up another window with the files contents inserted into a text area. From there the user can edit the text file then click a submit button to make the changes. The problem is whenever the file contains quotes, when the file gets edited it puts a slash in front of every quote. Like this. // original .txt file these are quotes Then when the submit buttons is clicked, the file looks like this: // edited .txt file \these are quotes\ If submit is pressed again, then it will look like this: // twice edited file \\these are quotes\\ Does anyone know how I can avoid this from happening? Thanks. Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php