Jump to content


Photo

I have 3 questions


  • This topic is locked This topic is locked
43 replies to this topic

#21 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 03 July 2006 - 07:04 PM


try this ok

<?php
session_start();

require_once("incs/conn.inc.php");

  if(isset($_POST['submit'])) {
  echo "Right after Submit is Accepted";
    $sql1= "SELECT administrators.id_administrator,administrators.superuser FROM administrators WHERE username = '".$_POST['username']."' and password = '".$_POST['password']."'";

$rez = mysql_query($sql1) or die("There was a problem with the query: $sql1
" . mysql_error());

      if(mysql_num_rows($rez) > 0){
      echo "Right after checking if for numrows";

        $row = mysql_fetch_row($rez) or die("The mysql fetch row is not working");

        session_register('administrator_portal');//used  single quote

        $_SESSION['administrator_portal'] = $row[0];
        $_SESSION['superuser'] = $row[1];

          $update="update `administrators` set `LastLoginAdmin`=Now() where id_administrator=".$_SESSION['administrator_portal'];

          $result=mysql_query($update); //removed $conn

        header("Location: download2.php");
        exit;
      }else{
        $msg = "The username or password are wrong.";
      }
  }
  if($_GET['erroare'] == "nr"){
    $msg = "Ne pare rau insa sesiunea dumneavostra a expirat.
You must log on.";
  }
?>
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#22 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 03 July 2006 - 07:07 PM

Same issue, it's still doing the exact same thing, any more ideas, I copied and pasted that over the old, and it's doing the same thing it was before.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#23 litebearer

litebearer
  • Members
  • PipPipPip
  • Advanced Member
  • 2,357 posts
  • Locationwhite lake michigan

Posted 03 July 2006 - 07:11 PM

Just another little 'tool' for your bag of tricks.

This script will display the structure and data in a mysql database table.

It is useful for checking (1) that you are using the proper values for connecting, (2) that the field names and types are what you think they are; and (3) for seeing if there is, in fact, data in the table.

As an aside, it can also be used to create csv and/or excel files for downloading.

The only items you need to change are in SECTIONS 1 & 2

Hope this is of some help in isolating your problem.

<?php
session_start();
header("Cache-control: private");  // IE 6 Fix.
session_unset(); 

#################################################################
# 	this small script can be used to 
#
#		get and display a database table's structure (field names and field type)
#		get and display the field contents in an html table
#		get and store the field names and contents to an excel file 
#

##################################
#
#			SECTION 1
#
#	set the database variables
#

$database="#####";
$location = "#####";  
$username = "#####";  
$password = "#####";  
$db_table = "#####";

######################################
#
#			SECTION 2
#
#	set the function switches
#	0 means use 
#	1 means do NOT use
#

$display_table_structure = 0;

$display_table_contents = 0;

$create_csv_file = 1; 		// use this to create a csv file from the data

$create_excel_file = 1; 	// use this to create an excel file from the table
													// requires m_e.php

$csv_name = $db_table . "_" . time();		// this gives the csv file a unique name

$how_many = 10; 			// use this value to limit the number of records returned in the data query (0 means no limit)
 

####################################################
####################################################
#
#	DO NOT EDIT BELOW THIS POINT
#
####################################################
####################################################


######################################
#	define the function(s)

// This function gets the field names
function my_db_get_table_field_names($table) {
	$sql = "SHOW COLUMNS FROM `$table`";
	$field_names = array();
	$result2 = mysql_query($sql);
	for($i=0;$i<mysql_num_rows($result2);$i++){
		$row = mysql_fetch_array($result2);
		$name = $row['Field'];
		array_push($field_names, $name);
	}
	return $field_names;
}



############################################
# connect to the database

mysql_connect ($location, $username, $password); 
@mysql_select_db($database) or die( "Unable to select database"); 
$result0 = mysql_query("SHOW COLUMNS FROM $db_table");

if (!$result0) {
  echo 'Could not run query: ' . mysql_error();
  exit;
}


####################################################
#	get the field names into an array and count them

$new_array = my_db_get_table_field_names($db_table);
$fields = count($new_array);

###################################################
#	get all the data and count the records

if ($how_many == 0) {
	$result = mysql_query( "SELECT * FROM $db_table" ) 
	or die("SELECT Error: ".mysql_error()); 
	$num_rows = mysql_num_rows($result); 
}else{
	$result = mysql_query( "SELECT * FROM $db_table LIMIT $how_many" ) 
	or die("SELECT Error: ".mysql_error()); 
	$num_rows = mysql_num_rows($result); 
}

##############################################################
#	display the general information

echo "This information is for the " . $database . " database. Table " . $db_table . "<br><br>";
echo "There are " . $fields . " columns/fields  and " . $num_rows . " records.<br><br>";

###########################################################
#	display the table structure

if ($display_table_structure == 0) {
		echo "<hr>Table structure for " . $db_table . ": <br><br>";
		echo "<table border=1> <tr><td>Field #</td><td>Field Name</td><td>Field Type</td></tr>";
	$result9 = mysql_query("SHOW FIELDS FROM $database.$db_table");
	$i = 0;
	while ($row = mysql_fetch_array($result9)){
		echo "<tr><td>" . $i . "</td><td>" . $row['Field'] . "</td><td>" . $row['Type'] . "</td></tr>";
	$i = $i +1;
	} 
		echo "</table>";
}

##############################################################
#	display the table contents

if ($display_table_contents == 0) {
	echo "<hr>Table data for " . $db_table . ": <br><br>";
	print "<table width='100%' border=1>\n"; 
	$i = 0;
	print "<tr>\n"; 
	for ($i=0;$i<$fields;$i++) {
	  print "\t<td><font face=arial size=1/>$new_array[$i]</font></td>\n";
	}
	while ($get_info = mysql_fetch_row($result)){ 
		print "<tr>\n"; 
		foreach ($get_info as $field) 
			print "\t<td><font face=arial size=1/>$field</font></td>\n"; 
			print "</tr>\n"; 
	} 
	print "</table>\n"; 
}

##################################################
# do the excel file creation

if ($create_excel_file ==0) {
	?>
	<meta http-equiv="refresh" content="2;url=http://nstoia.com/m_e.php">
	<?PHP
}

?>

and here is the script for the excel file

<?php 

//EDIT YOUR MySQL Connection Info: 
$DB_Server = "####"; //your MySQL Server 
$DB_Username = "####"; //your MySQL User Name 
$DB_Password = "####"; //your MySQL Password 
$DB_DBName = "####"; //your MySQL Database Name 
$DB_TBLName = "####"; //your MySQL Table Name 
//$DB_TBLName, $DB_DBName, may also be commented out & passed to the browser 
//as parameters in a query string, so that this code may be easily reused for 
//any MySQL table or any MySQL database on your server 

//DEFINE SQL QUERY: 
//you can use just about ANY kind of select statement you want - 
//edit this to suit your needs! 
$sql = "Select * from $DB_TBLName"; 

//Optional: print out title to top of Excel or Word file with Timestamp 
//for when file was generated: 
//set $Use_Titel = 1 to generate title, 0 not to use title 
$Use_Title = 1; 
//define date for title: EDIT this to create the time-format you need 
$now_date = date('m-d-Y H:i'); 
//define title for .doc or .xls file: EDIT this if you want 
$title = "Dump For Table $DB_TBLName from Database $DB_DBName on $now_date"; 
/* 

Leave the connection info below as it is: 
just edit the above. 

(Editing of code past this point recommended only for advanced users.) 
*/ 
//create MySQL connection 
$Connect = @mysql_connect($DB_Server, $DB_Username, $DB_Password) 
or die("Couldn't connect to MySQL:<br>" . mysql_error() . "<br>" . mysql_errno()); 
//select database 
$Db = @mysql_select_db($DB_DBName, $Connect) 
or die("Couldn't select database:<br>" . mysql_error(). "<br>" . mysql_errno()); 
//execute query 
$result = @mysql_query($sql,$Connect) 
or die("Couldn't execute query:<br>" . mysql_error(). "<br>" . mysql_errno()); 

//if this parameter is included ($w=1), file returned will be in word format ('.doc') 
//if parameter is not included, file returned will be in excel format ('.xls') 
if (isset($w) && ($w==1)) 
{ 
$file_type = "msword"; 
$file_ending = "doc"; 
}else { 
$file_type = "vnd.ms-excel"; 
$file_ending = "xls"; 
} 
//header info for browser: determines file type ('.doc' or '.xls') 
header("Content-Type: application/$file_type"); 
header("Content-Disposition: attachment; filename=database_dump.$file_ending"); 
header("Pragma: no-cache"); 
header("Expires: 0"); 

/* Start of Formatting for Word or Excel */ 

if (isset($w) && ($w==1)) //check for $w again 
{ 
/* FORMATTING FOR WORD DOCUMENTS ('.doc') */ 
//create title with timestamp: 
if ($Use_Title == 1) 
{ 
echo("$title\n\n"); 
} 
//define separator (defines columns in excel & tabs in word) 
$sep = "\n"; //new line character 

while($row = mysql_fetch_row($result)) 
{ 
//set_time_limit(60); // HaRa 
$schema_insert = ""; 
for($j=0; $j<mysql_num_fields($result);$j++) 
{ 
//define field names 
$field_name = mysql_field_name($result,$j); 
//will show name of fields 
$schema_insert .= "$field_name:\t"; 
if(!isset($row[$j])) { 
$schema_insert .= "NULL".$sep; 
} 
elseif ($row[$j] != "") { 
$schema_insert .= "$row[$j]".$sep; 
} 
else { 
$schema_insert .= "".$sep; 
} 
} 
$schema_insert = str_replace($sep."$", "", $schema_insert); 
$schema_insert .= "\t"; 
print(trim($schema_insert)); 
//end of each mysql row 
//creates line to separate data from each MySQL table row 
print "\n----------------------------------------------------\n"; 
} 
}else{ 
/* FORMATTING FOR EXCEL DOCUMENTS ('.xls') */ 
//create title with timestamp: 
if ($Use_Title == 1) 
{ 
echo("$title\n"); 
} 
//define separator (defines columns in excel & tabs in word) 
$sep = "\t"; //tabbed character 

//start of printing column names as names of MySQL fields 
for ($i = 0; $i < mysql_num_fields($result); $i++) 
{ 
echo mysql_field_name($result,$i) . "\t"; 
} 
print("\n"); 
//end of printing column names 

//start while loop to get data 
while($row = mysql_fetch_row($result)) 
{ 
//set_time_limit(60); // HaRa 
$schema_insert = ""; 
for($j=0; $j<mysql_num_fields($result);$j++) 
{ 
if(!isset($row[$j])) 
$schema_insert .= "NULL".$sep; 
elseif ($row[$j] != "") 
$schema_insert .= "$row[$j]".$sep; 
else 
$schema_insert .= "".$sep; 
} 
$schema_insert = str_replace($sep."$", "", $schema_insert); 
//following fix suggested by Josue (thanks, Josue!) 
//this corrects output in excel when table fields contain \n or \r 
//these two characters are now replaced with a space 
$schema_insert = preg_replace("/\r\n|\n\r|\n|\r/", " ", $schema_insert); 
$schema_insert .= "\t"; 
print(trim($schema_insert)); 
print "\n"; 
} 
} 

?>












Lite...




all the brothers were valiant!

[br][br]The truely intelligent people are not those who create the dots; rather they are they ones with the ability to connect the dots into a coherent picture

#24 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 03 July 2006 - 07:14 PM

try this and copy and past the result to us cheers.

Thank you for the code member litebearer your a star cheers.


<?php
session_start();

require_once("incs/conn.inc.php");

   if(isset($_POST['submit'])) {
   echo "Right after Submit is Accepted";
     $sql1= "SELECT administrators.id_administrator,administrators.superuser FROM administrators WHERE username = '".$_POST['username']."' and password = '".$_POST['password']."'";

echo $sql1;//debug sql1

$rez = mysql_query($sql1) or die("There was a problem with the query: $sql1
" . mysql_error());

echo $rez; // debug

      if(mysql_num_rows($rez) > 0){
      echo "Right after checking if for numrows";

        $row = mysql_fetch_row($rez) or die("The mysql fetch row is not working");

        session_register('administrator_portal');//used  single quote

         $_SESSION['administrator_portal'] = $row[0];
         $_SESSION['superuser'] = $row[1];

          $update="update `administrators` set `LastLoginAdmin`=Now() where id_administrator=".$_SESSION['administrator_portal'];

echo $update;//debug

          $result=mysql_query($update); //removed $conn

echo $result;//debug

         header("Location: download2.php");
         exit;
      }else{
        $msg = "The username or password are wrong.";
      }
   }
  if($_GET['erroare'] == "nr"){
    $msg = "Ne pare rau insa sesiunea dumneavostra a expirat.
You must log on.";
  }
?>
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#25 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 03 July 2006 - 07:16 PM

Right after Submit is AcceptedSELECT administrators.id_administrator,administrators.superuser FROM administrators WHERE username = '' and password = ''Resource id #4

That is the error I ran into that time, never encountered that before, what does it mean??

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#26 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 03 July 2006 - 07:23 PM

try this and post the same thing

<?php
session_start();

require_once("incs/conn.inc.php");

  if(isset($_POST['submit'])) {
  echo "Right after Submit is Accepted";
    $sql1= "SELECT * FROM administrators WHERE username = '".$_POST['username']."' and password = '".$_POST['password']."'";

echo $sql1;//debug sql1

$rez = mysql_query($sql1) or die("There was a problem with the query: $sql1
" . mysql_error());

echo $rez; // debug

      if(mysql_num_rows($rez) > 0){
      echo "Right after checking if for numrows";

        $row = mysql_fetch_row($rez) or die("The mysql fetch row is not working");

        session_register('administrator_portal');//used  single quote

        $_SESSION['administrator_portal'] = $row[0];
        $_SESSION['superuser'] = $row[1];

          $update="update `administrators` set `LastLoginAdmin`=Now() where id_administrator=".$_SESSION['administrator_portal'];

echo $update;//debug

          $result=mysql_query($update); //removed $conn

echo $result;//debug

        header("Location: download2.php");
        exit;
      }else{
        $msg = "The username or password are wrong.";
      }
  }
  if($_GET['erroare'] == "nr"){
    $msg = "Ne pare rau insa sesiunea dumneavostra a expirat.
You must log on.";
  }
?>
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#27 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 03 July 2006 - 07:31 PM

Right after Submit is AcceptedSELECT * FROM administrators WHERE username = '' and password = ''Resource id #4


That is the message I got from that one?

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#28 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 03 July 2006 - 07:39 PM


try this for some reason were not picking up username and password.

<?php
session_start();

require_once("incs/conn.inc.php");

$username=($_POST['username']);
$password=($POST['password']);

echo $username;
echo $password;

  if(isset($_POST['submit'])) {

  echo "Right after Submit is Accepted";
    $sql1= "SELECT administrators.id_administrator,administrators.superuser FROM administrators WHERE username = '$username' and password = '$password' ";

echo $sql1;//debug sql1

$rez = mysql_query($sql1) or die("There was a problem with the query: $sql1
" . mysql_error());

echo $rez // debug

      if(mysql_num_rows($rez) > 0){
      echo "Right after checking if for numrows";

        $row = mysql_fetch_row($rez) or die("The mysql fetch row is not working");

        session_register('administrator_portal');//used  single quote

        $_SESSION['administrator_portal'] = $row[0];
        $_SESSION['superuser'] = $row[1];

          $update="update `administrators` set `LastLoginAdmin`=Now() where id_administrator=".$_SESSION['administrator_portal'];

echo $update;//debug

          $result=mysql_query($update); //removed $conn

echo $result;//debug

        header("Location: download2.php");
        exit;
      }else{
        $msg = "The username or password are wrong.";
      }
  }
  if($_GET['erroare'] == "nr"){
    $msg = "Ne pare rau insa sesiunea dumneavostra a expirat.
You must log on.";
  }
?>
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#29 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 03 July 2006 - 07:42 PM

Right after Submit is AcceptedSELECT administrators.id_administrator,administrators.superuser FROM administrators WHERE username = '' and password = '' Resource id #4

I don't understand why this is happening, is this normal.  I knew debugging was hard, but I am confused, This is what I got when I changed the code, this is what outputted?

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#30 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 03 July 2006 - 07:48 PM

have you trid my above code please thanks.

display errow ok


i dont understand it

when you login in have you first got the correct name="username" and password in the form.


secoundly have you got the sessions registred to the admin sessions


example

alter this code to your needs ok

$query="SELECT * from xxx where xxx='$xxx' and xxx='$xxx'";
$result=mysql_query($query)or die("sorry mysql problam");

while($row=mysql_fetch_array($result)) {

if(mysql_num_rows($row) == 1) {

$id=$row["id"];
$name=$row["name"];
$password=$row["password"];

session_register('id');
session_register('name');
session_register('password');

if($row["level"]=="promotor_member"){
header("location: members_main_page.php?id=$id");
exit;
}
}
}


Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#31 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 03 July 2006 - 07:58 PM

Yes I tried your code exactly like above, also I do have the right username and password.  I am beginning to think this dude that wrote teh script is a dumb fuck and i may rewrite the whole thing, or something I don't understand what is going on.
I don't know why it's not working.  I need a few things to happen, I don't understand, when I register it logs in a username and password, and even with the admin it doesn't work, I don't know about the session thing, where do I find that at, I showed you all teh code i Had for all the related pages, where do I register those sessions at.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#32 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 03 July 2006 - 08:11 PM

the code i provided is the code you need just alter the select statement and try ok.


$query="SELECT * from whatever where name='$username' and password='$password'";
$result=mysql_query($query)or die("sorry mysql problam");

while($row=mysql_fetch_array($result)) {

if(mysql_num_rows($result) == 1) {

$id=$row["id"];
$name=$row["name"];
$password=$row["password"];

session_register('id');
session_register('name');
session_register('password');

if($row["username"]=="what ever the name of the user"){

echo"your logged in user admin";
exit;
}
}
}
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#33 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 03 July 2006 - 08:13 PM

I mean how do I work that into my current script, see here I see what to do, and what you showed me, but I have the alter script in the other one or something where does that fit in?

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#34 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 03 July 2006 - 08:16 PM

use this on the page you got know ok

remember to make a backup of your existing code.
<? session_start();

$query="SELECT * from administrators where adminfirstname='$adminfirstname' and password='$password'";
$result=mysql_query($query)or die("sorry mysql problam");

while($row=mysql_fetch_array($result)) {

if(mysql_num_rows($result) == 1) {

$id=$row["id"];
$adminfirstname=$row["adminfirstname"];
$password=$row["password"];

session_register('id');
session_register('name');
session_register('password');

if($row["adminfirstname"]=="what ever the name of the user"){

echo"your logged in user admin";
exit;
}
}
}else{

echo"sorry not logged in";
exit;
}

?>

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#35 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 03 July 2006 - 08:23 PM

I don't understand.  I could do this, but the script is supposed to check and see whether a username exists in the password, I am very confused:S:S

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#36 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 03 July 2006 - 08:30 PM

edited to match your code ok
<? session_start();

$query="SELECT * from administrators where adminfirstname='$adminfirstname' and adminlastname='$adminlastname'";
$result=mysql_query($query)or die("sorry mysql problam");

while($row=mysql_fetch_array($result)) {

if(mysql_num_rows($row) == 1) {

$id=$row["id"];
$adminfirstname=$row["adminfirstname"];
$adminlastname=$row["adminlastname"];

session_register('id');
session_register('adminfirstname');
session_register('adminlastname');

}elseif($row["adminfirstname"]=="what ever the name of the user"){

echo"your logged in user admin";
exit;
}elseif(mysql_num_rows($row) == 0) {
echo"sorry not logged in";
exit;
}
}
}




?>

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#37 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 03 July 2006 - 08:38 PM

I tried exactly what you said and got a blank white screen.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#38 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 03 July 2006 - 08:47 PM

there you go

<? session_start();

$id_administrator=($_POST["id_administrator"]);
$adminfirstname=($_POST["adminfirstname"]);
$adminlastname=($_POST["adminlastname"]);

if($_POST['submit']){

$query="SELECT * from administrators where adminfirstname='$adminfirstname' and id_administrator='$id_administrator'";
$result=mysql_query($query)or die("sorry mysql problam");

while($row=mysql_fetch_array($result)) {

if(mysql_num_rows($row) == 1) {

$id_administrator=$row["id_administrator"];
$adminfirstname=$row["adminfirstname"];
$adminlastname=$row["adminlastname"];

session_register('id_administrator');
session_register('adminfirstname');
session_register('adminlastname');

echo"your logged in user admin";
exit;

}else{

echo"sorry not logged in";
exit;
}
}
  }
   }
?>
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#39 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 03 July 2006 - 08:51 PM

Still not working.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#40 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 03 July 2006 - 08:54 PM


use this it will work ok form provided

login_result.php

<? session_start();

$id_administrator=($_POST["id_administrator"]);
$adminfirstname=($_POST["adminfirstname"]);
$adminlastname=($_POST["adminlastname"]);

if($_POST['submit']){

$query="SELECT * from administrators where adminfirstname='$adminfirstname' and id_administrator='$id_administrator'";
$result=mysql_query($query)or die("sorry mysql problam");

while($row=mysql_fetch_array($result)) {

if(mysql_num_rows($row) == 1) {

$id_administrator=$row["id_administrator"];
$adminfirstname=$row["adminfirstname"];
$adminlastname=$row["adminlastname"];

session_register('id_administrator');
session_register('adminfirstname');
session_register('adminlastname');

echo"your logged in user admin";
exit;

}else{

echo"sorry not logged in";
exit;
}
}
  }
   }
?>

form

lognin.php

<html>
<head>
<title>login page</title>
<body>
<h1>login please!</h1>

<form method="post" action="login_result.php">
<br>
firstname:
<br>
<input type="text" name="adminfirstname">
<br>
lastname:
<br>
<input type="text" name="adminlastname">
<br>
<input type="hidden" name="id_administrator">
<br>
<input type="submit" value="Login">
<br>
</form>
</body>
</html>
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users