Symbianize Forum

Most of our features and services are available only to members, so we encourage you to login or register a new account. Registration is free, fast and simple. You only need to provide a valid email. Being a member you'll gain access to all member forums and features, post a message to ask question or provide answer, and share or find resources related to mobile phones, tablets, computers, game consoles, and multimedia.

All that and more, so what are you waiting for, click the register button and join us now! Ito ang website na ginawa ng pinoy para sa pinoy!

PHP Chat !!

lambutan

Amateur
Advanced Member
Messages
113
Reaction score
0
Points
26
mga ka symbianize pa tulong nmn ohh may error ehh
balak ko lng sana mag gawa ng website tapos dadagdagan ko na lng kulang nyan


View attachment 308999

Eto po ung code.

index.php

<?php
require('includes/init.php');
if(check_login()==true){
header('location: chat/chat.php');
}
?>

<html>
<body>
<table>
<tr>
<form action="login.php" method="POST" >
<td>Enrollment:</td> <td><input type="text" name="user"></td>
</tr>
<tr>
<td>Password:</td> <td><input type="password" name="pass"></td>
</tr>
<tr>
<td></td><td><input type="submit" name="login" value="login"> or <a href='reg.php'>SignUp</a></td>
</tr>
</form>
</table>
</body>
</html>


init.php

<?php
session_start();
require('const.php');
require($db_file);

function check_login($username,$enroll) {
if(isset($_SESSION['username']) && isset($_SESSION['enroll'])) {
return true;
}
else
return false;
}

function get_username() {
return $_SESSION['username'];
}

function get_enroll() {
return $_SESSION['enroll'];
}
?>



const.php

<?php
define(DOC_DIR,dirname(__FILE__));
$db_file = DOC_DIR."/config.php";
?>
 

Attachments

  • Untitled.png
    Untitled.png
    124.1 KB · Views: 27
Try this:

<?php
define('DOC_DIR',dirname(__FILE__));
$db_file = DOC_DIR."/config.php";
?>


with quotes, at ano pala version ng PHP na gamit mo?
 
Back
Top Bottom