Jump to content

acroporas

Members
  • Posts

    15
  • Joined

  • Last visited

    Never

Posts posted by acroporas

  1. Using MySQL 4.1.22-standard

     

     

    The following code works when $fuzzy >= 0.125

     

    But when $fuzzy <= .05, the first seems to be working as expected, but the second query returns no results.  Anyone know why, or how to make it work with smaller values for $fuzzy?

     

     

    Query 1

    $sql = "SELECT AVG( user_lat ) AS AVG_Lat, AVG( user_long ) AS AVG_Lon, count( * ) AS Number_Users, `user_id`, ROUND( user_lat / $fuzzy ) * $fuzzy AS fuzzy_lat, ROUND( user_long / $fuzzy ) * $fuzzy AS fuzzy_lon
    FROM `phpbb_users` 
    WHERE user_lat != ''
    GROUP BY fuzzy_lat, fuzzy_lon
    ORDER BY Number_Users DESC";
    

    for each row returned I then run a second query using the fields fuzzy_lat and fuzzy_lon which were returned from the previous query.

    	$sql = "SELECT `user_id`, `username`
    		FROM `phpbb_users` 
    		WHERE ROUND( user_lat / $fuzzy ) * $fuzzy =  $fuzzy_lat
    		AND  ROUND( user_long / $fuzzy ) * $fuzzy = $fuzzy_lon;
    

  2. I have a "contact me" form.  The user fills in the from, clicks submit and I have Php email it to me.  Here's the code I use to send the email.

     

    $headers = "From: " . $_POST["from"];
    mail($MyEmailAddress,$_POST["Subject"],$_POST["body"],$headers);
    

     

    This works fine, in that it sends me the email.  However when there are " or ' symbols in the message, they are sent as \" or \'

     

    Why does this happen, and how do I fix it so that the email recieved shows " and '.

     

    Also, are there other symbols that I will discover later on don\'t work either.

  3. Thanks, yes, that does exactly what I wanted it to.  And yes, I was planning on using the same script to display all images, I was just trying to get it to work with one image first.  Here is the full code I will use.

    [code]
    Two numeric variables are passed via GET.  $Gallery and $Image

    <?
    $count=0;
    foreach( Glob("*") as $poten )
      {
    if ( is_dir($poten) )
      {
    $count += 1;
    $folders[$count] = $poten;
      }
      }
    sort($folders);

    if ( is_dir($folders[$Gallery]) )
      {
    chdir($folders[$Gallery]);

    $dir=Glob("{*.jpg,*.JPG}",GLOB_BRACE);
    sort($dir);

    if ( is_file("$dir[$Image]") )
      {
    header('Content-type: image/jpeg');
    readfile("http://server.com/images/$folders[$Gallery]/$dir[$Image]");
      }
    else
      {
    header('Content-type: image/jpeg');
    readfile("http://server.com/images/badimage.jpg");
      }
      }
    else
      {
    header('Content-type: image/jpeg');
    readfile("http://server.com/images/badimage.jpg");
      }

    ?>
    [/code]
  4. I want to hide the real location and file name of the images used on my site.

    instead of
    [code]<img src="/picture.jpg">[/code]

    I would use.
    [code]<img src="/image.php">[/code]

    Right now I have something like the following for image.php:
    [code]<? header("Location: http://www.server.com/picture.jpg"); ?>[/code]

    It works in that picture shows up as it on the page when I use. <img src="/image.php">

    But if you enter http://www.server.com/image.php into the address bar, rather than just showing the picture, the address is automatically changed to the pictures real address (http://www.server.com/picture.jpg)

    Is there a way to make image.php stay in the address bar, and just show the picture as if image.php was actually a .jpg file? 
  5. [quote author=Gaoshan link=topic=110039.msg444105#msg444105 date=1159592764]
    By "jump pass the form" do you mean you want the form to load some other page and it doesn't or do you want the form to reload the same page and it doesn't? Not clear what you want to do.  ???
    [/quote]

    overview of code

    If ( $_session['login']!=yes )
    {
    display login page
    submit goes back to same page
    }
    else

    "password was good"

    The problem is that even when the password is good, it still shows the login page.
  6. Can you see what's up with this?

    Even when I enter the correct username and password, the script does not jump pass the form.

    [code]<?php

    session_start();

    if ( $POST['login'] == "iamme" && $_post['pasword'] == "saysme" )
    $_SESSION['logged'] = "yes";


    if ( $_SESSION['logged'] != "yes" )
    {
    ?>

    <html>
    <head>
    <title>Login</title>
    </head>

    <body>

    <form action="index.php" method="post" >

      <p style="margin-top: 0; margin-bottom: 0"><b><font size="4">Domain.com</font></b></p>
      <p style="margin-top: 0; margin-bottom: 0">Login in to access admin page.</p>
     
    <?php

    if ( ( $_POST["login"] != "iamme" && $_POST["login"] ) || ( $_POST["pasword"] != "saysme" && $_POST["pasword"] ) )
    echo '<p style="margin-top: 0; margin-bottom: 0">Username or password was incorrectly entered.</p>';
    ?>

      <p>&nbsp;</p>
     
      Login:    <input type="text" name="login" size="20"></p>
     
      Password:  <input type="password" name="pasword" size="20"></p>
     
      <p>&nbsp;</p>
     
      <p><input type="submit"></p>
    </form>

    </body>

    </html>

    <?php

    die("");

    }
    ?>
    password was good.
    [/code]
  7. It is difficult to post code snippets as  the problem is not in just one line but I can explain one example of what I call 'hard to control' 

    I have the following file system.

    home directory
              header.php

              child directory 1
                      page.php

             child directory 2
                     java.js

    page.php has in it the line:    include ( ../header.php )
    and
    header.php has in it the line:  glob('*.*')

    Case 1:  header.php has the line "../child-directory2/java.js"
    Glob returns files in home directory.

    Case 2:  header.php has the line "http://www.home directory.com/child directory 2/java.js"
    Glob returns files in child directory 1

    Edit...I've change my code significantly so this is from memory so it may not be exactly as it was.  But the theme is accurate.  Changing how I refrenced the .js file from a relative link to a absolute link changed wich directory glob would search.
  8. I'm trying to figure out how to control which folder the glob( function looks at?  (I've noticed that it does not allways search the same folder that the php file calling the function is in.) 

    Is there a website that goes into more detail about the funtions than what is found in the php manual.


    Also, is there a better way to get the list of files in a folder that is more easily controlable?

    Thanks

    Will

  9. [quote author=shoz link=topic=108344.msg435940#msg435940 date=1158480716]
    If this is a shared host or you know nothing about linux contact your host and ask them about enabling the extension.
    [/quote]

    Thank you very much for your help.

    I suspect the host is shared, and I know I know nothing about linux.  I succeeded in step 1...

    So I emailed host's tech support, 5 minutes later I got a reply saying exif is now installed.  So I guess it is very easy when you know what you are doing.

    Thanks again

    Will
  10. To say that I am a beginner with this, would be an understatment.  Last night I was at the level of doing a google search for "what is php?"  So please forgive me if my question is stupid.

    I want to read exif data from a picture.  I read on "the manual" that in order to use the exif functions I must configure php to "enable exif".

    How do I do this?  Remember I am very much a novice?  I need directions that a moron could follow.

    I doubt I will be able to answer any questions.  So here is my phpinfo() page if that will help you give me very straitforward directions.  http://www.photography.willandsam.com//test.php

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