473,326 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

session in Dreamweaver and PHP

5
neeeed help.

i want help how to use session in the dreamweaver. I have 2 form. first is the login form and the second is welcome user page. I want the login user page appear at the welcome user page.

my database sturucture as:

login(table) user(table)
------- ...............
Uname Account_no
Upass name ---------------> display in the welcome user page
Account_no
Apr 7 '07 #1
4 3374
Motoma
3,237 Expert 2GB
That's fine, however, you have not asked a question. This fact makes it quite difficult for us to answer it.
Apr 7 '07 #2
ronverdonk
4,258 Expert 4TB
Is this a PHP problem or a pure Dreamweaver problem?

Ronald :cool:
Apr 7 '07 #3
cool84
5
Help.... i use dreamweaver and create 3 page.
1. JConnection.php
2. Login.php ( use table login1{uname,upass,matric} )
3. profile.php ( use table profile1{name,course,faculty,matric}

i want to use the session , i mean when the user successfully login the system, the user will view their profile page.

but it is not work. anyone know how 2 some the problwm is !
[php]

Jconnection.php

<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_Jconnection = "localhost";
$database_Jconnection = "sample";
$username_Jconnection = "root";
$password_Jconnection = "";
$Jconnection = mysql_pconnect($hostname_Jconnection, $username_Jconnection, $password_Jconnection) or trigger_error(mysql_error(),E_USER_ERROR);

//mysql_select_db($database_Jconnection)
?>

Login.php

<?php
require_once('Connections/Jconnection.php');

if(isset($_POST['username']))
{
$name = $_POST['username'];
$pass = $_POST['password'];
$query_Recordset1 = "select * from login1 where uname = '$name' and upass='$pass'";
$Recordset1 = mysql_query($query_Recordset1) ;//or die (mysql_error));
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);

if($totalRows_Recordset1==1)
{
$_SESSION['matric'] = $row_Recordset1['matric'];
echo $_SESSION['matric'];

echo '<script>window.location.href=\'profile.php\'</script>';
}
}

?>

<!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>Login</title>

</head>

<body>
<form id="form1" name="form1" method="POST" action="login.php">

<table width="405" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FF9933">
<tr>
<th width="405" bgcolor="#3366FF" scope="col"><span class="style1"></span></th>
</tr>
<tr>
<td><p>&nbsp;</p>
<table width="286" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<th width="286" scope="col">username
<label>
<input name="username" type="text" id="username" />
<br />
<br />
Password
<input name="password" type="text" id="password" />
<br />
<br />
<input type="submit" name="Submit" value="Submit" />
<input type="submit" name="Submit2" value="Cancel" />
</label></th>
</tr>
</table>
</tr>
<tr>

</tr>
</table>

</form>
</body>
</html>


profile.php

<?php require_once('Connections/Jconnection.php'); ?>
<?php
$colname_Recordset1 = "-1";
if (isset($_SESSION['matric'])) {
$colname_Recordset1 = (get_magic_quotes_gpc()) ? $_SESSION['matric'] : addslashes($_SESSION['matric']);
}
mysql_select_db($database_Jconnection, $Jconnection);
$query_Recordset1 = sprintf("SELECT * FROM profile1 WHERE matric = '%s'", $colname_Recordset1);
$Recordset1 = mysql_query($query_Recordset1, $Jconnection) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);

//session_start();

<!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>Untitled Document</title>
</head>

<body>
<table width="436" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<th width="436" bgcolor="#3399FF" scope="col">&nbsp;</th>
</tr>
<tr>
<td bgcolor="#FF9933"><form id="form1" name="form1" method="post" action="">
<p></p>
<table width="374" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<th width="328" height="19" scope="col">Name
<label>
<input name="textfield" type="text" value="<?php echo $row_Recordset1['name']; ?>" />
<br />
<br />
Course
<input name="textfield2" type="text" value="<?php echo $row_Recordset1['course']; ?>" />
<br />
<br />
Faculty
<input name="textfield3" type="text" value="<?php echo $row_Recordset1['faculty']; ?>" />
<br />
<br />
<input type="submit" name="Submit" value=" OK " />
<br />
<br />
<br />
</label></th>
</tr>
</table>
</form>
</td>
</tr>
<tr>
<td bgcolor="#3399FF">&nbsp;</td>
</tr>
</table>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>[/php]

Read the Posting Guidelines before you post any further in this forum!
Especially the part about enclosing code within code or php tags!!


You code is absolutely unreadable and can only be read using an IDE (which I will not)

moderator
Apr 8 '07 #4
Motoma
3,237 Expert 2GB
You need to call session_start() before you begin to use your session variable.
Apr 8 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: toedipper | last post by:
Hello, windows xp, apache, php and my sql and dreamweaver mx I have the code below. And it does'nt work! Basically the code below is the workings behind the scene that inserts a record to a...
5
by: middletree | last post by:
I've been doing ASP by hand-coding in either Homesite or Interdev for years. I have been using Dreamwever for static sites that I make on the side. I recently was asked to make a form which will...
6
by: Al Jones | last post by:
This is a repost form the vbscript newgroup - if this isn't the appropriate group would you point me toward one that is. Basically, I seem to be losing session data part way though preparing an...
0
by: Zorba.GR | last post by:
Macromedia Dreamweaver MX 2004 v7.0.1 Incl Keymaker, and Addons, other Workhouseboys Design The Transmitter Buttons v1.0 for Dreamweaver MX WebAssist WA eCommerce Suite v2.01 RETAIL for...
2
by: Wendy Elizabeth | last post by:
I am having problems using Dreamweaver mx 2000. My company purchased two licenses of the Universal Macromedia subscription. The other web programmer is not working at this company any more and I...
1
by: davemcdonald | last post by:
ASP Javascript (Dreamweaver) insert and retreive Primary Key -------------------------------------------------------------------------------- Been pulling my hair out all week. I am working on...
1
by: --[zainy]-- | last post by:
Hello Guyz.. I want to assign a varascript value to a session object in javascript function... like i have an image and onClick i am calling a function sort_(str).. Now i want to assign this...
2
by: =?Utf-8?B?R1ROMTcwNzc3?= | last post by:
Hi Guys, I'm using dreamweavers login behaviour to log people in, I've managed to manipulate it a little as I have many sites using the same database, but I'd like to manipulate it a little...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.