Page 1 of 1

[Solved] Blank Page affer LogIn

Posted: Thu Feb 09, 2006 1:39 am
by khaki_monster
hi guyz! yes!... its me again with some problem that i need some answers :)

i have here the source code of my litle "logIn" script. given all connections
are alright...

Code: Select all

<?php
ob_start();
session_start(); 

require("../../config_sys.php");

if($_POST['cmdLog']) // On POST execute statments.
{
	$user = trim($_POST['user']);
	$pass = trim($_POST['pass']);
	
	$crypt = md5($pass); // Encrypt Password
	$pass = substr($crypt, 1, 30); // Limit Password Up to 30 Characters 
	
	$seek = "select usr from user_mas where usr = '$user'";
	$flag = mysql_query($seek) or die('Problem: '.mysql_error());

	$getusr = mysql_fetch_array($flag);

	if(strcmp($user, $getusr['usr']))
	{
		echo 'Invalid <b>User</b> or <b>Password</b><br>';
		echo '<a href="../../login_frm.html">Back to LogIn</a>';
		die();
	}else{
		$seek = "select id_mas, usr from user_mas where usr = '$user' and psw = '$pass'";
		$flag = mysql_query($seek) or die('Problem: '.mysql_error());
		$getid = mysql_fetch_array($flag);
		if(mysql_num_rows($flag) == 1){ 
			$_SESSION['id'] = $getid['id_mas'];
			header("Location: ../new_article.php");
		}else{
			echo 'Invalid <b>User</b> or <b>Password</b><br>';
			echo '<a href="../../login_frm.html">Back to LogIn</a>';
			die();
		}
	}
}// End POST statements.
?>
after execution, it should go to another page where i can do some "Entry" to my database.
the page was "new_article.php" with some source code bellow. after execution of above code("LogIn") and being validated.
i only received a blank page from "new_article.php" :(

can anybody help and check what'z messing or causes the problem.

Code: Select all

<HTML>
<HEAD>
<link href="../default.css" rel="stylesheet" type="text/css">
<link href="../balita.css" rel="stylesheet" type="text/css">
<link href="../frmStyle.css" rel="stylesheet" type="text/css">
</HEAD>
<BODY>
<?php
require("../config_sys.php");

session_start();
$id = $_SESSION['id'];

if (!isset($id) || empty($id) || !is_numeric($id))
{
die("The search identifier ".$id." had errors.");
}

if($_POST['cmdAdd'])
{
	$location = trim($_POST['location']);
	$section = trim($_POST['section']);
	$title = trim($_POST['title']);
	$author = trim($_POST['author']);
	$lead = trim($_POST['lead']);
	$body = trim($_POST['body']);
	
	$comments = trim($_POST['comments']);

	$date = date('m.d.y');
	$ip = $_SERVER['REMOTE_ADDR'];

	$query = "insert into news_mas (ip, date, location, section) values ('$ip', '$date', '$location', '$section')";
	$res_mas = mysql_query($query);

	if($res_mas){
		$query = "insert into news_dtl (section, title, author, lead, body, comments) 
				  values ('$section', '$title', '$author', '$lead', '$body', '$comments')";
		$res_dtl = mysql_query($query);
		}
}
//end
?>
<div align="center">

<P>
<?php
       echo 'Session Identifier: '.$id; // I only add this line just to check if such value of a session is present.  
?>
</P>
  <form method="post" action="new_article.php">
  <table width="525" border="0" cellpadding="3" cellspacing="0" class="frmtable">
    <tr>
      <td height="25" colspan="3" nowrap></td>
    </tr>
    <tr>
      <td width="61" height="26" align="right" nowrap><img src="../images/location.jpg"></td>
      <td width="460" valign="top" ><select name="location" id="location">
        <option value="XXX" selected>Super Balita</option>
        <option value="CDO">Cag. de Oro</option>
        <option value="CBU">Cebu</option>
        <option value="DVO">Davao</option>
        <option value="GSN">Gen. Santos</option>
        </select></td>
      <td width="2"></td>
    </tr>
    <tr>
      <td height="26" nowrap><img src="../images/section.jpg"></td>
      <td valign="top" ><select name="section" id="section">
        <option value="0">- - - - - - - - - - - - - - - -</option>
        <option value="1">Balita</option>
        <option value="2">Opinyon</option>
        <option value="3">Kalingawan</option>
        <option value="4">Sports</option>
        </select></td>
      <td width="2"></td>
    </tr>
    <tr>
      <td height="26" nowrap><img src="../images/title.jpg"></td>
      <td ><input name="title" type="text" class="frmarea" id="title"></td>
      <td width="2"></td>
    </tr>
    <tr>
      <td height="26" nowrap><img src="../images/author.jpg"></td>
      <td ><input name="author" type="text" class="frmarea" id="author"></td>
      <td width="2"></td>
    </tr>
    <tr>
      <td height="26" nowrap><img src="../images/lead.jpg"></td>
      <td rowspan="2" valign="top" ><textarea name="lead" cols="65" rows="4" class="frmarea" id="lead"></textarea></td>
      <td rowspan="2"></td>
    </tr>
    <tr>
      <td height="52" nowrap></td>
    </tr>
    <tr>
      <td height="27" nowrap><img src="../images/image.jpg"></td>
      <td><input name="image" type="file" class="frmarea" id="image"></td>
      <td></td>
    </tr>
    <tr>
      <td height="26" nowrap><img src="../images/caption.jpg"></td>
      <td rowspan="2" valign="top" ><textarea name="caption" rows="3" class="frmarea" id="caption"></textarea></td>
      <td rowspan="2"></td>
    </tr>
    <tr>
      <td height="26" nowrap></td>
    </tr>
    <tr>
      <td height="26" nowrap  ><img src="../images/body.jpg"></td>
      <td rowspan="2" valign="top" ><textarea name="body" cols="65" rows="15" class="frmarea" id="body"></textarea></td>
      <td rowspan="2"></td>
    </tr>
    <tr>
      <td height="182" nowrap></td>
    </tr>
    <tr>
      <td height="74" nowrap ><img src="../images/comments.jpg"></td>
      <td><textarea name="comments" rows="4" class="frmarea" id="comments"></textarea></td>
      <td rowspan="2"></td>
    </tr>
    <tr>
      <td height="37"></td>
      <td ><table width="100%" border="0" cellpadding="3" cellspacing="0">
          <tr>
            <td width="69" height="28" ><input name="cmdAdd" type="submit" class="btun" id="cmdAdd" value="Submit"></td>
            <td width="69" ><input name="cmdCancel" type="submit" class="btun" id="cmdCancel" value="Cancel"></td>
            <td width="219">&nbsp;</td>
            <td width="69" ><input name="cmdReset" type="reset" class="btun" id="cmdReset" value="Reset"></td>
          </tr>
        </table></td>
    </tr>
  </table>
  </form>
</div>
</BODY>
</HTML>
im looking forward for some help :)

cheerz!

Posted: Thu Feb 09, 2006 2:09 am
by khaki_monster
:lol: hahaha... sorry guyz! i think i found the problem :D

cheerz! again

Posted: Thu Feb 09, 2006 2:57 am
by m3mn0n
Glad we could help. ;) :lol: