-
Posts
907 -
Joined
-
Last visited
Everything posted by searls03
-
Ok I will double check in a bit, I am pretty sure it is, but i could be wrong.............
-
I am pretty sure it does
-
Ya I want it to stretch to equal same length as the second column or the content.....
-
ok so i have this code for a new button as link.......it goes to proper page but doesnt insert id or get id.........help please.echo " <form action='registration.php' method='get'><input type='hidden' name='eventid' value='{$row['eventid']}'><INPUT TYPE='submit' name='submit' VALUE='Register'></form>\n";
-
in dreamweaver, how do I build a template that would automatically extend a side bar to match content length? is this possible?
-
do you need any code or anything?
-
But I need to make it not just so it lOgged in....only if admin logged in.....
-
I was asked to make new thread for this, so how do I use a session or something to restrict access to a page.....like if accounttype=Admin, stay here, all others go away......do you need to see code, or can you just give me an example.......
-
ok, that fine........
-
It grabs it from $userid....... Could you just help me make the code piece please and I can worry about where all it comes from and I will ask if I need help? Sorry if this sounds mean, but that's really all I need right now.....
-
on this same profile page, it is only for admins to edit other users..........can you tell me how I would use a session or something to block a scout user from acessing this page?
-
it has to be that exact address, cant change it.....the get value is what I was hoping I could get help with.......
-
yep thanks!!!!!!
-
nope, just refreshing the page...............
-
Where exactly will I put these in my PHP code?
-
<?php } //action: edit user ----------------------------------------------------------------------------- if (isset($_GET['edit']) && isset($_GET['id'])) { $userid = (int) $_GET['id']; if ($userid == 0) { die("Invalid ID provided."); } //execution when completed the edit user form and pressed submit button --------------------- if (isset($_POST['editUser'])) { //validate data ------------------------------------------------------------------------ //check empty fields //passwords won't be checked, as they are not required foreach ($_POST as $k=>$v) { if ($v == "" && !in_array($k,$notRequired)) { $error[$k] = "<strong>This field is empty</strong>"; } } //escape string $name = mysql_real_escape_string($_POST['name']); $phone = mysql_real_escape_string($_POST['phone']); $address = mysql_real_escape_string($_POST['address']); $city = mysql_real_escape_string($_POST['city']); $state = mysql_real_escape_string($_POST['state']); $zip = mysql_real_escape_string($_POST['zip']); $cell = mysql_real_escape_string($_POST['cell']); $email = mysql_real_escape_string($_POST['email']); $username = mysql_real_escape_string($_POST['username']); $badges = mysql_real_escape_string($_POST['badges']); $rank = mysql_real_escape_string($_POST['rank']); $accounttype = mysql_real_escape_string($_POST['accounttype']); //check email validation, the function is available at config.php if (!check_email($_POST['email'])) { $error['email'] .= " <strong>Email is not valid!</strong>"; } //check email exists in database $res = mysql_query("SELECT email FROM members WHERE email='".$email."' AND userid != '".$userid."'"); if (mysql_num_rows($res) == 1) { $error['email'] .= " <strong>Email already existst in database!</strong>"; } //check username exists in database $res = mysql_query("SELECT username FROM members WHERE username='".$username."' AND username != '".$username."'"); if (mysql_num_rows($res) == 1) { $error['username'] .= " <strong>Username already existst in database!</strong>"; } //check both passwords are the same when password fields are not empty //end validate data --------------------------------------------------------------------- //save to database when no errors are detected ------------------------------------------ if (count($error) == 0) { $query = "UPDATE members SET username='".$username."', email='".$email."',name='".$name."', phone='".$phone."',address='".$address."', city='".$city."',state='".$state."', zip='".$zip."',cell='".$cell."', accounttype='".$accounttype."',badges='".$badges."', rank='".$rank."' WHERE userid='".$userid."' "; //update username session if you edit yourself if ($userid == $_SESSION['auth_admin_userid']) { $_SESSION['auth_admin_username'] = $username; } if (mysql_query($query)) { echo "<p><strong>User has been edited and saved to the database.</strong></p>"; } else { echo "<strong>User has NOT been edited and saved into the database. ".mysql_error()."</strong>"; } } } //get user from the database and put data into $_POST variables. $rs = mysql_query("SELECT name, username, phone, address, city, state, zip, cell, email, badges, rank, accounttype FROM members WHERE userid = ".$userid.""); if (mysql_num_rows($rs) == 0) { die("User does not exists!"); } $row = mysql_fetch_assoc($rs); $_POST['name'] = $row['name']; $_POST['username'] = $row['username']; $_POST['phone'] = $row['phone']; $_POST['address'] = $row['address']; $_POST['city'] = $row['city']; $_POST['state'] = $row['state']; $_POST['zip'] = $row['zip']; $_POST['cell'] = $row['cell']; $_POST['email'] = $row['email']; $_POST['badges'] = $row['badges']; $_POST['rank'] = $row['rank']; $_POST['accounttype'] = $row['accounttype']; //if is admin, then $_POST['admin'] exists ?> I did add WHERE userid=$userid, I also tried without, neither worked table structure....... `eventid` int(11) NOT NULL auto_increment, `event` varchar(255) collate latin1_general_ci NOT NULL, `startdate` date NOT NULL, `enddate` varchar(255) collate latin1_general_ci NOT NULL, `description` longtext collate latin1_general_ci NOT NULL, `location` varchar(255) collate latin1_general_ci NOT NULL, `subevent1` longtext collate latin1_general_ci NOT NULL, `subevent2` longtext collate latin1_general_ci, `subevent3` longtext collate latin1_general_ci, `subevent4` longtext collate latin1_general_ci, `subevent5` longtext collate latin1_general_ci, `subevent6` longtext collate latin1_general_ci, `subevent7` longtext collate latin1_general_ci, `subevent8` longtext collate latin1_general_ci, `price1` varchar(255) collate latin1_general_ci NOT NULL, `price2` varchar(255) collate latin1_general_ci default NULL, `price3` varchar(255) collate latin1_general_ci default NULL, `price4` varchar(255) collate latin1_general_ci default NULL, `price5` varchar(255) collate latin1_general_ci default NULL, `price6` varchar(255) collate latin1_general_ci default NULL, `price7` varchar(255) collate latin1_general_ci default NULL, `price8` varchar(255) collate latin1_general_ci default NULL, `title1` varchar(255) collate latin1_general_ci NOT NULL, `title2` varchar(255) collate latin1_general_ci NOT NULL, `title3` varchar(255) collate latin1_general_ci NOT NULL, `title4` varchar(255) collate latin1_general_ci NOT NULL, `title5` varchar(255) collate latin1_general_ci NOT NULL, `title6` varchar(255) collate latin1_general_ci NOT NULL, `title7` varchar(255) collate latin1_general_ci NOT NULL, `title8` varchar(255) collate latin1_general_ci NOT NULL, `date1` varchar(255) collate latin1_general_ci NOT NULL, `date2` varchar(255) collate latin1_general_ci NOT NULL, `date3` varchar(255) collate latin1_general_ci NOT NULL, `date4` varchar(255) collate latin1_general_ci NOT NULL, `date5` varchar(255) collate latin1_general_ci NOT NULL, `date6` varchar(255) collate latin1_general_ci NOT NULL, `date7` varchar(255) collate latin1_general_ci NOT NULL, `date8` varchar(255) collate latin1_general_ci NOT NULL, PRIMARY KEY (`eventid`), FULLTEXT KEY `event_3` (`event`), FULLTEXT KEY `description` (`description`), FULLTEXT KEY `location` (`location`), FULLTEXT KEY `subevent1` (`subevent1`,`subevent2`,`subevent3`,`subevent4`,`subevent5`,`subevent6`,`subevent7`,`subevent8`), FULLTEXT KEY `price1` (`price1`,`price2`,`price3`,`price4`,`price5`,`price6`,`price7`,`price8`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=5 ;
-
It will always be mm/dd/yyyy for it will be a calendar that pops up to make sure it is that format............
-
so......what I need now is to take a table that will display month titles in it.......but I only want three months at a time....................so lets say it is march, it would display march in one row, april in one row, and may in one row......if april, april, may, june......so basically next three months......then I have some events with date format on them.....I want all the march events to display under march, all for april under april, and etc.....can someone help me with this?
-
I fixed it, same result........
-
How can I convert a database time to mm/dd/yyyy from yyyy-mm-dd when pulling from database to display, and vice versa when from form to database?
-
Ok, I need this button here to be a link to /admin.php?edit&id=$userid. I cant get anything after the edit to work. please help: echo "<form action='admin.php?edit&id=' method='get'><INPUT TYPE='submit' name='submit' VALUE='Edit'></form>\n"; echo "</td><td>"; I am pretty sure that this is not complete, but I cant seem to figure it out for some reason...
-
I tried and its still not working.....same issue, no errors, php code just doesn't have what you wanted me to take out: <?php } //action: edit user ----------------------------------------------------------------------------- if (isset($_GET['edit']) && isset($_GET['id'])) { $userid = (int) $_GET['id']; if ($userid == 0) { die("Invalid ID provided."); } //execution when completed the edit user form and pressed submit button --------------------- if (isset($_POST['editUser'])) { //validate data ------------------------------------------------------------------------ //check empty fields //passwords won't be checked, as they are not required foreach ($_POST as $k=>$v) { if ($v == "" && !in_array($k,$notRequired)) { $error[$k] = "<strong>This field is empty</strong>"; } } //escape string $name = mysql_real_escape_string($_POST['name']); $phone = mysql_real_escape_string($_POST['phone']); $address = mysql_real_escape_string($_POST['address']); $city = mysql_real_escape_string($_POST['city']); $state = mysql_real_escape_string($_POST['state']); $zip = mysql_real_escape_string($_POST['zip']); $cell = mysql_real_escape_string($_POST['cell']); $email = mysql_real_escape_string($_POST['email']); $username = mysql_real_escape_string($_POST['username']); $badges = mysql_real_escape_string($_POST['badges']); $rank = mysql_real_escape_string($_POST['rank']); $accounttype = mysql_real_escape_string($_POST['accounttype']); //check email validation, the function is available at config.php if (!check_email($_POST['email'])) { $error['email'] .= " <strong>Email is not valid!</strong>"; } //check email exists in database $res = mysql_query("SELECT email FROM members WHERE email='".$email."' AND userid != '".$userid."'"); if (mysql_num_rows($res) == 1) { $error['email'] .= " <strong>Email already existst in database!</strong>"; } //check username exists in database $res = mysql_query("SELECT username FROM members WHERE username='".$username."' AND username != '".$username."'"); if (mysql_num_rows($res) == 1) { $error['username'] .= " <strong>Username already existst in database!</strong>"; } //check both passwords are the same when password fields are not empty //end validate data --------------------------------------------------------------------- //save to database when no errors are detected ------------------------------------------ if (count($error) == 0) { $query .= "username='".$username."', email='".$email."',name='".$name."', phone='".$phone."',address='".$address."', city='".$city."',state='".$state."', zip='".$zip."',cell='".$cell."', accounttype='".$accounttype."',badges='".$badges."', rank='".$rank."' WHERE userid='".$userid."'"; //update username session if you edit yourself if ($userid == $_SESSION['auth_admin_userid']) { $_SESSION['auth_admin_username'] = $username; } if (mysql_query($query)) { echo "<p><strong>User has been edited and saved to the database.</strong></p>"; } else { echo "<strong>User has NOT been edited and saved into the database. ".mysql_error()."</strong>"; } } } //get user from the database and put data into $_POST variables. $rs = mysql_query("SELECT name, username, phone, address, city, state, zip, cell, email, badges, rank, accounttype FROM members WHERE userid = ".$userid.""); if (mysql_num_rows($rs) == 0) { die("User does not exists!"); } $row = mysql_fetch_assoc($rs); $_POST['name'] = $row['name']; $_POST['username'] = $row['username']; $_POST['phone'] = $row['phone']; $_POST['address'] = $row['address']; $_POST['city'] = $row['city']; $_POST['state'] = $row['state']; $_POST['zip'] = $row['zip']; $_POST['cell'] = $row['cell']; $_POST['email'] = $row['email']; $_POST['badges'] = $row['badges']; $_POST['rank'] = $row['rank']; $_POST['accounttype'] = $row['accounttype']; //if is admin, then $_POST['admin'] exists ?> Again, this is a template i used.....
-
I will try this.....but I was following what the code had yher previously and changed to my own fields.
-
ok, so I have found this code to edit profiles online, only problem is that the data is not being posted to the database, there are no errors, just basically refreshes the page. could you take a look and see if you can help me? <?php } //action: edit user ----------------------------------------------------------------------------- if (isset($_GET['edit']) && isset($_GET['id'])) { $userid = (int) $_GET['id']; if ($userid == 0) { die("Invalid ID provided."); } //execution when completed the edit user form and pressed submit button --------------------- if (isset($_POST['editUser'])) { //validate data ------------------------------------------------------------------------ //check empty fields //passwords won't be checked, as they are not required foreach ($_POST as $k=>$v) { if ($v == "" && !in_array($k,$notRequired)) { $error[$k] = "<strong>This field is empty</strong>"; } } //escape string $name = mysql_real_escape_string($_POST['name']); $phone = mysql_real_escape_string($_POST['phone']); $address = mysql_real_escape_string($_POST['address']); $city = mysql_real_escape_string($_POST['city']); $state = mysql_real_escape_string($_POST['state']); $zip = mysql_real_escape_string($_POST['zip']); $cell = mysql_real_escape_string($_POST['cell']); $email = mysql_real_escape_string($_POST['email']); $username = mysql_real_escape_string($_POST['username']); $badges = mysql_real_escape_string($_POST['badges']); $rank = mysql_real_escape_string($_POST['rank']); $accounttype = mysql_real_escape_string($_POST['accounttype']); //check email validation, the function is available at config.php if (!check_email($_POST['email'])) { $error['email'] .= " <strong>Email is not valid!</strong>"; } //check email exists in database $res = mysql_query("SELECT email FROM members WHERE email='".$email."' AND userid != '".$userid."'"); if (mysql_num_rows($res) == 1) { $error['email'] .= " <strong>Email already existst in database!</strong>"; } //check username exists in database $res = mysql_query("SELECT username FROM members WHERE username='".$username."' AND username != '".$username."'"); if (mysql_num_rows($res) == 1) { $error['username'] .= " <strong>Username already existst in database!</strong>"; } //check both passwords are the same when password fields are not empty //end validate data --------------------------------------------------------------------- //save to database when no errors are detected ------------------------------------------ if (count($error) == 0) { $query = "UPDATE members SET username='".$username."', email='".$email."',name='".$name."', phone='".$phone."',address='".$address."', city='".$city."',state='".$state."', zip='".$zip."',cell='".$cell."', accounttype='".$accounttype."',badges='".$badges."', rank='".$rank."' "; $query .= "username='".$username."', email='".$email."',name='".$name."', phone='".$phone."',address='".$address."', city='".$city."',state='".$state."', zip='".$zip."',cell='".$cell."', accounttype='".$accounttype."',badges='".$badges."', rank='".$rank."' WHERE userid='".$userid."'"; //update username session if you edit yourself if ($userid == $_SESSION['auth_admin_userid']) { $_SESSION['auth_admin_username'] = $username; } if (mysql_query($query)) { echo "<p><strong>User has been edited and saved to the database.</strong></p>"; } else { echo "<strong>User has NOT been edited and saved into the database. ".mysql_error()."</strong>"; } } } //get user from the database and put data into $_POST variables. $rs = mysql_query("SELECT name, username, phone, address, city, state, zip, cell, email, badges, rank, accounttype FROM members WHERE userid = ".$userid.""); if (mysql_num_rows($rs) == 0) { die("User does not exists!"); } $row = mysql_fetch_assoc($rs); $_POST['name'] = $row['name']; $_POST['username'] = $row['username']; $_POST['phone'] = $row['phone']; $_POST['address'] = $row['address']; $_POST['city'] = $row['city']; $_POST['state'] = $row['state']; $_POST['zip'] = $row['zip']; $_POST['cell'] = $row['cell']; $_POST['email'] = $row['email']; $_POST['badges'] = $row['badges']; $_POST['rank'] = $row['rank']; $_POST['accounttype'] = $row['accounttype']; //if is admin, then $_POST['admin'] exists ?> <div id="TabbedPanels1" class="TabbedPanels"> <ul class="TabbedPanelsTabGroup"> <li class="TabbedPanelsTab" tabindex="0">My Info</li> <li class="TabbedPanelsTab" tabindex="0">Merit Badges</li> <li class="TabbedPanelsTab" tabindex="0">Scout Rank</li> </ul> <div class="TabbedPanelsContentGroup"> <div class="TabbedPanelsContent"> <form action="admin.php?edit&id=<?php echo $userid;?>" method="post"> <table align="center" cellpadding="8" cellspacing="8"> <tr> <td><div align="right">Name:</div></td> <td> <p><input type="text" name="name" value='<?php echo $_POST['name'];?>' /> <?php echo(isset($error['name']))?$error['name']:"";?></p></td> </tr> <tr> <td>Phone Number:</td> <td><input type="text" name="phone" value='<?php echo $_POST['phone'];?>' /> <?php echo(isset($error['phone']))?$error['phone']:"";?></td> </tr> <tr> <td><div align="right">Address:</div></td> <td><input type="text" name="address" value='<?php echo $_POST['address'];?>' /> <?php echo(isset($error['address']))?$error['address']:"";?></td> </tr> <tr> <td><div align="right">City:</div></td> <td><input type="text" name="city" value='<?php echo $_POST['city'];?>' /> <?php echo(isset($error['city']))?$error['city']:"";?></td> </tr> <tr> <td><div align="right">State:</div></td> <td><input type="text" name="state" value='<?php echo $_POST['state'];?>' /> <?php echo(isset($error['state']))?$error['state']:"";?></td> </tr> <tr> <td><div align="right">Zip Code:</div></td> <td><input type="text" name="zip" value='<?php echo $_POST['zip'];?>' /> <?php echo(isset($error['zip']))?$error['zip']:"";?></td> </tr> <tr> <td><div align="right">Email:</div></td> <td> <p> <input type="text" name="email" value='<?php echo $_POST['email'];?>' /> <?php echo(isset($error['email']))?$error['email']:"";?></p></td> </tr> <tr> <td><div align="right">Cell Phone:</div></td> <td><input type="text" name="cell" value='<?php echo $_POST['cell'];?>' /> <?php echo(isset($error['cell']))?$error['cell']:"";?></td> </tr> <tr> <td class="aaaaaaa" align="right">Username:</td> <td><label for="username"></label> <input type="text" name="username" value='<?php echo $_POST['username'];?>' /> <?php echo(isset($error['username']))?$error['username']:"";?></p> </td> </tr> </table> <p> </p> <input name="submit" type="submit" value="Save" /> </form> </div> <div class="TabbedPanelsContent"> <label for="badges"></label> <input name="badges" type="text" id="badges" value="<?php echo "$badges"; ?>" /> </div> <div class="TabbedPanelsContent"> <input name="badges2" type="text" id="badges2" value="<?php echo $rank; ?>" /> </div> </div> </div> <script type="text/javascript"> var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1"); </script> <?php } ?>
-
All right, I am able to get the correct content to come up if there is no session set.......duh. So here is code I have it sets a session, but that is not the session I want.....I want userid not userid1 to be it............but that is the only way I can get info to display. Here is php code for the profile edit page: <?php session_start(); // Must start session first thing /* Created By Adam Khoury @ www.flashbuilding.com -----------------------June 20, 2008----------------------- */ // Here we run a login check if (!isset($_SESSION['id'])) { echo 'Please <a href="login.php">log in</a> to access your account'; exit(); } //Connect to the database through our include include_once "connect_to_mysql.php"; // Place Session variable 'id' into local variable $userid1 = $_SESSION['id']; ?> <?php // Process the form if it is submitted if ($_POST['username']) { $name = $_POST['name']; $phone = $_POST['phone']; $username = $_POST['username']; $address = $_POST['address']; $city = $_POST['city']; $state = $_POST['state']; $zip = $_POST['zip']; $cell = $_POST['cell']; $email = $_POST['email']; $rank = $_POST['rank']; $badges = $_POST['badges']; $sql = mysql_query("UPDATE members SET name='$name', phone='$phone', username='$username', address='$address', city='$city', state='$state', zip='$zip', cell='$cell', email='$email', rank='$rank', badges='$badges' WHERE userid='$userid'"); $sql = mysql_query("UPDATE sessions SET name='$name', phone='$phone', username='$username', address='$address', city='$city', state='$state', zip='$zip', cell='$cell', email='$email', rank='$rank', badges='$badges' WHERE id='$id'"); echo 'Your account info has been updated, visitors to your profile will now see the new info.<br /><br /> <meta HTTP-EQUIV="REFRESH" content="3; url=http://final.net46.net/myprofile.php">'; exit(); } // close if post ?> <?php // Query member data from the database and ready it for display $sql = mysql_query("SELECT * FROM editinfo WHERE userid1=".$_GET['userid1'].""); while($row = mysql_fetch_array($sql)){ $userid1 = $row["userid1"]; $name1 = $row["name1"]; $phone1 = $row["phone1"]; $username1 = $row["username1"]; $address1 = $row["address1"]; $city1 = $row["city1"]; $state1 = $row["state1"]; $zip1 = $row["zip1"]; $cell1 = $row["cell1"]; $email1 = $row["email1"]; $accounttype1 = $row["accounttype1"]; $rank1 = $row["rank1"]; $badges1 = $row["badges1"]; } ?> <!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=UTF-8" /> <title>Untitled Document</title> <style type="text/css"> #apDiv1 { position:absolute; left:33px; top:320px; width:252px; height:48px; z-index:1; } #apDiv2 { position:absolute; left:33px; top:361px; width:254px; height:46px; z-index:2; } #apDiv3 { position:absolute; left:33px; top:525px; width:256px; height:43px; z-index:3; } #apDiv4 { position:absolute; left:33px; top:402px; width:250px; height:48px; z-index:4; } #apDiv5 { position:absolute; left:106px; top:616px; width:263px; height:255px; z-index:5; } #apDiv6 { position:absolute; left:323px; top:200px; width:898px; height:530px; z-index:5; } #apDiv7 { position:absolute; left:33px; top:443px; width:266px; height:42px; z-index:6; } #apDiv8 { position:absolute; left:111px; top:500px; width:125px; height:37px; z-index:7; } #apDiv8 strong { font-size: 24px; } #apDiv9 { position:absolute; left:33px; top:408px; width:267px; height:49px; z-index:8; } #apDiv10 { position:absolute; left:33px; top:449px; width:242px; height:23px; z-index:9; } #apDiv8 a { color: #000; } #apDiv11 { position:absolute; left:101px; top:490px; width:168px; height:42px; z-index:10; font-size: 24px; font-weight: bold; } #apDiv11 a { color: #000; } #apDiv12 { position:absolute; left:33px; top:210px; width:205px; height:135px; z-index:11; } #apDiv12 { text-align: center; } #apDiv13 { position:absolute; left:33px; top:320px; width:258px; height:47px; z-index:12; } #apDiv { position:absolute; left:33px; top:484px; width:225px; height:35px; z-index:11; } #apDiv14 { position:absolute; left:33px; top:566px; width:298px; height:51px; z-index:12; } #apDiv15 { position:absolute; left:101px; top:611px; width:168px; height:42px; z-index:10; font-size: 24px; font-weight: bold; } #apDiv5 a { font-size: 24px; color: #000; font-weight: bold; } </style> <script type="text/javascript"> function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; } function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } </script> <script src="SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script> <link href="SpryAssets/SpryTabbedPanels.css" rel="stylesheet" type="text/css" /> </head> <?php // Query member data from the database and ready it for display $sql = mysql_query("SELECT * FROM members WHERE userid='userid'"); while($row = mysql_fetch_array($sql)){ $name = $row["name"]; $phone = $row["phone"]; $username = $row["username"]; $address = $row["address"]; $city = $row["city"]; $state = $row["state"]; $zip = $row["zip"]; $cell = $row["cell"]; $email = $row["email"]; $accounttype = $row["accounttype"]; $rank = $row["rank"]; $badges = $row["badges"]; } ?> <body onload="MM_preloadImages('button/myprofile2.png','button/pictures2.png','button/projects1.png','button/news2.png','button/eventmanager2.png','button/membermanager2.png','button/newsmanager2.png')"> <div id="apDiv2"><a href="register.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image3','','button/register2.png',1)"><img src="button/register1.png" name="Image3" width="235" height="50" border="0" id="Image3" /></a></div> <div id="apDiv4"><a href="projects.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image4','','button/projects2.png',1)"><img src="button/projects1.png" name="Image4" width="235" height="50" border="0" id="Image4" /></a></div> <div id="apDiv11"><?php if ($accounttype == "Scout") { echo '<a href="../logout.php">Logout</a>';} ?></div> <div id="apDiv12"><?php echo "$accounttype"; ?> <p><?php echo "$name"; ?></p> <p>Troop 78</p> </div> <div id="apDiv13"><a href="myprofile.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image5','','button/myprofile2.png',1)"><img src="button/myprofile1.png" name="Image5" width="235" height="50" border="0" id="Image5" /></a></div> <div id="apDiv5"><?php if ($accounttype == "Admin") { echo "<a href=\"../logout.php\">Logout</a>"; } ?></div> </a> </div> <div id="apDiv6"> <div id="TabbedPanels1" class="TabbedPanels"> <ul class="TabbedPanelsTabGroup"> <li class="TabbedPanelsTab" tabindex="0">My Info</li> <li class="TabbedPanelsTab" tabindex="0">Merit Badges</li> <li class="TabbedPanelsTab" tabindex="0">Scout Rank</li> </ul> <div class="TabbedPanelsContentGroup"> <div class="TabbedPanelsContent"><form action="myprofile.php" method="post" enctype="multipart/form-data" name="form" id="form" onsubmit="return validate_form ( );"> <table align="center" cellpadding="8" cellspacing="8"> <tr> <?php if ($accounttype == "Scout") { ?> <td><div align="right">Name:</div></td> <td><input name="name" type="text" disabled="disabled" id="name" value="<?php echo "$name1"; ?>" size="30" maxlength="64" /></td> </tr><?php } ?> <tr> <td><div align="right">Name:</div></td> <td><input name="name" type="text" id="name" value="<?php echo "$name1"; ?>" size="30" maxlength="64" /></td> </tr> <tr> <td>Phone Number:</td> <td><input name="phone" type="text" id="phone" value="<?php echo "$phone1"; ?>" size="30" maxlength="64" /></td> </tr> <tr> <td><div align="right">Address:</div></td> <td><input name="address" type="text" id="address" value="<?php echo "$address1"; ?>" size="30" maxlength="24" /></td> </tr> <tr> <td><div align="right">City:</div></td> <td><input name="city" type="text" id="city" value="<?php echo "$city1"; ?>" size="30" maxlength="64" /></td> </tr> <tr> <td><div align="right">State:</div></td> <td><input name="state" type="text" id="state" value="<?php echo "$state1"; ?>" size="30" maxlength="64" /></td> </tr> <tr> <td><div align="right">Zip Code:</div></td> <td><input name="zip" type="text" id="zip" value="<?php echo "$zip1"; ?>" size="30" maxlength="64" /></td> </tr> <tr> <td><div align="right">Email:</div></td> <td><input name="email" type="text" id="email" value="<?php echo "$email1"; ?>" size="30" maxlength="64" /></td> </tr> <tr> <td><div align="right">Cell Phone:</div></td> <td><input name="cell" type="text" id="cell" value="<?php echo "$cell1"; ?>" size="30" maxlength="64" /></td> </tr> <tr> <td class="aaaaaaa">Username:</td> <td><label for="username"></label> <input name="username" type="text" id="username" value="<?php echo "$username1"; ?>"/> </td> </tr> <tr> <td class="aaaaaaa"> </td> <td><label for="accounttype"></label> <input type="submit" name="submit" id="submit" value="Save" /></td> <input name="userid" type="text" value="<?php echo "$userid1"; ?>" /> </tr> </table> </form> </div> <div class="TabbedPanelsContent"> <label for="badges"></label> <input name="badges" type="text" id="badges" value="<?php echo "$badges"; ?>" /> </div> <div class="TabbedPanelsContent"> <input name="badges2" type="text" id="badges2" value="<?php echo $rank; ?>" /> </div> </div> </div> <script type="text/javascript"> var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1"); </script> </div> <div id="apDiv7"><a href="news.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image6','','button/news2.png',1)"><img src="button/news1.png" name="Image6" width="235" height="50" border="0" id="Image6" /></a></div> <div id="apDiv"> <?php if ($accounttype == "Admin") { echo "<a href=\"../search1.php\" onmouseout=\"MM_swapImgRestore()\" onmouseover=\"MM_swapImage('Image7','','../button/membermanager2.png',1)\"><img src=\"../button/membermanager1.png\" name=\"Image7\" width=\"235\" height=\"50\" border=\"0\" id=\"Image7\" /></a>"; } ?></div> <div id="apDiv3"><?php if ($accounttype == "Admin") { echo "<a href=\"../addevent.php\" onmouseout=\"MM_swapImgRestore()\" onmouseover=\"MM_swapImage('Image8','','../button/eventmanager2.png',1)\"><img src=\"../button/eventmanager1.png\" name=\"Image8\" width=\"235\" height=\"50\" border=\"0\" id=\"Image8\" /></a>"; } ?> </div> <div id="apDiv14"><?php if ($accounttype == "Admin") { echo "<a href=\"../addart.php\" onmouseout=\"MM_swapImgRestore()\" onmouseover=\"MM_swapImage('Image9','','../button/newsmanager2.png',1)\"><img src=\"../button/newsmanager1.png\" name=\"Image9\" width=\"234\" height=\"50\" border=\"0\" id=\"Image9\" /></a>"; } ?> </div> <img name="boyscout" src="buttons/boyscout.jpg" width="1180" height="700" border="0" id="boyscout" alt="" /> </body> </html> Here is the login page where all the variables are intitialized!!!!! <?php /* Created By Adam Khoury @ [url='http://www.flashbuilding.com/']www.flashbuilding.com[/url] -----------------------June 20, 2008----------------------- */ if ($_POST['username']) { //Connect to the database through our include include_once "connect_to_mysql.php"; $username = stripslashes($_POST['username']); $username = strip_tags($username); $username = mysql_real_escape_string($username); $password = ereg_replace("[^A-Za-z0-9]", "", $_POST['password']); // filter everything but numbers and letters $password = md5($password); // Make query and then register all database data that - // cannot be changed by member into SESSION variables. // Data that you want member to be able to change - // should never be set into a SESSION variable. $sql = mysql_query("SELECT * FROM sessions WHERE username='$username' AND password='$password'"); $login_check = mysql_num_rows($sql); if($login_check > 0){ while($row = mysql_fetch_array($sql)){ // Get member ID into a session variable $id = $row["id"]; session_register('id'); $_SESSION['id'] = $id; // Get member username into a session variable $name = $row["name"]; session_register('name'); $_SESSION['username'] = $username; // Get member userlevel into a session variable $userlevel = $row["userlevel"]; session_register('userlevel'); $_SESSION['userlevel'] = 9; // Update last_log_date field for this member now mysql_query("UPDATE sessions SET lastlogin=now() WHERE id='$id'"); // Print success message here if all went well then exit the script header("location: news.php?"); exit(); } // close while } else { // Print login failure message to the user and link them back to your login page print '<br /><br /><font color="#FF0000">No match in our records, try again </font><br /> <br /><a href="login.php">Click here</a> to go back to the login page.'; exit(); }} ?> <!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"><!-- InstanceBegin template="/Templates/template3.dwt.php" codeOutsideHTMLIsLocked="false" --> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <!-- InstanceBeginEditable name="doctitle" --> <title>Member Login</title> <!-- InstanceEndEditable --> <style type="text/css"> #apDiv1 { position:absolute; left:33px; top:203px; width:252px; height:48px; z-index:1; } #apDiv2 { position:absolute; left:33px; top:244px; width:254px; height:80px; z-index:2; } #apDiv3 { position:absolute; left:33px; top:367px; width:256px; height:65px; z-index:3; } #apDiv4 { position:absolute; left:33px; top:285px; width:250px; height:61px; z-index:4; } #apDiv5 { position:absolute; left:339px; top:199px; width:263px; height:255px; z-index:5; } #apDiv6 { position:absolute; left:325px; top:184px; width:898px; height:530px; z-index:5; } #apDiv7 { position:absolute; left:33px; top:326px; width:266px; height:83px; z-index:6; } </style> <script type="text/javascript"> function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; } function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } </script> <!-- InstanceBeginEditable name="head" --> <!-- InstanceEndEditable --> </head> <body onload="MM_preloadImages('button/register2.png','button/login2.png')"> <div id="apDiv1"><a href="pictures.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image2','','button/register2.png',1)"><img src="button/pictures1.png" name="Image2" width="300" height="50" border="0" id="Image2" /></a></div> <div id="apDiv2"><a href="login.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image3','','button/login2.png',1)"><img src="button/login1.png" name="Image3" width="300" height="50" border="0" id="Image3" /></a> <div id="apDiv4"></div> </div> <div id="apDiv6"><!-- InstanceBeginEditable name="EditRegion3" --> <script type="text/javascript"> <!-- Form Validation --> function validate_form ( ) { valid = true; if ( document.logform.username.value == "" ) { alert ( "Please enter your User Name" ); valid = false; } if ( document.logform.pass.value == "" ) { alert ( "Please enter your password" ); valid = false; } return valid; } <!-- Form Validation --> </script> <div align="center"> <h3><br /> <br /> Log in to your account here<br /> <br /> </h3> </div> <table align="center" cellpadding="5"> <form action="login.php" method="post" enctype="multipart/form-data" name="logform" id="logform" onsubmit="return validate_form ( );"> <tr> <td class="style7"><div align="right">Username:</div></td> <td><input name="username" type="text" id="username" size="30" maxlength="64" /></td> </tr> <tr> <td class="style7"><div align="right">Password:</div></td> <td><input name="password" type="password" id="password" size="30" maxlength="24" /></td> </tr> <tr> <td> </td> <td><input name="Submit" type="submit" value="Login" /></td> </tr> </form> </table> <!-- InstanceEndEditable --></div> <div id="apDiv7"></div><img name="boyscout" src="buttons/boyscout.jpg" width="1180" height="700" border="0" id="boyscout" alt="" /> </body> <!-- InstanceEnd --></html> If you could help me figure out the correct code for this so that the PHP tags work such as in the places where buttons show only if your accounttype is Admin (which needs session, duh) that would be so, so, so great!!!!!!!!!!!!!!!!!!!!!