1
nuker
help with php config between MDK10 and FC3
  • 2004/12/2 16:36

  • nuker

  • Not too shy to talk

  • Posts: 129

  • Since: 2002/12/14


Is there any significant differences between Fedora Core 3 and Mandrake 10 in their packaged implementations of php?

I have a web app which I developed in the LAMP environment using Mandrake 10. But we plan on hosting it on FC3.

We have come across problems when running the script in the FC3 setup. There seems to be problems with how the variables are handled after posting in a form.

What should I be looking for to make this work on FC3? I suspect there is a setting in php.ini but I can’t find where it may be.

i've matched the settings in php.ini from mdk to fc3. maybe i missed something?

any help would be appreciated.

common error i get is:

Notice: Undefined variable: uname in /server/www/fedora/validate.php on line 71

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /server/www/fedora/validate.php:71) in /server/www/fedora/validate.php on line 98

2
Mithrandir
Re: help with php config between MDK10 and FC3

what is that validate.php file?

3
nuker
Re: help with php config between MDK10 and FC3
  • 2004/12/2 17:58

  • nuker

  • Not too shy to talk

  • Posts: 129

  • Since: 2002/12/14


it a file in the app that was written.

should i be attaching the file(s) with the post?

4
nuker
Re: help with php config between MDK10 and FC3
  • 2004/12/2 18:39

  • nuker

  • Not too shy to talk

  • Posts: 129

  • Since: 2002/12/14


here's the code for validate.php

include("appConfig.php");

header("Pragma: ");
header("Cache-Control: ");
header("Expires: Mon, 26 Jul 2004 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate, proxy-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
//set global variables
//global $username,$password;$dept_code;$level;


//The Login Page --> where the user goes according to their levels.

$login_page = "index.php";

$sucess_admin_page = "admin.php"; //First level
$sucess_department_page ="department.php"; // department level
$sucess_workgroup_page = "workgroup.php"; // workgroup level
$sucess_subWorkgroup_page ="subworkgroup.php";// sub workgroup level
$sucess_suspended_page ="4.php";// sub workgroup level

$validate_path ="/temp/users/validate.php";

// ERROR messages

$login_err = ' <div align="center"><font color=red> Your User Name Or Password was incorrect </font></b></div>';

$empty_err = '<div align="center"><b>You need to login with your User Name and Password</b></div>';
//something entered that wasn't a letter or number error message
$chr_err = '<div align="center"><b>You have to enter valid characters.</b></div>';


//if the form is empty and the cookie isn't set
//then display error message the return to login
if($username == "" && $password == "" && !isset($this_cookie)){
print($empty_err);
include($login_page);
exit();
}

//if the form is not empty and the cookie isn't set
//then make sure that only letters and numbers are entered
//if there are then display error message the return to login
if($username != "" || $password != "" && !isset($this_cookie)){
if (preg_match ("/[^a-zA-Z0-9]/", $username.$password)){
print($chr_err);
include($login_page);
exit();
}
}

//if the cookie isn't set
if (!isset($this_cookie) ){
$user_count = count($uname);
$user_exists = false;
// check through all the users to see if they exist
$get_list = "SELECT username, password, accessLevel, Dept_Code, EMP_NUM FROM members WHERE username= '$username' AND password ='$password'";

$get_list_res = mysql_query($get_list) or die(mysql_error());
if (mysql_num_rows($get_list_res) > 0) {
$recs = mysql_fetch_array($get_list_res);
$username = $recs['username'];
$password = $recs['password'];
$level = $recs['accessLevel'];
$dept_codex = $recs['Dept_Code'];
$emp_num2 = $recs['EMP_NUM'];
$user_exists = true;

}

if(!$user_exists){


print ($login_err);
include($login_page);
exit();
}
//if the login is correct then set the cookie
$cookie_val=crypt($uname[$user_id]);
//set the cookie so it dies when the browser is closed
session_start();
$_SESSION[username] = $username;
$_SESSION[dept_codex] = $dept_codex;
$_SESSION[level] = $level;
$_SESSION[password] = $password;
$_SESSION[emp_num2] = $emp_num2;

setcookie("this_cookie", $cookie_val, 0);

// Log the user
$hostname = 'localhost';
$dbname = "trainingreport1";
$dbusername = 'likitung';
$dbpassword = '3l3ctr0d3';
$id_link = mysql_connect("localhost", "$dbusername", "$dbpassword")
or die(mysql_error());
mysql_select_db($dbname,$id_link) or die(mysql_error());
$log ="User Login ";
$Query="INSERT INTO systeLog(date, user, action, time, dept_code)VALUES(now(), '$username', '$log', curtime(),$dept_codex)";
mysql_query($Query,$id_link) or die(mysql_error());


if($level==1)
{
header("Location: $sucess_suspended_page");
}
else if($level ==5)
{
header("Location: $sucess_subWorkgroup_page");

}
else if($level ==10)
{
header("Location: $sucess_workgroup_page");

}
else if($level==15)
{
header("Location: $sucess_department_page");
}
else if($level == 20)
{
header("Location: $sucess_admin_page");
}

}


//if a user tries to access validate.php directly and they are logged in
if($REQUEST_URI == $validate_path){
echo "<html>\n<head>\n";
echo "<title>Yor are logged in</title>\n";
echo "</head>\n";
echo "<body bgcolor=\"white\">\n";
echo "You are logged in. <a href=\"".$success_page."\">Continue</a>\n";
echo "</body>\n";
echo "</html>\n";
}



?>

5
Mithrandir
Re: help with php config between MDK10 and FC3

Looks like it relies on the php.ini setting "register_globals" being ON - something XOOPS doesn't.

6
nuker
Re: help with php config between MDK10 and FC3
  • 2004/12/2 20:11

  • nuker

  • Not too shy to talk

  • Posts: 129

  • Since: 2002/12/14


i have register globals on.

it's weird because the app works in mandrake 10 and it's apache/mysql/php setup.

i put it to fc3 and it get all these errors. so i'm not sure if the solution is within php.ini or in the code.

i've matched the php.ini setings in rc3 to that of mdk but still no luck.

7
sylvainb
Re: help with php config between MDK10 and FC3
  • 2004/12/2 21:48

  • sylvainb

  • Not too shy to talk

  • Posts: 168

  • Since: 2003/2/11


Hello Nuker

Maybe I'm totally wrong but I had some similar problems with my apache server and fedora core 3 and not with mandrake.

The thing was that apache was unabled to write or to read some files even if the good permissions were there.

While making research, I was directed towards protection via SELinux included in fedora.
So I had disabled it for the httpd process and now all is fine.

8
nuker
Re: help with php config between MDK10 and FC3
  • 2004/12/6 15:21

  • nuker

  • Not too shy to talk

  • Posts: 129

  • Since: 2002/12/14


i took care of that already too.

the problem i had with selinux was changing the document root.

i still can't figure out what the problem is. i'd switch to mdk but i won't be able to get updates to the system without subscribing.

fedora gives me system updates for free...

Login

Who's Online

77 user(s) are online (53 user(s) are browsing Support Forums)


Members: 0


Guests: 77


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits