Jump to content

Worst PHP experience :(


captaintyson

Recommended Posts

session_start() does not have an index, You know, I may have to say your server is at fault, I've never seen session cookies stored at /var/php_sessions before, and if you're truly not sending content before the header, then it makes no sense to show the error it has.

 

Try using ob_start(); before session_start(); , to start output buffering and possibly fix bandaid the session setting problem.

Link to comment
Share on other sites

Shoulda listened to my friends when they say dont buy from ipage.com... The deal is too good to be true :P

 

Yep, it seems it's just some weird server problem, many servers are misconfigured (as yours, is setting default folders to non-default areas, which are clearly not built right). Whois:  "ipage.com is associated with about 605 domains"

 

Appears they're not as big as they put out to be..

 

(Did you try Thorpe's code up there btw)?

Link to comment
Share on other sites

Check login:

<?php
$host="asdfasdf.asdf.com"; // Host name 
$username="adsf"; // Mysql username 
$password="asdfadsf"; // Mysql password 
$db_name="asdf"; // Database name 


// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
mysql_select_db("$db_name")or die("cannot select DB");

// username and password sent from signup form 
$PID = $_POST['PID']; 
$pwd = $_POST['password'];



$sql="SELECT * FROM `Roster` WHERE PID=$PID and pwd=$pwd";
$result=mysql_query($sql) or die(mysql_error());

// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row

if($count > 0){
// Register $myusername, $mypassword and redirect to file "login_success.php"
$_SESSION['PID'] = $PID;
$_SESSION['pwd'] = $pwd;
header("location:login_success.php");
echo 'Login Worked';
}
else {
mysql_error();
header("location:index.php?page=crew");;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Loading</title>
</head>

<body>
</body>
</html>

You're not calling session_start for check login. You need to call session_start() at the top of the script, eg

 

<?php
session_start();
$host="asdfasdf.asdf.com"; // Host name 
... 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

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

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

×
×
  • 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.