Jump to content

priti

Members
  • Posts

    461
  • Joined

  • Last visited

Posts posted by priti

  1. It works like a charm!  Just one more question....

    Do you have to end sessions or are they timed or what?

    Don't think it's important.... just want to make sure it isn't.

     

    I would say kindly destroy your session don't depend on timeouts if a user has logged in for 10 min work and he leave off the PC and another got a chance tolook in his account easily..... becos your will give user a sesible amount of time to work on your system hence once you think user will be done with work on logout button call session_destroy or unset your $_SESSION.

     

     

  2. considering two tables

     

    table 1:company

    nokia

    motorola

     

    table2:model

                                        id company model

                                          1  nokia  N91

    Edit Delete 2 NOKIA n92

    Edit Delete 3 samsung 123

    Edit Delete 4 samsung 3434

    Edit Delete 5 LG LG-dinamit

    Edit Delete 8 Motorola motoRocker

    Edit Delete 9 Motorola motoRocker

     

    Query:

    select company.name,model.company,model.model

    from company LEFT JOIN model on company.name=model.company

    where company.name="nokia" OR model.company="nokia"

     

    Output:

    name company model

    nokia nokia N91

    nokia NOKIA n92

     

    I think this works  that query needed a proper way of setting joins for more info on mysql join kindly visit

    http://dev.mysql.com/doc/refman/5.0/en/join.html

     

    it wil help you understand what i have done here

     

    hope it help

    happy coding

     

     

    The query

     

  3. Code:

    --> is used for my comments

     

    <?php

      // Edit upload location here

      $destination_path = getcwd().DIRECTORY_SEPARATOR;

     

      -->getcwd() IS A FUNCTION WHICH WILL RETURN CURRENT WORKING DIRECTORY.

      -->DIRECTORY_SEPARATOR IS A DEFINED CONSTANT

     

      $result = 0;

     

      $target_path = $destination_path . basename( $_FILES['myfile']['name']);

        -->BASENAME IS A FUNCTION WHICH RETURN FILENAME ONLY.

     

      if(@move_uploaded_file($_FILES['myfile']['tmp_name'], $target_path)) {

          $result = 1;

      }

      -->move_uploaded_file IS A FUNCTION WHICH MOVE THE UPLOADED FILE FROM TEMP DIR TO $target_path

      -->$_FILES IS A SUPER GLOBAL ARRAY WHICH GET POPULATED WHEN YOU DO FILE UPLOADING

      sleep(1);

    ?>

     

    <script language="javascript" type="text/javascript">window.top.window.stopUpload(<?php echo $result; ?>);</script> 

    --> upload will get stop once files are moved to correct directory.

     

    I think the js part is not a concern area.

     

    Regards

  4. I am VERY new to php & mysql.

     

    Today I created a form that updates a database.

     

    I then created this page: http://www.bjjnews.org/TUF/fighterdb/formatting.php

     

    for viewing it. There is alot of info. Is there a better way to view it? to format it?

     

    The output on this page is very much scattered .

     

    1.Give proper heading to your columns  like you have given for your First name,Last name

    2.the better would be acc. to me

     

    ->   First list the all the student by their teams

    -> The names of students should be clickable link i.e when you click 'Steve Kinnison ' It should take you to a Steve Kinnison 's profile page and on the profile page you can nicely provide all the needed details.

     

    regards

     

  5. Try to get filemtime(),filectime() function to these uploaded files to get the date and time.The other way is to upload the file in today's date folder or files with file name having their timestamp. so this way of trick can help you also.

     

    Regards

  6. one more thought to do the same is working in your .htaccess file by writing a rule about error 404 .when ever response form server is 404  page not found then show some particular page .

     

    ErrorDocument 404 /path/to/404.html

     

    Regards

     

  7. Hi,

     

    I'm a complete newbie to php, and I've read php experts warning not to place passwords inside a php file, coz if the server gets compromised, a hacker will be able to see the password.

    But my question is that if the server gets compromised and the hacker can see the php file, then won't the hacker be able to view the login and password of the sql database (stored in the php file) and then gain access to the database?

     

    thats pretty true !! Nothing is safe if login credentials are with hackers .

     

    Well i was reading an article some time back on security and it listed some basic step like if you have to create an admin panel the very first thing come in mind is create an admin directory and keep related files there. Rather, then this keep this directory name some thing different(something which is diffcult to guess and only known to you)  and protect it with password. this is how you avoid a very first step of hacker to your system.he has to find which is a admin directory before he sits for getting control thru admin with admin login creditials to get your sites related sensitive info.

     

    no system is 100% secure.

     

    Regards

     

     

  8. Hi,

     

    <?php

    header("Content-type: image/png");

    $string = $_GET['text'];

    $im = imagecreatefrompng("Button.png");button.png

     

    $black = imagecolorallocate($im, 0, 0, 0); //I don't need any color so can I remove this line?

     

    YES YOU CAN REMOVE THIS LINE.

     

    $px = (imagesx($im) - 7.5 * strlen($string)) / 2; // not sure what's going on in this line.

     

    THIS CALCULATE WHERE TO SHOW YOUR STRING ON IMAGE ( X )

     

     

    imagestring($im, 3, $px, 9, $string, $black); //would i need to remove anything here?

     

    NO YOU DON'T HAVE TO CHANGE ANYTHING HERE IS $BLACK IS NULL OR EMPTY IT WILL TAKE IT AS WHITE COLOR.ALL FIELDS ARE MANDATORY NO OPTIONAL SO YOU HAVE TO GIVE THESE NUMBER OF PARAMETER IN imagestring() function.

     

    imagepng($im);

    imagedestroy($im);

    ?>

     

    let us know if things are not solved.

  9. well if you go by this way it will not show you it will return 1 or other value as it is not the correct way of including some file.

     

    In second code book code link work becuase on click you process a file called booknews.php .

     

    while templating you are using???

     

    if($var == 'book')

      $file_to_be_include='booknews.php'

    elseif()

      $file_to_be_include='booknews.php'

    .

    .

    .

    .

    .

     

    and in your template use {include file="$file_to_be_included"} to include the files content. (this is in smarty) use the same way in your template engine.

     

    Regards

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