Football Fans: Download the 2012 Schedule App from Google Play!


Go Back   Android Forums > Android Development > Application Development

Application Development Dev Lounge for the Coder Folks



Reply
 
LinkBack Thread Tools
Old December 8th, 2011, 12:41 AM   #1 (permalink)
New Member
 
Join Date: Apr 2011
Posts: 2
 
Device(s):
Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation [Problem]Session in PHP server for Android app

I am trying to create a session to retrieve the login username for further usage, which is to create a directory name based on the login username. It is an app connect to the php server I am able to connect to the database. Login successfully. Creating the directory is successful too(in separated android project)

When I try to add in session_start in the mkdir.php file. My login failed (even the individual project which contains the login function ONLY to the same database failed.)Login only works again once I remove the session_start from mkdir.php).Not only that, the app which contains login function is force to close.Other apps related to the same database was affected too.

Please guide.The problem is on the mkdir.php I guess

FAILED: mkdir.php
PHP Code:
<?php 
include "Header.php";
include 
"localhost.php"
include 
"main.php"

$path $_Session['username'].$_POST['Case_no'];
mkdir($path);

?>
Header.php
PHP Code:
<?php   session_start();
include 
"localhost.php"

if(!isset(
$_SESSION['username']))
{
    
?>
     <a href="Login.php" />Login </a>
    <?
}
else 
{
  echo 
"welcome ".$_SESSION['username'];

  
?>
   <a href="Logout.php" />Logout </a>
  <?
}

     
?>
localhost.php is the connection to the database(it works)

main.php
PHP Code:
<?php require_once('localhost.php'); mysql_select_db($database_localhost,$localhost);



$username $_POST['UserEmail'];

$password $_POST['Password'];



$query_search "select * from tbl_user where username = '".$username."' AND password = '".$password"'";

$query_exec mysql_query($query_search) or die(mysql_error());

$rows mysql_num_rows($query_exec);

$_SESSION['username']=$username;


?>
SUCCESSFUL :mkdir.php

PHP Code:
<?php
$path 
$_POST['Case_no'];
mkdir($path);

?>

peacefreezer is offline  
Reply With Quote
Sponsors
Reply

Bookmarks

Tags
android 2.2, php server


Go Back   Android Forums > Android Development > Application Development User CP
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -5. The time now is 11:52 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Custom vBulletin Skins by: Relivo