[PHP] Howto: run local script to update remote script
I was wondering how I could have a local PHP (4.2.3) script running on Apache 1.3.27 / WinXP Pro send my current local IP address to a remote server running PHP 4.1.2, RedHat 7.3 & Apache 1.3.26.. In the Linux based script, I'd want it to basically display my current IP address to friends who know the remote URL to connect to my FTP/HTTP server(s) and grab mp3s, etc.. I'm a complete newbie, and in my php.net/google.com searches the only thing I've come across is something called a CRON Job.. From my little experience and understanding, I've always thought a Cron Job was something that only was valid on *nix platforms and not Win32.. Am I mistaken? My remote linux server has a dedicated IP, although my Win32 machine obviously doesn't.. I assume this would make it easier to communicate from local to remote? >From my little understanding, I assume the local script would need to place my IP address in a variable (within say: ipaddy.inc) and the remote script would be updated as the variable was read from ipaddy.inc when someone visited the page..? If anyone could point me to a tutorial, function name(s) or offer some code to get me started, I'd greatly appreciate it.. Apache & PHP load on my local (Win32) machine when it boots and it's always running.. I just can't get past the auto-run-a-local-php-script area for the most part.. TIA.. Take care.. peace.. eriol -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] test - please ignore
testing php.general list -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] show_source question
I've got the following bit of code to work in showing the actual PHP file source code, but it doesn't show include() or require() files and I'd like it to.. -- source.php -- if(strlen($php)>0){ $php = $DOCUMENT_ROOT . $php; if (ereg("(\.php)$",$php) && !ereg("\/\.\.", $php)){ require("head.php"); echo "\n\n"; show_source("$php"); echo "\n\n\n"; require("foot.php"); } else{ require("head.php"); echo "\n"; echo " There's been an error..\n"; echo "\n"; require("foot.php"); } exit; } I've checked the manual and google, but I'm not too sure the keywords I'd used were correct as I didn't find any results.. I looked at highlight_file() but it would seem to cause the same output as show_source() neglecting to include the php code within head.php and foot.php.. Is there a function I'm missing that would somehow allow me to add the head.php and foot.php code within the source code output page? Will I need to add something to the head.php and foot.php files to have them included? I'm a bit of a php newbie, so sorry if my terminology isn't correct.. TIA.. Take care.. peace.. eriol -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: show_source question
Thanks for the reply.. I did try what you suggested, but am getting the following warning: Warning: Failed opening 'ArrayArrayArray' for highlighting in /hsphere/local/home/eriol/oo0oo.com/o0o.o0o on line 43 (o0o is php) Line 43 is: show_source("$show"); I copied everything as written, so I'm not sure where the problem could be.. I assume "ArrayArrayArray" has to do with $show = file() portion of the code, but I don't know enough about php to debug it.. Do you, or anyone else, have an idea what may cause this? If it helps, the original "show source" code is here: http://oo0oo.com (Just click the SHOW SOURCE link at the bottom of the page twice - going to the actual file of o0o.o0o isn't allowed) Thanks again Mike.. Take care.. peace.. eriol "Mike Mannakee" <[EMAIL PROTECTED]> disgorged: : You could just append the files into a string, then show the string instead. : : Like : : if(strlen($php)>0){ :$php = $DOCUMENT_ROOT . $php; : if (ereg("(\.php)$",$php) && !ereg("\/\.\.", $php)){ : $show=file("head.php"); : $show.=file("$php"); : $show.=file("foot.php"); : echo "\n\n"; : show_source("$show"); : echo "\n\n\n"; :} : : This would give you the full source, and would need to be in addition to : actually 'requiring' the files. : : If your show_source() function is set to take a file, you'd need to change : it to take a string instead. Or save $show as a file and send the name or : handle (I'm not sure which it expects) to the function. : : Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: show_source question
Thanks for the reply.. As a newbie, I'm not understanding what else I could use, even after searching the manual and google.. I've tried readfile() instead of file() which returns some, not all, of the head.o0o code (I assume as a strong instead of an array), but I still get an error: Warning: Failed opening '11063121715' for highlighting in /hsphere/local/home/eriol/oo0oo.com/o0o.o0o on line 43 I have no idea what 11063121715 is.. I have no files with numeric names and don't have a clue where this number came from.. Line 43 still is: show_source("$show"); I don't expect someone to do the work for me, but if you or someone else could suggest a function name or keywords to search for I'd definately appreciate it.. file() led me to look into readfile(), and it solved some of the problem by printing out some of the head.o0o source (minus formatting issues within the output which I can fix), but I don't know what to do about the 11063121715 highlighting error above.. Thanks again for your reply.. Take care.. peace.. eriol "Rasmus Lerdorf" <[EMAIL PROTECTED]> disgorged: : file() returns an array, show_source() takes a string. : : On Mon, 12 Aug 2002, eriol wrote: : : > Thanks for the reply.. : > : > I did try what you suggested, but am getting the following warning: : > : > Warning: Failed opening 'ArrayArrayArray' for highlighting in : > /hsphere/local/home/eriol/oo0oo.com/o0o.o0o on line 43 : > : > (o0o is php) : > : > Line 43 is: : > : > show_source("$show"); : > : > I copied everything as written, so I'm not sure where the problem could be.. I : > assume "ArrayArrayArray" has to do with $show = file() portion of the code, but : > I don't know enough about php to debug it.. Do you, or anyone else, have an idea : > what may cause this? : > : > If it helps, the original "show source" code is here: http://oo0oo.com (Just : > click the SHOW SOURCE link at the bottom of the page twice - going to the actual : > file of o0o.o0o isn't allowed) : > : > Thanks again Mike.. : > : > Take care.. peace.. : > eriol -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] quick ereg() question
I checked the manual and it's comments as well as google, but didn't find the simple answer i'm wanting.. I have the following line in a "show php source code" page: if (ereg("(\.php)$",$o0o) && !ereg("\/\.\.", $o0o)){ ... } It works fine on .php files but I was hoping I could include .inc files as well when someone wanted to view the source of them.. To include .inc files as viewable php source code, I'd rewrite it similar to below I assume, but I'm not understanding the syntax I'm missing.. if (ereg("(\.inc | .php)$",$o0o) && !ereg("\/\.\.", $o0o)){ ... } I know I have to use a pipe to seperate allowable file types, but that's the extent of what I know.. Any help would be appreciated.. TIA.. Take care.. peace.. eriol -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] quick ereg() question
Thank you Bas.. I appreciate the reply.. It works great.. Take care.. peace.. eriol "Bas Jobsen" <[EMAIL PROTECTED]> disgorged: : if (ereg("((\.)(php|inc))$",$o0o) && !ereg("\/\.\.", $o0o)){ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mail/variable help needed..
The following is the partial source for an upload form.. I'm having trouble with the mail() function including the actual file name the user is sending instead of "/tmp/phpIkRjHq".. I understand that PHP will retain the file in a temporary directory (/tmp/) until it is stored to the path I've specified (/uploaded/), but I don't understand how to get it to print the new file name within the email it sends to me.. Currently, it only prints the temporary file name as shown above.. As you can see, to the last $body variable, I've added both $info & $file as a test, but $info returns null and $file returns the temp path/name only.. However, within the returned php/html page, the $file variable actually does echo the actual file name the user chose to upload.. I'm a newbie, so hopefully I'm making sense.. Any ideas to help me fix this problem would be appreciated.. Thanks in advance.. Take care.. peace.. eriol <SNIP> 0){ $allowed_types = array("text/plain","text/html"); $size_limit = "524288"; $file = $_FILES["file"]["name"]; $type = $_FILES["file"]["type"]; $size = $_FILES["file"]["size"]; $temp = $_FILES["file"]["tmp_name"]; $path_info = pathinfo($PATH_TRANSLATED); $write_path = $path_info["dirname"] . "$uppath$uptime" . $file; if ($file){ if ($size < $size_limit){ if (in_array($type,$allowed_types)){ if(move_uploaded_file($temp,$write_path)){ $info = "$file has been uploaded successfully.."; if(!mail($email,$subject,$body,"Return-Path: \r\n" ."From: me \r\n" ."Reply-To: me@$SERVER_NAME\n" ."X-Mailer: $SERVER_NAME")){ echo "uh.."; } a few else statements ... } } ?> Upload: </SNIP> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] if/else & mail() problem..
I've got the following bit of code for an upload/feedback form.. Upload isn't a required field, but name, email and message are.. When someone submits this form with an upload used, it works fine.. But if an upload is excluded and they only fill in the required fields, I don't get an email.. I'm sure this has to do with the if/else statements, but I haven't been able to figure this out.. If anyone has a suggestion, help or can point me in the right direction, I'd appreciate it.. TIA.. Take care.. peace.. eriol $info = NULL; if(count($_FILES) > 0){ $allowed_types = array("text/plain","text/html"); $size_limit = "524288"; $file = $_FILES["file"]["name"]; $type = $_FILES["file"]["type"]; $size = $_FILES["file"]["size"]; $temp = $_FILES["file"]["tmp_name"]; $path_info = pathinfo($PATH_TRANSLATED); $write_path = $path_info["dirname"] . "$uploadpath$uptime" . $file; if ($file){ if ($size < $size_limit){ if (in_array($type,$allowed_types)){ if(move_uploaded_file($temp,$write_path)){ $info = "Thank you ".$_REQUEST['name']."\n"; if(!mail($email,$subject,$body,"Return-Path: \r\n" ."From: me \r\n" ."Reply-To: me@$SERVER_NAME\r\n" ."X-Mailer: $SERVER_NAME")){ if($_REQUEST["submit"]){ $null = ""; $name = $_REQUEST['name']; $from = $_REQUEST['email']; $message = $_REQUEST['message']; } echo "uh.."; } } else{ $info = "$file wasn't sent due to an error.."; } } else{ $info = "I do not accept $type type files.."; } } else{ $info = "Only files up to $size_limit bytes accepted.."; } } $info .="\n"; } echo $info; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: if/else & mail() problem..
Sorry, I didn't figure it was needed, but here is the html info as requested.. Thanks.. Name: Email: " class="file"/> Upload: [ Information ] Message: Take care.. peace.. eriol "Tony Harrison" <[EMAIL PROTECTED]> disgorged: : You need to give us the HTML for the form so we can comprehend the context : of it all -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: upload file
Check these out: http://www.php.net/manual/en/features.file-upload.php http://www.php.net/manual/en/function.move-uploaded-file.php >From the bit of code you posted, you're not declaring where an upload should actually go.. If you want it sent via email (attachment, not upload), that's another story, but if you want it sent to a directory within your site, the links above should be of some help.. Take care.. peace.. eriol "Daniel Guerrier" <[EMAIL PROTECTED]> disgorged: : upload.html has this: : : : : : : and : : upload2.php has this: : : : Where is the file?? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: if/else & mail() problem..
I got this figured out already.. I was having a brain fart and just needed to move the IF statement with the mail() function further down past a few ELSE statements.. Thanks anyway.. Take care.. peace.. eriol "Eriol" <[EMAIL PROTECTED]> disgorged: : I've got the following bit of code for an upload/feedback form.. Upload isn't a : required field, but name, email and message are.. When someone submits this form : with an upload used, it works fine.. But if an upload is excluded and they only : fill in the required fields, I don't get an email.. : : I'm sure this has to do with the if/else statements, but I haven't been able to : figure this out.. If anyone has a suggestion, help or can point me in the right : direction, I'd appreciate it.. TIA.. : : [snip] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Setting HTACCESS user/pass with php?
http://www.hido.net/projects/htadmin/ That may be what you're looking for.. Searching google for "php user authentication htaccess" turns up several more results.. HTH.. Take care.. peace.. eriol "Brian J. Celenza" <[EMAIL PROTECTED]> disgorged: : Is it possible to set, delete, or alter htaccess usernames and passwords : using a php script? If so, where might I find a reference to the code for it : or even a walkthrough? I have searched the php functions and I haven't found : anything like that. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie "Parse" error
Use a closing "?>" php tag before writing your html and after your mail() function.. Also, in your first $mailheaders variable, you may want to add a ":" after "From".. HTH.. Take care.. peace.. eriol "Chase Knott" <[EMAIL PROTECTED]> disgorged: : Maybe you can help me with YOUR eyes again... Now I am getting this : error... : : Parse error: parse error, unexpected '<' in send_contact_form.php on line 18 : : This will be around the "" line... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Uploading file
Definately check out the URL Juan posted first to learn how you can easily do this yourself.. You can also check http://www.hotscripts.com/PHP/Scripts_and_Programs/ and look into the "/File Manipulation/Upload Systems" and "/Form Processors" directorys there for some pre-written upload scripts.. You can also search google for "php upload script" and it should give you some decent results.. In answer to your other question, make a .php file with the following line of code in it, then place it in your web directory on your server and pull it up in a browser to see all your PHP/server features.. HTH.. Take care.. peace.. eriol "Clemson Chan" <[EMAIL PROTECTED]> disgorged: : Hi, I am new to this group. : I am trying to figure out how to let people to upload image files to my : website. : My ISP is using PHP 3 (I believe). : If someone can give me simple example, that will be great. : Thanks. : : --Clemson : : How can I tell what version of PHP is running on the system (linux)? : -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: bugs/master are back
http://master.php.net redirects me to http://www.php.net, but the "bugs" url works fine.. I'm not sure what "master" would be which is why I tried accessing it.. Is this normal to redirect to the main site? TIA.. Take care.. peace.. eriol <[EMAIL PROTECTED]> disgorged: : For those who are interested, master.php.net and bugs.php.net are back. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: bugs/master are back
Ahh.. Okay.. Thanks.. I don't know if this is a normal issue (first time I've seen it), but in my initial reply to your thread, I received the following back via email.. I typically post through replies the newsgroup way at news.php.net and not the mailing list route.. Didn't know if I should point it out or not, but decided it couldn't hurt to do so.. Your message was not delivered for the following reason: E-mail Account: lists-php is over the limit of 31457280 bytes. Automated Postmaster [snipped original email reply and headers] Take care.. peace.. eriol <[EMAIL PROTECTED]> disgorged: : Yes thats normal. master.php.net is used by the members of PHP (cvs accounts : etc..) to manage their account. They've got the correct url to do that from : master.php.net. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML vs Everything Else
http://www.w3schools.com/xml/default.asp has some tutorials.. It helped me understand the basics of XML and what it can be used for.. They also have some XSL(T) information and tutorials (http://www.w3schools.com/xsl/default.asp) as well.. Take care.. peace.. eriol "Javier Montserat" <[EMAIL PROTECTED]> disgorged: : Could you (or anyone else on the list) recommend some good resources (Books : / Websites) for learning XML and XSLT? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: help me regarding redirecting a page
http://your.redirection.url/";); die; ?> http://www.php.net/manual/en/function.header.php HTH.. Take care.. peace.. eriol "Anjali Kaur" <[EMAIL PROTECTED]> disgorged: : i dont know how to redirect a page... i mean i want to : have the effect of submit button without clicking on : the submit button. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Uploading Files
"Jason" <[EMAIL PROTECTED]> disgorged: : I would like to be able to upload files from the client computer to the : server via a form. I know how to build the form, but am not sure of the : best way to process this. I know there are certain ftp functions that can : do this, which I'm not sure how to use. Are there any others? http://www.php.net/manual/en/features.file-upload.php More specifically, move_uploaded_file() and is_uploaded_file() HTH.. Take care.. peace.. eriol -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Uploading Files
"Jason" <[EMAIL PROTECTED]> disgorged: : : : I am able to get rid of this error, but changing the line to: : move_uploaded_file($_FILES['userfile']['tmp_name'], : "../images/$_FILES[userfile][name]"); : : However, the file is then uploaded as Array[name] : : How do I get past this? I'm not 100% sure this will work, but try this: If you're using $_FILES, I assume you have Register_Globals = on? If not, use $HTTP_POST_FILES instead.. From 4.2.0 on register globals is off in the php.ini by default.. Also, you might try hotscripts.com for file upload scripts that allow one or multiple files at a time.. There may be a script there that's already created that'll serve your purpose.. http://www.hotscripts.com/PHP/Scripts_and_Programs/File_Manipulation/Upload_Sy stems/ HTH.. Take care.. peace.. eriol -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] WinAMP Plugin Question
I was wondering if anyone has tried or would know how to take my mp3 collection listing from SpyAMP (http://spyamp.sf.net) and incorporate it into my site (which is on a different server and not on my home network) and have guests be able to download songs assuming I have it running? I want to change the HTML layout, the order the songs are listed (alphabetical vs. random, etc.), and have them in categories instead of being all in one long list.. I don't know if this is possible, but I figure it wouldn't hurt to ask.. SpyAMP, for those unfamiliar with it, basically sets up a small mp3 server on your local machine and allows anyone who knows your IP address (or visits the SA server page if you're listed) to download songs if you've chosen to allow it.. I have no clue where to begin as I'm a php newbie.. Any ideas, tutorials, code or function names to help me on my way would be appreciated.. TIA.. Take care.. peace.. eriol -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] local IP script question
I assume this would be easy to accomplish, but I can't seem to figure it out.. I'm running Apache/PHP on my machine (WinXP Pro).. I want to create a local php script that detects my ISP's assigned IP address and add a port to it (e.g.: http://xxx.xxx.xxx.xxx: ).. I often am running SpyAmp (a WinAmp plugin) and that creates a basic html output page using a different port than Apache does.. They both run together fine without conflicts, but I can't figure out how to create a php script that finds my IP address and adds my SpyAmp assigned port to it.. I don't want to have to manually get my IP thru "run --> cmd /k ipconfig" each time as I'd like to bookmark the local php page instead.. Is this possible using REMOTE_ADDR somehow? If so, what function(s) do I need to look into and how would I configure this? Does the script need to find my IP, then forward me to another page using the header() function adding the port to my IP? If you have a working example, tips or a URL to help me on my way, I'd appreciate it.. TIA.. Take care.. peace.. eriol -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] A couple of questions..
I have two very newbie questions.. I want to be able to create a directory index view on my local Apache server other than the default Apache view (similar to Expow, but not as complex).. Can anyone recommend a simple script that you know of which can display Name, Type, Size and Modified Date columns as well as allow users to browse folders/directories and download the files within them? I was told browsing subdirectories on Win32 machines isn't possible with PHP, but I've seen it elsewhere (such as using Expow).. I assume I could make a simple directory view script myself, but I'm not familiar enough with PHP to feel comfortable about possible security issues.. Register globals is off if that has any impact on possible help.. The second question relates to the first, although it's more of an Apache question.. I hope someone could help me as I assume it'd be an easy fix, but I don't know what to search for.. I'm running Apache 1.3.27 on WinXP Pro with PHP 4.2.3 locally.. Whether I type in the SERVER_ADDR IP address, the computer name, localhost or 127.0.0.1, I still get this following problem.. If I view this: http://localhost/mp3/ I get the default Apache directory index view.. However, if I view this: http://localhost/mp3 (minus the trailing forward slash) I can't get a directory listing.. I get the default MSIE error page similar to no DNS found.. I have most every ErrorDocument number set correctly and working, but I don't even get an error # or page.. Is there something in Apache's httpd.conf that corrects this? I wasn't sure if the following has anything to do with this.. With my last setup (Win98/Apache 1.3.26/PHP 4.1.1), I don't remember having the php.exe Action & ScriptAlias directive there.. As you probably have guessed, I'm no expert with Apache either.. When I started Apache in the past on my old setup, it'd start in console and tell me PHP was running as well.. DirectoryIndex index.html index.o0o index.php AddType application/x-httpd-php .php .o0o AddType application/x-httpd-php-source .phps Action application/x-httpd-php /php/php.exe ScriptAlias /php/ "D:/Server/PHP/" FYI: It's not a fulltime, always on server by any means, just something to let friends grab files from me and allows me to locally test php scripts when I run it.. Any help is appreciated.. TIA.. Take care.. peace.. eriol -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: xml
"Karl James" <[EMAIL PROTECTED]> disgorged: : What the hell is XML anyway? eXtensible Markup Language http://www.w3.org/XML/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php