php-general Digest 15 Aug 2003 06:16:45 -0000 Issue 2237

Topics (messages 159608 through 159642):

Re: project management php system
        159608 by: Michael A Smith

Re: email confirmation script
        159609 by: Anthony Ritter
        159626 by: Anthony Ritter
        159638 by: olinux

Newbie Session Question
        159610 by: Tim Winters
        159611 by: CPT John W. Holmes
        159614 by: Analysis & Solutions
        159615 by: Tim Winters

LAMP > I need a good tutorial on how to install and configure GD2
        159612 by: Matt Babineau

Templates, custom functions, mysql
        159613 by: Tyler Longren

searching date
        159616 by: bl1412.hotpop
        159617 by: Jay Blanchard
        159642 by: Kae Verens

Category and sub-category logic
        159618 by: Ryan A
        159619 by: Chris W. Parker
        159620 by: David Otton
        159621 by: Chris W. Parker

Generate Dates
        159622 by: Ralph Guzman
        159624 by: CPT John W. Holmes

ldap_list + Novell eDirectory
        159623 by: Daniel Bray

Image with graduated fill using PHP
        159625 by: Adrian

Re: php.ini configuration can we have two include_path in php.in file
        159627 by: Justin French

host name
        159628 by: viraj.ceynet.net
        159631 by: Mike Migurski
        159632 by: Justin French

mail error
        159629 by: merryE
        159635 by: Jackson Miller

configure smtp in php.ini
        159630 by: merryE

configure smtp error
        159633 by: merryE
        159636 by: Jackson Miller

How can I load load Additional extensions ?
        159634 by: Dennis Lee
        159637 by: Leif K-Brooks
        159639 by: Dennis Lee
        159641 by: Dennis Lee

How to Select
        159640 by: John Taylor-Johnston

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message --- I've developed PrattCMS... (Try out the latest RC, it's quite stable and note that 2.0 will be out later today or tomorrow depending...).

It's:
-GPL'ed
-PHP/MySQL (Could support other databases, with small amount of work.)
-Has an error reporting class to send notes when a db query fails (by e-mail).
-Has an in-line WYSIWYG editor that runs in IE 5.5+ and Mozilla 1.3+.
-Has a _really_ easy way to install/switch templates.
-----Uses .xml files that exist inside the right directory to get information about each template.
-----Creating a new template is easy... just look at the four provided, use smarty templates, and look at and *.xml file in the templates/ directory.
-----Switching templates is as easy as clicking 1 button.
-Has customizable style-sheet values.
-Works fine with web spiders (uses ?id=<num> to get different files).
-Doesn't require register_globals (never tested with register_globals on... ought to work though).
-Has user groups so that only certain users are allowed to create new users/edit site-wide configuration/change templates and you can even restrict which pages they are allowed to modify as well as whether they are allowed to create new pages or not.
-Has a front-page module so you can have an entry page (you can disable by emptying the "modules" table, but then you'll have to make a simple modification so that your home page will exist... you can ask me later if you want)
-You can backup all your information (pages, database configuration, downloads you've uploaded, images you've uploaded... requires --with-zlib)
-Has stats: Number of visitors, Country graph of where you're users come from, Browser detection, Most visited pages, Where the users came from, Graph of Hourly visits (does _not_ require GD).
-Has a SELECT only Database viewer that runs in PEAR::DB (just like the rest of the CMS).


It shouldn't be too hard to customize if you need to. You can create new templates/etc., obviously for yourself.

Webpage:
http://prattcms.sourceforge.net/
(You can try it out by visiting: http://opensourcecms.com/ and clicking the "PrattCMS" link on the left hand side.)


HTH!
-Michael
[EMAIL PROTECTED] wrote:

Hi guys ok i am doing it now, but i'm not asking for you to code something
for me, i'm looking for a classy project management system possibly in an
open source format in PHP and Mysql.

I was wondering who has implemented such a system they could recommend, i
am investigation to look into customising an already developed system or we
have to develop one from scratch to suit our needs.

Let me know.

Thanks

Dan








--- End Message ---
--- Begin Message ---
Thanks Jackson.

I appreciate the assistance.

Am I on the right track?

Best...
TR
......................

// this is the form

<html>
<body>
<form action="post" method="process.php">
<p>
Your e-mail address:<br>
<input type="text" name="name"><br>
<input type="text" name="email"><br>
<input type="submit" name="submit" value="submit">
</body>
</form>
</html>
...............
//process.php
<?
if ($email)
{
 $secret_variable = "something_only_you_know";
 $confirmationID = md5($email.$secret_variable);
 $body = "Thank you for registering $name \n;";
 $body .= "Please click on the <a
href=mailto:[EMAIL PROTECTED]/email_verify.php?email=$email&c
onfirmation_ID=$confirmation_ID>link</a>"
 mail($_POST['email'],'Thank you',$body,'From: Us Fish');
}

...............

//email_verify.php
<?

if ($_GET['confirmationID'] = md5($_GET['email'].$secret_variable)) {
    // insert the user into the database
} else {
  // display an error message
}
?>



--- End Message ---
--- Begin Message ---
This is what I receive via e-mail after I click submit using the following
code.  As you can see - the html attribute <a href= shows up and the whole
string in linked.  All I was looking for is a link to the URL and the word -
Click - to be underlined showing the link.

Additionally, the value (as in key/value) part of confirmation_ID  is
nowhere to be found in the query string.

Thank you for any assistance.
Tony Ritter

.....................................
// This is what I get back via e-mail:

----- Original Message -----
From: <Us>
To: <[EMAIL PROTECTED]>
Sent: Thursday, August 14, 2003 2:04 PM
Subject: Thank you for registering


> Thank you for registering tony
>
> <a
href="http://www.gonefishingguideservice.com/[EMAIL PROTECTED]
efishingguideservice.com&confirmation_ID=">Click</a>

---------------------------------------------


/*the .html form which takes a name and an e-mail address */

<html>
<body>
<form action="process_a.php" method="post">
<p>
Your name:<br>
<input type="text" name="name"><br>
Your e-mail address:<br>
<input type="text" name="email"><br>
<input type="submit" name="submit" value="submit">
</body>
</form>
</html>
...............


/*process_a.php: which receives the name and email variables.  The script
then tries to then send the note back to the user with a link - called
CLICK.  When the user hits the link to email_verify.php the email address is
inserted into the database*/

<?
 $msg = "Thank you for registering $name\n\n";
 $msg .= "<a
href=\"http://www.gonefishingguideservice.com/email_verify.php?email=$email&;
confirmation_ID=$confirmation_ID>CLICK</a>";
 $secret_variable = "something_only_you_know";
 $confirmation_ID = md5($email.$secret_variable);
 $to="[EMAIL PROTECTED]";
 $subject="Thank you for registering";
 $mailheaders="From: Us";
 mail($to,$subject,$msg,$mailheaders);
?>
.............

// email_verify.php

<?
if ($_GET['confirmation_ID'] = md5($_GET['email'].$secret_variable)) {
    // insert the user into the database
} else {
  // display an error message
}
?>





--- End Message ---
--- Begin Message ---
Read the manual notes for mail() and find out how to
send html messages.
www.php.net/mail

or better - just send a text message
make your link shorter though so the link won't break.


olinux


--- Anthony Ritter <[EMAIL PROTECTED]>
wrote:
> This is what I receive via e-mail after I click
> submit using the following
> code.  As you can see - the html attribute <a href=
> shows up and the whole
> string in linked.  All I was looking for is a link
> to the URL and the word -
> Click - to be underlined showing the link.
> 
> Additionally, the value (as in key/value) part of
> confirmation_ID  is
> nowhere to be found in the query string.
> 
> Thank you for any assistance.
> Tony Ritter
> 
> .....................................
> // This is what I get back via e-mail:
> 
> ----- Original Message -----
> From: <Us>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, August 14, 2003 2:04 PM
> Subject: Thank you for registering
> 
> 
> > Thank you for registering tony
> >
> > <a
>
href="http://www.gonefishingguideservice.com/[EMAIL PROTECTED]
> efishingguideservice.com&confirmation_ID=">Click</a>
> 
> ---------------------------------------------
> 
> 
> /*the .html form which takes a name and an e-mail
> address */
> 
> <html>
> <body>
> <form action="process_a.php" method="post">
> <p>
> Your name:<br>
> <input type="text" name="name"><br>
> Your e-mail address:<br>
> <input type="text" name="email"><br>
> <input type="submit" name="submit" value="submit">
> </body>
> </form>
> </html>
> ...............
> 
> 
> /*process_a.php: which receives the name and email
> variables.  The script
> then tries to then send the note back to the user
> with a link - called
> CLICK.  When the user hits the link to
> email_verify.php the email address is
> inserted into the database*/
> 
> <?
>  $msg = "Thank you for registering $name\n\n";
>  $msg .= "<a
>
href=\"http://www.gonefishingguideservice.com/email_verify.php?email=$email&;
> confirmation_ID=$confirmation_ID>CLICK</a>";
>  $secret_variable = "something_only_you_know";
>  $confirmation_ID = md5($email.$secret_variable);
>  $to="[EMAIL PROTECTED]";
>  $subject="Thank you for registering";
>  $mailheaders="From: Us";
>  mail($to,$subject,$msg,$mailheaders);
> ?>
> .............
> 
> // email_verify.php
> 
> <?
> if ($_GET['confirmation_ID'] =
> md5($_GET['email'].$secret_variable)) {
>     // insert the user into the database
> } else {
>   // display an error message
> }
> ?>
> 
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

--- End Message ---
--- Begin Message ---
Hi,
 
Normally to start a session one would use session_start();
 
Is there a different command to do this if you're instead using the
$http_session_vars type coding?
 
Thx
 
Tim Winters
Creative Development Manager
Sampling Technologies Incorporated
 
1600 Bedford Highway, Suite 212
Bedford, Nova Scotia
B4A 1E8
www.samplingtechnologies.com
[EMAIL PROTECTED]
[EMAIL PROTECTED]
Office: 902 450 5500
Cell: 902 430 8498
Fax:: 902 484 7115
 

--- End Message ---
--- Begin Message ---
From: "Tim Winters" <[EMAIL PROTECTED]>

> Normally to start a session one would use session_start();
>  
> Is there a different command to do this if you're instead using the
> $http_session_vars type coding?

No, and it's $HTTP_SESSION_VARS. PHP is case sensitive, remember?

---John Holmes...

--- End Message ---
--- Begin Message ---
On Thu, Aug 14, 2003 at 03:44:10PM -0400, CPT John W. Holmes wrote:
> From: "Tim Winters" <[EMAIL PROTECTED]>
> 
> No, and it's $HTTP_SESSION_VARS. PHP is case sensitive, remember?

And, do note, use $_SESSION instead.  It will continue to work in 
default configurations of PHP 5, plus it's already global so saves having 
to issue global statements in each function using them.

Enjoy,

--Dan

-- 
     FREE scripts that make web and database programming easier
           http://www.analysisandsolutions.com/software/
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7th Ave #4AJ, Brooklyn NY    v: 718-854-0335   f: 718-854-0409

--- End Message ---
--- Begin Message ---
Sorry, Lazy typing!

Thanks for the quick response!

Tim Winters
Creative Development Manager
Sampling Technologies Incorporated

1600 Bedford Highway, Suite 212
Bedford, Nova Scotia
B4A 1E8
www.samplingtechnologies.com
[EMAIL PROTECTED]
[EMAIL PROTECTED]
Office: 902 450 5500
Cell: 902 430 8498
Fax:: 902 484 7115


-----Original Message-----
From: CPT John W. Holmes [mailto:[EMAIL PROTECTED] 
Sent: August 14, 2003 4:44 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [PHP] Newbie Session Question

From: "Tim Winters" <[EMAIL PROTECTED]>

> Normally to start a session one would use session_start();
>  
> Is there a different command to do this if you're instead using the
> $http_session_vars type coding?

No, and it's $HTTP_SESSION_VARS. PHP is case sensitive, remember?

---John Holmes...


--- End Message ---
--- Begin Message ---
Anyone have a good place to help with this... Google was seeming a bit
light on good help. I tried to get it going but there seemed to be some
dependant libraries tha tI could not build myself, they were erroring
out..blah blah. Is there any easier way to do this?

Thanks,
Matt


--- End Message ---
--- Begin Message ---
Hi list,

I'm using TemplatePower (http://templatepower.codocad.com/) as my template
engine.  There will be multiple rows of results, and the data is stored in
the $tpl->assign(); parts.  The function gets projects for a given employee.
My function is at the bottom of this e-mail.

The problem is that I can't get the results to be printed to my $template,
or $home_tpl.  $home_tpl is named home.tpl, and that's where the html code
is that displays the results from worker_projects();

Can anyone help me out here?  If you need more info, just let me know.

Tyler Longren
[EMAIL PROTECTED]

CODE BELOW

function worker_projects() {
 $template = $home_tpl;
 $tpl = new TemplatePower("$template");
 $tpl->prepare();
 // Begin getting consulting projects.
 $consultingproject_sqltext = "SELECT
customer.custid,customer.ownorgname,customerorder.custid,consultingproject.p
rojectid,consultingproject.description,consultingproject.startdate,consultin
gproject.enddate,consultingprojectassign.workerid,consultingprojectassign.pr
ojectid
 FROM consultingproject,consultingprojectassign, customerorder, customer
 WHERE consultingprojectassign.workerid='$_COOKIE[workerid]'
 AND consultingproject.projectid=consultingprojectassign.projectid
 AND consultingproject.ordid = customerorder.ordid
 AND customer.custid = customerorder.custid
 ORDER BY enddate ASC";
 $consultingproject_sql = mysql_query("$consultingproject_sqltext");
 if (mysql_num_rows($consultingproject_sql) < "1") {
  $tpl->newBlock('no_consulting_projects');
  $tpl->assign("no_consulting_projects","You don't have any consulting
projects.");
 }
 else {
  $alternate = "1";
  $tpl->newBlock('consulting_projects');
  while ($row = mysql_fetch_array($consultingproject_sql)) {
   $tpl->newBlock('consulting_projects_data');
   $tpl->assign("consulting_projectid","$row[projectid]");
   $tpl->assign("consulting_company","$row[ownorgname]");
   $tpl->assign("consulting_startdate","$row[startdate]");
   $tpl->assign("consulting_enddate","$row[enddate]");
   if ($alternate == "1") {
    $color = "#ffffff";
    $tpl->assign("row_color","$color");
    $alternate = "2";
   }
   else {
    $color = "#cecece";
    $tpl->assign("row_color","$color");
    $alternate = "1";
   }
  }
 }
       mysql_close($connection);
       $tpl->printToScreen();
       return $tpl;
 // End getting consulting projects.
}



--- End Message ---
--- Begin Message ---
Hi ,

The  user  have to choose 2 date ($date_begin & $date_last) and i want
to  know  howcan  i  make  to find field in mysql where field included
between ($date_begin & $date_last)

"SELECT  *  FROM  `news`  WHERE  `date`  included  in  ($date_begin  &
$date_last)"

-- 
Best salutations,
     Admin                         mailto:[EMAIL PROTECTED]
http://clubafricain.partout.org

Post-Joint : <none>.


--- End Message ---
--- Begin Message ---
[snip]
The  user  have to choose 2 date ($date_begin & $date_last) and i want
to  know  howcan  i  make  to find field in mysql where field included
between ($date_begin & $date_last)

"SELECT  *  FROM  `news`  WHERE  `date`  included  in  ($date_begin  &
$date_last)"
[/snip]

This is better suited to the mysql list, but you could do ...
"SELECT  *  FROM  `news`  WHERE  `date` BETWEEN  $date_begin  AND
$date_last "

HTH!

--- End Message ---
--- Begin Message --- [EMAIL PROTECTED] wrote:
Hi ,

The  user  have to choose 2 date ($date_begin & $date_last) and i want
to  know  howcan  i  make  to find field in mysql where field included
between ($date_begin & $date_last)

"SELECT  *  FROM  `news`  WHERE  `date`  included  in  ($date_begin  &
$date_last)"


$q=mysql_query('select * from news where `date` >= "'.$date_begin.'" and `date` < "'.$date_last.'" + interval 1 day');


you should rename the field you have called `date` - it's ambiguous.

Kae


--- End Message ---
--- Begin Message ---
Hi,
I am thinking of making a program for  personal use which does a very simple
thing, just displays listings under categories,
eg:
under main category "Auto" there would be "cars","bikes" etc
under "banking" there would be "financing","loans" etc (I as admin create
master and sub-categories)

then if you click on "cars" you would either see a sub category or all the
listings there

I have never done a project like this so am a bit confused but I am pretty
sure quite a few of you must have done this because its a bit common on the
net and while I am kind of new to php, most of you guys are fossils :-D

So far the logic I have worked out is:
Create a "master_category" table for the main categories, a "child_table"
for the subs, a "the_listings" table for the details which will have a
reference (number or word) field which will be to keep a reference as to
which category/sub-category it belongs to..

Tell me if my logic is wrong or I missed anything

The part where I am confused is, on the front page (say index.php) how do I
display all the categories and sub categories in the correct order?

eg:

Auto
--Cars
--Bikes

Banking
--Finances
--Loans

Women
--Boring but REALLY good looking
--Great fun but not-so-good-looking


Any ideas? I searched hotscripts and google but found crappy programs like
phpyellow and zclassifieds which are really no good to me. If you know of
something that already does the above kindly share it with me.

Thanks,
-Ryan

                                                         -------------------
-----------------
The government announced today that it is changing it's emblem to a condom
because it more clearly reflects the government's political stance. A condom
stands up to inflation, halts production, destroys the next generation,
protects a bunch of pricks, and gives you a sense of security while you're
actually getting screwed.
                                                         -------------------
-----------------


--- End Message ---
--- Begin Message ---
Ryan A <mailto:[EMAIL PROTECTED]>
    on Thursday, August 14, 2003 3:21 PM said:

Read this http://www.sitepoint.com/article/1105 and you will know what
you should do.

The database organization you want to use is called Modified Preorder
Tree Traversal. It takes only one table to create all the relationships
needed.

If you have any questions about this technique send me an email as I've
got some experience with this method.


Chris.

p.s. The easiest way (I think) to learn this method is to actually use
your own data and draw it out on a piece of paper (as opposed to trying
to visualize the map in your head).

--- End Message ---
--- Begin Message ---
On Fri, 15 Aug 2003 00:20:58 +0200, you wrote:

>Hi,
>I am thinking of making a program for  personal use which does a very simple
>thing, just displays listings under categories,
>eg:
>under main category "Auto" there would be "cars","bikes" etc
>under "banking" there would be "financing","loans" etc (I as admin create
>master and sub-categories)

>So far the logic I have worked out is:
>Create a "master_category" table for the main categories, a "child_table"
>for the subs, a "the_listings" table for the details which will have a
>reference (number or word) field which will be to keep a reference as to
>which category/sub-category it belongs to..
>
>Tell me if my logic is wrong or I missed anything
>
>The part where I am confused is, on the front page (say index.php) how do I
>display all the categories and sub categories in the correct order?

You need a pig's ear on the database table. It's really simple once you've
seen it done.

Basically, each row in the database contains a reference to its parent's
primary key.

Call our table "category".

categoryid   parentid     title
         1          0      Auto
         2          1      Cars
         3          1     Bikes
         4          0   Banking
         5          4  Finances
         6          4     Loans

SELECT title FROM category WHERE parentid = 0

gives us the root elements in the tree (Auto, Banking) while

SELECT title FROM category WHERE parentid = 4

gives us the children of Banking (Finances, Loans).

The advantage of doing it this way is that your tree structure is generic
and can have many levels. The disadvantage is that you may need many SQL
queries to fully traverse the tree (though people rarely want to do this,
and sub-selects, clever joins or post-query processing can reduce the
overhead).

The fun thing about this structure is writing the delete function.


--- End Message ---
--- Begin Message ---
David Otton <mailto:[EMAIL PROTECTED]>
    on Thursday, August 14, 2003 4:58 PM said:

> The advantage of doing it this way is that your tree structure is
> generic and can have many levels. The disadvantage is that you may
> need many SQL queries to fully traverse the tree (though people
> rarely want to do this, and sub-selects, clever joins or post-query
> processing can reduce the overhead).

Which is why you should use the Modified Preorder Tree Traversal method
instead. With that method you've got one table that defines the
categories AND their relationships to each other.

Your SQL queries end up looking something like this.

SELECT name
FROM categories
WHERE lft >= x
        AND rgt <= y



Chris.

--- End Message ---
--- Begin Message ---
I have to generate a menu for all months in a year, with each month
broken down into two periods. For example:

January 01-15
January 15-31
February 01-15
February 15-28
March 01-15
March 15-31
Etc...

How can generate a list of all 12 months using the above format?



--- End Message ---
--- Begin Message --- Ralph Guzman wrote:
I have to generate a menu for all months in a year, with each month
broken down into two periods. For example:

January 01-15
January 15-31
February 01-15
February 15-28
March 01-15
March 15-31
Etc...

How can generate a list of all 12 months using the above format?

Well, seeing as that data is going to be the same NO MATTER WHAT YEAR IT IS, why don't you just hard code in? (I guess the FEB end date would change, but...)


$_CONF['month_array'] = array('January 01-15','January 15-31'...);

Also, if it is the 15th, which category does that fall into?

--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

PHP|Architect: A magazine for PHP Professionals – www.phparch.com





--- End Message ---
--- Begin Message ---
I am trying to list out some printers in our Novell tree.  The server
that I am hitting is a Netware 6 server, running eDirectory 8.  Here is
the code I am using (simplified):
--------begin code------------------
$printer_dn = "ou=$facility_selected, $basedn";
                
$printer_list = ldap_list($ldapconnect, $printer_dn, "cn=*");
ldap_sort ($ldapconnect, $printer_list,"cn");
$printer_list_results = ldap_get_entries($ldapconnect, $printer_list);
                        
if ($printer_list_results != 0)
{
        echo "\t<blockquote>\n";

        for ($p=0; $p<$printer_list_results["count"]; $p++)
        {
                $printer = $printer_list_results[$p]["cn"][0];
                echo "$printer <br>";
        }
        echo "\t</blockquote>\n";
}
--------end code------------------
Problem with this, is that if the containers has let's say 5 printers, and
just one of them has a DS problem, then the entire list is corrupted and 
will only return "LDAP Error: Invalid DN syntax" to the screen.  
The list will not return ANY of the printers.

Thanks for your time, 
DB


--- End Message ---
--- Begin Message ---
Hi all!
 
Is it possible to have PHP creates an image that graduates 1 color to
another, such as create and images 100 pixels wide and in height which
fades red to green top to bottom?
 
Any help or suggestions would be really helpful.
 
Thanks 
 
Adrian
[EMAIL PROTECTED]
 

--- End Message ---
--- Begin Message --- Create a text file called .htaccess, and place it in the root directory of the "second" apache server, as stated below.

Justin French


On Thursday, August 14, 2003, at 09:17 PM, murugesan wrote:


I am not able to locate the file you are referring to. Please do help
me I am very much frustrated.


-Murugesan
----- Original Message -----
From: "Justin French" <[EMAIL PROTECTED]>
To: "murugesan" <[EMAIL PROTECTED]>
Cc: "PHP List" <[EMAIL PROTECTED]>
Sent: Thursday, August 14, 2003 2:29 PM
Subject: Re: [PHP] php.ini configuration can we have two include_path in
php.in file



The include_path can be set via a .htaccess file on a per-directory
basis... so, at the root of your "second" apache server, you could have
a file called .htaccess with something like:


---
<IfModule mod_php4.c>
php_flag register_globals off
php_value include_path '/path/to/your/include/dir/'
</IfModule>
---

Have fun,

Justin




On Thursday, August 14, 2003, at 06:39 PM, murugesan wrote:
        I am running an apache.In the php.ini file I have defined the
include path.
Now I want to run another apache in different port. The thing is that
for
that apache I need another include path in the php.ini file.
Is there any way to achieve this to have two include_path in the
php.ini
file.




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

---
[This E-mail scanned for viruses]




--- End Message ---
--- Begin Message ---
Hi all,
I want to get the current domain name in to a PHP
variable.

This is the case..
I have a web site and four diferent domian names
pointing to that site. I want to redirect users from
the four domains to their specific home pages.

eg: if a visitor from http://domain1.com the header 
should be passed to domain1.php, if the visitor from 
http://domain2.com the header hould be pass to domain2.php.

thanks

Viraj


--- End Message ---
--- Begin Message ---
>I want to get the current domain name in to a PHP variable.

print_r() the contents of $_SERVER to see all the information given to you
by the webserver -- the host name will be in there.

---------------------------------------------------------------------
michal migurski- contact info and pgp key:
sf/ca            http://mike.teczno.com/contact.html


--- End Message ---
--- Begin Message ---
<pre>
<?print_r($_SERVER);?>
</pre>

Have a look at the output, find the variable you need, then manipulate it if needed.

Justin French

On Friday, August 15, 2003, at 01:32 PM, [EMAIL PROTECTED] wrote:

Hi all,
I want to get the current domain name in to a PHP
variable.

This is the case..
I have a web site and four diferent domian names
pointing to that site. I want to redirect users from
the four domains to their specific home pages.

eg: if a visitor from http://domain1.com the header
should be passed to domain1.php, if the visitor from
http://domain2.com the header hould be pass to domain2.php.

thanks

Viraj


-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

---
[This E-mail scanned for viruses]




--- End Message ---
--- Begin Message ---
I am using php 4 with apache in windows. I created a form in html with this code:

<FORM method="POST" action="do_feedback.php">
<p>your name: <INPUT type="text" NAME="sender_name" size=30></p>
<p>your email: <INPUT type="text" NAME="sender_email" size=30></p>
<p>Additional message:<br>
<textarea name="message" cols=30 rows=5></textarea>
</p>
<INPUT type="submit" value="Send">
</FORM>

In php, I wrote this and save as do_feedback.php:
<?php 
$msg = "Sender's Full Name:\t$sender_name\n";
$msg .="Sender's E-mail:\t$sender_email\n";
$msg .="Additional Message:\t$message\n\n";

$mailheaders = "From: My Web Site\n";
$mailheaders .="Reply-To: $sender_email\n\n";

mail("[EMAIL PROTECTED]", "Feedback Form", $msg, $mailheaders);

echo "<H1 align=center>Thank You, $sender_name</H1>";
echo "<P align=center>We appreciate your feedback</P>";
 ?>
I got an error message ssy Undefined variable:sender_name
bla bla bla and
Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your 
"SMTP" and "smtp_port" setting in php.ini or use ini_set() in c:\program files\apache 
group\apache\htdocs\do_feedback.php on line 12

 what's that means? Is anyone got a clue. please help

--- End Message ---
--- Begin Message ---
The from header has to be something like:
$mailheaders = "From: My Web Site <[EMAIL PROTECTED]>\n";

There has to be an email address in the from header.  It will show up like you 
want in your mail client.

-Jackson

On Thursday 14 August 2003 10:50, merryE wrote:
> I am using php 4 with apache in windows. I created a form in html with this
> code:
>
> <FORM method="POST" action="do_feedback.php">
> <p>your name: <INPUT type="text" NAME="sender_name" size=30></p>
> <p>your email: <INPUT type="text" NAME="sender_email" size=30></p>
> <p>Additional message:<br>
> <textarea name="message" cols=30 rows=5></textarea>
> </p>
> <INPUT type="submit" value="Send">
> </FORM>
>
> In php, I wrote this and save as do_feedback.php:
> <?php
> $msg = "Sender's Full Name:\t$sender_name\n";
> $msg .="Sender's E-mail:\t$sender_email\n";
> $msg .="Additional Message:\t$message\n\n";
>
> $mailheaders = "From: My Web Site\n";
> $mailheaders .="Reply-To: $sender_email\n\n";
>
> mail("[EMAIL PROTECTED]", "Feedback Form", $msg, $mailheaders);
>
> echo "<H1 align=center>Thank You, $sender_name</H1>";
> echo "<P align=center>We appreciate your feedback</P>";
>  ?>
> I got an error message ssy Undefined variable:sender_name
> bla bla bla and
> Warning: mail(): Failed to connect to mailserver at "localhost" port 25,
> verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in
> c:\program files\apache group\apache\htdocs\do_feedback.php on line 12
>
>  what's that means? Is anyone got a clue. please help

-- 
jackson miller
 
cold feet creative
615.321.3300 / 800.595.4401
[EMAIL PROTECTED]
 
 
cold feet presents Emma
the world's easiest email marketing
Learn more @  http://www.myemma.com

--- End Message ---
--- Begin Message ---
Help.How to configure SMTP in php.ini ? I am a beginner. no clue at all.


--- End Message ---
--- Begin Message ---
I am using LAN in my college and there is firewall. will it effect my mail function in 
php. 

I configure my server name as localhost at apache http.conf. and inphp.ini i configure 
my SMTP like this:

[mail function]

; For Win32 only.

SMTP= POP ; for Win32 only

; For Win32 only.

sendmail_from= [EMAIL PROTECTED] ; for Win32 only

but i got warning: mail(): Failed to connect to mailserver at "POP" port 25, verify 
your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in c:\program 
files\apache group\apache\htdocs\do_feedback.php on line 12





--- End Message ---
--- Begin Message ---
It looks like sendmail_from should be an smtp server, not an email address.

Try setting it to your outgoing mail server that you use with your email 
client (i.e. Outlook).  If you can send email from your email client then the 
firewall will have no bearing.

-Jackson


On Thursday 14 August 2003 11:24, merryE wrote:
> I am using LAN in my college and there is firewall. will it effect my mail
> function in php.
>
> I configure my server name as localhost at apache http.conf. and inphp.ini
> i configure my SMTP like this:
>
> [mail function]
>
> ; For Win32 only.
>
> SMTP= POP ; for Win32 only
>
> ; For Win32 only.
>
> sendmail_from= [EMAIL PROTECTED] ; for Win32 only
>
> but i got warning: mail(): Failed to connect to mailserver at "POP" port
> 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set()
> in c:\program files\apache group\apache\htdocs\do_feedback.php on line 12

-- 
jackson miller
 
cold feet creative
615.321.3300 / 800.595.4401
[EMAIL PROTECTED]
 
 
cold feet presents Emma
the world's easiest email marketing
Learn more @  http://www.myemma.com

--- End Message ---
--- Begin Message ---
My OS is Winxp . My web server is apache 2 which is installed as a NT
service .

My php version is 4.32 , and I extracted it into  "c:\php" .

I run php as a apache module .

I want to load Additional extensions .They are php_mbstring.dll,
php_xslt.dll and php_domxml.dll .

I have made changes to php.ini as follow.
extension_dir = "c:\php\extensions"
extension=php_mbstring.dll
extension=php_xslt.dll
extension=php_domxml.dll

then I restarted apache2 .

but it told me that the modules could not be located .

what was wrong ? thanks for any useful words .



--- End Message ---
--- Begin Message --- Dennis Lee wrote:

what was wrong ? thanks for any useful words .

Are those extensions in c:\php\extensions?

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.



--- End Message ---
--- Begin Message ---
I am sure they are in c:\php\extensions .

any other idea  ?

"Leif K-Brooks" <[EMAIL PROTECTED]> ????
news:[EMAIL PROTECTED]
> Dennis Lee wrote:
>
> >what was wrong ? thanks for any useful words .
> >
> Are those extensions in c:\php\extensions?
>
> -- 
> The above message is encrypted with double rot13 encoding.  Any
unauthorized attempt to decrypt it will be prosecuted to the full extent of
the law.
>
>



--- End Message ---
--- Begin Message ---
I am really confused .

When I just run php as CGI without changing anything else, It works quite
well .

Why it is wrong when I run php as module under apache 2.0.46 ?

Is it a bug  or anything else ?

Any help will be appreciated .


"Dennis Lee" <[EMAIL PROTECTED]> дÈëÓʼþ
news:[EMAIL PROTECTED]
> My OS is Winxp . My web server is apache 2 which is installed as a NT
> service .
>
> My php version is 4.32 , and I extracted it into  "c:\php" .
>
> I run php as a apache module .
>
> I want to load Additional extensions .They are php_mbstring.dll,
> php_xslt.dll and php_domxml.dll .
>
> I have made changes to php.ini as follow.
> extension_dir = "c:\php\extensions"
> extension=php_mbstring.dll
> extension=php_xslt.dll
> extension=php_domxml.dll
>
> then I restarted apache2 .
>
> but it told me that the modules could not be located .
>
> what was wrong ? thanks for any useful words .
>
>



--- End Message ---
--- Begin Message ---
Ok, this is a basic MySQL question, but I don't know how to code it in PHP. I want to 
check in StudentId. If it exists, ...
Anyone good humoured who would help me fill in the blank. Like I should know this, but 
haven't even thought of coding SQL in a while :)

$myconnection = mysql_connect($server,$user,$pass);
mysql_select_db($db,$myconnection);

$news = mysql_query("select StudentId $table");

while ($mydata = mysql_fetch_object($news))
{
}

if exists
        {do this}else{do that}



--- End Message ---

Reply via email to