[HELP] met het maken van een php site

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

Jaap Jolman

jaap Jolman

09/09/2008 13:57:00
Quote Anchor link
ik heb een inlog die werkt alleen ik wil graag een dat bv dat de pagina facturen dus facturen van de user die ingelogd is laat zie maar ik weet niet hoe het hoe
 
PHP hulp

PHP hulp

25/12/2024 01:52:56
 
Mar cel

Mar cel

09/09/2008 14:08:00
Quote Anchor link
Let in het vervolg even op de interpuntie.

Je moet bij het inloggen van de gebruiker een sessie aanmaken met bijvoorbeeld de gebruikersnaam daarin.

Dan doe je bijvoorbeeld dit:

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
$sql = mysql_query("SELECT * FROM facturen WHERE gebruiker = '".$_SESSION['gebruiker']."'");
 
Jaap Jolman

jaap Jolman

09/09/2008 14:09:00
Quote Anchor link
dat heb ik maar hoe maak ik nu de dat die pagina alleen de facturen van die gene te zien krijgt en niet die van alle gebruikers
 
Jan geen

Jan geen

09/09/2008 14:11:00
Quote Anchor link
Dat komt door het WHERE gedeelte in de query
 
Jaap Jolman

jaap Jolman

09/09/2008 14:15:00
Quote Anchor link
----------------------------------------------------------------------------------------
dit is de login

----------------------------------------------------------------------------------------

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php require_once('../Connections/mysql.php'); ?>

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
if (!function_exists("GetSQLValueString")) {
function
GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{

  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case
"text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case
"long":
    case
"int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case
"double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case
"date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case
"defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }

  return $theValue;
}
}


mysql_select_db($database_mysql, $mysql);
$query_Recordset1 = "SELECT * FROM user3";
$Recordset1 = mysql_query($query_Recordset1, $mysql) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
  session_start();
}


$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
  $_SESSION['PrevUrl'] = $_GET['accesscheck'];
}


if (isset($_POST['username'])) {
  $loginUsername=$_POST['username'];
  $password=$_POST['password'];
  $MM_fldUserAuthorization = "id_level";
  $MM_redirectLoginSuccess = "../pages/klanten/HA/index.php";
  $MM_redirectLoginFailed = "../pages/index.php?p=wronglogin";
  $MM_redirecttoReferrer = false;
  mysql_select_db($database_mysql, $mysql);
      
  $LoginRS__query=sprintf("SELECT `user`, password, id_level FROM user3 WHERE `user`=%s AND password=%s",
  GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
  
  $LoginRS = mysql_query($LoginRS__query, $mysql) or die(mysql_error());
  $loginFoundUser = mysql_num_rows($LoginRS);
  if ($loginFoundUser) {
    
    $loginStrGroup  = mysql_result($LoginRS,0,'id_level');
    
    //declare two session variables and assign them
    $_SESSION['MM_Username'] = $loginUsername;
    $_SESSION['MM_UserGroup'] = $loginStrGroup;          

    if (isset($_SESSION['PrevUrl']) && false) {
      $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];    
    }

    header("Location: " . $MM_redirectLoginSuccess );
  }

  else {
    header("Location: ". $MM_redirectLoginFailed );
  }
}

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<table width="19%" border="0">
<tr>
<td><form id="form1" name="form1" method="POST" action="
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo $loginFormAction; ?>
">
<label>username:
<input type="text" name="username" id="username" />
</label>
<p>
<label> password:
<input type="password" name="password" id="password" />
</label>
</p>
<p>
<label>
<input type="submit" name="login" id="login" value="login" />
</label>
</p>
</form>
</td>
</tr>
</table>
</body>
</html>
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
<?php
mysql_free_result($Recordset1);
?>


----------------------------------------------------------------------------------------
dit is het script waar de facturen staan
----------------------------------------------------------------------------------------

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php require_once('../../Connections/mysql.php'); ?>

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
if (!function_exists("GetSQLValueString")) {
function
GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{

  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case
"text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case
"long":
    case
"int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case
"double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case
"date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case
"defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }

  return $theValue;
}
}


mysql_select_db($database_mysql, $mysql);
$query_Recordset1 = "SELECT text FROM text10";
$Recordset1 = mysql_query($query_Recordset1, $mysql) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);

mysql_select_db($database_mysql, $mysql);
$query_Recordset2 = "SELECT * FROM text17";
$Recordset2 = mysql_query($query_Recordset2, $mysql) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysql_num_rows($Recordset2);

mysql_select_db($database_mysql, $mysql);
$query_Recordset3 = "SELECT * FROM text18";
$Recordset3 = mysql_query($query_Recordset3, $mysql) or die(mysql_error());
$row_Recordset3 = mysql_fetch_assoc($Recordset3);
$totalRows_Recordset3 = mysql_num_rows($Recordset3);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src="../../SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script>
<link href="../../SpryAssets/SpryTabbedPanels.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div id="TabbedPanels1" class="TabbedPanels">
<ul class="TabbedPanelsTabGroup">
<li class="TabbedPanelsTab" tabindex="0">Home</li>
<li class="TabbedPanelsTab" tabindex="0">kosten</li>
<li class="TabbedPanelsTab" tabindex="0">Facturen</li>
<li class="TabbedPanelsTab" tabindex="0">Activeer hulp</li>
</ul>
<div class="TabbedPanelsContentGroup">
<div class="TabbedPanelsContent">
<p>&nbsp;
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo $row_Recordset1['text']; ?>
</p>
</div>
<div class="TabbedPanelsContent">
<p>&nbsp;
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo $row_Recordset2['text']; ?>
</p>
</div>
<div class="TabbedPanelsContent">
<p>&nbsp;
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo $row_Recordset3['text']; ?>
</p>
<p>&nbsp;</p>
</div>
<div class="TabbedPanelsContent">
<p><a href="http://www.teamviewer.com/download/TeamViewerQS_nl.exe">Quick_Support</a></p>
</div>
</div>
</div>
<script type="text/javascript">
<!--
var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1");
//-->
</script>
</body>
</html>
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
<?php
mysql_free_result($Recordset1);

mysql_free_result($Recordset2);

mysql_free_result($Recordset3);
?>


----------------------------------------------------------------------------------------
wat moet ik waar neerzetten
 
Jaap Jolman

jaap Jolman

09/09/2008 14:56:00
Quote Anchor link
gaat iemand me nog helpen
 
Mark PHP

Mark PHP

09/09/2008 14:59:00
Quote Anchor link
jaap schreef op 09.09.2008 14:56:
gaat iemand me nog helpen
Nee, nu niet meer.

Plaats ten eerste alleen relevante code, daarnaast zitten we niet met z'n allen 24/7 op dit forum dus hoef je niet te bumpen.
Gewijzigd op 01/01/1970 01:00:00 door Mark PHP
 
Jaap Jolman

jaap Jolman

09/09/2008 15:03:00
Quote Anchor link
ik weet alleen niet waar ik het moet plaatsen dus kan iemand mee helpen
 



Overzicht Reageren

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.