User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 14

Thread: PHP Server side app needed to...

  1. #1
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Tuna's Avatar
    Join Date
    Feb 2008
    Location
    Central Texas
    Posts
    1,853
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    PHP Server side app needed to...

    Some of you may have been following in the other thread regarding my need for accessing a dictionary file.

    The file is pretty large, so downloading the entire file is prohibitive.

    Jeff and I discussed the idea of using the GET Object to send the "word" to a server wherein a database would be queried. If the "word" is in the database, the return would be either that word, or as simple as a 1, and conversely, return 0 if the word is not in the database...

    I have some long term hosting arranged, and bandwidth isn't an issue, so I'm willing to host this database and the application, so if anyone wants to use the app, they will be welcome to it.

    Jeff eluded to the desire to write the code, but there's no guarantee in that, since he's very busy.

    Now, I've dabbled just a little with PHP, but I'm not so good at it. I'm going to try to pull it off myself, but if anyone out there wants to tackle this not so monumental task, please let me know!


  2. #2
    Clickteam Clickteam
    LB's Avatar
    Join Date
    Jun 2007
    Location
    Richardson, Texas, North America
    Posts
    8,937
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)

    Re: PHP Server side app needed to...

    I haven't tested but this looks like it could work:
    PHP Code:
    <?php
        $Find 
    $_POST['w'];

        
    $Words file_get_contents("http://pixelkick.com/Dictionary.csv");

        
    $Word explode("\r\n"$Words);

        
    $Num count($Word);
        for(
    $i 0$i $Num$i++)
        {
            if(
    $Word[$i] == $Find)
            {
                exit(
    "1");
            }
        }
        exit(
    "0");
    ?>
    Just pass the word as a POST data item.

    EDIT: Just tested and it isn't working for me, I think I made a mistake. I haven't done PHP for several months.

    Anything returns 0, but nothing as in "" returns 1!?


    Never mind, I changed "\n" to "\r\n" instead. It works perfectly

    Just give it a post data item named "w" with the word you want to check. 0 means not found and 1 means found.

    Takes 1~2 seconds with my server.
    Working as fast as I can on Fusion 3

  3. #3
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Tuna's Avatar
    Join Date
    Feb 2008
    Location
    Central Texas
    Posts
    1,853
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Re: PHP Server side app needed to...

    Wow! How can I thank you LB? I can't tell you how much this will help!

    I'm going to change it just a bit, if I can manage it, to query a MySQL table on my server. I'm hoping this will decrease the response time as much as possible.

  4. #4
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Tuna's Avatar
    Join Date
    Feb 2008
    Location
    Central Texas
    Posts
    1,853
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Re: PHP Server side app needed to...

    I set up a table called TheList in one of my existing databases. The table has but one field called Word.

    Would this work? I haven't tested it yet...



    Code:
    <?
    
    $word = $_GET['w'];
    
    
    $service="******";
    $username = "******";
    $password="*******";
    $database = "********";
    
    mysql_connect($service, $username, $password);
    @mysql_select_db($database) or die( "Unable to select database");
    
    $query = "Select Count(*) from TheList where Word = "$Word";
    
    $result = mysql_query($query);
    
    if($result == 1)
        {
    	exit("1");
        }
    	exit("0");
    
    ?>
    Or should I just echo the result of the query, which would be either 0 or 1 ?

  5. #5
    Clickteam Clickteam
    LB's Avatar
    Join Date
    Jun 2007
    Location
    Richardson, Texas, North America
    Posts
    8,937
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)

    Re: PHP Server side app needed to...

    I don't know about databases and queries, sorry. You'll have to ask Jeff or Looki, or anyone else who knows.
    Working as fast as I can on Fusion 3

  6. #6
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Tuna's Avatar
    Join Date
    Feb 2008
    Location
    Central Texas
    Posts
    1,853
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Re: PHP Server side app needed to...

    Well, I've done database and queries plenty of times, but almost never with PHP. I'm trying to test this now. If I can't get it to work, I have your solution to fall back on, and LB, I can't thank you enough!

  7. #7
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Tuna's Avatar
    Join Date
    Feb 2008
    Location
    Central Texas
    Posts
    1,853
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Re: PHP Server side app needed to...

    Ok, i got it working as far as returning 0 or 1 now...

    its been a NIGHTMARE trying to figure it out, and I never would have pulled it off without the code that LB first offered.

    I'm going to test it with flash tomorrow, i'm totally beat now.

    but here is the code that works:

    Code:
    <html>
    <head>
    <title>Pixelkick Word Lookup</title>
    </head>
    <body>
    <?
    
    $word = $_GET['w'];
    
    $service="shhhhhhh";
    $username = "shhhhhhh";
    $password="shhhhhhhhh";
    $database = "shhhhhhhh";
    
    mysql_connect($service, $username, $password);
    @mysql_select_db($database) or die( "Unable to select database");
    
    $query = "Select * from TheList where Word = '$word'";
    
    $result = mysql_query($query);
    
    while ($row = mysql_fetch_assoc($result))
    {
        If($row['Word'] == $word)
    {
      exit("1");
    } 
    }
    exit("0");
    
    ?>
    
    </table>
    </body>
    </html>
    this should return a 1:
    http://pixelkick.com/LookUpWord.php?w=zulu

    but this should return a 0:
    http://pixelkick.com/LookUpWord.php?w=zzulu

    THANKS!!!!!!!!!!!

  8. #8
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Tuna's Avatar
    Join Date
    Feb 2008
    Location
    Central Texas
    Posts
    1,853
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Re: PHP Server side app needed to...

    Well, I made a little flash program (I'll post it here). When I run it from MMF2 it works fine. When I run the swf it doesn't work.

    All it does is send the GET call and display's the right$(ofresult,1) which should be either 0 or 1

    Attached files Attached files

  9. #9
    Clickteam Clickteam
    LB's Avatar
    Join Date
    Jun 2007
    Location
    Richardson, Texas, North America
    Posts
    8,937
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)

    Re: PHP Server side app needed to...

    Why does the script need to be inside an HTML page? It works fine if you put the script in a file without the HTML tags and all that.
    Working as fast as I can on Fusion 3

  10. #10
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Tuna's Avatar
    Join Date
    Feb 2008
    Location
    Central Texas
    Posts
    1,853
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Re: PHP Server side app needed to...

    well, i did not know that... I appreciate you pointing that out!

    Does it work for you when you compile the swf?

Page 1 of 2 1 2 LastLast

Similar Threads

  1. HTML5 Server Side Setup
    By Kimera in forum HTML5 Export Module 2.5
    Replies: 6
    Last Post: 3rd January 2014, 10:27 AM
  2. Server-side logic with lacewing
    By ac3raven in forum Multimedia Fusion 2 - Technical Support
    Replies: 16
    Last Post: 11th July 2013, 04:55 AM
  3. Server Side Saving/Loading iOS Specific
    By cfullerNY in forum iOS Export Module Version 2.0
    Replies: 6
    Last Post: 10th May 2013, 05:27 PM
  4. Saving/editing/loading a large level, server-side.
    By SergeantBiscuits in forum Multimedia Fusion 2 - Technical Support
    Replies: 6
    Last Post: 23rd March 2012, 04:42 PM
  5. MOO documentation of SERVER side
    By Patrick in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 13th July 2006, 01:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •