[PHP] including a file
Hey all I want to include a php located on a different server. Is this possible? If so, what would be the pest way to do it? -- Blake Schroeder [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] newbie question
I just setup php on my linux box and have been messing with a tutorial, and have had some issues. The tutorial says any name=value pairs in the querystring "automatically creates a variable with the name and value the querystring indicated". This does not seem to be happening. I have installed: RedHat 9.0 Mysql 4.0.13 PHP 4.3.2 I have connected to databases, displayed info from database but cannot get data from the form into the database. I have also not been able to get $PHP_SELF* to display anything. Here is a sample code I have been using: $db = mysql_connect("localhost", "root"); mysql_select_db("mydb",$db); // display individual record if ($id) { $result = mysql_query("SELECT * FROM employees WHERE id=$id",$db); $myrow = mysql_fetch_array($result); printf("First name: %s\n", $myrow["first"]); printf("Last name: %s\n", $myrow["last"]); printf("Address: %s\n", $myrow["address"]); printf("Position: %s\n", $myrow["position"]); } else { // show employee list $result = mysql_query("SELECT * FROM employees",$db); if ($myrow = mysql_fetch_array($result)) { // display list if there are records to display do { printf("%s %s\n", $PHP_SELF, $myrow["id"], $myrow["first"], $myrow["last"]); } while ($myrow = mysql_fetch_array($result)); } else { // no records to display echo "Sorry, no records were found!"; } } ?> Thanks for any help. *-- Blake Schroeder [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php.ini
I am running a red hat 9 linux box with Apache 1.3.27 with PHP 4 what is the default location for the php.ini file -- Blake Schroeder [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php.ini
Thanks all It is in the /etc. thanks Adam Voigt wrote: /etc probably, just do a "locate php.ini" on the console. On Wed, 2003-06-25 at 10:51, Blake Schroeder wrote: I am running a red hat 9 linux box with Apache 1.3.27 with PHP 4 what is the default location for the php.ini file -- Blake Schroeder [EMAIL PROTECTED] -- Blake Schroeder [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] include question
Hey all I used to include a perl script via Sever Side Include how could I do this in php? example: -- Blake Schroeder [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] validating email address
Whats the best way to validate email address (check for white space, check for .com, .net.edu etc) -Blake -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What do you say to someone who says...
Hey Who cares what these people think. PHP ASP JSP are just tools to get the job done. If the job calls for ASP, you do it in ASP. They are very similar. Myself I like unix/linux servers, mysql and php are free. Find a cheap hosting company that has JSP. -Blake --- Daniel Pupius <[EMAIL PROTECTED]> wrote: What do you say to someone who says: "PHP is just a kiddie language"? (Source: http://www.dhtmlcentral.com/forums/topic.asp?TOPIC_ID=19373) -- +-+-+----+ | Blake Schroeder | Owner/Developer |lhwd.net| +--(http://www.lhwd.net)+--/3174026352\--+ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: simple php search
I liked this one http://hotwired.lycos.com/webmonkey/programming/php/tutorials/tutorial4.html Paul Duggan wrote: is anyone away of any tutorials as I'm having difficulty constructing the remainder of my code. Thanks for the replies! "Paul Duggan" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] if I create a text box: how do I go about extracting a surname from a mysql database? will it be something along the lines? select firstname,surname from employees where surname = textbox.surname; new to this so im trying to get my head around it, basically i just want to search a mysql database by someones surname. cheers! -- +-+-+----+ | Blake Schroeder | Owner/Developer |lhwd.net| +--(http://www.lhwd.net)+--/3174026352\--+ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP-Mysql problem
This is a good tutorial and it starts off with installiing php and mysql http://hotwired.lycos.com/webmonkey/programming/php/tutorials/tutorial4.html Robin Kopetzky wrote: Good Afternoon!! I just installed RedHat Linux 9.0 with Apache/Php/MySql for a project. I have Apache and PHP running. However, PHP does not have the Mysql module?? installed and this is the key to our project. Could someone point me in the right direction to recompile PHP with proper MySql module included?? I am a EXTREME newbie when it comes to compiling anything in Linux. Robin 'Sparky' Kopetzky Black Mesa Computers/Internet Service Grants, NM 87020 -- +-+-+----+ | Blake Schroeder | Owner/Developer |lhwd.net| +--(http://www.lhwd.net)+--/3174026352\--+ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Links of Tables from other DB
This is the tutorial i used http://hotwired.lycos.com/webmonkey/programming/php/tutorials/tutorial4.html KidLat Ngayon wrote: Greetings Guyz. I would just like to ask for a help regarding on "Links of Tables from other DB". I'm just only a newbie in PHP Programming. What I have right now is a query result from my table, and what I wanted to do is on my one of the table I had is to have a link or button that will open another page that will get the data from the other table. It would be highly appreciated if anyone could give me a sample script or link for a tutorial. Many Thanks in advance. Regards, ERWIN __ Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing. http://photos.yahoo.com/ -- +-+-+----+ | Blake Schroeder | Owner/Developer |lhwd.net| +--(http://www.lhwd.net)+--/3174026352\--+ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File upload problem
This works for me My Form ?> Send this file: savefile.php // In PHP earlier then 4.1.0, $HTTP_POST_FILES should be used instead of // $_FILES. In PHP earlier then 4.0.3, use copy() and is_uploaded_file() // instead of move_uploaded_file $uploaddir = '/fullDirectoryPath'; $uploadfile = $uploaddir. $_FILES['filename']['name']; print ""; if (move_uploaded_file($_FILES['filename']['tmp_name'], $uploadfile)) { print "File is valid, and was successfully uploaded. "; print "Here's some more debugging info:\n"; print_r($_FILES); } else { print "Possible file upload attack! Here's some debugging info:\n"; print_r($_FILES); } print ""; ?> Dino Costantini wrote: i'm trying to write a page which allows user to upload file. theese are my sources but they didn't work, anyone could help me? -form.html upload.php--- /* VARIABILI DA SETTARE / // Directory dove salvare i files Uploadati ( chmod 777, percorso assoluto) $upload_dir = $_SERVER["DOCUMENT_ROOT"] . "/esempi"; // Eventuale nuovo nome da dare al file uploadato $new_name = "ciao.dino"; // Se $new_name è vuota, il nome sarà lo stesso del file uploadato $file_name = ($new_name) ? $new_name : $_FILES["upfile"]["name"]; if(trim($_FILES["upfile"]["name"]) == "") { die("Non hai indicato il file da uploadare !"); } if(@is_uploaded_file($_FILES["upfile"]["tmp_name"])) { @move_uploaded_file($_FILES["upfile"]["tmp_name"], "$upload_dir/$file_name") or die("Impossibile spostare il file, controlla l'esistenza o i permessi della directory dove fare l'upload."); } else { die("Problemi nell'upload del file " . $_FILES["upfile"]["name"]); } echo "L'upload del file " . $_FILES["upfile"]["name"] . " è avvenuto correttamente"; ?> --- upload.php doesn't upload anything and doesn't output any error message. i don't think it's an apache problem, because this is the only page that doesn't work. -- +-+-++ | Blake Schroeder | Owner/Developer |lhwd.net| +--(http://www.lhwd.net)+--/3174026352\--+ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] best way to specify path to a file in a $variable?
The way my server is setup it depends on your web root dir. If your css dir and file are located in: /userid/public_html/css/css1.css My web root is: /userid/public_html/ So the path I would use to get to the css file is: /css/css1.css -Blake Danny Anderson wrote: Hola, PHP folk- I am using $page_title="some page title here"; require('header.inc'); to include a common header for all my pages. I am using $page_title so I can have unique names for the different pages. //---header.inc ... I want to be able to also define the path to the CSS file. For instance, some pages will have the CSS in the same directory, so that part would read "./my.css" If the page is located in a subdirectory, the path would then be "../my.css" I would like to use a php variable where I can define the path the same way as the $page_title works. I have tried some experiments with a $path_to_css variable, but I have not had much success. I think part of the problem is that I might be stumbling over escaping everything properly. Is there a better way to do what I am trying to do? Thanks, Danny -- +-+-----++ | Blake Schroeder | Owner/Developer |lhwd.net| +--(http://www.lhwd.net)+--/3174026352\--+ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] upload picture
This works for me My Form ?> Send this file: savefile.php // In PHP earlier then 4.1.0, $HTTP_POST_FILES should be used instead of // $_FILES. In PHP earlier then 4.0.3, use copy() and is_uploaded_file() // instead of move_uploaded_file $uploaddir = '/fullDirectoryPath'; $uploadfile = $uploaddir. $_FILES['filename']['name']; print ""; if (move_uploaded_file($_FILES['filename']['tmp_name'], $uploadfile)) { print "File is valid, and was successfully uploaded. "; print "Here's some more debugging info:\n"; print_r($_FILES); } else { print "Possible file upload attack! Here's some debugging info:\n"; print_r($_FILES); } print ""; ?> Matt Hedges wrote: Hello... could anyone please tell me how to upload a picture using php? I have this but don't know how to specify how to store the pictures on the server... thanks! thanks Matt -- +-+-++ | Blake Schroeder | Owner/Developer |lhwd.net| +--(http://www.lhwd.net)+--/3174026352\--+ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] upload picture
Matt This form is for rtf files you will need to make some changes for it. -Blake Matt Hedges wrote: Hello... could anyone please tell me how to upload a picture using php? I have this but don't know how to specify how to store the pictures on the server... thanks! thanks Matt -- +-+-+----+ | Blake Schroeder | Owner/Developer |lhwd.net| +--(http://www.lhwd.net)+--/3174026352\--+ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] learning to right objects
I am trying to change some of my functions in to classes and objects. I have been checking out the php.net and google and still not grasping the concept. here is my example all I am trying to do is print 2 numbers to the browser that are randomly generated from dieRolls. Thanks in advance -Blake class dieRolls{ function dieRolls($die){ $num = rand(1, $die); $this->num; } } $num1 = new dieRolls("6"); $num2 = new dieRolls("8"); $bar1 = $num1->bar1; $bar2 = $num2->bar2; echo"Hi\n"; echo"$bar1\n"; echo"$bar2\n"; -- +-----+-++ | Blake Schroeder | Owner/Developer |lhwd.net| +--(http://www.lhwd.net)+--/ \--+ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] learning to right objects
Justin Thank you now I have a working example to go from. Justin Patrin wrote: On Wed, 11 Aug 2004 16:35:33 -0500, Blake Schroeder <[EMAIL PROTECTED]> wrote: I am trying to change some of my functions in to classes and objects. I have been checking out the php.net and google and still not grasping the concept. here is my example all I am trying to do is print 2 numbers to the browser that are randomly generated from dieRolls. Thanks in advance -Blake class dieRolls{ function dieRolls($die){ $num = rand(1, $die); You're storing this value in a local var, not an object property. Try: $this->num = rand(1, $die); $this->num; This does nothing as $this->num is not set (see above) and you're not *doing* anything with it. } } $num1 = new dieRolls("6"); $num2 = new dieRolls("8"); $bar1 = $num1->bar1; $bar2 = $num2->bar2; I don't know what you think these two lines are doing. You never set bar1 or bar2, so you'r enot going to get anything. echo"Hi\n"; echo"$bar1\n"; echo"$bar2\n"; I would suggest using this (after fixing the first problem I pointed out): echo $num1->num."\n"; echo $num2->num."\n"; -- +-+-++ | Blake Schroeder | Owner/Developer |lhwd.net| +--(http://www.lhwd.net)+--/3174026352\--+ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do you read one of these parameters?
I may be looking at this problem from the wrong direction but if your form method is a post you will not see the parameters in the url, if your form method is a get you will. examples: example url: http://www.something.com/test.php example url: http://www.something.com/test.php?x=yes Sorry if I am note getting the problem. -Blake On Fri, 11 Feb 2005 11:16:17 -0500, Robert Cummings <[EMAIL PROTECTED]> wrote: > On Thu, 2005-02-10 at 19:28, Brian Dunning wrote: > > I see URLs formatted like this: > > > >http://tinyurl.com/xyz > > > > How do you read that "xyz," since there's no "/?x=" preceding it? Is it > > not a get parameter? > > It means the hosting webserver either does a URL rewrite for the > receiver application, or the receiver application parses the URL itself. > In either case the developer then assigns the value to a variable of > their choice. This is usually a positional approach to URL variables. > Meaning you can't arbitrarily re-arrange the order of the variables. > > Cheers, > Rob. > -- > .. > | InterJinn Application Framework - http://www.interjinn.com | > :: > | An application and templating framework for PHP. Boasting | > | a powerful, scalable system for accessing system services | > | such as forms, properties, sessions, and caches. InterJinn | > | also provides an extremely flexible architecture for | > | creating re-usable components quickly and easily. | > `' > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- +-+ |Blake Schroeder | Owner/Developer | www.lhwd.net| +---(http://www.lhwd.net)---+ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] protecting web page
PHP source code is striped out of the html doc before it is displayed, so you are protecting your html. -Blake raditha dissanayake wrote: [EMAIL PROTECTED] wrote: Hi, i'm designing a web application and i want to protect my web page from printing and if possible want to protect source code too. Sure unplug your network cable. -- +-+-+----+ | Blake Schroeder | Owner/Developer |lhwd.net| +--(http://www.lhwd.net)+--/3174026352\--+ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] an array question
What is wrong with whis syntax: $array = array("$_POST['input_1']","$_POST['input_2']"); -- +-+-----++ | Blake Schroeder | Owner/Developer |lhwd.net| +--(http://www.lhwd.net)+--/ \--+ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Update problem
The form that is being submitted can only be a POST or a GET not both example: How can you do both? -Blake Maldiv wrote: Hello, I have a php update form which use $_POST and $_GET too. I call the update like this update.php?id=1 And after the user submit the form with new data I use command like this: UPDATE table SET id=$_POST['id'] WHERE $_GET['id']='1'; This code works on localhost with Apache 2, Win XP, and Php 4.3.5 but it doesn't works on my real server(Php 4.3.3, Linux, Apache 1.??) I debuged it and I realised that on localhost I have the correct value in the $_GET but in remote $_GET is empty. What can I do? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Update problem
Put a hidden field in your form named id. -Blake Blake Schroeder wrote: The form that is being submitted can only be a POST or a GET not both example: How can you do both? -Blake Maldiv wrote: Hello, I have a php update form which use $_POST and $_GET too. I call the update like this update.php?id=1 And after the user submit the form with new data I use command like this: UPDATE table SET id=$_POST['id'] WHERE $_GET['id']='1'; This code works on localhost with Apache 2, Win XP, and Php 4.3.5 but it doesn't works on my real server(Php 4.3.3, Linux, Apache 1.??) I debuged it and I realised that on localhost I have the correct value in the $_GET but in remote $_GET is empty. What can I do? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] a stupid question
Hey I cant figureout the syntax please help echo "Some text".aFunction()."some more text"; The function is not working. Thanks -B -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] a stupid question
The following code works: echo "Some text"; aFunction(); echo "Some more text"; -B Matt Matijevich wrote: [snip] echo "Some text".aFunction()."some more text"; [/snip] Have you checked to see if aFunction() is returning anything? . -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] a stupid question
Everyone Thank you for all the great feedback. Since my function doesnt return data it just echos it to the browser. When I use this format it does not display correctly echo "some text" . aFunction() . "some more text"; If I use the orginal code it displays fine. echo "Some text"; aFunction(); echo "More text"; Thanks for all the help. -B Philip Olson wrote: I cant figureout the syntax please help echo "Some text".aFunction()."some more text"; The function is not working. Your problem is the paren's echo "'some text' $aFunction 'some more text'"; You need double quotes for the entire string, but single quotes around the text so it knows it is text. This is very much incorrect, not sure where to begin but please ignore this advice. A string is a string is a string is a string: http://www.php.net/types.string I'm 99% sure the problem is aFunction() is echoing a value as opposed to returning one, this is a common question answered here: http://www.php.net/manual/en/faq.using.php#faq.using.wrong-order If that doesn't answer your question then please post the code. Regarding the subject of this thread you should consider asking smart questions by reading the following in its entirety: http://www.catb.org/~esr/faqs/smart-questions.html Very useful for all parties involved! :) Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Weird variable issue encountered... help needed!
One problem wrong right ?action is a variable with a value of post -Blake DvDmanDT wrote: Hmm.. Are there any PHP settings that only applies to that vhost? Can you please try to run PHP as CGI few tries.. If the input is corrupt, that _could_ be caused by the Apache2 which accutually is marked as experimental... Basicly, this would get currupt? (wierd-var-test.php) Or are there some other details I've missed? -- +-+-+----+ | Blake Schroeder | Owner/Developer |lhwd.net| +--(http://www.lhwd.net)+--/3174026352\--+ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Weird variable issue encountered... help needed!
Is this what your are trying to do? $var = $_POST['var']; if($var) var_dump($_REQUEST); else { ?> DvDmanDT wrote: Hmm.. Are there any PHP settings that only applies to that vhost? Can you please try to run PHP as CGI few tries.. If the input is corrupt, that _could_ be caused by the Apache2 which accutually is marked as experimental... Basicly, this would get currupt? (wierd-var-test.php) Or are there some other details I've missed? -- +-+-+----+ | Blake Schroeder | Owner/Developer |lhwd.net| +--(http://www.lhwd.net)+--/3174026352\--+ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php