Jump to content
Fórum Script Brasil
  • 0

PHP em pagina java scrypt


MGProjects

Question

como faço para abrir um php em uma pagina com java scrypt e ele não exibir meu codigo?

semttuloupf.jpg

codigo do index em HTML.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<title>templates</title>

<link rel="stylesheet" type="text/css" media="screen" href="style.css" />

&lt;script src="js/AC_RunActiveContent.js" type="text/javascript"></script>

&lt;script src="js/jquery142.js" type="text/javascript"></script>

&lt;script src="js/sound.js" type="text/javascript"></script>

&lt;script src="js/main.js" type="text/javascript"></script>

<!--BEGIN OF TERMS OF USE. DO NOT EDIT OR DELETE THESE LINES. IF YOU EDIT OR DELETE THESE LINES AN ALERT MESSAGE MAY APPEAR WHEN TEMPLATE WILL BE ONLINE-->

<style>#free-flash-header a,#free-flash-header a:hover {color:#FFFFFF;}#free-flash-header a:hover {text-decoration:none}</style>

<!--END OF TERMS OF USE-->

<!--[if lt IE 8]>

<style type=text/css">

<!--

#free-flash-header {bottom: 115px;}

-->

</style>

<![endif]-->

</head>

<body>

<div id="body">

<div id="holder">

<!--BEGIN OF TERMS OF USE. DO NOT EDIT OR DELETE THESE LINES. IF YOU EDIT OR DELETE THESE LINES AN ALERT MESSAGE MAY APPEAR WHEN TEMPLATE WILL BE ONLINE-->

<div id="copy" style="height: 75px; position: absolute; bottom: 0px; left:0px; border: none; width: 100%;">

<div id="free-flash-header" style="width:820px;margin:0 auto;text-align:right;position:relative;bottom:0px;margin-top:63px;color:#FFFFFF;font-size:10px;font-family:Verdana"></div>

</div>

<!--END OF TERMS OF USE-->

<div id="frame">

<!-- MENU -->

<div id="big_menu">

<table>

<tr>

<td><a href="java script:showPage('_home.htm', '');"> Home </a> </td>

<td><a href="java script:showPage('reg.php', '');"> Registration </a> </td>

<td><a href="java script:showPage('_forum.htm', '');"> SERVER RATES</a></td>

<td><a href="java script:showPage('_serveur.htm', '');"> PLAYERS INFO</a> </td>

<td><a href="java script:showPage('_serveur.htm', '');"> FORUM </a> </td>

</tr>

</table>

</div>

<!-- MENU END -->

<!-- HEADER -->

<div id="header">

<div id="header_id"></div>

&lt;script type="text/javascript">

var hasRightVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);

if(hasRightVersion) {

myFlashHeader('flash/header',900,500,'#000000','header_id','custom.xml');

}

else {

alert("Your version of Flash player is rather old. We suggest you to upgrade your Flash player to version "+requiredMinorVersion+" (at least).The latest version can be downloaded here : http://www.adobe.com/shockwave/download/do...eFlash.");

}

</script>

</div>

<!-- HEADER END -->

<div class="clear"> </div>

<div id="border">

<div id="content">

<!-- MENU LEFT -->

<div id="left_menu">

<div class="little_menu">

<div>

<h1>Movie</h1>

<ul>

<li></li>

<li></li>

<li></li>

</ul>

</div>

<div>

<h1>MGP Silkroad Online</h1>

<ul>

<li></li>

<li></li>

<li></li>

<li></li>

</ul>

</div>

</div>

</div>

<!-- MENU LEFT END -->

<!-- CONTENT BLOCK -->

<div class="dynamicContent"></div>

<!-- BLOCK CONTENT END -->

<!-- MENU RIGHT -->

<div id="right_menu">

<div class="little_menu">

<div>

<h1>Activity</h1>

<p>&nbsp;</p>

</div>

</div>

</div>

<!-- MENU RIGHT END -->

</div>

<div class=" clear"> </div>

</div>

<!-- FOOTER -->

<div id="footer"> <span class="copyright">MGProjects&reg; Copyright &copy; 2011..</span></div><br/>

<!-- FOOTER END -->

</div>

<!-- FRAME END -->

</div>

<!-- HOLDER END -->

</div>

</body>

</html>

codigo do php

&lt;script type="text/javascript">

alert("<?php echo "olá"; ?>");

</script>

<head>

<link rel="shourtcut icon" href="favicon.ico">

<STYLE TYPE="text/css">@import url(style.css);</STYLE>

<title>MGPSro - Registration</title>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<meta name="description" content="EGSRO Private Server">

<head>

<link rel="shourtcut icon" href="favicon.ico">

<STYLE TYPE="text/css">@import url(style.css);</STYLE>

<title>MGPSro</title>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<meta name="description" content="EGSRO Private Server">

</head>

<body>

<div align="center">

<tr>

<td style="width: 10px">&nbsp;</td>

<?php

/* Simple registration page for silkroad server, by Chernobyl

* Settings are at _inc/config.php

* If you get an mssql connection error, while defining totally correct data

* Just use older ntwdblib.dll for your webserver

*/

require_once('_inc/security.class.php');

require_once('_inc/config.php');

if(!isset($_POST['submit]))

{

echo "<form method='post'>

<table border='0' align='center'>

<br><br><br><br><br><br><br><br><br><br><br><br><br>

<td><td align='center'><h1>Username:</td><td><input type='text' name='username' maxlength='16'></td><tr/>

<td><td align='center'><h1>Password:</td><td><input type='password' name='pw1' maxlength='32'></td><tr/>

<td><td align='center'><h1>Password again:</td><td><input type='password' name='pw2' maxlength='32'></td><tr/>

<td><td align='center'><h1></td><td><input type='submit' name='submit' value='Register'></td>

</form>

</table>";

}

else

{

if(strlen($_POST['username']) < 3) $msg[] = "Username too short";

if(strlen($_POST['username']) > 16)$msg[] = "Username too long";

if(strlen($_POST['pw1']) < 6) $msg[] = "<h1>Password too short";

if(strlen($_POST['pw1']) > 32)$msg[] = "<h1>Password too long";

if(strlen($_POST['pw2']) < 6) $msg[] = "<h1>Password too short";

if(strlen($_POST['pw2']) > 32) $msg[] = "<h1>Password too long";

if($_POST['pw1'] != $_POST['pw2']) $msg[] = "<h1>Passwords do not match";

$sec = new security();

if($sec->is_secure($_POST['username']) == false) $msg[] = "Username contains forbidden symbols";

if($sec->is_secure($_POST['pw1']) == false) $msg[] = "<h1>Passwords contains forbidden symbols";

if($sec->is_secure($_POST['pw2']) == false) $msg[] = "<h1>Passwords do not match";

if(count($msg) > 0)

{

for($i = 0; $i < count($msg); $i++)

{

echo $msg[$i]."<br/>";

}

return;

}

else

{

//checking damn mssql stuff

$accountExists = mssql_num_rows(mssql_query("select StrUserID from TB_User where StrUserID=$_POST[username]'"));

if($accountExists > 0) echo "<h1>User name already used<br/>";

else

{

$pwd = md5($_POST['pw1]);

mssql_query("insert into TB_User(StrUserID,password,sec_primary,sec_content) values('$_POST[username]','$pwd','3','3')");

echo "<h1>Account successfully created<br/>";

}

}

}

?>

Edited by MGProjects
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Neste trecho, ao invés de usar echo use o a tag de fechar php para mostrar o que é estritamente html e abra a tag php novamente.

if(!isset($_POST['submit']))
{
    ?>
    <form method='post'>
    <table border='0' align='center'>
    <br><br><br><br><br><br><br><br><br><br><br><br><br>
    <td><td align='center'><h1>Username:</td><td><input type='text' name='username' maxlength='16'></td><tr/>
    <td><td align='center'><h1>Password:</td><td><input type='password' name='pw1' maxlength='32'></td><tr/>
    <td><td align='center'><h1>Password again:</td><td><input type='password' name='pw2' maxlength='32'></td><tr/>
    <td><td align='center'><h1></td><td><input type='submit' name='submit' value='Register'></td>
    </form>
    </table>
    <?php
}

Outra coisa, o html aí tá todo errado, precisa corrigir, tem tag que abre e não fecha e tags aninhadas que fecham de forma incorreta.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...