Jump to content

samona

Members
  • Posts

    232
  • Joined

  • Last visited

    Never

Posts 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. 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?

  5. 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?

  6. 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();
    
    	}

  7. 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?

  8. 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');
    
    
    }
    
    
    
    
    
    
    ?>
    
    

  9. 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.

  10. 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.