Re: [PHP] mail() and passwords
I mean the only way is to use existing classes for sending emails via smtp socket or to write your own one. tom On Tue, 9 Mar 2004 03:37:33 -0500 "Will" <[EMAIL PROTECTED]> wrote: > How do I modify the following to except a password for the SMTP server? > > [mail function] > SMTP = localhost > > sendmail_from = [EMAIL PROTECTED] > > Please help!! > > Thanks in advance! > > ~WILL~ > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- == Tomas Meinlschmidt, SBN3, MCT, MCP, MCP+I, MCSE, NetApp Filer & NetCache gPG fp: CB78 76D9 210F 256A ADF4 0B02 BECA D462 66AB 6F56 / $ID: 66AB6F56 GCS d-(?) s: a- C++ ULHISC*$ P+++> L+++$> E--- W+++$ N++(+) !o !K w(---) !O !M V PS+ PE Y+ PGP++ t+@ !5 X? R tv b+ !DI D+ G e>+++ h r+++ z+++@ == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] getting message from file
see php.net/file or php.net/fread $file = "somefile.dat"; if ([EMAIL PROTECTED]($file)) return 0; $filecontent = file($file); $numbers = array(); if (is_array($filecontent) && count($filecontent)) { foreach($filecontent as $line) { // delete more than one space $line = ereg_replace("[ ]*"," ", $line); // explode whole line into array $numbers_temp = explode(" ", $line); // add temp arr to $numbers array $numbers = array_merge($numbers, $numbers_temp); } } and now you have all the data in $numbers array... you DON'T need to convert strings to numbers. /tom On Tue, 9 Mar 2004 15:25:16 +0800 "Kenneth" <[EMAIL PROTECTED]> wrote: > My data file is sth like: > 2.208 2.18 2.415 2.283 2.234 2.155 2.389 2.201 > 2.204 2.181 2.43 2.285 2.231 2.164 2.387 2.197 > 2.2 2.179 2.429 2.29 2.225 2.181 2.385 2.195 > 2.196 2.178 2.424 2.291 2.225 2.213 2.386 2.19 > > I would like to get these data in order to plot graph. > > I've tried to use fgets() and then convert them from string back into > array...but it seems doesn't work~ > > Thanks, > Kenneth > > > > "Jason Wong" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > On Monday 08 March 2004 09:04, Kenneth wrote: > > > > > I have a problem on getting content from a data file (data.txt). > > > I have many numbers in the file...all of them are about 2.XXX, and I > need > > > them to plot a graph. > > > > What does your data file look like? Show a few sample lines. > > > > > But I just can't read them out as a integer. > > > > What code did you use? > > > > -- > > 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 > > -- > > /* > > "Have you lived here all your life?" > > "Oh, twice that long." > > */ > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- == Tomas Meinlschmidt, SBN3, MCT, MCP, MCP+I, MCSE, NetApp Filer & NetCache gPG fp: CB78 76D9 210F 256A ADF4 0B02 BECA D462 66AB 6F56 / $ID: 66AB6F56 GCS d-(?) s: a- C++ ULHISC*$ P+++> L+++$> E--- W+++$ N++(+) !o !K w(---) !O !M V PS+ PE Y+ PGP++ t+@ !5 X? R tv b+ !DI D+ G e>+++ h r+++ z+++@ == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RE: R: [PHP] Get "nice" variables from POST
oops. It's much better to use single quotes and entire variable in {} eg .. where user_id = '{$_POST['user_id']}' ... realize - POST variable user_id has no value, so in your code it will be as "select * from users where user_id ="; as a result - you have wrong sql query. /tom On Fri, 12 Mar 2004 13:40:12 + "Mike Mapsnac" <[EMAIL PROTECTED]> wrote: > I try to use quotes in the query and this doesn't work. >$query = "SELECT * FROM user WHERE user_id = '$_POST['user_id']}'"; > But you use brackets and it works.. Why do you use brackets ? > $query = "SELECT * FROM user WHERE user_id = ${_POST['user_id']}"; > > > >From: "Alessandro Vitale" <[EMAIL PROTECTED]> > >To: "Mike Mapsnac" <[EMAIL PROTECTED]>,<[EMAIL PROTECTED]> > >Subject: R: [PHP] Get "nice" variables from POST > >Date: Thu, 11 Mar 2004 17:30:57 +0100 > > > >hi, > > > >why don't you simple use the $_POST vars? they are already available to > >you, > >so why you should copy them? > > > >example: > > > >function show_function() > >{ > >$query = "SELECT * FROM user WHERE user_id = ${_POST['user_id']}"; > > > >} > > > >at the same time: > >- you save a lot of time ( you don't need to write code for copying vars ) > >- you can always identify in your script the variable you are using is the > >one that comes from POST > > > >cheers, > > > >alessandro > > > >-Messaggio originale- > >Da: Mike Mapsnac [mailto:[EMAIL PROTECTED] > >Inviato: giovedÄ› 11 marzo 2004 15.51 > >A: [EMAIL PROTECTED] > >Oggetto: [PHP] Get "nice" variables from POST > > > > > >I have about 10 fields in the form. And I get the fields through POST: > >//Get Variable from the form > >$username = $_POST['username']; > >$password = $_POST['password']; > >$password2 = $_POST['password2']; > >$email = $_POST['email']; > >$email2 = $_POST['email2']; > >$nickname = $_POST['name']; > >$city = $POST['city']; > >$state = $_POST['state']; > >$country = $_POST['country']; > >$misc = $_POST['misc']; > >$country = $_POST['country']; > > > >It works but it looks ugly. For each variable I have statemet. Is there a > >way to get the variables in the loop? > > > >I'm looking for "nice" way to get variables from POST? > > > >Thanks > > > >_ > >Frustrated with dial-up? Lightning-fast Internet access for as low as > >$29.95/month. http://click.atdmt.com/AVE/go/onm00200360ave/direct/01/ > > > >-- > >PHP General Mailing List (http://www.php.net/) > >To unsubscribe, visit: http://www.php.net/unsub.php > > > > _ > Get a FREE online computer virus scan from McAfee when you click here. > http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php --
Re: [PHP] Get "nice" variables from POST
if (is_array($_POST)) { foreach($_POST as $name=>$value) { ${$name} = $value; } } /tom On Fri, 12 Mar 2004 15:59:00 +0100 (CET) Hans Juergen von Lengerke <[EMAIL PROTECTED]> wrote: > I know this isn't what you want, but nevertheless, this > "does not look ugly": > > > > # Get variables from the form > # > $username = $_POST['username']; > $password = $_POST['password']; > $password2 = $_POST['password2']; > $email = $_POST['email']; > $email2= $_POST['email2']; > $nickname = $_POST['name']; > $city = $POST['city']; > $state = $_POST['state']; > $country = $_POST['country']; > $misc = $_POST['misc']; > $country = $_POST['country']; > > > > and there you go, you can now easily spot a typo too :-) > > Hans > > > PS: If you read this with variable-width font > you might think I am an idiot. never mind. > > > > Date: Thu, 11 Mar 2004 14:51:25 + > > From: Mike Mapsnac <[EMAIL PROTECTED]> > > To: [EMAIL PROTECTED] > > Subject: [PHP] Get "nice" variables from POST > > > > I have about 10 fields in the form. And I get the fields through POST: > > //Get Variable from the form > > $username = $_POST['username']; > > $password = $_POST['password']; > > $password2 = $_POST['password2']; > > $email = $_POST['email']; > > $email2 = $_POST['email2']; > > $nickname = $_POST['name']; > > $city = $POST['city']; > > $state = $_POST['state']; > > $country = $_POST['country']; > > $misc = $_POST['misc']; > > $country = $_POST['country']; > > > > It works but it looks ugly. For each variable I have statemet. Is there a > > way to get the variables in the loop? > > > > I'm looking for "nice" way to get variables from POST? > > > > Thanks > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] load a URL and trap output
simple use fopen() or file() as $fp = fopen("http://somedomain/some.url?blablah","r";); and read via fread() /tom On Fri, 12 Mar 2004 10:54:53 -0500 Roger Spears <[EMAIL PROTECTED]> wrote: > Hello, > > I have this application which is accessed via a web portal. The first > thing my application must do is make sure the visitor is logged in via > the portal. The only way to do this is by making a request to a > specific URL. This URL (which includes the log in cookie id) will > return XML to my application. Once I parse this XML, I will know if > visitors are logged in. > > Simple enough. > > How do I make my application load a URL and trap the returned data so > that it never creates any browser output? > > My first reaction was header("Location: URL") but then I'd be handing > off control to the URL and the output would appear in the browser. > > I've done some research and found system(), exec(), and passthru(). But > I'm not sure if these functions are the proper way to do such a task > especially since I'm calling a URL and not a specific UNIX command. > > Thanks, > Roger > > -- > 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] use of @ operator to suppress errors
Yes, it's normal. You've to check if is that variable set if (isset($_GET['this'])) and than you didn't get any NOTICE about that undefined variable. condition "if ($_GET['this'])" is not sufficient to check whether is variable set or not. /tom On Mon, 15 Mar 2004 11:43:24 - "Ben Joyce" <[EMAIL PROTECTED]> wrote: > hi. > > i'm using error_reporting(0) and set_error_handler("MyErrorHandler") to > manage my errors but I'm getting situations where a NOTICE error is thrown. > > For example if I refer to $_GET['this'] when there is no 'this' querystring > key then i get the error. > > I've tried using @$_GET['this'] but it makes no difference. > > Is this normal? > > Thanks in advance. > > Ben > > p.s. PHP 4.3.4 on Windows 2003 > > -- > 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] Anyway to access a class variable without using a return function?
I mean using get_object_vars() is much better. and in the example I've seen there: you HAVE TO define all the variables you're using in a class scope. eg class myClass { var $var1; var $var2 = array(); function myClass($var) { $vars =get_object_vars($this); if (isset($vars[$var])) return $vars[$var]; return false; } } /tom On Mon, 15 Mar 2004 13:36:07 +0100 Marco Schuler <[EMAIL PROTECTED]> wrote: > Hi! > > Am Mo, 2004-03-15 um 13.02 schrieb Dave Starling: > > I think you could also do something like this: > > > > class MyClass { > > function MyClass { > > $this->var1="1"; > > $this->var2="2"; > > } > > function GetVar($var) { > > return $this->{$var}; > > } > > } > > > > $test = new MyClass(); > > > > echo $test->GetVar('var1').''; > > echo $test->GetVar('var2').''; > > Better check first if property/var exists: > > function getVar($var) > { > $that = null; > if (isset($this->$var)) { > $that = $this->$var; > } > return $that; > } > > > -- > Regards > Marco > > -- > 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] catching URL#target params
Hi, it could be done only by parsing $_SERVER['QUERY_STRING'] variable ... eg $querystring = $_SERVER['QUERY_STRING']; eregi("#([a-z0-9_.-]*)", $querystring, $arg); $hashtarget = $arg[1]; /tom On Mon, 15 Mar 2004 08:52:43 -0500 David T-G <[EMAIL PROTECTED]> wrote: > Hi, all -- > > I know that I can easily see > > http://URL?param=value > > and even > > http://URL?value > > but I haven't found any way to capture > > http://URL#target > > as one would use to jump to a certain location in a plain HTML file. > When I try this in a PHP file and run phpinfo, I see nothing that > includes that target. > > Is there a var that will work for me? > > > TIA & HAND > > :-D > -- > David T-G * There is too much animal courage in > (play) [EMAIL PROTECTED] * society and not sufficient moral courage. > (work) [EMAIL PROTECTED] -- Mary Baker Eddy, "Science and Health" > http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! > > -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] catching URL#target params
BACK BACK BACK. I'm a stupid fool ... #something is NOT send to the server, so it's unable to track it ... sorry /tom request was a.php?aasdf=1234a#greetz and from apache log someip - - [15/Mar/2004:15:01:37 +0100] "GET /~znouza/a.php?aasdf=1234a HTTP/1.1" 200 3325 On Mon, 15 Mar 2004 15:00:04 +0100 Tom Meinlschmidt <[EMAIL PROTECTED]> wrote: > Hi, > > it could be done only by parsing $_SERVER['QUERY_STRING'] variable ... > > eg > > $querystring = $_SERVER['QUERY_STRING']; > eregi("#([a-z0-9_.-]*)", $querystring, $arg); > > $hashtarget = $arg[1]; > > /tom > > On Mon, 15 Mar 2004 08:52:43 -0500 > David T-G <[EMAIL PROTECTED]> wrote: > > > Hi, all -- > > > > I know that I can easily see > > > > http://URL?param=value > > > > and even > > > > http://URL?value > > > > but I haven't found any way to capture > > > > http://URL#target > > > > as one would use to jump to a certain location in a plain HTML file. > > When I try this in a PHP file and run phpinfo, I see nothing that > > includes that target. > > > > Is there a var that will work for me? > > > > > > TIA & HAND > > > > :-D > > -- > > David T-G * There is too much animal courage in > > (play) [EMAIL PROTECTED] * society and not sufficient moral courage. > > (work) [EMAIL PROTECTED] -- Mary Baker Eddy, "Science and Health" > > http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! > > > > > > > -- > > -- > 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] catching URL#target params
is possible to catch it by javascript, but I have no clue how to use with normal hrefs (not forms) try alert(document.location); and you'll get entrire request with #target part too. /tom -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Anyway to access a class variable without using a return function?
thank, sure. function name should be myClassGetVar() :) /tom On Mon, 15 Mar 2004 14:49:55 +0100 Marco Schuler <[EMAIL PROTECTED]> wrote: > Hi > > Am Mo, 2004-03-15 um 14.10 schrieb Tom Meinlschmidt: > > I mean using get_object_vars() is much better. > > > > and in the example I've seen there: > > > > you HAVE TO define all the variables you're using in a class scope. eg > > class myClass { > > var $var1; > > var $var2 = array(); > > > > function myClass($var) { > >$vars =get_object_vars($this); > >if (isset($vars[$var])) return $vars[$var]; > >return false; > > } > > } > > Somewhat more elegant, yes. But: your function above is called myClass > which is the classname and therefore this function is a _constructor_! > As a constructor does not allow to return values, the above example > would only work if you rename the function-name to something other than > myClass! > > -- > Regards > Marco > > -- > 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