I am trying to create a PHP file each time a user registers my website. I use the following code to create the file in my register.php :
The thing is, my create file function works but the variable $data doesn't give any result. When I run that $data as a single variable in a different PHP file it still doesn't work.
What did I do wrong about setting the variable.
// STARTING to create a file
$my_file = "$username.php";
$handle = fopen("give/$my_file", 'w') or die('Cannot open file: '.$my_file);
//----------- BEGINNING OF THE PHP DATA TO WRITE TO NEW FILE ----------
$data = "<?
require('../config.inc.php');
$damned_user = $username;
if ( $_COOKIE['damn_given'] != TRUE ) {
$sql = mysql_query(\"SELECT * FROM users WHERE username='$damned_user' LIMIT 1\");
if(mysql_num_rows($sql) == 1){
$row = mysql_fetch_array($sql);
// $row['field'];
$damned_user_id = $row['id'];
if($_SESSION['id'] == $damned_user_id) {
} else {
$taken = $row['taken_damns'];
$taken_damns = $taken + 1;
$taking_sql = \"UPDATE users SET taken_damns='$taken_damns' WHERE username='$damned_user' \";
if (mysql_query($taking_sql)) {
setcookie(\"damn_given\", TRUE, time()+3600*24);
$date = date(\"Y-m-d H:i:s\");
$ip = $_SERVER['REMOTE_ADDR'];
$damns_table = \"INSERT INTO damns (id, from_ip, user_damned, when_damned) VALUES ('','$ip','$damned_user','$date') \";
if ( mysql_query($damns_table)) {
} else {
echo \"Couldn't save damn to damns table in database!\";
}
if ( $_SESSION['logged'] == TRUE ) {
$session_id = $_SESSION['id'];
$giving_sql = \"UPDATE users SET given_damns='$taken_damns' WHERE id='$session_id'\";
if ( mysql_query($giving_sql ) ) {
} else {
echo ('Error giving damn!');
}
}
}
else
{
die (\"Error taking damn!\");
}
}
} else {
die(\"Error first sql!\");
}
}
?>
<html>
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />
<link rel=\"stylesheet\" href=\"/_common.css\" />
<link rel=\"stylesheet\" href=\"/_col_white.css\" />
<link rel=\"shortcut icon\" href=\"/favicon.ico\" /> <title>DamnIt.tk - Damned!</title>
</head>
<body>
<div id=\"main\">
<div class=\"center\"><img src=\"/_bnr_white.png\" style=\"width: 500px; height: 100px;\" alt=\"DamnIt Banner\" /></div>
<table class=\"tmid\" style=\"width: 100%;\"><tr>
<td class=\"center\" style=\"width: 25%;\">Profile</td>
<td class=\"center\" style=\"width: 25%;\">Options</td>
<td class=\"center\" style=\"width: 25%;\">Stats</td>
<td class=\"center\" style=\"width: 25%;\">Log out</td>
</tr></table> <h1>Give a Damn</h1>
<?
if ( isset($_COOKIE['damn_given'])) {
?>
<h2>You have already given a Damn to <? echo $damned_user ?> today!</h2><h3>Couldn't damn - try again tomorrow.</h3>
<?
}
elseif ( $_SESSION['id'] == $damned_user_id ) {
?>
<h2>You cannot damn yourself!</h2>
<?
} else{ ?> <h2>Damn given!</h2><h3>You have given a Damn to <? echo $damned_user ?>.</h3> <? } ?>
</div></body>
</html>";
//------- END OF PHP WHICH MUST BE WRITTEN TO NEW FILE ---------
fwrite($handle, $data);
fclose($handle);
// finished with the file
Try NOWDOC:
$data = <<<'END'
Your PHP code here
END;
This will allow for any string, without need for escaping.
However, please consider what you're doing very carefully!
Also... you wouldn't happen to be trying to rip off this site of mine, would you? http://giveadamn.co.uk/
(source: giveadamn.co.uk)
Because if so, you're doing it wrong. .htaccess, mate ;)
RewriteEngine on
RewriteRule give/(.*) give.php?user=$1 [L]
Related
Does anyone have an example of php code to check to see if an Infusionsoft contact has a specific tag? I am using the following code to insert into Infusionsoft Campaign Builder image feature. The code is a file called buspass.php. After I scanned the image with the applied code it does not display the "Display the Route #'s" as echoed with the "If" statements. After the scan the image looks like this: image after QR Scan
Here's what I have:
<html>
<code>
<p><img style="display: block; margin-left: auto; margin-right:auto;" src="https://d1yoaun8syyxxt.cloudfront.net/ib945-9ac2eb8c510b-4ac6-b282-bcd4552812f1-v2" alt="TOPA LOGO" width="80%" /></p>
<?php
require_once("isdk.php");
$app = new iSDK;
// Establish Connnection
if ($app->cfgCon("ib945"));
// Confirm Connection with Date Display
date_default_timezone_set("America/Phoenix");
echo "<div align='center'><h2>Scanned on " . $currentDate =
date("Y/m/d # h:i:sa") . "<br/></h2></div>";
echo "<div align='center'><img src='https://d1yoaun8syyxxt.cloudfront.net/ib945-321c85f8-dafe-45a1-9388-ef7fb6b7b4ec-v2'/></div>";
// Call Infusiosoft Contact Information
$Id = $_REQUEST['id'];
$fname = $_REQUEST['fname'];
$lname = $_REQUEST['lname'];
$email = $_REQUEST['email'];
$phone1 = $_REQUEST['phone1'];
$sfname1 = $_REQUEST['sfname1'];
$slname1 = $_REQUEST['slname1'];
$sfname2 = $_REQUEST['sfname2'];
$slname2 = $_REQUEST['slname2'];
$sfname3 = $_REQUEST['sfname3'];
$slname3 = $_REQUEST['slname3'];
$sfname4 = $_REQUEST['sfname4'];
$slname4 = $_REQUEST['slname4'];
$sfname5 = $_REQUEST['sfname5'];
$slname5 = $_REQUEST['slname5'];
$sfname6 = $_REQUEST['sfname6'];
$slname6 = $_REQUEST['slname6'];
//Display Parent/Guardian Information
echo "<div align='center'><h1><u>PARENT/GUARDIAN INFORMATION:</u>
<br/><br/>
<div align='left'>Contact ID: $Id<br/>
Name: $fname $lname<br/>
Email: $email<br/>
Phone: $phone1<br/></h1></div>";
//Display Scholar Names
echo strtoupper ("<div align='center'><h1><u>BUS RIDER SCHOLAR
NAME(S):</u></h1></div>
<div align='left'><strong><font size='24'>$sfname1
$slname1<br/>$sfname2 $slname2<br/>$sfname3 $slname3<br/>$sfname4
$slname4<br/>$sfname5 $slname5<br/>$sfname6 $slname6</strong>
</div>");
//Display Route #'s
If($tagId == 1184 || $tagId == 1192) {
echo 'Route #1';
}
If($tagId == 1182 || $tagId == 1194) {
echo 'Route #2';
}
If($tagId == 1186 || $tagId == 1196) {
echo 'Route #3';
}
?>
<p><img style="display: block; margin-left: auto; margin-right:auto;" src="https://d1yoaun8syyxxt.cloudfront.net/ib945-585a8b93-7096-4240-b543-e40ffecc5699-v2" alt="Thumbs Up" width="60%" />
</code>
</html>
I am not sure what is in the QR Scan, but it looks like you are passing the information for the contact and other individuals in the URL, is that correct? It also looks like you are using the iSDK. If you have the iSDK files you should be able to use something like this:
If you need to get the contact information:
$app = new iSDK;
if (!$app->cfgCon("CONNNAME"))
exit;
$returnFields = array('Email', 'FirstName', 'LastName', 'Company');
$conDat = $app->dsLoad("Contact", $contact_id, $returnFields);
if (isset($conDat['Email'])){
$email = $conDat['Email'];
}
if (isset($conDat['FirstName'])){
$FirstName = $conDat['FirstName'];
}
if (isset($conDat['LastName'])){
$LastName = $conDat['LastName'];
}
if (isset($conDat['Company'])){
$Company = $conDat['Company'];
}
You can of course change the fields to what you need...
To get tags:
$app = new iSDK;
if (!$app->cfgCon("CONNNAME"))
exit;
$fields = array('Id', 'Groups');
$results = $app->loadCon($contact_id,$fields);
$BufferTEXT = "0,".$results['Groups'];
switch (true) {
case strpos($BufferTEXT,'1184') || strpos($BufferTEXT,'1192'):
echo 'Route #1';
break;
case strpos($BufferTEXT,'1182') || strpos($BufferTEXT,'1194'):
echo 'Route #1';
break;
case strpos($BufferTEXT,'1186') || strpos($BufferTEXT,'1196'):
echo 'Route #1';
break;
default:
echo 'No Assigned Route';
break;
}
The reason I use the $BufferTEXT, is because if your tag is the first one the strpos function won't catch it. So adding a 0, to the beginning of the array fixed it for me.
I did not test the code, I have used similar code in the past and it worked for me. I hope this points you in the right direction.
I actually test this code and it works, assuming you are actually connecting using your connection string, not just putting your application Id in the cfgCon and also that all the names and contactId is coming into the URL for the QR Code:
<html>
<code>
<p><img style="display: block; margin-left: auto; margin-right:auto;" src="https://d1yoaun8syyxxt.cloudfront.net/ib945-9ac2eb8c510b-4ac6-b282-bcd4552812f1-v2" alt="TOPA LOGO" width="80%" /></p>
<?php
include 'isdk.php';
$apiKey = 'YOURAPIKEY';
$secret = 'YOURSECRETKEY';
$app = new iSDK;
//I am assuming you have set up the connection string???
if (!$app->cfgCon("ib945"))
exit;
// Confirm Connection with Date Display
date_default_timezone_set("America/Phoenix");
echo "<div align='center'><h2>Scanned on " . $currentDate =
date("Y/m/d # h:i:sa") . "<br/></h2></div>";
echo "<div align='center'><img src='https://d1yoaun8syyxxt.cloudfront.net/ib945-321c85f8-dafe-45a1-9388-ef7fb6b7b4ec-v2'/></div>";
// Call Infusionsoft Contact Information
// I am assuming that you are passing this data in the url???
$Id = $_REQUEST['id'];
$fname = $_REQUEST['fname'];
$lname = $_REQUEST['lname'];
$email = $_REQUEST['email'];
$phone1 = $_REQUEST['phone1'];
$sfname1 = $_REQUEST['sfname1'];
$slname1 = $_REQUEST['slname1'];
$sfname2 = $_REQUEST['sfname2'];
$slname2 = $_REQUEST['slname2'];
$sfname3 = $_REQUEST['sfname3'];
$slname3 = $_REQUEST['slname3'];
$sfname4 = $_REQUEST['sfname4'];
$slname4 = $_REQUEST['slname4'];
$sfname5 = $_REQUEST['sfname5'];
$slname5 = $_REQUEST['slname5'];
$sfname6 = $_REQUEST['sfname6'];
$slname6 = $_REQUEST['slname6'];
//Display Parent/Guardian Information
echo "<div align='center'><h1><u>PARENT/GUARDIAN INFORMATION:</u>
<br/><br/>
<div align='left'>Contact ID: $Id<br/>
Name: $fname $lname<br/>
Email: $email<br/>
Phone: $phone1<br/></h1></div>";
//Display Scholar Names
echo strtoupper ("<div align='center'><h1><u>BUS RIDER SCHOLAR
NAME(S):</u></h1></div>
<div align='left'><strong><font size='24'>$sfname1
$slname1<br/>$sfname2 $slname2<br/>$sfname3 $slname3<br/>$sfname4
$slname4<br/>$sfname5 $slname5<br/>$sfname6 $slname6</strong>
</div>");
//Display Route #'s
$fields = array('Id', 'Groups');
$results = $app->loadCon($Id,$fields);
$BufferTEXT = "0,".$results['Groups'];
switch (true) {
case strpos($BufferTEXT,'1184') || strpos($BufferTEXT,'1192'):
echo 'Route #1';
break;
case strpos($BufferTEXT,'1182') || strpos($BufferTEXT,'1194'):
echo 'Route #2';
break;
case strpos($BufferTEXT,'1186') || strpos($BufferTEXT,'1196'):
echo 'Route #3';
break;
default:
echo 'No Assigned Route';
break;
}
?>
<p><img style="display: block; margin-left: auto; margin-right:auto;" src="https://d1yoaun8syyxxt.cloudfront.net/ib945-585a8b93-7096-4240-b543-e40ffecc5699-v2" alt="Thumbs Up" width="60%" />
</code>
</html>
I'm having a trouble with passing string while using include() function. I have index.php which serves as template file and is including any other pages.
For example, if I want to go to the home page, the address is http://somethingsomething.com/index.php?page=home and included file is pages/home.php. Bellow you can find how the template system works. I want to change of the page you're currently are but I don't know what is the best way to pass that string from the title of the page. So if I'm on the Catalogue page - http://somethingsomething.com/index.php?page=catalogue, it will include file pages/catalogue.php and I've tried to pass string as SESSION but it didn't worked. Could you please help me?
Source URL: http://somethingsomething.com/index.php?page=catalogue
index.php file
<html>
<head>
<title><?php echo $title; ?></title>
</head>
<body>
<h1>Welcome, world!</h1>
<?php
if (isset($_GET['page'])) {
$page = $_GET['page'];
} else {
$page = 'home';
}
if (preg_match('/^[a-z0-9]+$/', $page)) {
$insert = include('pages/' . $page . '.php');
if (!$insert) {
$insert = include('pages/error.php');
}
} else if (empty($page)) {
$insert = include('pages/error.php');
} else {
$insert = include('pages/error.php');
}
?>
</body>
</html>
pages/catalogue.php file
<?php
$title = "Catalogue";
?>
Something like this?
<?php
ob_start();
if (isset($_GET['page'])) {
$page = $_GET['page'];
} else {
$page = 'home';
}
if (preg_match('/^[a-z0-9]+$/', $page)) {
$insert = include('pages/' . $page . '.php');
if (!$insert) {
$insert = include('pages/error.php');
}
} else if (empty($page)) {
$insert = include('pages/error.php');
} else {
$insert = include('pages/error.php');
}
$output = ob_get_clean();
?>
<html>
<head>
<title><?php echo $title; ?></title>
</head>
<body>
<h1>Welcome, world!</h1>
<?php
echo $output;
?>
</body>
</html>
This question already has answers here:
Reference - What does this error mean in PHP?
(38 answers)
Closed 7 years ago.
I've try to read data from my database but I don't know what it don't work and show me that error
Notice: Array to string conversion in C:\Users\VladxD\Desktop\Xampp\htdocs\Web(workspace)\Test\show_animation.php on line 65
Here is my code:
MySQL_connect:
<?php
$dbhost = 'localhost';
$dbuser = 'root';
$dbpassword = '';
$conn = mysqli_connect($dbhost, $dbuser, $dbpassword, "portofoliu_database") or die ("<div id='err'>Could not connect:</div> ");
Code:
<?php session_start(); ?>
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Directory Contents</title>
<link rel="stylesheet" href="show_folder.css">
<link rel="stylesheet" href="NewFile.css">
</head>
<body>
<div id=wapper>
<?php include 'Menu.php';
include 'MySQL_connect.php'; ?>
<div class="box">
<div id="container">
<table class="sortable">
<thead>
<tr>
<th>File name</th>
<th>Uplaod time</th>
</tr>
</thead>
<tbody>
<?php
// Opens directory
$user = #$_SESSION ['account'];
$dir = #$_SESSION ['account'] . '/image/';
if (is_dir($dir) == true) {
$myDirectory = opendir($dir);
// Gets each entry
while ($entryName = readdir($myDirectory)) {
$dirArray [] = $entryName;
}
// Closes directory
closedir($myDirectory);
// Counts elements in array
$indexCount = count($dirArray);
// Sorts files
sort($dirArray);
// Loops through the array of files
for ($index = 0; $index < $indexCount; $index++) {
// Allows ./?hidden to show hidden files
if ($_SERVER ['QUERY_STRING'] == "hidden") {
$hide = "";
} else {
$hide = ".";
}
//-------------------------------------------------------------------------------------------------
//$modtime=date("M j Y g:i A", filemtime($dir.$dirArray[$index]));
$modtime_test = mysqli_query($conn, "SELECT file_upload_time FROM users WHERE file_name ='$dirArray[$index]'");
$modtime = mysqli_fetch_assoc($modtime_test);
$timekey = date("YmdHis", filemtime($dir . $dirArray[$index]));
//-------------------------------------------------------------------------------------------------
if (substr($dirArray [$index], 0, 1) != $hide) {
// Gets File Names
$name = $dirArray [$index];
// Print 'em
echo "
<tr class='file'>
<td><a href=#' onclick='showImage(\"$index\")'>$name</a></td>
<td sorttable_customkey='$timekey'><a href='#'>$modtime</a></td>
</tr>";
}
}
}
?>
</tbody>
</table>
</div>
<div id="imageHolder">
<?php if (is_dir($dir) == false)
echo("<div id = 'noFile'>Your folder it's empty, upload file</div>");
?>
<script>
var array = [
<?php
foreach ($dirArray as $item)
{
echo "\"$dir{$item}\",";
}
?>
];
function showImage(index) {
var url = array[index];
url = "<img src='" + url + "'>";
document.getElementById("imageHolder").innerHTML = url;
}
</script>
</div>
</div>
</div>
</body>
</html>
I want to get my data time from my database and show it on my folder
Here is my element from database: http://i.imgur.com/kYciFQJ.png
and here are my site: http://i.imgur.com/HeEv1yG.png
If you see below "Upload time" I have this text "Array" but I want to get me data time from my database and put there.
As mysqli_fetch_assoc returns an array, not a single value, even if there is a single field being returned... try changing
$modtime = mysqli_fetch_assoc($modtime_test);
to
$results = mysqli_fetch_assoc($modtime_test);
$modtime = $results["file_upload_time"];
You have a PHP notice, "PHP array to string conversion".
<tr class='file'>
<td><a href=#' onclick='showImage(\"$index\")'>$name</a></td>
<td sorttable_customkey='$timekey'><a href='#'>$modtime</a></td>
</tr>";
In that code $modtime is array. You need to use $modtime['file_upload_time'].
I have looked around the web on how to scrape all headings (h1 to h6) with content. Like this <h2>Some Heading</h2>, <h4>Some Heading</h4>. I have even looked at file_get_html() which PHP does not recognize. The code I have written so far lets you see the content but with out the h1 tags. I am new to this so if anyone can help me I would appreciate it. Here is my code I have now:
<html>
<head>
<title></title>
</head>
<body>
<?php
$theurl = "http://www.msn.com";
if(!($contents=file_get_contents($theurl)))
{
echo 'Could not open URL';
exit;
}else{
echo "The $theurl is open <br />";
}
$pattern = "/<h[1-6]>(.*?)<\/h[1-6]>/si";
$found = preg_match_all($pattern,$contents,$matches);
if(is_array($matches) && count($matches) >= 1){
echo "Scraping $theurl<br />";
for($i = 1; $i <= $found - 1; $i++){
echo $matches[0][$i];
}
}else{
echo "No heading found";
}
?>
</body>
</html>
EDIT: My below example is more of a post-redirect-get than a MVC
I am reading a lot about correct structure for my page, MVC pattern, frameworks etc. and yet I am confused which parts of my page best fit under the description of model, of view and which of controller. Now before you downvote I did a lot of research already to separate my logic and make my simple page, I just need a confirmation that I am doing it right, what to fix/separate, which page is what according to MVC and where would I link or include index.php? I am not asking much I hope just for a quick glance at my code.
I will provide 3 different pages I built in order they are initialized as an example:
html form, also displays processed data user starts here:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Vaški gozd</title>
<link href="../html/css/base.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php if(!$_POST and $poskodbe != '0') { ?>
<p>Presenetil<?php text($spol); ?> te je <?php text($monster); ?> !</p>
<form action='../php/gozd.php' method='post'>
<input type='submit' name='action' value='Napadi' /> ali
<input type='submit' name='action' value='Pobegni' />
<input type='hidden' name='monster' value= '<?php text($monster); ?>' />
</form>
<?php }
else if ($poskodbe == '0'){text($moznost); ?>
<p><a href='../php/start.php'>Odpravi se proti domu</a></p>
<?php }
else { ?>
<ul><?php foreach ($combat as $turns => $i) { ?>
<li> <p><strong><?php text($i['napadalec']); ?></strong>
<?php text(' napade '); ?><strong><?php text($i['branilec']); ?></strong>
<?php text(' in mu napravi poškodbe za ') ?><strong><?php text($i['damage']); ?></strong>
<?php text(' točk zdravja '); } ?> </p></li>
</ul>
<?php if(isset ($zmaga)) { ?>
<p>Pregnal si <strong><?php text($monster_ime); ?></strong>!
V naglici je za seboj pustil <strong><?php text($cekini); ?></strong> cekinov, ki jih seveda pobereš.</p>
<p><a href='../php/gozd.php'>Raziskuj dalje</a></p>
<?php } ?>
<?php if(isset ($zguba)) { ?>
<p>Podlegel si poškodbam <strong><?php text($monster_ime); ?></strong>.</p>
<?php } ?>
<p><a href='../php/start.php'>Odpravi se proti domu</a></p>
<?php } ?>
</body>
</html>
php that processes data and returns results:
<?php
session_start();
include 'config.php';
include 'stats.php';
$igralec_ime = $_SESSION['username'];
$_SESSION['poskodbe'] = ($poskodbe = prikazi_stat('curhp', $igralec_ime));
if ($poskodbe == '0') {$_SESSION['moznost'] = ($moznost = 'Tvoje zdravje je resno ogroženo, vrni se domov!');}
else {
if ($_POST) {
if($_POST['action'] == 'Napadi') {
$igralec = array (
'ime' => $igralec_ime,
'napad' => prikazi_stat('ofe',$igralec_ime),
'obramba' => prikazi_stat('def',$igralec_ime),
'curhp' => prikazi_stat('curhp',$igralec_ime)
);
$monster_ime = $_POST['monster'];
$monster = array (
'ime' => $monster_ime,
'napad' => prikazi_monster_stat('ofe',$monster_ime),
'obramba' => prikazi_monster_stat('def',$monster_ime),
'curhp' => prikazi_monster_stat('maxhp',$monster_ime)
);
$combat = array();
$turns = 0;
while($igralec['curhp'] > 0 && $monster['curhp'] > 0) {
if($turns % 2 != 0) {
$napadalec = &$monster;
$branilec = &$igralec; }
else {
$napadalec = &$igralec;
$branilec = &$monster; }
$damage = 0;
if($napadalec['napad'] > $branilec['obramba']) {
$damage = $napadalec['napad'] - $branilec['obramba']; }
$branilec['curhp'] -= $damage;
$combat[$turns] = array(
'napadalec' => $napadalec['ime'],
'branilec' => $branilec['ime'],
'damage' => $damage
);
$turns++; }
update_stat('curhp',$igralec_ime,$igralec['curhp']);
if($igralec['curhp'] > 0) {
update_stat('cek',$igralec_ime,prikazi_stat('cek',$igralec_ime)+ prikazi_monster_stat('cek',$monster_ime));
$zmaga = 1;
$cekini = prikazi_monster_stat('cek',$monster_ime); }
else {
if ($igralec['curhp'] <0) {update_stat('curhp', $igralec_ime, '0'); }
$zguba = 1; } }
else {
header('Location:../php/start.php');
exit;
}
}
else {
$query = sprintf("SELECT ime, spol FROM monsters ORDER BY RAND() LIMIT 1");
$result = mysql_query($query);
list($monster, $spol) = mysql_fetch_row($result);
}
}
$_SESSION['moznost'] = $moznost;
$_SESSION['monster'] = $monster;
$_SESSION['spol'] = $spol;
$_SESSION['poskodbe'] = $poskodbe;
$_SESSION['combat'] = $combat;
$_SESSION['turns'] = $turns;
$_SESSION['zmaga'] = $zmaga;
$_SESSION['zguba'] = $zguba;
$_SESSION['monster_ime'] = $monster_ime;
$_SESSION['cekini'] = $cekini;
$_SESSION['post'] = $_POST;
header('Location:../php/gozd_kontroler.php',true,303);
exit;
?>
php page that has included html page from earlier and to which my data manipulating php script redirects to display results:
<?php
session_start();
include 'razno.php';
$monster = $_SESSION['monster'];
$spol = $_SESSION['spol'];
$poskodbe = $_SESSION['poskodbe'];
$moznost = $_SESSION['moznost'];
$combat = $_SESSION['combat'];
$turns = $_SESSION['turns'];
$zmaga = $_SESSION['zmaga'];
$zguba = $_SESSION['zguba'];
$monster_ime = $_SESSION['monster_ime'];
$cekini = $_SESSION['cekini'];
$_POST = $_SESSION['post'];
include '../html/gozd.html';
?>
Which page is which acording to model-view-controller? Am I doing it right at all? Where would I link or include index.php?
Which page is which according to model-view-controller?
A page is a page. It isn't part of MVC, it is built using MVC.
The view is the class that (given some data) generates whatever is sent to the client (usually HTML).
The model is the class that operates on the data. It talks to your database or other data store.
The controller is the class that looks at the URL, decides which models and views are right for it and exchanges data between the submitted data, the models and the view.
Am I doing it right at all?
No
Where would I link or include index.php?
Your index page should just bootstrap your controller class.