<?php
ini_set("log_errors", 1);
ini_set("error_log", "errorlog.log");
$recid= $_POST['recid'];
$username = $_POST['name'];
$email = $_POST['email'];
$ownername = $_POST['ownername'];
include ("connection.php");
$result = $db->query("UPDATE users SET verified='y' WHERE recid='$recid'");
$filename = str_replace(" ","_", trim($username) );
mkdir("Business_Pages/". $filename."/");
$jquery = "<script src='http://code.jquery.com/jquery-1.9.1.min.js'> </script>";
$jqueryui = "<script src='http://code.jquery.com/ui/1.10.2/jquery-ui.js'> </script>";
$jquerycss = "<link rel='stylesheet' href='http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css'>";
$postdata = "<script src='../../Scripts/postdata.js'> </script>";
$pagecss = "<link rel='stylesheet' href='../../CSS/businesspages.css'>";
$wclogo = "<img src='../../wc.png' id='wc'>";
$postinput = "<input type='text' id='post' placeholder='Post' name='post'>";
$postdate = "<input type='text' id='date' placeholder='Enter Date' name='date'>";
$accountinfo = "<table id='accountinfo'> <tr> <td> <img src='../../testresteraunt.png' id='testresteraunt'> </td> </tr> <tr> <td> $username </td> </tr> <tr> <td> $ownername </td> </tr> </table>";
$links = "<table id='links'> <tr> <td> </td> <td> </td> </tr> </table> <div id='header'>";
$fp = fopen("Business_Pages/". $filename . "/" . $filename . ".html", "w");
fwrite($fp,"<?php session_start()");
fwrite($fp,"if(isset($_SESSION['id'])) { ?>");
fwrite($fp,"<!DOCTYPE html> <html> <head>");
fwrite($fp,"</head>");
fwrite($fp,"<body>");
fwrite($fp,"</body> </html>");
fwrite($fp,"<?php } ?>");
fclose($fp);
$to = "$email";
$subject = "Account Creation";
$message = "Congratulations you have been accepted to Wolfeboro Connection";
$from = "info@wolfeboroconnection.com";
$headers = "From:" . $from;
mail($to, $subject, $message, $headers)
?>
我试图只显示html会话是否有效但是php说它是一个意外的if语句和
解析错误:语法错误,意外T_ENCAPSED_AND_WHITESPACE,预期 /home/content/96/10688096/html/verify.php 中的T_STRING或T_VARIABLE或T_NUM_STRING 37
提前致谢
答案 0 :(得分:2)
如果您尝试在浏览器上显示该页面,那么您应该执行以下操作,而不是编写该文件然后再显示该文件。只需将下面的代码写入要检查会话的文件中即可。
<?php
session_start();
if( isset($_SESSION['id'])) {
?>
<!DOCTYPE html>
<html>
<head>
</head>
<body></body> </html>
<?php } ?>
希望它有所帮助。
好的我发现了错误..请查看以下行
fwrite($fp,"if(isset(".$_SESSION['id'].")) { ?>");
将它放在您的代码中,它应该正常工作..如果出现任何进一步的问题,请告诉我......
嘿,这是我在我的机器上尝试过的最新代码,它运行起来......看看它,让我知道结果..
<?php
ini_set("log_errors", 1);
ini_set("error_log", "errorlog.log");
$fp = fopen("newtest.php", "w");
fwrite($fp,"<?php session_start();");
fwrite($fp,"if(isset(\$_SESSION['id'])) { ?>");
fwrite($fp,"<!DOCTYPE html> <html> <head>");
fwrite($fp,"</head>");
fwrite($fp,"<body>");
fwrite($fp,"</body> </html>");
fwrite($fp,"<?php } ?>");
fclose($fp);
?>
希望它有所帮助。
答案 1 :(得分:1)
这是错误的
if( isset($_SESSION=['id')) {
你有不想要的=签名
试试这个
if( isset($_SESSION['id'])) {