I'm going nuts to try to understand why the script below (let's call it script1 is passing session variable $_SESSION['emptystcode'] to bulkstOLD.php but not the other two: $_SESSION['dlstrest'] and $_SESSION['dllist']. I have session_start(); on the first command line of the called script.
All this script1 does is to $_GET the Restaurant and List names and display a form where the user can fill in a CODE field and submit it.
To makes things worse, I've created another script (a simplified version of this caller script) which just set the session variables and calls the same bulkstOLD.php and it works ok. I wonder if this has something to do with the $_GET. Any help would be much appreciated.. Thanks!!
Here is the code:
<?php
session_start();
include ('logged.php');
require_once ('functions.php');
$acisversion = $_SESSION['acisversion'];
reset_all();
$cyear = date(Y);
$cmonth = date(M);
$cday = date(d);
$configs = include('config.php');
$_SESSION["module"] = 'st';
$_SESSION['favstlists_ref'] = 0;
$strest = $dlstrest = $_GET['dlstrest'];
$favstlist = $dllist = $_GET['dllist'];
$restname = 'restname_'.$strest;
$stlistrest = $configs[$restname];
?>
<!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=iso-8859-1"/>
<title>ACIS - Edit Lists</title>
<script type="text/javascript" src="jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="stmenu.js"></script>
<style type="text/css">
#import url(acis.css);
</style>
<script type="text/javascript" src="js.js"></script>
</head>
<body>
<div id="content">
<?php
$_SESSION['stcodesub'] = $stcodesub = $stcode = ($_POST["stcodein"]);
dbfile_init() ;
$_SESSION['stcode'] = $stcode;
if(isset($_POST["editSave"]))
{
connect_db ();
if (!empty($stcode))
{
check_code_for_st_list();
$emptystcode = 0;
}
else
{
$emptystcode = 1;
}
$_SESSION['dlstrest'] = $dlstrest;
$_SESSION['dllist'] = $dllist;
$_SESSION['emptystcode'] = $emptystcode;
if ((!$emptystcode and $codestok) or $emptystcode)
{
echo '<META HTTP-EQUIV="Refresh" Content="0; URL=bulkstOLD.php">';
exit;
}
}
?>
<table width="100%" border="0" align="center">
<tr>
<td width="223" align="left"></td>
<td width="111" align="right"></td>
</tr>
</table>
</style>
<form method="post" id="editLists" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
<table width="739" border="0" align="center" cellspacing="0" bgcolor="#171717">
<tr>
<td colspan="3"
style="color:#00CC00;
text-align: left;
padding: 0;
background: #2e2e2e url(images/nav_bar.jpg) repeat-x;
font-size: 0.9em;
color: white;
height:16px;"><script type="text/javascript" src="mainmenu.js"></script></td>
</tr>
<tr>
<td width="502"><h2 style="color:red;"> Atualizar Listas Favoritas de Pratos</h2></style></td>
<td width="231" colspan="2" align="right"><?php echo $configs[footer];?></td>
</tr>
<tr>
<td colspan="3" align="right" ><table width="100%" border="0" align="center">
<tr>
<td align="center">Restaurante:</td>
<td width="84" align="center" valign="bottom">Adicionar Código</td>
<td width="350" align="center">Lista a ser atualizada:</td>
<td width="150" align="left" valign="bottom"><span class="error"><?php echo $favErr;?></span></td>
</tr>
<tr>
<td width="135" align="center"><b><?php echo $stlistrest; ?></b></td>
<td align="center">
<?php
echo $stcodeline;
?>
</td>
<td align="center"><b><?php echo $dllist; ?></b></td>
<td align="right"><input type="submit" name="editSave" style="background-color: #009900; color: #FFFFFF;" value="Submeter" /></td>
</tr>
</table></td>
</tr>
</table>
</form>
<?php
$_SESSION["module"] = 'st';
?>
</div>
</body>
</html>
The only possible explanation for your problem is that you might have not written <?php session_start();?> in the very beginning, before any HTML tags(even doctype). Write it on top of every relevant php document.
Look if all your files are saved as UTF-8 without BOM, not just UTF-8.
This BOM dissables sessions.
And look if all your files are called as they are in the same subdomain.
www.domain.com/file1.php,
ww2.domain.com/file2.php,
domain.com/file3.php
... with diferent subdomains should not work.
Related
I have the following code for generating HTML content to PDF using DomPDF.and my problem focuses on this line
$pdf_content='<!DOCTYPE html PUBLIC "-//W3C//DTD...
The entire code
<?php
error_reporting(0);
require_once ('dompdf_config.inc.php');
$pdf_content='<!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" />
</head>
<style type="text/css">
#pdf_header, #pdf_container{ border: 1px solid #CCCCCC; padding:10px; }
#pdf_header{ margin:10px auto 0px; border-bottom:none; }
table{ width:580px; }
#pdf_container{margin:0px auto; }
.rpt_title{ background:#99CCFF; }
</style>
<body>
<div id="pdf_header" >
<table border="0" cellspacing="1" cellpadding="2">
<tr id="hdRow">
<td width="20%"><img src="space_age_header.jpg" style="width:250px" ></td>
<td width="30%" align="center">Sample File</td>
<td width="30%" align="left">Marimuthu<br>User Code : 179865420</td>
</tr>
</table>
</div>
<div id="pdf_container" >
<table border="0" cellspacing="1" cellpadding="2">
<tr align="center" bgcolor="pink" style="color:#FFF"><td colspan="3"><b>Your Statement Summery</b></td> </tr>
<tr bgcolor="#006" style="color:#FFF"><td colspan="3" align="left">Your Heading.</td></tr>
</table>
<table> <tr> <td> Name </td><td> Department</td><td>Total </td><td>Grade </td> </tr>
<tr> <td> Marimuthu </td><td> Admin</td><td>250 </td><td>A </td> </tr>
</div></body></html>'
;
$name = date("Ymd").rand().'.pdf';
$reportPDF=createPDF(12, $pdf_content, 'activity_Report', $name );
function createPDF($pdf_userid, $pdf_content, $pdf_For, $filename){
$path='UsersActivityReports/';
/*$rndNumber=rand();
$filename=$pdf_userid.date("Ymd").$rndNumber.'.pdf';*/
$dompdf=new DOMPDF();
$dompdf->load_html($pdf_content);
$dompdf->render();
$output = $dompdf->output();
file_put_contents($path.$filename, $output);
return $filename;
}
echo '<a href="UsersActivityReports/'.$name.'" > Download </a>';
?>
I have extracted the $pdf_content='<!DOCTYPE html PUBLIC "-//W3C//DTD... part to another page page.php and modified it to allow generating files from database using a do while loop.
<?php
include("../../Connections/dbConfig.php");
$query_record = mysqli_query($link,"SELECT * FROM `subjects`") or
die (mysqli_error($link));
$row_record = mysqli_fetch_assoc($query_record);
$totalRows_record = mysqli_num_rows($query_record);
?>
<!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" />
</head>
<style type="text/css">
#pdf_header, #pdf_container{ border: 1px solid #CCCCCC; padding:10px; }
#pdf_header{ margin:10px auto 0px; border-bottom:none; }
table{ width:580px; }
#pdf_container{margin:0px auto; }
.rpt_title{ background:#99CCFF; }
</style>
<body>
<div id="pdf_header" >
<table border="0" cellspacing="1" cellpadding="2">
<tr id="hdRow">
<td width="20%"><img src="space_age_header.jpg" style="width:250px" ></td>
<td width="30%" align="center">Sample File</td>
<td width="30%" align="left">Marimuthu<br>User Code : 179865420</td>
</tr>
</table>
</div>
<div id="pdf_container" >
<table border="0" cellspacing="1" cellpadding="2">
<tr align="center" bgcolor="pink" style="color:#FFF"><td colspan="3"><b>Your Statement Summery</b></td> </tr>
<tr bgcolor="#006" style="color:#FFF"><td colspan="3" align="left">Your Heading.</td></tr>
</table>
<table>
<tr> <td> Subject </td><td> Code </td><td>Total </td><td>Grade </td> </tr>
<?php do { ?>
<tr> <td> <?php echo $row_record['subject']; ?> </td><td> <?php echo $row_record['code']; ?> </td><td>250 </td><td>A </td> </tr>
<?php } while ($row_record = mysqli_fetch_assoc($query_record)); ?>
</table>
</div></body></html>
Now this is where i am stuck. How do i implement this. How do i return the dynamically generated code back to the
$pdf_content='
and make it work.
$pdf_content= include('page.pp'); //something like this doesn't seem to work
I welcome any alternative idea on the same
The main thing to note about your code changes is that the HTML is now outside of a code block. This means that PHP will send that code to the browser as it's processed. To get around this you would need to enable output buffering to capture the rendered text.
ob_start();
include('page.php');
$pdf_content = ob_get_clean();
ob_end_clean();
Note that some systems may limit the size of the output buffer (see the output_buffering setting). You can check that using ini_get('output_buffering');. If a limit is enabled make sure the size of your rendered HTML is less than the maximum size of the buffer.
I have a PHP/HTML page that prints a bunch of receipts. I'm trying to make it page break after each when actually printing. I've tried several style and class codes, but the best I've been able to do is get it to break after the first, but it never repeats. IOW I want it to page break after each time it prints the table referred to in the code.
enter code here
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head>
<style type="text/css">
#media all {
.page-break { display: none; }
}
#media print {
.page-break { display: block; page-break-before: always; }
}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>North Atlanta Riding Club</title>
<link href="../styles.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style45 {
color: #FF0000;
font-weight: bold;
font-style: italic;
}
-->
</style>
</head>
<body>
<?php
do{
//THIS SEES IF THE LOGGED IN MEMBER HAS CONFIRMED CLOTHING
$colname_confirmed = "1";
if (isset($row_roster['key1'])) {
$colname_confirmed = (get_magic_quotes_gpc()) ? $row_roster['key1'] : addslashes($row_roster['key1']);
}
mysql_select_db($database_connection1, $connection1);
$query_confirmed = sprintf("SELECT * FROM clothingorder WHERE who = %s AND confirmed = 'Y' ORDER BY key1 ASC", $colname_confirmed);
$confirmed = mysql_query($query_confirmed, $connection1) or die(mysql_error());
$row_confirmed = mysql_fetch_assoc($confirmed);
$totalRows_confirmed = mysql_num_rows($confirmed);
if($totalRows_confirmed<>0){?>
<table width="990" border="0" align="left" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="990" height="31" valign="top"><!--DWLayoutEmptyCell--> </td>
</tr>
<tr>
<td height="83" valign="top">
<table border="1" align="left" cellpadding="2" cellspacing="0" bordercolor="#000000">
<tr bgcolor="#FFFFFF" class="style5">
<td colspan="9"><p>Member- <strong><?php echo $row_roster['fname']." ".$row_roster['lname']; ?><br>
</strong>Telephone- <strong><?php echo $row_roster['tel']; ?></strong> Email- <strong><?php echo $row_roster['email']; ?></strong><br>
Address- <br>
<strong>
<?php if($row_roster['add1']<>''){echo $row_roster['add1']."<br>";} ?>
</strong>
<strong>
<?php if($row_roster['add2']<>''){echo $row_roster['add2']."<br>";} ?>
</strong>
<strong>
<?php if($row_roster['city']<>''){echo $row_roster['city'].", ";} ?>
</strong>
<strong>
<?php if($row_roster['state']<>''){echo $row_roster['state']." ";} ?>
</strong>
<strong>
<?php if($row_roster['zip']<>''){echo $row_roster['zip'];} ?>
</strong><br>
</p>
</td>
</tr>
<tr bgcolor="#FFFFFF" class="style5">
<td><div align="center"><strong>Qty</strong></div></td>
<td><strong>Item</strong></td>
<td><strong>PO?</strong></td>
<td><div align="center"><strong>Paid?</strong></div></td>
<td><div align="center"><strong>Mens/Womens</strong></div></td>
<td><div align="center"><strong>Style</strong></div></td>
<td><div align="center"><strong>Cut</strong></div></td>
<td><div align="center"><strong>Size</strong></div></td>
<td><div align="center"><strong>Price</strong></div></td>
</tr>
<tr bgcolor="#FFFFFF" class="style5">
<td colspan="8"><div align="right">Narc Membership </div></td>
<td><div align="center">
<?php if($row_roster['paid']=="Y"){echo "Paid";$total=0;}else{echo "$".$row_dues['dues'];$total=$row_dues['dues'];} ?></div></td>
</tr>
<?php
do {
$colname_item = "1";
if (isset($row_confirmed['item'])) {
$colname_item = (get_magic_quotes_gpc()) ? $row_confirmed['item'] : addslashes($row_confirmed['item']);
}
mysql_select_db($database_connection1, $connection1);
$query_item = sprintf("SELECT key1, item, price, free FROM clothing WHERE key1 = %s", $colname_item);
$item = mysql_query($query_item, $connection1) or die(mysql_error());
$row_item = mysql_fetch_assoc($item);
$totalRows_item = mysql_num_rows($item);
?>
<tr class="style5">
<td><div align="center"><?php echo $row_confirmed['qty']; ?></div></td>
<td><?php echo $row_item['item']; ?></td>
<td><div align="center"><span class="style45">
<?php if($row_confirmed['postorder']=='Y'){?>YES<?php }?></span></div></td>
<td><div align="center"><?php echo $row_confirmed['paid']; ?></div></td>
<td><div align="center"><?php echo $row_confirmed['mf']; ?></div></td>
<td><div align="center"><?php echo $row_confirmed['style']; ?></div></td>
<td><div align="center"><?php echo $row_confirmed['cut']; ?></div></td>
<td><div align="center"><?php echo $row_confirmed['size']; ?></div></td>
<td><div align="center">
<?php if($row_confirmed['price'] == 0){echo "Free";
}else{
if($row_confirmed['paid']=="Y"){echo "Paid";}else{echo $row_confirmed['price'];$total = $total + $row_confirmed['price'];}
} ?>
</div></td>
</tr>
<?php
} while ($row_confirmed = mysql_fetch_assoc($confirmed)); ?>
<tr bgcolor="#FFFFFF" class="style5">
<td colspan="8"><div align="right"><em><strong>Total Owed</strong></em></div></td>
<td><div align="center" class="style6"><em><strong><?php echo "$".$total.".00";?></strong></em></div></td>
</tr>
</table>
</td>
</tr>
</table>
<div class="page-break"></div>
<?php
}
}while($row_roster = mysql_fetch_assoc($roster));
?>
</body>
I too am finding the page break in #media print {} to be "beyond flaky"! In fact, so far finding the #media print to be flaky entirely. Floats aren't working well and several styling details just don't seem to be displaying as envisioned. It seems that browser support for "print" is lackluster. I am working on an application that should print name badges and precision is critical regarding placement and sizing. I'm close to giving up on the #media print {} styling though I'd hoped to have it look web-savvy online but to print as I envision. Might have to settle for it looking like the badges. I'm using code which adds that page-break class div every 6 "records" (badges are 6-up in 2 columns of 3, 4" x 3" w).
If like me, you're unable to find the method that uses #media print {} would it work to just display the receipt on-screen as you intend it to print? May also be your workaround until (and if) the browsers catch up to w3c conventions. I'd love to find a good publication explaining what does and doesn't work about the #media print styling otherwise the screen styling should work.
I have this code:
<?php require_once("config.inc.php"); ?>
<?
ob_start();
session_start();
if(isset($_SESSION['myusername'])) {
// do nothing here
} else { ?>
<!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>Live chat</title>
</head>
<body bgcolor="#000000">
<font color="white" size="+3"><b>You are not logged in! <br />
Log in and start chatting!</b></font>
</body>
</html>
<?php exit(); }
ob_flush();
?>
<!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" />
<meta name="description" content="<?php echo $meta_description ?>" />
<meta name="keywords" content="<?php echo $meta_keywords ?>" />
<title><?php echo $site_name; ?> | Live chat</title>
<link rel="icon" type="image/gif" href="favicon.png" >
<link href="style.css" rel="stylesheet" type="text/css" />
<style>
body { margin:0;padding:0; background-image:url(images/background.jpg); }
</style>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
$(document).ready(function() {
$("#lolmesazhet").load("mesazhetnechat.php");
var refreshId = setInterval(function() {
$("#lolmesazhet").load("mesazhetnechat.php");
}, 1000);
$.ajaxSetup({ cache: false });
});
</script>
</head>
<body>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="500px" bgcolor="#000000" >
<?php include 'headerchat.inc.php'; ?>
</td>
</tr>
<tr>
<td width="500px" align="left" valign="top" style="padding:20px 5px 20px;">
<?php
if($_POST['submit654']) {
$result128 = mysqli_query($con,"SELECT id FROM users WHERE email = '$_SESSION[myusername]'");
$row128 = mysqli_fetch_array($result128);
date_default_timezone_set("Europe/Tirane");
$todaydate3 = date("Y-m-d H:i:s");
mysqli_query($con,"INSERT INTO chat (id, derguesi, dhoma, mesazhi, ora) VALUES (NULL, '$row128[id]', 'Main room', '$_POST[mesazhi]', '$todaydate3')");
}
?>
<table width="470px" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="50px" valign="middle" colspan="2" style="border-bottom:1px solid #FFFFFF;"> </td>
</tr>
<tr>
<td width="320" height="339px" valign="top" style="padding:3px;">
<div style="width:320px; height:339px; overflow-y:auto;">
<?php
$result73 = mysqli_query($con,"SELECT * FROM chat WHERE dhoma = 'Main room' ORDER BY id DESC");
while($row73 = mysqli_fetch_array($result73))
{
$result127 = mysqli_query($con,"SELECT username FROM users WHERE id = '$row73[derguesi]'");
$row127 = mysqli_fetch_array($result127);
?>
<table width="320px" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="150" align="left"><font color="white" size="4"><b><?php echo $row127['username']; ?></b></font></td>
<td width="170" align="right"><?php echo $row73['ora']; ?></td>
</tr>
<tr>
<td colspan="2">
<font color="white"><?php echo $row73['mesazhi']; ?></font>
</td>
</tr>
</table>
<?php } ?>
</div>
</td>
<td width="150" height="450px" rowspan="2" valign="top" style=" padding:3px; border-left:1px solid #FFFFFF;">
<div style="width:150px; height:450px; overflow-y:auto;">
<font color="#FFFFFF" size="+2"><b>Online users:</b></font><br /><br />
<?php
$result = mysqli_query($con,"SELECT username FROM users WHERE verifikuar='po' AND online = 'po'");
while($row = mysqli_fetch_array($result))
{ ?>
<font color="#FFFFFF"><b><?php echo $row['username']; ?></b></font> <br />
<?php }
?>
</div>
</td>
</tr>
<tr>
<td height="50px" valign="middle" style="border-top:1px solid #FFFFFF; padding:3px; border-right:1px solid #FFFFFF;">
<form action="" method="post" name="comesazh">
<textarea name="mesazhi" cols="35" rows="4" required="required"></textarea>
<br /><input type="submit" name="submit654" id="submit654" value="Send" style="border-radius:0px; border-size:1px; border-style:solid; border-color:#ffffff; border-width:thin; background-color:#000000; color:#ffffff; height:26px; width:60px; font-size:16px;" />
</form>
</td></tr>
</table>
</body>
</html>
I would like to know if it is possible to reload that page using ajax in order to create a live chat and if yes, how to do it.
I tried many ways like reloading just a part of it using $.load function but it does not work. Then I tried to $.load all the page, but still did not work. After a lot of silly efforts, I gave up.
Here is what you can do to have the chat box update without reloading the page.
Chat page that you have:
<script>
window.setInterval(function(){
{
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","response.php",true);
xmlhttp.send();
}, 5000);
</script>
<div id="myDiv"><h2>This should be your chat box</h2></div>
Response.php
<?php
//do the while loop for the amount of chat you want to see
//example
for ($i = 1; $i <= 10; $i++) {
echo $i.'<br/>'; // Print out $i
}
?>
This will update the chat box every 5 seconds with the most recent chats. Give it a shot
If no element is matched by the selector — in this case, if the document does not contain an element with id="result" — the Ajax request will not be sent.
From jQuery.load manual. I can't see element with ID "lolmesazhet" in your code. Or I'm missing something.
Trying to make a simple site where users can have different account levels.
For example, user with account type 'a' and 'b' will see a Link/button at the top which says basic and the users with account type 'c' will see a Link/button which says full member.
I have a code which will almost do what I need and it will save the users in different A/B/C categories in the database.
I just need to know what I have to do to be able to show different links to different account type as I explained above?
also, I know the code bellow is not the greatest codes but just need to achieve the results I am after for now with what I have.
<?php
session_start(); // Must start session first thing
// See if they are a logged in member by checking Session data
$toplinks = "";
if (isset($_SESSION['id'])) {
// Put stored session variables into local php variable
$userid = $_SESSION['id'];
$username = $_SESSION['username'];
$toplinks = '' . $username . ' •
Account •
Log Out';
} else {
echo 'Please log in to access your account';
exit();
}
?>
<?php
//Connect to the database through our include
include_once "scripts/connect_to_mysql.php";
// Query member data from the database and ready it for display
$sql = mysql_query("SELECT * FROM members WHERE id='$userid'");
while($row = mysql_fetch_array($sql)){
$country = $row["country"];
$state = $row["state"];
$city = $row["city"];
$accounttype = $row["accounttype"];
$bio = $row["bio"];
}
// Give different options or display depending on which user type it is
if ($accounttype == "a") {
$userOptions = "You get options for Expert User";
} else if ($accounttype == "b") {
$userOptions = "You get options for Expert User";
} else if ($accounttype == "c") {
$userOptions = "You get options for Expert User";
} else {
$userOptions = "You get options for Super User";
}
?>
<!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=iso-8859-1" />
<title>Member Account</title>
<link rel="stylesheet" type="text/css" href="style/style.css">
<style type="text/css">
<!--
body {
margin: 0px;
background-image: url(imgs/bgnoise.png);
background-repeat: repeat;
}
-->
</style>
</head>
<body>
<?php include_once("temps/template_header.php");?>
<table style="background-image: url(imgs/horizontal_nav_bg.jpg);" repeat="x" width="100%" border="0" cellpadding="0">
<tr>
<td height="94" ><table style=" margin-left:20px; " width="734" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="156"><p><img src="imgs/info.png" width="35" height="35" border="0" "/>Edit Information</p></td>
<td width="179"><img src="imgs/very.png" width="35" height="35" border="0" />Verify Your Identity</td>
<td width="126"><img src="imgs/profile.png" width="35" height="35" border="0" />View Profile</td>
<td width="138"><img src="imgs/basket.png" width="35" height="35" />Buy Bitcoin</td>
<td width="135"><img src="imgs/user.png" width="35" height="35" alt="user" /><?php echo "$username"; ?></td>
</tr>
</table> <h1> </h1></td>
</tr>
</table>
<table width="700" align="right" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><h3></h3></td>
</tr>
</table>
<table width=950" cellpadding="3" cellspacing="3" style="line-height:1.5em;">
<tr>
<td width="118" valign="top" bgcolor="#E4E4E4"><h6>YOUR ACCOUNT<br />
Edit Information <br />
Verify Your Identity<br />
View Profile</h6>
<h6><?php echo "$bio"; ?><br />
</h6></td>
<!-- See the more advanced member system tutorial to see how to place default placeholder pic until member uploads one -->
<td width="160" valign="top"><div align="center"><img src="memberFiles/<?php echo "$userid"; ?>/pic1.jpg" alt="Ad" width="150" /></div></td>
<td width="201" valign="top">
Country: <?php echo "$country"; ?> <br />
State: <?php echo "$state"; ?><br />
City: <?php echo "$city"; ?>
<table width="50" border="0" cellspacing="0" cellpadding="0">
<tr>
</tr>
</table> <br />
</td>
<td width="430" margin="left" style="margin-right:0px;" rowspan="2" valign="top"><div id="veri"><img src="imgs/verifynote.png" width="430" height="600" /> </div></td>
</tr>
<tr>
<td colspan="3" valign="top"><br />
<br />
<br />
<div style="overflow:hidden; width:100%px;">
<iframe width="565" height="400" scrolling="no" frameBorder="0"
src="http://bitcoin.clarkmoody.com/widget/chart/"
style="width:728px; height:270px; border:none; margin-left:-60px;"/>
</div>
</td>
</tr>
</table>
<?php include_once("temps/template_footer.php");?>
</body>
</html>`
Please be gentle as I am a newbie in PHP and just learning the curves.
Thanks
I am not sure if I got this correctly but if you want according to the user's group to display different links just do:
if ($accounttype == "a") {
echo 'Page for user a';
}
else if ($accounttype == "b") {
echo 'Page for user b';
} else if ($accounttype == "c") {
echo 'Page for user c';
} else {
echo 'Page for others';
}
Also I suggest you to use mysqli. It is pretty similar to mysql. http://php.net/manual/en/book.mysqli.php (Myqsl is being removed)
I am trying to create a page that displays rpg ranks from a mysql database on a webpage
i went into the database and organized the data by level, so the person with the highest level is shown first and so on, however the database does not contain a table for ranks
I am trying to do that manually in dreamweaver but I don't know how, can I create a counter and have it display in the table?
I managed to get the following:
http://slayersgaming.com/rpgranks2.php
<?php
$dbh=mysql_connect("********", "**********", "*********") or die('Cannot connect to the database because: '. mysql_error());
mysql_select_db("C368969_thcrpgCSGO");
$rpgranks_sql = "SELECT * FROM `thc_rpg` ORDER BY `thc_rpg`.`level` DESC LIMIT 0, 30 ";
$rpgranks_query = mysql_query($rpgranks_sql) or die(mysql_error());
$rsrpgranks = mysql_fetch_assoc($rpgranks_query);
?>
<!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>
<p>
<table width="501" height="58" border="0">
<tr>
<td width="240"><h2><strong>Name</strong></h2></td>
<td width="70"><strong>Level</strong></td>
<td width="70"><strong>XP</strong></td>
<td width="70"><strong>Credits</strong></td>
<td width="70"><strong>Rank</strong></td>
</tr>
</table>
<?php do{ ?>
<table width="501" height="58" border="0">
<tr>
<td width="240"><?php echo $rsrpgranks['name'];?></td>
<td width="70"><?php echo $rsrpgranks['level'];?></td>
<td width="70"><?php echo $rsrpgranks['xp'];?></td>
<td width="70"><?php echo $rsrpgranks['credits'];?></td>
<td width="70"> </td>
</tr>
</table>
<?php } while ($rsrpgranks = mysql_fetch_assoc($rpgranks_query)) ?>
</p>
<p> </p>
</body>
</html>
screen cap here: http://oi47.tinypic.com/21exdfs.jpg
This is actually really easy to do. You just need a counter in your do-while loop like this:
<?php
$counter = 1;
do{
?>
<table width="501" height="58" border="0">
<tr>
<td><?php echo $counter; ?></td>
<td width="240"><?php echo $rsrpgranks['name'];?></td>
<td width="70"><?php echo $rsrpgranks['level'];?></td>
<td width="70"><?php echo $rsrpgranks['xp'];?></td>
<td width="70"><?php echo $rsrpgranks['credits'];?></td>
<td width="70"> </td>
</tr>
</table>
<?php
$counter++;
} while ($rsrpgranks = mysql_fetch_assoc($rpgranks_query))
?>