Jump to content

session issue


popcornplya

Recommended Posts

Login.php

<?php
session_start();
if($_SESSION['logged_in']==true) {
header("Location: index.php");
exit;
}
$user = $_POST['user'];
$pass = md5($_POST['pass']);
if($user && $pass) {
include("config.php");
$user = mysql_real_escape_string($user);
$user = htmlentities($user);
$sql = mysql_query("SELECT * FROM `users` WHERE `username`='$user' && `password`='$pass'");
if(mysql_num_rows($sql)==1) {
	$_SESSION['logged_in']=true;
	$_SESSION['user']=$user;
	header("Location: index.php");
	exit;
} else {
	header("Location: index.php?e=1");
	exit;
}
} else {
header("Location: index.php");
}
?>

 

Other pages:

<?php
session_start();
if($_SESSION['logged_in']) {
echo '<p>Welcome, '.$_SESSION['user'].'</p>';
}
?>

Link to comment
https://forums.phpfreaks.com/topic/145261-session-issue/#findComment-762579
Share on other sites

How do you edit ini's on shared hosting?

Sorry I'm not a PHP pro so if I ask any stupid questions please excuse me.

 

I used godaddy before my friend got a dedicated server (free for me >:])...

 

In your root directory, make a new file called "php.ini" (in some cases, try "php5.ini")

Link to comment
https://forums.phpfreaks.com/topic/145261-session-issue/#findComment-762605
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.