rvroberto 0 Denunciar post Postado Setembro 17, 2012 Boa tarde, eu uso o cs3 dreamweaver, fiz um painel de controle onde o usuario vai digitar mensagens, onde sera postado em outra pagina. Ok. Ao mesmo tempo assim que a pessoa digitar vai aparecer na mesma pagina o que foi digitado tbm. Pois sera gravado em um banco de dados. O que eu gostaria de fazer é abrir a possibilidade da pessoa alterar ou excluir as mensagens que foi digitado. segue o codigo da pagina pcontrol.php <?php require_once('Connections/mae.php'); ?> <?php //initialize the session if (!isset($_SESSION)) { session_start(); } // ** Logout the current user. ** $logoutAction = $_SERVER['PHP_SELF']."?doLogout=true"; if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){ $logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){ //to fully log out a visitor we need to clear the session varialbles $_SESSION['MM_Username'] = NULL; $_SESSION['MM_UserGroup'] = NULL; $_SESSION['PrevUrl'] = NULL; unset($_SESSION['MM_Username']); unset($_SESSION['MM_UserGroup']); unset($_SESSION['PrevUrl']); $logoutGoTo = "login.php"; if ($logoutGoTo) { header("Location: $logoutGoTo"); exit; } } ?> <?php if (!isset($_SESSION)) { session_start(); } $MM_authorizedUsers = ""; $MM_donotCheckaccess = "true"; // *** Restrict Access To Page: Grant or deny access to this page function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { // For security, start by assuming the visitor is NOT authorized. $isValid = False; // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. // Therefore, we know that a user is NOT logged in if that Session variable is blank. if (!empty($UserName)) { // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. // Parse the strings into arrays. $arrUsers = Explode(",", $strUsers); $arrGroups = Explode(",", $strGroups); if (in_array($UserName, $arrUsers)) { $isValid = true; } // Or, you may restrict access to only certain users based on their username. if (in_array($UserGroup, $arrGroups)) { $isValid = true; } if (($strUsers == "") && true) { $isValid = true; } } return $isValid; } $MM_restrictGoTo = "erro.php"; if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) { $MM_qsChar = "?"; $MM_referrer = $_SERVER['PHP_SELF']; if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&"; if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0) $MM_referrer .= "?" . $QUERY_STRING; $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer); header("Location: ". $MM_restrictGoTo); exit; } ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form4")) { $insertSQL = sprintf("INSERT INTO msnmae (msn) VALUES (%s)", GetSQLValueString($_POST['msn'], "text")); mysql_select_db($database_mae, $mae); $Result1 = mysql_query($insertSQL, $mae) or die(mysql_error()); $insertGoTo = "pcontrol.php"; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); } mysql_select_db($database_mae, $mae); $query_vermsn = "SELECT * FROM msnmae"; $vermsn = mysql_query($query_vermsn, $mae) or die(mysql_error()); $row_vermsn = mysql_fetch_assoc($vermsn); $totalRows_vermsn = mysql_num_rows($vermsn); ?> <? if (isset($_REQUEST['alterar'])) { elseif (isset($_REQUEST['excluir'])) { } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR...nsitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Painel de Controle</title> </head> <body> <form id="form1" name="form1" method="post" action=""> <table width="100%"> <tr> <td><div align="center">Mãe seja bem vinda ao seu painel de controle, aqui a Senhora pode alterar, excluir e digitar novas mensagens.</div></td> </tr> </table> </form> <form action="" method="get"> <table width="100%"> <tr> <td><div align="center">Mensagens Cadastradas no Banco de Dados</div></td> </tr> </table> </form> <form id="form3" name="form3" method="post" action=""> <form action="<?php echo $editFormAction; ?>" method="post" name="form4" id="form4"> <table width="700" align="center"> <tr valign="baseline"> <td nowrap="nowrap" align="right">Mensagem:</td> <td><input type="text" name="msn" value="" size="100" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right"> </td> <td><input type="submit" value="Inserir" /></td> </tr> </table> <input type="hidden" name="MM_insert" value="form4" /> </form> <p> </p> <form id="form3" name="form3" method="post" action=""> <?php do { ?> <table width="100%"> <tr> <td width="7%"><?php echo $row_vermsn['id']; ?></td> <td width="81%"><?php echo $row_vermsn['msn']; ?></td> <td width="12%"><label> <input type="submit" name="alterar" value="Alterar" /> </label> <label> <input type="submit" name="excluir" value="Excluir" /> </label></td> </tr> </table> <?php } while ($row_vermsn = mysql_fetch_assoc($vermsn)); ?></form> <p> </p> <a href="<?php echo $logoutAction ?>">Sair do Painel de Controle </a> </body> </html> <?php mysql_free_result($vermsn); ?> Compartilhar este post Link para o post Compartilhar em outros sites
wolfphw 60 Denunciar post Postado Setembro 17, 2012 Posso recomendar uma coisa... não utilize o DW para gerar seus código.. faz eles na mão, você vai aprender mais... Agora como você esta com uma dúvida de como fazer isso no DW.. coloca sua dúvida no forum na parte destinada ao DW: http://forum.imasters.com.br/forum/318-dreamweaver-flash-fireworks/ Compartilhar este post Link para o post Compartilhar em outros sites
rvroberto 0 Denunciar post Postado Setembro 18, 2012 Posso recomendar uma coisa... não utilize o DW para gerar seus código.. faz eles na mão, você vai aprender mais... Agora como você esta com uma dúvida de como fazer isso no DW.. coloca sua dúvida no forum na parte destinada ao DW: http://forum.imasters.com.br/forum/318-dreamweaver-flash-fireworks/ Obrigado Compartilhar este post Link para o post Compartilhar em outros sites