Jump to content

samona

Members
  • Posts

    232
  • Joined

  • Last visited

    Never

Everything posted by samona

  1. That made no difference. What I ended up doing is setting the column size. I can't make out the table's data on the screen now, but at least it prints the way i want it. However, it would be nice if I could adjust the print size without affecting the window on the screen.
  2. I want to change the actual table width and height to be smaller for printing purposes. I want the table as a whole to be smaller. Right now for printing I have FIT_WIDTH which span across the whole page, but I want the table width to span only across half the page. I looked at the link before, but nothing jumps at me as to adjusting overall table size for printing.
  3. thank you for the response. below is my cell renderer. I can only make the size of the data but not the actual table which what I want. public class MyTableCellRenderer extends javax.swing.JLabel implements javax.swing.table.TableCellRenderer { public java.awt.Component getTableCellRendererComponent( javax.swing.JTable table, java.lang.Object value, boolean isSelected, boolean hasFocus, int rowIndex, int colIndex) { setText(value.toString()); if (value.equals(null)) { return this; } javax.swing.JLabel label = new javax.swing.JLabel(value.toString()); //label.setFont(new java.awt.Font("Helvetica Bold", java.awt.Font.PLAIN,7)); label.setVerticalAlignment(javax.swing.SwingConstants.CENTER); label.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); // System.out.println("IN RENDER"); return label; } public void validate() {} public void revalidate() {} protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) {} public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue) {}
  4. I need some help printing a jtable so that the table prints 50% of what the normal print size would be. Any ideas on how I can control the Jtable's print size?
  5. Anyone have an idea of why Windows 7 limits the resolution for remote desktop to 4096x2048? Is this a software limitation? Any way around it? Is there any application available that provides higher resolutions? Also, any ideas on what the maximum number of monitors one can use with Windows 7 remote desktop?
  6. Bookmarked it. Thx again!
  7. Thx! Where in the Doc?
  8. Anyone have an idea of how to sum a calculated field. I have field A and field B. I create a new field called C and that equals the sum(A, B). Now i want a grand total of field C. Any ideas?
  9. If an administrator is logged in and wishes to visit the admin pages he is required to login. However, if his login fails he is sent to the login page and his session is destroyed. Also, if a regular user attempts to login to the admin pages, his session is destroyed and he is sent back to the login page. However, if he clicks back, he is still able to get into his account. It seems as though the session isn't really destroyed. if (!$session->isAdmin()) { $session->destroySession(); header('Location: ../login.php'); exit(); } public function destroySession() { $_SESSION = array(); session_destroy(); }
  10. Hi, I want to end a session when a registered user is asked to login again but enters the incorrect credentials. I'm destroying the session and taking the user back to the login page, but for some reason when s/he clicks "back" on the browser s/he is able to get back into her/his account. Any ideas?
  11. I used another form for the admin login as fugix suggested. thx!
  12. i could do that but i figured that would be redundant. is that the best practice?
  13. Hi, I want to have a way to require an admin who is logged in to re-authenticate before he/she is allowed to view administrative pages using the same form they used to login. Any ideas?
  14. Thanks! You were right. That was the issue. I'll take your advice and put it all in the same request. thanks again!
  15. I believe youre right. However, I'm not sure why it runs the code in the isset($_POST['submit']) if statement in login.php after the redirect in processform.php. Shouldn't the $_POST array be empty at that point and the form displayed?
  16. Yeah, I've tried it in IE8 and it tries to load the page for about 4 minutes, then i just cancelled it. I'm wondering if the $_POST['submit'] is still set when the processform.php redirects to login.php. However, I would think it would be cleared out.
  17. I keep getting a 'The page isn't redirecting properly error on Firefox. Anyone have an idea? I think it has something to do with the header() function, but I can't seem to pinpoint it. Code for the two files are below. login.php <?php require_once('./lib/myform.class.php'); require_once('./functions.php'); $page = 'Login Page'; $myStyles = './css/mystyles.css'; if (isset($_POST['submit'])) { $error_ar = array(); $values_ar = array(); $username = sanatize($_POST['username']); $password = sanatize($_POST['password']); if (empty($username)) { $error_ar['username'] = 'You must enter your username'; //echo $arr_error['username']; } else { $values_ar['username'] = $_POST['username']; } if (empty($password)) { $error_ar['password'] = 'You must enter a password'; } } if (count($error_ar) == 0) { session_start(); $_SESSION['username'] = $username; $_SESSION['password'] = md5($password); header('Location: processform.php'); exit(); } ?> <html> <head> <title><?php print $page ?></title> <link href="<?php print $myStyles ?>" rel="stylesheet" type="text/css"> </head> <body> <div id="container"> <div id="form"> <?php $f = new myForm($error_ar); $f->beginForm("login.php"); $f->beginFieldset(array('class'=>'form')); $f->addLegend($page); $f->beginList(); $f->beginListItem(); $f->addLabel('username', 'Username'); $f->addInput('text', 'username', $values_ar['username'], array('class'=>'text', 'id'=>'username')); $f->endListItem(); $f->beginListItem(); $f->addLabel('password', 'Password'); $f->addPassword(); $f->endListItem(); $f->endList(); $f->endFieldset(); $f->beginFieldset(array('class'=>'form')); $f->addLegend('Submit'); $f->beginList(); $f->beginListItem(); $f->submitButton('Login', array('class'=>'submit')); $f->endListItem(); $f->endList(); $f->endFieldset(); echo $f->printForm(); ?> </div> </div> </body> </html> processform.php <?php session_start(); require_once('./lib/mysqldb.class.php'); if (!isset($_SESSION['username'])) { header('Location: login.php'); exit(); } $db = new MySQLDB(); $username = $_SESSION['username']; $password = $_SESSION['password']; if ($db->authenticateUser($username, $password)) { echo "SUCCESS!!!"; } else { $_SESSION = array(); session_destroy(); header('Location: login.php'); } ?>
  18. paste the code that you are having trouble with
  19. Thanks for the response. I want to create a login system using a mysql database instead of the default filesystem. I'm just wondering if its better to tear down the connection after each page and rebuild it on the next one. Also,I want to use object so I'm wondering if I should serialize those object or just store the values in the database and query them using the saved session value.
  20. I'm thinking that your variable $count is local to the function that's executing. Have you tried making it a global variable?
  21. I was wondering what the users at phpfreaks recommend as far as persistent database connections. Is it better to save the connection, or to open up a new connection for each page? Also, how would you have a persistent connection?
  22. Hi all, What is the best practice when using Sessions for guest users?
  23. Hi all, In the following code I have a header() call that should be executed when the username or password field is empty. However, for some reason that header() function will not execute. Instead, it goes all the way to the end of the process() method. Any help will be appreciated. class ProcessLoginForm { private $db; public function __construct(){ $this->db = new MySQLDB(); } public function process() { $guest_session = new Session(); $errors = array(); $username = sanatize($_POST['username']); $password = sanatize($_POST['password']); if (empty($username)) { $errors['username'] = 'The username field cannot be blank.'; } if (empty($password)) { $errors['password'] = 'The password field cannot be blank.'; } if (count($errors)) { $_SESSION['errors'] = $errors; header('Location:../login.php'); } if ($this->db->authenticateUser($username, md5($password))) { $guest_session->destroySession(); $session = new Session(); $session->registerSession($username); header('Location:../welcome.php'); } $errors['invalid'] = 'Invalid Username/Password'; $_SESSION['errors'] = $errors; header('Location:../login.php'); } } $proc = new ProcessLoginForm(); $proc->process(); ?>
×
×
  • 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.