rofl Posted July 19, 2007 Share Posted July 19, 2007 Hi, everyone. I have two questions; 1. I want to know whether i can use Dreamweaver to write my PHP scripts. And if yes! Am I going to create a separate file for the PHP script or I will add it to my HTML script. For example: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Authenticaton system</title> </head> <body> <?php $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = '123dare'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); $dbname = 'mydatabase'; mysql_select_db($dbname); ?> <?php $db = mysql_connect ('localhost', 'username', 'password') or die ("Unable to connect to Database Server"); ?> <?php mysql_select_db ('mydatabase', $db) or die ("Could not select database"); ?> <?php /* get the incoming ID and password hash */ $user = $_POST["userid"]; $pass = sha1($_POST["password"]); /* establish a connection with the database */ $server = mysql_connect("localhost", "mysql_user", "mysql_password"); if (!$server) die(mysql_error()); mysql_select_db("myDatabase"); /* SQL statement to query the database */ $query = "SELECT * FROM authentication WHERE user = '$user' AND Pass = '$pass'"; /* query the database */ $result = mysql_query($query); /* Allow access if a matching record was found, else deny access. */ if (mysql_fetch_row($result)) echo "Access Granted: Welcome, $user!"; else echo "Access Denied: Invalid Credentials."; mysql_close($server); if (mysql_fetch_row($result)) { /* access granted */ session_start(); header("Cache-control: private"); $_SESSION["access"] = "granted"; header("Location: ./secure.php"); } else /* access denied – redirect back to login */ header("Location: ./login.html"); ?> <?php session_start(); header("Cache-control: private"); if ($_SESSION["access"] == "granted") header("Location: ./secure.php"); else header("Location: ./login.html"); ?> <form action="validate.php" method="post"> <label for="userid">ID</label> <input type="text" name="userid" id="userid" /> <br /> <label for="password">Password</label> <input type="password" name="password" id="password" /> <br /> <input type="submit" name="submit" value="Submit" /> </form> </body> </html> 2. I want to know whether a PHP page should have an Hyperlink, so that for example, in a form, if the submit button is clicked, it can go to the PHP page. Please i really need help. I will be greatfull if someone can help me out Link to comment https://forums.phpfreaks.com/topic/60725-can-i-use-dreamweaver-to-write-my-php-scripts/ Share on other sites More sharing options...
suma237 Posted July 19, 2007 Share Posted July 19, 2007 1.you can use dreamweaver,save it as *.php 2.You can redirect the page by clicking the submit button Link to comment https://forums.phpfreaks.com/topic/60725-can-i-use-dreamweaver-to-write-my-php-scripts/#findComment-302090 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.