Welcome to dbFreaks.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

How To...

 
   Database Help (Home) -> PHP RSS
Next:  advise for setting up new sql db for SAP ERP  
Author Message
george

External


Since: Jul 10, 2008
Posts: 92



(Msg. 1) Posted: Tue Sep 30, 2008 7:25 pm
Post subject: How To...
Archived from groups: alt>comp>lang>php, others (more info?)

Hi All
I am writing some 'contact me' code for my web page and need some help with
the following code snipet below:

$validated ="Yes"; //declared early in the code, and I got some other error
//checking

if (strlen($message) > 128){
$validated = "No";
}

//some other stuff I won't bore you with

if ($validated == "Yes"){
mail($to, $subject, $body);
echo "Thanks for you message!";
}
else {
// I need something like:
header("Location: http://$site_url");
// BUT I don't want to type the full url, I want to go back
to the //previous page and I want it to work
when I use it on
// my other web site in a different directory so,
//www.myexampleblahblah.com/form.php
// is not ideal - How can I do it?
}
Many thanks, G

 >> Stay informed about: How To... 
Back to top
Login to vote
Anze

External


Since: Jan 05, 2008
Posts: 11



(Msg. 2) Posted: Thu Oct 09, 2008 10:25 pm
Post subject: Re: How To... [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

> // I need something like:
> header("Location: http://$site_url");
> // BUT I don't want to type the full url, I want to go
> back
> to the //previous page and I want it to work
> when I use it on
> // my other web site in a different directory so,
> //www.myexampleblahblah.com/form.php
> // is not ideal - How can I do it?

I always declare some config data first - the full url, the dir where
scripts reside, DB connection details,... If you do that then you can use
it everywhere.

Of course, you have to set it up when you upload to a new server.

Hope it helps.

Anze

 >> Stay informed about: How To... 
Back to top
Login to vote
Maxim

External


Since: Oct 10, 2008
Posts: 1



(Msg. 3) Posted: Fri Oct 10, 2008 6:31 am
Post subject: Re: How To... [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Oct 1, 2:14 am, "george" <geo... RemoveThis @nospam.nospam> wrote:
> Hi All
> I am writing some 'contact me' code for my web page and need some help with
> the following code snipet below:
>
> $validated ="Yes";  //declared early in the code, and I got some other error
> //checking
>
>         if (strlen($message) > 128){
>                 $validated = "No";
>         }
>
>         //some other stuff I won't bore you with
>
>         if ($validated == "Yes"){
>                 mail($to, $subject, $body);
>                 echo "Thanks for you message!";
>         }
>         else {
>                 // I need something like:
>                 header("Location: http://$site_url");
>                 // BUT I don't want to type the full url, I want to go back
> to the                             //previous page and I want it to work
> when I use it on
>                 // my other web site in a different directory so,
> //www.myexampleblahblah.com/form.php
>                 // is not ideal - How can I do it?
>       }
> Many thanks, G

$_SERVER['SERVER_NAME'] , give yous the url that the user types to
access your website.

Look at this page for more info:
http://ua.php.net/manual/en/reserved.variables.server.php
 >> Stay informed about: How To... 
Back to top
Login to vote
Anze

External


Since: Jan 05, 2008
Posts: 11



(Msg. 4) Posted: Sun Oct 19, 2008 9:25 am
Post subject: Re: How To... [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

> $_SERVER['SERVER_NAME'] , give yous the url that the user types to
> access your website.

Yes, _BUT_: you can't trust this variable as can't trust anything that user
supplies without cleaning and validating.

It is easier to redirect the user to an address that your program knows from
its settings.

Best,

Anze
 >> Stay informed about: How To... 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
help needed for mailing HTMl content - hai...can someone plzz help me in writing a class to send Mails with HTML content. Try to suggest some working Class library if there is any on the web so that i may not re-invent the wheel. thanx...

Output XML file! - I have a XML variable (string). I want to output it to a XML file. I'm using <?php header("Content-type: application/gps"); header("Content-Disposition: attachment; filename=paring.xml"); print $xml; ?> But I get an error ...

I need a fat server..... - I am looking for an inexpensive or free hosting server where I can store extra user uploaded files (beyond my current host). Don't care about the bells and whistles, just need tons of bulk space that can be hyperlinked and FTP'd to mostly. Any pointers...

PHP Scripts and Creating Files - Hello Everyone: I have a PHP script that attempts to create a temporary file to be used during processing. The script is owned by my username (bryanrme) on the server. When the script attempts to create the temporary file, I get a "failed to open...

saving a session - Hi Folks I have been trying to find out how I can save a session - so far without success. I use PHP in combination with MySql and I would like my users to be able to save their sessions in my database so that they can retrieve it later... Meanwhile,....
   Database Help (Home) -> PHP All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]