truenitin
-
Posts
10 -
Joined
-
Last visited
Never
Posts posted by truenitin
-
-
hii this is the script i am using
<?php
ob_start();
require("data_conn.php");
ob_end_flush();
?>
<?php
ob_start();
$myusername=$_POST['myusername'];
$mypassword=$_POST['mypassword'];
$sql="SELECT * FROM members where username='$myusername' and password='$mypassword'" ;
$result=mysql_query($sql);
$count=mysql_num_rows($result);
if($count==1){
//session_register("myusername");
//session_register("mypassword");
header("location:login_success.php");
}
else {
echo "Wrong Username or Password";
}
ob_end_flush();
?>
i removed the session_register because it is also giving me the same error
will sort that out when i get to the root of the problem.
I am calling the above script in the form
Nitin
Nitin -
hiii
i am using php5
apache 2
the following line of code
header("location:login_success.php")
gives the error
header already sent
i tried ob_end_flush also , removed all the blank spaces also everything but it still keeps popping up
Nitin
This is an SOS -
ok i solved the problem
by using isset
but now i am having another problem
when i run the page it goes into a loop
and end with standard error that page cannot be displayed
it is something like this
if i comment the line $content_file it works
otherwise it goes in loop
Nitin
what is the behaviour of the server....
-
hiii
i tried a lot but i am still gettting this error
Undefined index: page in c:\program files\easyphp1-8\www\index.php on line 8
i tried using an if statement but then also i get the error
my lines of code are
<?php
$page=$_GET['page']; =======error point
if (!$page) $page = "";
$content_file=$_SERVER["DOCUMENT_ROOT"]."/".$page.".php";
echo $content_file;
$title = ($page) ? "$page - My Site!" : "Main page - My Site!";
include("header.php");
//include($content_file);
include("footer.php");
?>
Someone please explain to me what does $_get does????
Nitin -
Hiii
i get the following error
when i clik on
<li><a href="index.php?page_file=mainlogin">Login</a></li> the link i wrote in my menu item
error:
Warning: main(\index.php?page_file=mainlogin.php): failed to open stream: Invalid argument in c:\program files\easyphp1-8\www\index.php on line 16
Warning: main(): Failed opening '\index.php?page_file=mainlogin.php' for inclusion (include_path='.;C:\PROGRA~1\EASYPH~1\\php\pear\') in c:\program files\easyphp1-8\www\index.php on line 16
when i run this code:
<?php
$full_path = getenv("REQUEST_URI");
$root = dirname($full_path);
$page = basename($full_path);
if (strpos($page,"..")) {
die("Bad page request");
}
if (!$page) $page = "index";
$content_file=$root."".$page.".php";
echo "this is full path".$content_file;
include("header.php");
include($content_file);
include("footer.php");
?>
is it something to do with setting of default paths to search for files?????
Nitin -
Notice: Undefined variable: p in c:\program files\easyphp1-8\www\index.php on line 11
Notice: Undefined variable: p in c:\program files\easyphp1-8\www\index.php on line 19
Warning: Cannot modify header information - headers already sent by (output started at c:\program files\easyphp1-8\www\index.php:11) in c:\program files\easyphp1-8\www\index.php on line 23
I am getting this error when i run the following code.
<?php
if (isset($_GET['page']) and $_GET['page'] != "") {
$p = $_GET['page'];
}
if (strpos($p,"..")) {
die("Bad page request");
}
if (!$p) $p = "main";
$content_file=$_SERVER["DOCUMENT_ROOT"]."/".$p.".php";
if (!file_exists($content_file)) {
header("Location: {$_SERVER["PHP_SELF"]}");
exit();
}
$title = ($p) ? "$p - My Site!" : "Main page - My Site!";
include("header.php");
include($content_file);
include("footer.php");
?>
i get this error when i use session_register also.
A possible solution?
Nitin -
it is something like this
i want the index page as the main page
i want the header and footer to be included in all the pages.
now i have a login file mainlogin.php
the header has the main menu.
the main menu has member login which will call the mainlogin.php
now when i click on member login it should call mainlogin.php
i can add the link to it as /mainlogin.php
but i
i want the mainlogin to be read dynamically by doing something like this
index.php code.
<?php
$p = $_GET['page'];
if (strpos($p,"..")) {
die("Bad page request");
}
if (!$p) $p = "index";
$content_file=$_SERVER["DOCUMENT_ROOT"]."/".$p.".php";
if (!file_exists($content_file)) {
header("Location: {$_SERVER["PHP_SELF"]}");
exit();
}
$title = ($p) ? "$p - My Site!" : "Main page - My Site!";
include("header.php");
include($content_file);
include("footer.php");
?>
how will this code read my mainlogin.php file when i click on member login.
i want the link dynamic in my menu.
-
it is something like this
i want the index page as the main page
i want the header and footer to be included in all the pages.
now i have a login file mainlogin.php
the header has the main menu.
the main menu has member login which will call the mainlogin.php
now when i click on member login it should call mainlogin.php
i can add the link to it as /mainlogin.php
but i
i want the mainlogin to be read dynamically by doing something like this
index.php code.
<?php
$p = $_GET['page'];
if (strpos($p,"..")) {
die("Bad page request");
}
if (!$p) $p = "index";
$content_file=$_SERVER["DOCUMENT_ROOT"]."/".$p.".php";
if (!file_exists($content_file)) {
header("Location: {$_SERVER["PHP_SELF"]}");
exit();
}
$title = ($p) ? "$p - My Site!" : "Main page - My Site!";
include("header.php");
include($content_file);
include("footer.php");
?>
how will this code read my mainlogin.php file when i click on member login.
i want the link dynamic in my menu.
-
i am new to new php i am trying to learn to load pages through index.php. Help me out...
header problem i am getting frustrated now
in PHP Coding Help
Posted
thank you very much
Data_conn had some white spaces i removed them
and it is working fine ....
Thank you very much
Nitin