marcoshac 0 Denunciar post Postado Novembro 25, 2003 Olá Pessoal, estou começando a "brincar" com o PHP e estou gostando muito... Para quem já mexeu com C e Java é realmente tranquilo..... Minhas dúvidas no momento são as seguintes: OBS.:Já postei isso aqui antes perguntando sobre o uso the thumbnails, mas após ver alguns decidi fazer algo bme simples até mesmo para aprender Estou fazendo tipo um album de fotos onde se clica na imagem e abre-se outra janela com a imagem aumentada. A geração da tabela com as jpg´s já está feita e ok. O meu problema é quando tenho que abrir esta outra janela, passando o nome do arquivo para esta nova janela. 1) Estou passando o nome do arquivo desta forma (mais ou menos assim): "<a href='#' onfiltered= 'nova_pagina.php?foto=".$foto."' target = 'nova'>"; Dúvida: nesta nova janela não estou conseguindo recuperar o valor da $foto. Como faço isso. Li na apostila do Vivas que o PHP cria a variável automáticamente, e que eu não precisaria fazer nada.... 2) Usando HTML "target=", não tem como eu mandar abrir a janela com um tamanho específico, sem os botões, url, só com a barra da janela e a foto. Em _JavaScript eu posso usar a função window.open. Como eu poderia usar esta função dentro do PHP. Quero dizer, como usar _JavaScript dentro do PHP?? 3) Dá pra mandar abrir uma janela, como descrita anteriormente, usando código PHP?? Pelo que entendo PHP roda no Servidpr, e a janela está sendo aberta no cliente.... Valeu Pessoal. :D Marcos Henrique Compartilhar este post Link para o post Compartilhar em outros sites
void 1 Denunciar post Postado Novembro 25, 2003 olha essa pagina! /pages/list.php <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><?session_start();$aintID = $_SESSION["AID"];$astrName = $_SESSION["ANAME"];$astrType = $_SESSION["ATYPE"];?><html><head><title>fccSurvey | thevoiddesign</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style><!--BODY { scrollbar-face-color:#E0E0E0; scrollbar-arrow-color: #666666; scrollbar-track-color:#F1F1F1; scrollbar-shadow-color:#E0E0E0; scrollbar-highlight-color:#E0E0E0; scrollbar-3dlight-color:#FFFFFF; scrollbar-darkshadow-Color:#C0C0C0; margin: 0px; padding: 0px; background-color: 333333;}TD { font-family: Geneva, Verdana, Arial, Helvetica; font-size: 10px; color: #333333; text-decoration: none;}A { text-decoration: none; cursor: hand }A:link { color: #333333 }A:visited { color: #333333}A:hover { color: #009900}A:active { color: #333333 }BUTTON { background: #898989; border-bottom: 1px solid #434343; border-right: 1px solid #434343; border-left: 1px solid #707070; border-top:1px solid #707070; color:#FFFFFF; text-decoration:none; cursor: hand; font-family: Geneva, Verdana, Arial, Helvetica; font-size: 10px; text-transform: uppercase;}input{ height: 16px; font-family: Geneva, Verdana, Arial, Helvetica; font-size: 10px; color: #666666; border: 1px solid #989898;}.input{ font-family: Geneva, Verdana, Arial, Helvetica; font-size: 10px; color: #666666; border: 1px solid #989898;}.none{ font-family: Geneva, Verdana, Arial, Helvetica; font-size: 10px; color: #666666; border: 0px solid #989898;}--></style><script> function MM_openBrWindow(theURL,winName,features) { //v2.0 window.open(theURL,winName,features);}</script></head><body bgcolor="333333"> <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td align="center" valign="middle"> <table width="520" height="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF"> <tr> <td valign="top"><table width="520" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="173"><img src="images/logo.gif" width="203" height="89"></td> <td height="10"> <? include('menu.php'); ?></td> <td align="right" valign="top"><img src="images/logosmall.gif" width="105" height="38" border="0" usemap="#Map"></td> </tr> </table> <table width="520" border="0" cellspacing="0" cellpadding="0"> <tr> <td><img src="images/list_01.jpg" width="297" height="129"></td> <td><img src="images/list_02.gif" width="223" height="129"></td> </tr> </table> <table width="520" border="0" cellspacing="10" cellpadding="0"> <tr valign="top"> <td align="right"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#ffffff"> <tr> <td width="2" height="2"><img src="images/mobile/void.gif" width="2" height="2"></td> <td></td> <td width="2" height="2"><img src="images/mobile/void.gif" width="2" height="2"></td> </tr> <tr> <td></td> <td> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td> <table width="100%" border="0" cellspacing="0"> <tr> <td width="3"> </td> <!--td width="20"><strong>id</strong></td--> <td><strong>Nome</strong></td> <td width="70" align="right"><strong>Tipo</strong></td> <td width="3"> </td> </tr> </table> </td> </tr> </table></td> <td></td> </tr> <tr> <td width="2" height="2"><img src="images/mobile/void.gif" width="2" height="2"></td> <td></td> <td width="2" height="2"><img src="images/mobile/void.gif" width="2" height="2"></td> </tr></table> </td> </tr> <? $iTotal = count($aintID); for($i=0; $i<$iTotal; $i++){ switch ($astrType[$i]) { case 1: $strTipo = "Administrador"; break; case 2: $strTipo = "Operador"; break; case 3: $strTipo = "Avaliador"; break; } ?> <tr> <td><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="<? if($i%2==0){ ?>#cccccc<? }else{?>#ffffff<? }?>"> <tr> <td width="2" height="2"><? if($i%2==0){ ?><img src="images/mobile/ls.gif" width="2" height="2"><? }else{?><img src="images/mobile/void.gif" width="2" height="2"><? }?></td> <td></td> <td width="2" height="2"><? if($i%2==0){ ?><img src="images/mobile/rs.gif" width="2" height="2"><? }else{?><img src="images/mobile/void.gif" width="2" height="2"><? }?></td> </tr> <tr> <td></td> <td> <table width="100%" border="0" cellspacing="1" cellpadding="0"> <tr> <td> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="3"> </td> <!--td width="20"><?=$aintID[$i]?></td--> <td><a href="#" onClick="MM_openBrWindow('user.php?action=user&id=<?=$aintID[$i]?>&name=<?=$astrName[$i]?>&type=<?=$astrType[$i]?>','','scrollbars=no,width=300,height=150,top='+((screen.height/2)-75)+',left='+((screen.width/2)-150));"><?=$astrName[$i]?></a></td> <td width="70" align="right"><?=$strTipo?></td> <td width="3"> </td> </tr> </table> </td> </tr> </table></td> <td></td> </tr> <tr> <td width="2" height="2"><? if($i%2==0){ ?><img src="images/mobile/li.gif" width="2" height="2"><? }else{?><img src="images/mobile/void.gif" width="2" height="2"><? }?></td> <td></td> <td width="2" height="2"><? if($i%2==0){ ?><img src="images/mobile/ri.gif" width="2" height="2"><? }else{?><img src="images/mobile/void.gif" width="2" height="2"><? }?></td> </tr></table></td> </tr> <? } ?> </table> <br> <button onClick="window.location = 'gateway.php?page=add_user'">adicionar</button></td> </tr> </table></td> </tr></table></td> </tr> </table><map name="Map"> <area shape="rect" coords="7,5,97,32" href="http://teco.fcc.univap.br/cc010115" target="_blank"></map></body></html> user.php <?PHPsession_start();require "core/user.core.php";$strAction = $_REQUEST["action"]==null ? "default" : $_REQUEST["action"];if ($strAction=="default"){ $strAction = $_SESSION["action"]==null ? "default" : $_SESSION["action"];}$userID = $_REQUEST["userid"]==null ? "-1" : $_REQUEST["userid"];$strAction = strtoupper($strAction);switch ($strAction) { case "NEW_USER": processNewUser(); break; case "USER": processUser(); break; case "LIST": processList(); break; case "CHANGE_TYPE": processChangeType(); break; case "CHANGE_PASSWORD": processChangePassword(); break; case "DELETE": processDelete(); break; case "LOGIN": processLogin(); break; case "LOGOUT": processLogout(); break; default: processDefault();}function processNewUser(){ if($_SESSION["USER_TYPE"]=="1"){ $strName = $_REQUEST["name"]==null ? "-1" : $_REQUEST["name"]; $strType = $_REQUEST["type"]==null ? "-1" : $_REQUEST["type"]; $strLogin = $_REQUEST["login"]==null ? "-1" : $_REQUEST["login"]; $strPassword = $_REQUEST["password"]==null ? "-1" : $_REQUEST["password"]; if($strLogin=="-1" || $strPassword=="-1"){ if($strLogin=="-1"){ $_SESSION["error_login"] = "Este campo é obrigatório!"; } if($strPassword=="-1"){ $_SESSION["error_password"] = "Este campo é obrigatório!"; } $_SESSION["page"] = "login"; forward("gateway.php"); } else { $asParams = array(); $asParams[0] = $strName; $asParams[1] = $strType; $asParams[2] = $strLogin; $asParams[3] = $strPassword; if(newuser($asParams)){ $_SESSION["action"] = "list"; forward("user.php"); } else { echo "error"; } } } else { processDefault(); }}function processList() { if($_SESSION["USER_TYPE"]=="1"){ $aintID = array(); $astrName = array(); $astrType = array(); list($aintID,$astrName,$astrType) = list_users(); $_SESSION["AID"] = $aintID; $_SESSION["ANAME"] = $astrName; $_SESSION["ATYPE"] = $astrType; $_SESSION["page"] = "list"; forward("gateway.php"); } else { processDefault(); }}function processChangeType(){ if($_SESSION["USER_TYPE"]=="1"){ $strID = $_REQUEST["id"]==null ? "-1" : $_REQUEST["id"]; $strType = $_REQUEST["type"]==null ? "-1" : $_REQUEST["type"]; $asParams = array(); $asParams[0] = $strID; $asParams[1] = $strType; if (change_type($asParams)){ ?> <script> window.opener.location = "user.php?action=list"; window.close(); </script> <? } else { ?> <script> alert("Este usuário não pode ser Alterado!") window.close(); </script> <? } } else { processDefault(); }}function processChangePassword(){ $strNewPassword = $_REQUEST["newpassword"]==null ? "-1" : $_REQUEST["newpassword"]; $strPassword = $_REQUEST["password"]==null ? "-1" : $_REQUEST["password"]; $strConfirmPassword = $_REQUEST["confirmpassword"]==null ? "-1" : $_REQUEST["confirmpassword"]; $asParams = array(); $asParams[0] = $strNewPassword; if ($strPassword == $_SESSION["MD5"]){ if($strPassword != $strConfirmPassword){ forward("gateway.php?page=change_password&cerror=Inválido"); } else { if (change_password($asParams)){ ?> <script> alert("Sua senha foi alterada com Sucesso!"); window.close(); </script> <? } else { ?> <script> alert("Erro ao alterar senha !"); window.close(); </script> <? } } } else { forward("gateway.php?page=change_password&error=Inválido"); }}function processDelete(){ if($_SESSION["USER_TYPE"]=="1"){ $strID = $_REQUEST["id"]==null ? "-1" : $_REQUEST["id"]; $asParams = array(); $asParams[0] = $strID; if (delete_user($asParams)){ ?> <script> window.opener.location = "user.php?action=list"; window.close(); </script> <? } else { ?> <script> alert("Este usuário não pode ser Removido!") window.close(); </script> <? } } else { processDefault(); } }function processUser(){ if($_SESSION["USER_TYPE"]=="1"){ $strID = $_REQUEST["id"]==null ? "-1" : $_REQUEST["id"]; $asParams = array(); $asParams[0] = $strID; list($intID,$strName,$strType,$strLogin) = get_user($asParams); forward("gateway.php?page=user&id=$intID&name=$strName&type=$strType&login=$strLogin"); } else { processDefault(); }}function processLogin(){ $strLogin = $_REQUEST["login"]==null ? "-1" : $_REQUEST["login"]; $strPassword = $_REQUEST["password"]==null ? "-1" : $_REQUEST["password"]; if($strLogin=="-1" || $strPassword=="-1"){ if($strLogin=="-1"){ $_SESSION["error_login"] = "Este campo é obrigatório!"; } if($strPassword=="-1"){ $_SESSION["error_password"] = "Este campo é obrigatório!"; } $_SESSION["page"] = "login"; forward("gateway.php"); } else { $asParams = array(); $asParams[0] = $strLogin; $asParams[1] = $strPassword; $bLogin = login($asParams); if($bLogin){ $_SESSION["msg"]="-1"; forward("survey.php?action=scheduling"); } else { $_SESSION["msg"] = "Login ou senha inválidos!<br>"; $_SESSION["page"] = "login"; forward("gateway.php"); } }}function processLogout(){ $_SESSION["STATUS"] = "-1"; $_SESSION["MD5"] = "-1"; $_SESSION["USER_TYPE"] = "-1"; forward("gateway.php");}function processDefault(){ forward("gateway.php");}function forward($url){ header("Location:".$url);}?> /pages/user.php <?PHPsession_start();$strPage = $_REQUEST["page"]==null ? "default" : $_REQUEST["page"];if ($strPage=="default"){ $strPage = $_SESSION["page"]==null ? "default" : $_SESSION["page"];}$strPage = strtoupper($strPage);define("HOME", "pages/home.php");define("LOGIN", "pages/login.php");define("LIST_USERS", "pages/list.php");define("USER", "pages/user.php");define("CHANGE_TYPE", "pages/change.php");define("CHANGE_PASSWORD", "pages/pass.php");define("ADD_USER", "pages/add.php");define("CREATE", "pages/create.php");define("SURVEY", "pages/survey.php");define("SCHEDULING", "pages/scheduling.php");define("RESPONSE", "pages/response.php");define("RESULT", "pages/result.php");define("ADD_QUESTION", "pages/add_question.php");define("ADD_QUESTION_BY_FILE", "pages/add_qusetion_by_file.php");if ($_SESSION["STATUS"]=="login"){ switch ($strPage) { case "LOGIN": goLogin(); break; case "LIST": goList(); break; case "USER": goUser(); break; case "CHANGE_TYPE": goChangeType(); break; case "CHANGE_PASSWORD": goChangePassword(); break; case "ADD_USER": goAddUser(); break; case "CREATE": goCreate(); break; case "SURVEY": goSurvey(); break; case "SCHEDULING": goScheduling(); break; case "RESULT": goResult(); break; case "RESPONSE": goResponse(); break; case "ADD_QUESTION": goAddQuestion(); break; case "ADD_QUESTIONS_BY_FILE": goAddQuestionsByFile(); break; default: goDefault(); }} else {goDefault();}function goLogin(){ forward(LOGIN);}function goList(){ forward(LIST_USERS);}function goAddUser(){ forward(ADD_USER);}function goUser(){ forward(USER);}function goChangeType(){ forward(CHANGE_TYPE);}function goChangePassword(){ forward(CHANGE_PASSWORD);}function goCreate(){ forward(CREATE);}function goSurvey(){ forward(SURVEY);}function goScheduling(){ forward(SCHEDULING);}function goResult(){ forward(RESULT);}function goResponse(){ forward(RESPONSE);}function goAddQuestion(){ forward(ADD_QUESTION);}function goAddQuestionsByFile(){ forward(ADD_QUESTION_BY_FILE);}function goDefault(){ forward(HOME);}function forward($url){ include $url;}?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><?$strName = $_REQUEST["name"]==null ? "default" : $_REQUEST["name"];$strID = $_REQUEST["id"]==null ? "-1" : $_REQUEST["id"];$strType = $_REQUEST["type"]==null ? "default" : $_REQUEST["type"];$strLogin = $_REQUEST["login"]==null ? "default" : $_REQUEST["login"]; switch ($strType) { case 1: $strTipo = "Administrador"; break; case 2: $strTipo = "Operador"; break; case 3: $strTipo = "Avaliador"; break; }?><html><head><title>fccSurvey | thevoiddesign</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style><!--BODY { scrollbar-face-color:#E0E0E0; scrollbar-arrow-color: #666666; scrollbar-track-color:#F1F1F1; scrollbar-shadow-color:#E0E0E0; scrollbar-highlight-color:#E0E0E0; scrollbar-3dlight-color:#FFFFFF; scrollbar-darkshadow-Color:#C0C0C0; margin: 0px; padding: 0px; background-color: #ffffff;}TD { font-family: Geneva, Verdana, Arial, Helvetica; font-size: 10px; color: #333333; text-decoration: none;}A { text-decoration: none; cursor: hand }A:link { color: #333333 }A:visited { color: #333333}A:hover { color: #009900}A:active { color: #333333 }BUTTON { background: #898989; border-bottom: 1px solid #434343; border-right: 1px solid #434343; border-left: 1px solid #707070; border-top:1px solid #707070; color:#FFFFFF; text-decoration:none; cursor: hand; font-family: Geneva, Verdana, Arial, Helvetica; font-size: 10px; text-transform: uppercase;}input{ height: 16px; font-family: Geneva, Verdana, Arial, Helvetica; font-size: 10px; color: #666666; border: 1px solid #989898;}.input{ font-family: Geneva, Verdana, Arial, Helvetica; font-size: 10px; color: #666666; border: 1px solid #989898;}.none{ font-family: Geneva, Verdana, Arial, Helvetica; font-size: 10px; color: #666666; border: 0px solid #989898;}--></style></head><body><table width="300" height="150" border="0" cellpadding="0" cellspacing="0"> <tr> <td height="29"><img src="images/t_user.gif" width="300" height="29"></td> </tr> <tr> <td height="121" valign="top"> <table width="300" height="121" border="0" cellpadding="10" cellspacing="0"> <tr> <td valign="top"><strong>Nome:</strong> <?=$strName?> <br> <strong>Login:</strong> <?=$strLogin?> <br> <strong>Tipo:</strong> <?=$strTipo?> </td> </tr> <tr> <td height="1" valign="bottom"> <button onClick="window.location = 'user.php?action=delete&id=<?=$strID?>'">remover</button> <button onClick="window.location = 'gateway.php?page=change_type&name=<?=$strName?>&id=<?=$strID?>'">trocar tipo</button></td> </tr> </table> </td> </tr></table></body></html> acredito q analizando esses códigos você pode tirar suas duvidas c quiser ver isso funcionando ta em http://teco.fcc.univap.br/~ec010238 login: woody pass: teste espero ter ajudado the void Compartilhar este post Link para o post Compartilhar em outros sites
ualex 0 Denunciar post Postado Novembro 25, 2003 você tem dois problemas. primeiro tenta mandar abrir em uma pagina de teste que só tenha essas linhas <?phpecho $foto."<br> 1";echo $_GET['foto'];?> caso imprimi só a segunda linha é config. de servidor a proxima questão é criar uma função javascript para abrir a janela <script>function abre(url) { window.open(url,'FOTOS','statusbar=no,width=500');}</script> dae se coloca assim no seu link <a href=# onclick=abre('http:/sassa....') >img</a> Compartilhar este post Link para o post Compartilhar em outros sites
emanuel fonseca 0 Denunciar post Postado Novembro 25, 2003 olha essa pagina!/pages/list.php <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><?session_start();$aintID = $_SESSION["AID"];$astrName = $_SESSION["ANAME"];$astrType = $_SESSION["ATYPE"];?><html><head><title>fccSurvey | thevoiddesign</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style><!--BODY { scrollbar-face-color:#E0E0E0; scrollbar-arrow-color: #666666; scrollbar-track-color:#F1F1F1; scrollbar-shadow-color:#E0E0E0; scrollbar-highlight-color:#E0E0E0; scrollbar-3dlight-color:#FFFFFF; scrollbar-darkshadow-Color:#C0C0C0; margin: 0px; padding: 0px; background-color: 333333;}TD { font-family: Geneva, Verdana, Arial, Helvetica; font-size: 10px; color: #333333; text-decoration: none;}A { text-decoration: none; cursor: hand }A:link { color: #333333 }A:visited { color: #333333}A:hover { color: #009900}A:active { color: #333333 }BUTTON { background: #898989; border-bottom: 1px solid #434343; border-right: 1px solid #434343; border-left: 1px solid #707070; border-top:1px solid #707070; color:#FFFFFF; text-decoration:none; cursor: hand; font-family: Geneva, Verdana, Arial, Helvetica; font-size: 10px; text-transform: uppercase;}input{ height: 16px; font-family: Geneva, Verdana, Arial, Helvetica; font-size: 10px; color: #666666; border: 1px solid #989898;}.input{ font-family: Geneva, Verdana, Arial, Helvetica; font-size: 10px; color: #666666; border: 1px solid #989898;}.none{ font-family: Geneva, Verdana, Arial, Helvetica; font-size: 10px; color: #666666; border: 0px solid #989898;}--></style><script> function MM_openBrWindow(theURL,winName,features) { //v2.0 window.open(theURL,winName,features);}</script></head><body bgcolor="333333"> <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td align="center" valign="middle"> <table width="520" height="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF"> <tr> <td valign="top"><table width="520" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="173"><img src="images/logo.gif" width="203" height="89"></td> <td height="10"> <? include('menu.php'); ?></td> <td align="right" valign="top"><img src="images/logosmall.gif" width="105" height="38" border="0" usemap="#Map"></td> </tr> </table> <table width="520" border="0" cellspacing="0" cellpadding="0"> <tr> <td><img src="images/list_01.jpg" width="297" height="129"></td> <td><img src="images/list_02.gif" width="223" height="129"></td> </tr> </table> <table width="520" border="0" cellspacing="10" cellpadding="0"> <tr valign="top"> <td align="right"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#ffffff"> <tr> <td width="2" height="2"><img src="images/mobile/void.gif" width="2" height="2"></td> <td></td> <td width="2" height="2"><img src="images/mobile/void.gif" width="2" height="2"></td> </tr> <tr> <td></td> <td> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td> <table width="100%" border="0" cellspacing="0"> <tr> <td width="3"> </td> <!--td width="20"><strong>id</strong></td--> <td><strong>Nome</strong></td> <td width="70" align="right"><strong>Tipo</strong></td> <td width="3"> </td> </tr> </table> </td> </tr> </table></td> <td></td> </tr> <tr> <td width="2" height="2"><img src="images/mobile/void.gif" width="2" height="2"></td> <td></td> <td width="2" height="2"><img src="images/mobile/void.gif" width="2" height="2"></td> </tr></table> </td> </tr> <? $iTotal = count($aintID); for($i=0; $i<$iTotal; $i++){ switch ($astrType[$i]) { case 1: $strTipo = "Administrador"; break; case 2: $strTipo = "Operador"; break; case 3: $strTipo = "Avaliador"; break; } ?> <tr> <td><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="<? if($i%2==0){ ?>#cccccc<? }else{?>#ffffff<? }?>"> <tr> <td width="2" height="2"><? if($i%2==0){ ?><img src="images/mobile/ls.gif" width="2" height="2"><? }else{?><img src="images/mobile/void.gif" width="2" height="2"><? }?></td> <td></td> <td width="2" height="2"><? if($i%2==0){ ?><img src="images/mobile/rs.gif" width="2" height="2"><? }else{?><img src="images/mobile/void.gif" width="2" height="2"><? }?></td> </tr> <tr> <td></td> <td> <table width="100%" border="0" cellspacing="1" cellpadding="0"> <tr> <td> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="3"> </td> <!--td width="20"><?=$aintID[$i]?></td--> <td><a href="#" onClick="MM_openBrWindow('user.php?action=user&id=<?=$aintID[$i]?>&name=<?=$astrName[$i]?>&type=<?=$astrType[$i]?>','','scrollbars=no,width=300,height=150,top='+((screen.height/2)-75)+',left='+((screen.width/2)-150));"><?=$astrName[$i]?></a></td> <td width="70" align="right"><?=$strTipo?></td> <td width="3"> </td> </tr> </table> </td> </tr> </table></td> <td></td> </tr> <tr> <td width="2" height="2"><? if($i%2==0){ ?><img src="images/mobile/li.gif" width="2" height="2"><? }else{?><img src="images/mobile/void.gif" width="2" height="2"><? }?></td> <td></td> <td width="2" height="2"><? if($i%2==0){ ?><img src="images/mobile/ri.gif" width="2" height="2"><? }else{?><img src="images/mobile/void.gif" width="2" height="2"><? }?></td> </tr></table></td> </tr> <? } ?> </table> <br> <button onClick="window.location = 'gateway.php?page=add_user'">adicionar</button></td> </tr> </table></td> </tr></table></td> </tr> </table><map name="Map"> <area shape="rect" coords="7,5,97,32" href="http://teco.fcc.univap.br/cc010115" target="_blank"></map></body></html> user.php<?PHPsession_start();require "core/user.core.php";$strAction = $_REQUEST["action"]==null ? "default" : $_REQUEST["action"];if ($strAction=="default"){ $strAction = $_SESSION["action"]==null ? "default" : $_SESSION["action"];}$userID = $_REQUEST["userid"]==null ? "-1" : $_REQUEST["userid"];$strAction = strtoupper($strAction);switch ($strAction) { case "NEW_USER": processNewUser(); break; case "USER": processUser(); break; case "LIST": processList(); break; case "CHANGE_TYPE": processChangeType(); break; case "CHANGE_PASSWORD": processChangePassword(); break; case "DELETE": processDelete(); break; case "LOGIN": processLogin(); break; case "LOGOUT": processLogout(); break; default: processDefault();}function processNewUser(){ if($_SESSION["USER_TYPE"]=="1"){ $strName = $_REQUEST["name"]==null ? "-1" : $_REQUEST["name"]; $strType = $_REQUEST["type"]==null ? "-1" : $_REQUEST["type"]; $strLogin = $_REQUEST["login"]==null ? "-1" : $_REQUEST["login"]; $strPassword = $_REQUEST["password"]==null ? "-1" : $_REQUEST["password"]; if($strLogin=="-1" || $strPassword=="-1"){ if($strLogin=="-1"){ $_SESSION["error_login"] = "Este campo é obrigatório!"; } if($strPassword=="-1"){ $_SESSION["error_password"] = "Este campo é obrigatório!"; } $_SESSION["page"] = "login"; forward("gateway.php"); } else { $asParams = array(); $asParams[0] = $strName; $asParams[1] = $strType; $asParams[2] = $strLogin; $asParams[3] = $strPassword; if(newuser($asParams)){ $_SESSION["action"] = "list"; forward("user.php"); } else { echo "error"; } } } else { processDefault(); }}function processList() { if($_SESSION["USER_TYPE"]=="1"){ $aintID = array(); $astrName = array(); $astrType = array(); list($aintID,$astrName,$astrType) = list_users(); $_SESSION["AID"] = $aintID; $_SESSION["ANAME"] = $astrName; $_SESSION["ATYPE"] = $astrType; $_SESSION["page"] = "list"; forward("gateway.php"); } else { processDefault(); }}function processChangeType(){ if($_SESSION["USER_TYPE"]=="1"){ $strID = $_REQUEST["id"]==null ? "-1" : $_REQUEST["id"]; $strType = $_REQUEST["type"]==null ? "-1" : $_REQUEST["type"]; $asParams = array(); $asParams[0] = $strID; $asParams[1] = $strType; if (change_type($asParams)){ ?> <script> window.opener.location = "user.php?action=list"; window.close(); </script> <? } else { ?> <script> alert("Este usuário não pode ser Alterado!") window.close(); </script> <? } } else { processDefault(); }}function processChangePassword(){ $strNewPassword = $_REQUEST["newpassword"]==null ? "-1" : $_REQUEST["newpassword"]; $strPassword = $_REQUEST["password"]==null ? "-1" : $_REQUEST["password"]; $strConfirmPassword = $_REQUEST["confirmpassword"]==null ? "-1" : $_REQUEST["confirmpassword"]; $asParams = array(); $asParams[0] = $strNewPassword; if ($strPassword == $_SESSION["MD5"]){ if($strPassword != $strConfirmPassword){ forward("gateway.php?page=change_password&cerror=Inválido"); } else { if (change_password($asParams)){ ?> <script> alert("Sua senha foi alterada com Sucesso!"); window.close(); </script> <? } else { ?> <script> alert("Erro ao alterar senha !"); window.close(); </script> <? } } } else { forward("gateway.php?page=change_password&error=Inválido"); }}function processDelete(){ if($_SESSION["USER_TYPE"]=="1"){ $strID = $_REQUEST["id"]==null ? "-1" : $_REQUEST["id"]; $asParams = array(); $asParams[0] = $strID; if (delete_user($asParams)){ ?> <script> window.opener.location = "user.php?action=list"; window.close(); </script> <? } else { ?> <script> alert("Este usuário não pode ser Removido!") window.close(); </script> <? } } else { processDefault(); } }function processUser(){ if($_SESSION["USER_TYPE"]=="1"){ $strID = $_REQUEST["id"]==null ? "-1" : $_REQUEST["id"]; $asParams = array(); $asParams[0] = $strID; list($intID,$strName,$strType,$strLogin) = get_user($asParams); forward("gateway.php?page=user&id=$intID&name=$strName&type=$strType&login=$strLogin"); } else { processDefault(); }}function processLogin(){ $strLogin = $_REQUEST["login"]==null ? "-1" : $_REQUEST["login"]; $strPassword = $_REQUEST["password"]==null ? "-1" : $_REQUEST["password"]; if($strLogin=="-1" || $strPassword=="-1"){ if($strLogin=="-1"){ $_SESSION["error_login"] = "Este campo é obrigatório!"; } if($strPassword=="-1"){ $_SESSION["error_password"] = "Este campo é obrigatório!"; } $_SESSION["page"] = "login"; forward("gateway.php"); } else { $asParams = array(); $asParams[0] = $strLogin; $asParams[1] = $strPassword; $bLogin = login($asParams); if($bLogin){ $_SESSION["msg"]="-1"; forward("survey.php?action=scheduling"); } else { $_SESSION["msg"] = "Login ou senha inválidos!<br>"; $_SESSION["page"] = "login"; forward("gateway.php"); } }}function processLogout(){ $_SESSION["STATUS"] = "-1"; $_SESSION["MD5"] = "-1"; $_SESSION["USER_TYPE"] = "-1"; forward("gateway.php");}function processDefault(){ forward("gateway.php");}function forward($url){ header("Location:".$url);}?> /pages/user.php<?PHPsession_start();$strPage = $_REQUEST["page"]==null ? "default" : $_REQUEST["page"];if ($strPage=="default"){ $strPage = $_SESSION["page"]==null ? "default" : $_SESSION["page"];}$strPage = strtoupper($strPage);define("HOME", "pages/home.php");define("LOGIN", "pages/login.php");define("LIST_USERS", "pages/list.php");define("USER", "pages/user.php");define("CHANGE_TYPE", "pages/change.php");define("CHANGE_PASSWORD", "pages/pass.php");define("ADD_USER", "pages/add.php");define("CREATE", "pages/create.php");define("SURVEY", "pages/survey.php");define("SCHEDULING", "pages/scheduling.php");define("RESPONSE", "pages/response.php");define("RESULT", "pages/result.php");define("ADD_QUESTION", "pages/add_question.php");define("ADD_QUESTION_BY_FILE", "pages/add_qusetion_by_file.php");if ($_SESSION["STATUS"]=="login"){ switch ($strPage) { case "LOGIN": goLogin(); break; case "LIST": goList(); break; case "USER": goUser(); break; case "CHANGE_TYPE": goChangeType(); break; case "CHANGE_PASSWORD": goChangePassword(); break; case "ADD_USER": goAddUser(); break; case "CREATE": goCreate(); break; case "SURVEY": goSurvey(); break; case "SCHEDULING": goScheduling(); break; case "RESULT": goResult(); break; case "RESPONSE": goResponse(); break; case "ADD_QUESTION": goAddQuestion(); break; case "ADD_QUESTIONS_BY_FILE": goAddQuestionsByFile(); break; default: goDefault(); }} else {goDefault();}function goLogin(){ forward(LOGIN);}function goList(){ forward(LIST_USERS);}function goAddUser(){ forward(ADD_USER);}function goUser(){ forward(USER);}function goChangeType(){ forward(CHANGE_TYPE);}function goChangePassword(){ forward(CHANGE_PASSWORD);}function goCreate(){ forward(CREATE);}function goSurvey(){ forward(SURVEY);}function goScheduling(){ forward(SCHEDULING);}function goResult(){ forward(RESULT);}function goResponse(){ forward(RESPONSE);}function goAddQuestion(){ forward(ADD_QUESTION);}function goAddQuestionsByFile(){ forward(ADD_QUESTION_BY_FILE);}function goDefault(){ forward(HOME);}function forward($url){ include $url;}?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><?$strName = $_REQUEST["name"]==null ? "default" : $_REQUEST["name"];$strID = $_REQUEST["id"]==null ? "-1" : $_REQUEST["id"];$strType = $_REQUEST["type"]==null ? "default" : $_REQUEST["type"];$strLogin = $_REQUEST["login"]==null ? "default" : $_REQUEST["login"]; switch ($strType) { case 1: $strTipo = "Administrador"; break; case 2: $strTipo = "Operador"; break; case 3: $strTipo = "Avaliador"; break; }?><html><head><title>fccSurvey | thevoiddesign</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style><!--BODY { scrollbar-face-color:#E0E0E0; scrollbar-arrow-color: #666666; scrollbar-track-color:#F1F1F1; scrollbar-shadow-color:#E0E0E0; scrollbar-highlight-color:#E0E0E0; scrollbar-3dlight-color:#FFFFFF; scrollbar-darkshadow-Color:#C0C0C0; margin: 0px; padding: 0px; background-color: #ffffff;}TD { font-family: Geneva, Verdana, Arial, Helvetica; font-size: 10px; color: #333333; text-decoration: none;}A { text-decoration: none; cursor: hand }A:link { color: #333333 }A:visited { color: #333333}A:hover { color: #009900}A:active { color: #333333 }BUTTON { background: #898989; border-bottom: 1px solid #434343; border-right: 1px solid #434343; border-left: 1px solid #707070; border-top:1px solid #707070; color:#FFFFFF; text-decoration:none; cursor: hand; font-family: Geneva, Verdana, Arial, Helvetica; font-size: 10px; text-transform: uppercase;}input{ height: 16px; font-family: Geneva, Verdana, Arial, Helvetica; font-size: 10px; color: #666666; border: 1px solid #989898;}.input{ font-family: Geneva, Verdana, Arial, Helvetica; font-size: 10px; color: #666666; border: 1px solid #989898;}.none{ font-family: Geneva, Verdana, Arial, Helvetica; font-size: 10px; color: #666666; border: 0px solid #989898;}--></style></head><body><table width="300" height="150" border="0" cellpadding="0" cellspacing="0"> <tr> <td height="29"><img src="images/t_user.gif" width="300" height="29"></td> </tr> <tr> <td height="121" valign="top"> <table width="300" height="121" border="0" cellpadding="10" cellspacing="0"> <tr> <td valign="top"><strong>Nome:</strong> <?=$strName?> <br> <strong>Login:</strong> <?=$strLogin?> <br> <strong>Tipo:</strong> <?=$strTipo?> </td> </tr> <tr> <td height="1" valign="bottom"> <button onClick="window.location = 'user.php?action=delete&id=<?=$strID?>'">remover</button> <button onClick="window.location = 'gateway.php?page=change_type&name=<?=$strName?>&id=<?=$strID?>'">trocar tipo</button></td> </tr> </table> </td> </tr></table></body></html> acredito q analizando esses códigos você pode tirar suas duvidasc quiser ver isso funcionando ta em http://teco.fcc.univap.br/~ec010238login: woodypass: testeespero ter ajudadothe void Na boa esse código está porcão. Compartilhar este post Link para o post Compartilhar em outros sites
hinom 5 Denunciar post Postado Novembro 25, 2003 emanuel fonseca, é só um exemplo bichooinc oinc Compartilhar este post Link para o post Compartilhar em outros sites
Alisson Rodrigues 3 Denunciar post Postado Novembro 25, 2003 Que exemplo heim, achei que tinha umas 50 respostas no tópico e quando vou ver, tá esse código aí hehe. :D Compartilhar este post Link para o post Compartilhar em outros sites
emanuel fonseca 0 Denunciar post Postado Novembro 26, 2003 emanuel fonseca, é só um exemplo bichooinc oinc por isso falei na boa q era porcão. ;) Compartilhar este post Link para o post Compartilhar em outros sites