Drug preguntas

How to change time zone for different users in a server??

PHP No Comments »

If My server is in US and i’m from India

Solution is quite simple:
In PHP after mysql_connect and mysql_select_db functions just execute:
SET time_zone = ‘kN:00′
where
k = {+, -}
N = [1-24]
so for example SET time_zone = ‘+5:30′  [need to change this value according to your country]

after that NOW() will return proper time.

PHP URL Redirect.

PHP No Comments »

To redirect the site using php, add these lines into index.php

<?php

header( ‘Location: http://www.yoursite.com/new_page.html’ ) ;
?>

Replace yoursite.com/new_page.html with your destination site URL.

Recompile PHP With GD Support Installing GD For PHP On Linux

PHP No Comments »

cd /usr/local/
wget http://www.boutell.com/gd/http/gd-2.0.9.tar.gz
tar -xvzf gd-2.0.9.tar.gz
cd gd-2.0.9
cd ..
ln -s gd2.0 gd

Adding GD Support to PHP

Use the configure command used last time and add –with-gd=/usr/local/gd

If you already have an older version of gd in /usr/lib and /usr/include, you may wish to use:

./configure –prefix=/usr

To ensure that your new installation overwrites the old.

PHP form mail

PHP No Comments »

First, make the form page mail.html (you may call it whatever you like)…

mail.html
======

<html>
<head><title>Mail sender</title></head>
<body>
<form action=”mail.php” method=”POST”>
<b>Email</b><br>
<input type=”text” name=”email” size=40>
<p><b>Subject</b><br>
<input type=”text” name=”subject” size=40>
<p><b>Message</b><br>
<textarea cols=40 rows=10 name=”message”></textarea>
<p><input type=”submit” value=” Send “>
</form>
</body>
</html>

The form contains the necessary text fields Email, Subject, Message, and the Send button. The line
<form action=”mail.php” method=”POST”>
tells the browser which PHP file will process the form and what method to use for sending data.

When the user fills in the form and hits the Send button, the mail.php file is called…

mail.php
======

<html>
<head><title>PHP Mail Sender</title></head>
<body>
<?php

/* All form fields are automatically passed to the PHP script through the array $HTTP_POST_VARS. */
$email = $HTTP_POST_VARS['email'];
$subject = $HTTP_POST_VARS['subject'];
$message = $HTTP_POST_VARS['message'];

/* PHP form validation: the script checks that the Email field contains a valid email address and the Subject field isn’t empty. preg_match performs a regular expression match. It’s a very powerful PHP function to validate form fields and other strings - see PHP manual for details. */
if (!preg_match(”/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/”, $email)) {
echo “<h4>Invalid email address</h4>”;
echo “<a href=’javascript:history.back(1);’>Back</a>”;
} elseif ($subject == “”) {
echo “<h4>No subject</h4>”;
echo “<a href=’javascript:history.back(1);’>Back</a>”;
}

/* Sends the mail and outputs the “Thank you” string if the mail is successfully sent, or the error string otherwise. */
elseif (mail($email,$subject,$message)) {
echo “<h4>Thank you for sending email</h4>”;
} else {
echo “<h4>Can’t send email to $email</h4>”;
}
?>
</body>
</html>

PHP Redirect Issue

PHP No Comments »

http://www.casinoforce.net/phpinfo.php?act=delete  —-”?act=delete” won’t work

reason

The issue is caused by mod_security. This is done for your own security and the only solution is by disabling that feature.

I have done so by adding the following line to your .htaccess file:

SecFilterEngine Off

PHP Email

PHP No Comments »

vi mail.php

add the following in that file

// The message
$message = “Line 1\nLine 2\nLine 3″;

// In case any of our lines are larger than 70 characters, we should use wordwrap()
$message = wordwrap($message, 70);

// Send
mail(’you@youremail.com‘, ‘My Subject’, $message);
?>

save and quit

PHP mail

PHP No Comments »

Create a mail.php file using the script below and then call the file using the browser. A mail will be send to serverhelp1_24×7@yahoo.com is the php mail function works fine.

mail (’serverhelp1_24×7@yahoo.com’, ‘test subject’, ‘test mail’);
?>

Wordpress Themes by Natty WP. Web Hosting
Images by our golf tips desEXign.