Jump to content

Eiolon

Members
  • Posts

    358
  • Joined

  • Last visited

Posts posted by Eiolon

  1. That is correct.  However, using the @page CSS code I was able to have the printer inerpret the margin for where it printed on the paper.

     

    For example, in Internet Explorer I set the print margin to be 5 inches all around.  However, inserting the @page CSS made it so it printed to the very edge instead of 5 inches into the paper.  So while it doesn't change the value found in Page Setup of the browser, it does sent it to the printer without the margin.

  2. I too am using 14.0.1.

     

    I only care about the print margin when it is applied to paper.  As shown with my above receipts, the margin is only there when printed from Firefox.  It is non-existant if I print from IE or Chrome.

     

    jesirose - if I remove the @page code, it makes it so the margin is no longer 0 for the printer.  I then get the same result as the Firefox receipt.  I have removed the @page and tried doing only the html,body tag you suggested and did not fix Firefox but broke IE and Chrome.

     

    Mahngiel - you still have the margin visible in your print preview screen.  If I look at the print preview in IE and Chrome, the margin is not there, just with Firefox.

     

    Keep in mind I have the headers/footers set to empty for all the browsers so I am not sure if that is why you have one.

     

    EDIT: I think at this point I will have to control the margins from the browser.  I was hoping to avoid doing so that way non-receipts would not be affected.  They will just have to live with everything they print to the laserjet being brushed up against the page.

  3. The page is validating fine for both HTML and CSS.  This is literally just a page with text on it because it is being sent to a point of sale receipt printer.  The only CSS is the code I provided in the original post and that all validated fine.

     

    Here is how it looks in the browser:

     

    receipt-browser.jpg

     

    Here is the result when the receipt is printed.

     

    receipt-printed.jpg

     

    So if there is any way to make that margin disappear without having to manually edit the Page Setup in the browser that is what I am looking for.

  4. I have some CSS code that I can control the Page Setup margins of Internet Explorer and Google Chrome but it will not work in Firefox.

     

    Basically I want the margins to be set to 0 instead of what is specified on the browser.  Any idea of what I can add to have it work in Firefox?

     

    <style type="text/css"> 
    @page  
    { 
    size: auto;   /* auto is the initial value */ 
    margin: 0mm;  /* this affects the margin in the printer settings */
    } 
    
    body  
    { 
    background-color:#FFFFFF;  
    margin: 0px;  
    } 
    p {
    margin:0;
    padding:0;
    font-family: "Courier New", Courier, monospace;
    font-size:12px;
    }
    </style>

  5. I now PHP is server side but I am not sure if there is some way to interface with hardware in some manner.

     

    Basically, I have an event registration page.  I would like the info that was registered to be sent to a receipt printer (such as a Star TSP series) as soon as the button is clicked to register.

     

    Even Name

    Date & Time

    Customer Name

     

    Currently, we get to a confirmation page in the web browser, and that is printed on 8.5x11 paper.  As you can image, it is quite a waste.  It would also like to stop having to go to FILE > PRINT.  I just want it to be instant.

     

    I can't print that confirmation page on the receipt printer because the browsers header/footer makes it 11 inches long for 3 lines.

     

    So any ideas on how to send directly to the receipt printer after submitting registration?

  6. Basically it is issuing a trigger command to show the pop up when a mouseover is done and there is a valid ID.  Then in the page personajax.aspx it is querying the database for the information.

     

    $.ajax({  
    54.          type: 'GET',  
    55.          url: 'personajax.aspx',  
    56.          data: 'page=' + pageID + '&guid=' + currentID,  
    57.          success: function(data)  
    58.          { 
    

  7. The DATETIME column is limited to YYYY-MM-DD HH:MM:SS format.  Anything else is illegal.

     

    Simply insert it that way, then format it as you desire when showing it to the user.

     

    You can also store it as a unix timestamp and format it as well.  Many people find a unix timestamp to be easier to work with when doing advanced mathematics.

  8. Yeah, I'd say it's a mess.

     

    You are assigning variables to things that haven't been posted yet, therefore they are undefined.

     

    Start by telling the script to begin when you press the submit button.

     

    if (isset($_POST['submit'])) {
    
       // then start assigning variables here
    
      // then start validating your data here
    
      // then start sanitizing your data here
    
      // then submit to your database here
    

     

    When you submit to your database, make sure it is the variables that have been assigned/validated/sanitized(which you are lacking) and NOT the POST variables.

     

    Also, it is easier to check if passwords match when they are still plain text, then hash a single one shortly before inserting into the database.

     

    Do all your database connection in one fell swoop.  You have it broken up.  Tell your script to connect to the database as you are inserting.

  9. In your SQL, you are asking it to select data based on the criteria of a username, password AND the userlevel.  Your fields being submitted are for username and password only. You are not submitting a userlevel field (nor should you be).

     

    Secondly, you are saying that $count is your $userlevel is.  Basically, you are saying if 1 row is returned, then userlevel is equal to 1.  It will never be 2 because you should never have two of the same username/password combinations in your database.

     

    So what you really need to do is modify your SQL to select the userlevel based on the submitted fields of the username and password.

     

    $sql="SELECT userlevel FROM daftarPenyelia WHERE user='$username' AND pass='$password'"; 
    

     

    Then you need to do your error checking.

     

    If $count is = to 1, then there was a match for the username and password.  Once that has been done, determine if it was a 1 or 2 for the admin or staff to direct to the appropriate page.

  10. There are a few approaches that you can do, but the simplist would be to keep them all in the users table, whether activated or not.  Have a column called "activated" as a tinyint and default to 0 for being inactive, and set to 1 for being active.  You then don't have to worry about comparing tables or moving and deleting from other tables.

  11. You should sanitize user input with mysql_real_escape_string. - EDIT just noticed you aren't also putting into MySQL database so ignore lol.

     

    Do not use

     

    <?php echo $_SERVER['PHP_SELF'];?>
    

     

    in the form action.

     

    To retain user input, you need to echo the value that was POSTed in each field.  Example:

     

    <p><input type="text" name="first" size="40" placeholder="Ex: Paul" value="<?php if (isset($_POST['first'])) echo $_POST['first']; ?>/></p>
    

     

    You can tell where error messages go by assigning the error message to a variable, then echo the variable in the spot you want it to be shown.  If you have lots of possible error messages, I suggest making an array and lopping through the error messages.

     

    I'm sure others can find more suggestions for you.

  12. I have a hardware device that I can send commands to by typing in a URL in the address bar.

     

    One command tells me if the ports are in use:

     

    http://admin:12345678@192.168.1.10/Set.cmd?CMD=GetPower
    

     

    It returns the result:

     

    p61=1,p62=1,p63=1,p64=1 
    

     

    What I want to do is try and grab the result with PHP when the page loads so I can tell people if the port is turned on or off.

     

    So "p61=1" means port 1 is turned ON.  If "p61=0" was displayed, it means port 1 is turned OFF.

     

    I am not sure if it is even possible to grab the information using PHP or not.  Any place to start would be great!  Thanks!

  13. How do websites determine what provider is providing service to a cell phone number?  Is there a database that they tie into?  I know it can't be based on the number itself since you can port numbers between providers.  I am just asking because I have a PHP script to send text message reminders to people but currently I need to select the service provider.  It would be nice to just enter the number and query a database to see the provider and then send the message.

  14. Here is my CSS:

     

    
    div.header {
    width:900px;
    background-color:#363E44;
    padding:12px;
    font-family:Arial, Helvetica, sans-serif;
    font-size:13px;
    color:#FFFFFF;
    font-weight:bold;
    }
    
    table.data {
    width:900px;
    padding:12px;
    border-collapse:collapse;
    }
    
    table.data th {
    background-color:#EEEEEE;
    padding:12px;
    font-family:Arial, Helvetica, sans-serif;
    font-size:11px;
    font-weight:bold;
    color:#000000;
    }
    
    table.data td {
    background-color:#FFFFFF;
    padding:12px;
    font-family:Arial, Helvetica, sans-serif;
    font-size:11px;
    color:#000000
    }
    

×
×
  • 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.