Jump to content

Data base viewing


djscottyis

Recommended Posts

Hello First of all thanks for your help in advance. I build a members website and can use HTML but seem to be going round in circles with php.

So Ive made a page that allows users to input there details and register this DOES Work and adds the data to a mysql data base. However I would like when they click register it sends them a email to confirm there info and at the same time send myself one so I can check there details. this is the link http://www.asian-travel-club.co.uk/php/files/register.htm

Once this is done I would like to be able to see on a admin page that has a username and password  to allow me to active and deactive there members. I know this would need a button added this is where I get lost. the link to the admin page ive made is http://www.asian-travel-club.co.uk/php/files/admin/ Then once i actived them they will recive an auto activtion email .

 

I dont seem to be able to see data from the Database on mysql but i can interact with it.

As one you register if you try to log in it say that the username and passwodr is incorrect. I TAKE IT IS BECAUSE THE USER DOES NOT HAVE PERMISSION> how do i do this? Any way if you go to forot password page it allows you to enter data and on submittion it chz the database and then sends you an email with your username and password attached. This is the link to the password recover page.

http://www.asian-travel-club.co.uk/php/files/password_recover.php

 

this is what is in my config.php

<?php

define('DB_SERVER', ''); // database server/host

define('DB_USER', ''); // database username

define('DB_PASS', ''); // database password

define('DB_NAME', ''); // database name
?>

Please help if you can

Link to comment
Share on other sites

I took out your database credentials --- i don't think you really want the world to know them.  :(

 

I'm not sure what you are asking.  Clearly the things you want to do are typical, so there's no question of whether or not they can be done with php. 

 

When you "login" to your system, that has nothing to do with the mysql user/password that would be configured for use by php. 

 

We really can't help you without specific code and specific errors. 

Link to comment
Share on other sites

You seem to have a bunch of different questions.  First off, your questions about mailing can be most simply addressed by reading mail.

 

I personally wouldn't want a system where I had to individually approve every user.  Usually people automate that by emailing a validation url that the user can then click on or type into a browser. 

 

As for your issues, again, you need to provide a code snippet of what you have that isn't working (your Login script?), as well as any errors the script is generating.

Link to comment
Share on other sites

I understand that it is a few issuse.

But first off Admin page

this is the script. This should allow me to enter the page for viewing the database I paid some one to do this before but they are no longer here. and it was working but on another site and ive copied and altered where i can.

<?php
ob_start();
// 	include section	
define('DIR', '..');
session_start();
include(DIR."/includes/phpclass.inc.php");		
include(DIR."/includes/functions.php");	
$db = new PHP_fun();	// object for php class
// 	end include section	

$errmsg = "";
if (isset($_POST["btnlogin_x"]) || isset($_POST["btnlogin"]))
{
	$user = trim($_POST["txtadmuser"]);
	$pass = trim($_POST["txtadmpass"]);
	$sql = "select * from admin where username = '".$user."' and passwd = '".$pass."'";
	$r = $db->select_row($sql);
	if(count($r) > 0)
	{
		$_SESSION["admin_id"] = $r[0]['admin_id'];
		header("Location: myprofile.php");
	}
	else
		$errmsg = "Invalid username or Password";
}
?>
<?php
ob_start();
?>
<script language="javascript">
	function validate()
	{
		var obj = document.form1;
		if (validateBlank(obj.txtadmuser, "Please enter username")==false) return false;
		if (validateBlank(obj.txtadmpass, "Please enter password")==false) return false;

	}
</script>
<?php
$javaScript = ob_get_contents();
ob_end_clean();
?>
<link href="../maincss.css" rel="stylesheet" type="text/css" />

<table width="400"  border="0" align="center" cellpadding="3" cellspacing="0">
<tr><td colspan="3" class="errmsg"> </td></tr>
  <form name="form1" action="" method="post" onSubmit="javascript: return validate()">
<?php if (strlen($errmsg) > 0) {?><tr><td colspan="3" class="verdana11"><? echo $errmsg; ?></td>
</tr><? } ?>
<tr>
  <td width="30%" height="25" align="left"  class="verdana11bold" >Username </td>
  <td width="5%" align="center"  class="verdana11bold"><strong>:</strong></td>
  <td width="61%" align="left"><input name="txtadmuser" type="text" class="text_fild"  value="<?=trim($_POST['txtadmuser'])?>"></td>
</tr>
<tr>
  <td height="25" align="left"  class="verdana11bold">Password</td>
  <td align="center"  class="verdana11bold"><strong>:</strong></td>
  <td align="left"><input name="txtadmpass" type="password" class="text_fild"  value="<?=trim($_POST['txtadmpass'])?>"></td>
</tr>
<tr>
  <td> </td>
  <td align="center"> </td>
  <td align="left">
  <input name="btnlogin" type="submit" class="btn" value="Login">	  </td>
</tr>
  </form>
</table>
<?php
$metaTitle = $db->siteName;
$metaKeywords = "";
$metaDescription = "";
$pageHeading = "Admin Login";
$CODE = ob_get_contents();
ob_end_clean();
include(DIR."/layout/admin_layout.php");
?>

Link to comment
Share on other sites

Do you have mysql command line (shell) access to your server, or do you have a phpMyAdmin installation you can use?  You need to insert a row for the admin.  The code appears to be working correctly as best as I can tell from your description of the situation.  Since there is no row, it just shows you the error msg.

Link to comment
Share on other sites

no there are not it comes up with a red cross. Ineed to add a row in the admin table I under that but where i fill the register form it adds it to the user table not the admin table if you understand. So who do I add to different tables within the  database

Link to comment
Share on other sites

When you're in the Browse screen for the admin table look at the tabs at the top, and click on INSERT tab.  Fill out the form and save it to make an admin row.  Then try your login as admin. 

 

This is obvious stuff, sorry.  We're a site for developers and if you can't get this going I can only suggest at this point that you hire someone to help you who understands php/mysql websites, and can help you out.

Link to comment
Share on other sites

this i have done and it still come up with a message invalid username and password.

this is from the login php

<?php

ob_start();

// include section

define('DIR', '..');

session_start();

include(DIR."/includes/phpclass.inc.php");

include(DIR."/includes/functions.php");

$db = new PHP_fun(); // object for php class

// end include section

 

$errmsg = "";

if (isset($_POST["btnlogin_x"]) || isset($_POST["btnlogin"]))

{

$user = trim($_POST["txtadmuser"]);

$pass = trim($_POST["txtadmpass"]);

$sql = "select * from admin where username = '".$user."' and passwd = '".$pass."'";

$r = $db->select_row($sql);

if(count($r) > 0)

{

$_SESSION["admin_id"] = $r[0]['admin_id'];

header("Location: myprofile.php");

}

else

$errmsg = "Invalid username or Password";

}

?>

<?php

 

 

Ive named the field user username and passwd pass.

I also understand that this is for delopers but i am trying to develop my skill and learn . I will get there and thanks for your help and assistance.

Link to comment
Share on other sites

The code you are posting should be working fine provided you using the same username/password you added into your admin table. When you added a row to your Admin table in phpmyadmin what did you type for the username and password?

Link to comment
Share on other sites

Once again you show that you don't have a clue what you're doing.  That is not a screen showing you rows in the table.  That would show up in the browse screen.  The screen shot you attached is showing the structure of the table, where you went and added default values to the structure --- which is absolutely not what you wanted to do. 

Link to comment
Share on other sites

Here is it in row view and ive added a roww as told by u.

I sorry if I cant grasp it quickly ive tried and got this far and thats why im reaching out to professionals like yourself for help.

 

[attachment deleted by admin]

Link to comment
Share on other sites

djscottyis,

  This community is not based on us being good Samaritans.  It is based on developers helping less experienced developers or students to improve their expertise.

 

Based on this thread, I have ascertained that you are out of your depth in regards to this technology and are just looking for a developer to hold your hand for you.  This forum is not organized around the idea of providing free help for people who really should be employing someone, as I suggested to you previously.

 

If I thought there was some overall beneift to continuing this thread, I might let it continue, but quite frankly anyone who is a competent PHP developer would have whatever your actual issue is, sorted out in an hour or less.

 

I'm locking this thread, and once again, can only advise you to seek the help of a competent developer before you make matters worse for yourself by accidently screwing things up worse than they already are. 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.