Jump to content

manton

Members
  • Posts

    19
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

manton's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I did what you say but i get the same error "Parse error: syntax error, unexpected T_VARIABLE in D:\webroot\assembly\insert.php on line 43"
  2. Hi I want to use a variable inside to a sql query here is an example $var = $_SERVER['DOCUMENT_ROOT']."/files/data.csv"; $sql = 'LOAD DATA LOCAL INFILE \"'$var'\" INTO TABLE `data` FIELDS TERMINATED BY \';\' ENCLOSED BY \'"\' ESCAPED BY \'\\\\\' LINES TERMINATED BY \'\\r\\n\''; mysql_query($sql, $palso) or die(mysql_error()); What am i doing wrong? thanks in advanced
  3. Hello! I have a page that only logged in users may have access to some records of a db. The problem is that when a logged in user browse the pages and use the back button of the browser, the data of the previous page is lost. It seems that session is lost. Can you please help me? This is my code: <?php require_once('../Connections/palso.php'); ?> <?php //initialize the session if (!isset($_SESSION)) { session_start(); } // ** Logout the current user. ** $logoutAction = $_SERVER['PHP_SELF']."?doLogout=true"; if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){ $logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){ //to fully log out a visitor we need to clear the session varialbles $_SESSION['MM_Username'] = NULL; $_SESSION['MM_UserGroup'] = NULL; $_SESSION['PrevUrl'] = NULL; unset($_SESSION['MM_Username']); unset($_SESSION['MM_UserGroup']); unset($_SESSION['PrevUrl']); $logoutGoTo = "login.php"; if ($logoutGoTo) { header("Location: $logoutGoTo"); exit; } } ?> <?php session_start(); $var = $_SESSION['MM_Username']; require_once('../Connections/palso.php'); $colname_Recordset1 = "-1"; if (isset($_SESSION['MM_Username'])) { $colname_Recordset1 = (get_magic_quotes_gpc()) ? $_SESSION['MM_Username'] : addslashes($_SESSION['MM_Username']); } mysql_select_db($database_palso, $palso); $query_Recordset1 = sprintf("SELECT * FROM `data` WHERE SchoolCode = '%s' ORDER BY `data`.`LevelDescription` ASC, `data`.`Surname` ASC", $colname_Recordset1); $Recordset1 = mysql_query($query_Recordset1, $palso) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); session_start(); $_SESSION['ses_kod'] = $_POST['txtkod']; session_start(); $_SESSION = array(); ?> <!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-7" /> <title>Ταξινόμηση υποψηφίων ανά επίπεδο</title> <link href="styles.css" type="text/css" rel="stylesheet" /> <link rel="stylesheet" type="text/css" href="print.css" media="print" /> </head> <body> <div id="container"> <div id="list"> <h4>ΛΙΣΤΑ ΥΠΟΨΗΦΙΩΝ</h4> <form id="form1" name="form1" method="get" action="tickets.php"> <input class="nav" type="submit" name="Submit" value="Εμφάνιση Δελτίων" /> <a class="nav"><a href="<?php echo $logoutAction ?>" class="nav">Αποσύνδεση</a> <p></p> <table width="800" border="1"> <tr> <td width="50" class="fields"><a href="list.php">LevelDescription</a></td> <td width="100" class="fields"><a href="list_bin.php">BinSerialCode</a></td> <td width="320" class="fields"><a href="list_sur.php">Surname</a></td> <td width="150" class="fields">Name</td> <td width="130" class="fields">Fathername</td> </tr> <?php do { ?> <tr> <td class="calign"><?php echo $row_Recordset1['LevelDescription']; ?></td> <td class="calign"><a href="ticket.php?BinSerialCode=<?php echo $row_Recordset1['BinSerialCode']; ?>" class="binserial"><?php echo $row_Recordset1['BinSerialCode']; ?></a></td> <td><?php echo $row_Recordset1['Surname']; ?></td> <td><?php echo $row_Recordset1['Name']; ?></td> <td><?php echo $row_Recordset1['Fathername']; ?></td> </tr> <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?> </table> </form> </div> </div> </body> </html> <?php mysql_free_result($Recordset1); ?>
  4. Hello I have a problem with sessions. Please, check what is wrong with my code page1 is a form page2 PHP Code: session_start(); $_SESSION['ses_kod'] = $_POST['txtkod']; It works up to here, I get the data but when loading the page itself (a link that points to the page itself) data is lost. Then I have a page 3 PHP Code: <?php session_start(); ?> Here is the problem, I cannot retreive any data. Thanks
  5. Ok, and let me be more specific... I have a database (with names for example) and i use a table to display them. Users want to print the names but not all of them so i use checkbox to select some of the records that must be displayed on the printable page. The problem is that i don t know how can i get only the records that are selected. How can i do that? myform <form id="form1" name="form1" method="get" action="tickets.php"> <input type="submit" name="Submit" value="Submit" /> <table border="1"> <tr> <td> </td> <td>ExamCenter</td> <td>Area</td> <td>InterviewExamCenter</td> <td>SchoolCode</td> <td>Name</td> <td>Surname</td> <td>Fathername</td> <td>BinSerialCode</td> <td>LevelDescription</td> <td>Comments</td> <td>WrittingDate</td> <td>WrittingTimeStart</td> <td>WrittingTimeEnd</td> <td>InterviewDate</td> <td>InterviewTime</td> <td>InterviewRoom</td> </tr> <?php do { ?> <tr> <td> <input name="" type="checkbox" value="<?php echo $row_Recordset1['BinSerialCode']; ?>" /> </td> <td><?php echo $row_Recordset1['ExamCenter']; ?></td> <td><?php echo $row_Recordset1['Area']; ?></td> <td><?php echo $row_Recordset1['InterviewExamCenter']; ?></td> </tr> <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?> </table> </form> the opening page <?php require_once('../Connections/palso.php'); ?> <?php $var = $_GET['checkbox']; session_start(); $_SESSION['ses_check'] = $var; echo $_SESSION['ses_chek']; $maxRows_data = 2; $pageNum_data = 0; if (isset($_GET['pageNum_data'])) { $pageNum_data = $_GET['pageNum_data']; } $startRow_data = $pageNum_data * $maxRows_data; $colname_data = "-1"; if (isset($_SESSION['BinSerialCode'])) { $colname_data = (get_magic_quotes_gpc()) ? $_SESSION['BinSerialCode'] : addslashes($_SESSION['BinSerialCode']); } mysql_select_db($database_palso, $palso); $query_data = sprintf("SELECT * FROM `data` WHERE BinSerialCode = '%s' ORDER BY BinSerialCode ASC", $colname_data); $query_limit_data = sprintf("%s LIMIT %d, %d", $query_data, $startRow_data, $maxRows_data); $data = mysql_query($query_limit_data, $palso) or die(mysql_error()); $row_data = mysql_fetch_assoc($data); if (isset($_GET['totalRows_data'])) { $totalRows_data = $_GET['totalRows_data']; } else { $all_data = mysql_query($query_data); $totalRows_data = mysql_num_rows($all_data); } $totalPages_data = ceil($totalRows_data/$maxRows_data)-1; ?> <?php echo $_SESSION['ses_kod']; ?> <!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-7" /> <title>Untitled Document</title> <link href="styles.css" type="text/css" rel="stylesheet" /> </head> <body> <div id="container"> <?php do { ?> <table width="800"> <tr> <td colspan="4"><h3><?php echo $row_data['Surname']; ?> <?php echo $row_data['Name']; ?></h3></td> <td><h3><?php echo $row_data['BinSerialCode']; ?></h3></td> </tr> </table> <br /> <?php } while ($row_data = mysql_fetch_assoc($data)); ?></div> </body> </html> <?php mysql_free_result($data); ?>
  6. Hello, I have a table on a form which contains records that can be multiple selected by checkboxes. A submit button sucessfully sends the record IDs of the checked records to the next page. I want to display the records that were selected via the checkboxes, but the problem is that I get only the first of them. Any help would be really appreciated, thanks
  7. oh...alright. I implement the code u sent to me but I still get that blank page...
  8. Thanks for your reply;but where is the php on page1? @itsmeArry: I removed the line
  9. Hi, I have a form with a textbox and A submit button. I want the value of the textbox to be stored in a variable so as to pass through to other pages. I have reached this point: page 1 <?php session_start(); if (isset($_POST['txtusername'])) $_SESSION['test'] = $_POST['txtusername']; $_SESSION['test'] = ?> <!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>Untitled Document</title> </head> <body> <form id="form1" name="form1" method="post" action="page2.php"> <input type="submit" name="Submit" value="Submit" /></a> <input type="text" name="txtusername" /> </form> </body> </html> page2 <?php session_start(); echo $_SESSION['test']; ?> <?php echo $_SESSION['test']; ?> Im testing it both on localhost and web server. Unfortunately, the opening page is blank...I don't know what to do...please, help me
  10. Ok...I think I am getting somewhere The code is now the following but although I provide the correct username and password I cannot access the page. Don't I have to declare somewhere that 'MM_Username' is the variable's value? <?php require_once('../Connections/palso.php'); ?> <?php if (!isset($_SESSION)) { session_start(); } $MM_authorizedUsers = ""; $MM_donotCheckaccess = "true"; // *** Restrict Access To Page: Grant or deny access to this page function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { // For security, start by assuming the visitor is NOT authorized. $isValid = False; // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. // Therefore, we know that a user is NOT logged in if that Session variable is blank. if (!empty($UserName)) { // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. // Parse the strings into arrays. $arrUsers = Explode(",", $strUsers); $arrGroups = Explode(",", $strGroups); if (in_array($UserName, $arrUsers)) { $isValid = true; } // Or, you may restrict access to only certain users based on their username. if (in_array($UserGroup, $arrGroups)) { $isValid = true; } if (($strUsers == "") && true) { $isValid = true; } } return $isValid; } $MM_restrictGoTo = "login_failed.php"; if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) { $MM_qsChar = "?"; $MM_referrer = $_SERVER['PHP_SELF']; if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&"; if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0) $MM_referrer .= "?" . $QUERY_STRING; $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer); header("Location: ". $MM_restrictGoTo); exit; } ?> <?php mysql_select_db($database_palso, $palso); $query_Recordset1 = "SELECT * FROM `data`"; $Recordset1 = mysql_query($query_Recordset1, $palso) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); $maxRows_list = 10; $pageNum_list = 0; if (isset($_GET['pageNum_list'])) { $pageNum_list = $_GET['pageNum_list']; } $startRow_list = $pageNum_list * $maxRows_list; mysql_select_db($database_palso, $palso); $query_list = "SELECT ID, Surname, BinSerialCode, LevelDescription FROM `data` ORDER BY LevelDescription ASC"; $query_limit_list = sprintf("%s LIMIT %d, %d", $query_list, $startRow_list, $maxRows_list); $list = mysql_query($query_limit_list, $palso) or die(mysql_error()); $row_list = mysql_fetch_assoc($list); if (isset($_GET['totalRows_list'])) { $totalRows_list = $_GET['totalRows_list']; } else { $all_list = mysql_query($query_list); $totalRows_list = mysql_num_rows($all_list); } $totalPages_list = ceil($totalRows_list/$maxRows_list)-1; ?><!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-7" /> <title>Ταξινόμηση υποψηφίων ανά επίπεδο</title> <link href="styles.css" type="text/css" rel="stylesheet" /> <link rel="stylesheet" type="text/css" href="print.css" media="print" /> </head> <body> <div id="container"> <h1>ΚΑΤΑΛΟΓΟΣ ΥΠΟΨΗΦΙΩΝ</h1> <div id="sort"><table width="600"> <tr class="nav"> <td><a href="list.php">Ταξινόμηση ανά επίπεδο</a></td> <td><a href="list_bin.php">Ταξινόμηση ανά κωδικό μαθητή</a> </td> <td><a href="list_sur.php">Ταξινόμηση ανά επίθετο</a></td> </tr> </table> </div> <br /> <form id="form1" name="form1" method="post" action=""> <table border="1"> <tr> <td class="fields"> </td> <td class="fields">LevelDescription</td> <td class="fields">BinSerialCode</td> <td class="fields">Surname</td> </tr> <?php do { ?> <tr> <td><input type="checkbox" name="checkbox" value="checkbox" /></td> <td><?php echo $row_list['LevelDescription']; ?></td> <td><?php echo $row_list['BinSerialCode']; ?></td> <td><?php echo $row_list['Surname']; ?></td> </tr> <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?> </table> </form> </div> </body> </html> <?php mysql_free_result($Recordset1); mysql_free_result($list); ?>
  11. So, how the session variable works? It saves the userdata (login) directly on the server rather than passing them from one page to another via the url?
  12. Hello, I use Dreamweaver. I have a login form (method:post) which works fine. But, when I add a session variable in order to keep the user logged in, the session does not work. I figure it out because i see no user data on the URL. Changing the form method from post to get, seems to work (I mean userdata are on the URL), but in this case the form action (opening another page) is not performed. I know this is a noob question but I would really appreciate any kind of help. Thanks
  13. No. Specifically, the table is about a list of names. When the user checks one or more records, I want those records to open on a new page. My problem is how am Isupposed to pass the IDs of the selected records to that new page. Please, note that the check box is not retrieved from a db.
  14. Hi all. I have a dynamic table and use a check box in every record. I want the selected ones to open in a new page. What shall I do? I mean, what is the way to pass the selected records to the new page?
×
×
  • 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.