From: beginner on 23 Oct 2008 17:44 I found a great site for making highscore list from flash with actionscript to mysql To send data from a flash file looks like this with actionscript _root.add_pass = "{same as $pass in _data.php}"; _root.name = _root.variableYouUsedInTheGameForThePlayersName; _root.score = _root.variableYouUsedInTheGameForThePlayersScore; getURL("http://mattias24.gratiswebb.0lx.net/new_score.php", "", "POST"); But how do i do the same from director with lingo? Ive tried this as a test but it aint working global score, name, add_pass on preparemovie set add_pass="psxmgui" set score=3 set name="Kalleanka" end -------------------------- And this on a button global score, name, add_pass on mouseDown netID = postNetText ("http://mattias24.gratiswebb.0lx.net/ new_score.php", add_pass) netID = postNetText ("http://mattias24.gratiswebb.0lx.net/ new_score.php", name) netID = postNetText ("http://mattias24.gratiswebb.0lx.net/ new_score.php", score) end on mouseUp me gotonetpage "http://mattias24.gratiswebb.0lx.net/index.php", "_new" end -------------------------- _data.php looks like this: <? //****Made by: Jeroen den Haan***Alias's: jeroen84 / Jer'ul**** //*****You will need to modify the following few lines***** //1. Hostname or IP of your MySQL-Server $db_host = "sql208.0lx.net"; //2. Username and Password to Login to your Database $db_user = "mattias24"; $db_pass = "psxmgui"; //3. Name of your Database $db_name = "0lx_2518830_highscore"; //4. Name of your Flash Game $game_name = "test"; //5. Name of file that displays HTML Highscore (.php file!) $dis_file = "index.php"; //6. Password for adding new scores to the list. (Include variable in flashmovie) $add_pass = "psxmgui"; //***From here on you don't need to modify, but you can if you want and on your own risk.*** //7. Unique usernames on list (0/1) $u_user = 1; //8. Standard scoresize $st_size = 10; //9. Secondary scoresize (HTML only) $sec_size = 100; // HTML Table Properties (Use ' in the html code instead of ".) //10. Top Font properties $t_font = "<font color='#FFFFFF' face='Arial, Helvetica, sans- serif'>"; //11. Main Font properties $m_font = "<font color='#750000' size='2' face='Arial, Helvetica, sans-serif'>"; //12. Table Properties $table_prop = "<table cellpadding='2' cellspacing='2' border='0' width='152'>"; $table_width = "152"; //13. Top Row Color $t_color = "#000033"; //14. Main Rows Color $m_color = "#666666"; //**Do NOT modify this line** $db_table = "highscores_" . $game_name; ?> ------------------------------------- _new_score.php <? //****Made by: Jeroen den Haan***Alias's: jeroen84 / Jer'ul**** include_once ("_data.php"); $conn = mysql_connect($db_host,$db_user,$db_pass); mysql_select_db($db_name,$conn); if ($pass==$add_pass) { if ($u_user==1) { $sql3 = "SELECT name FROM $db_table ORDER BY name"; $result3 = mysql_query($sql3); while($r = mysql_fetch_object($result3)) { $tmp = "{$r->name}"; if ($name==$tmp) { $n_exist=1; } } if ($n_exist==1) { $sql1 = "UPDATE $db_table SET score='$score' WHERE name=\"$name\""; $result1 = mysql_query($sql1); } else { $sql1 = "INSERT INTO $db_table (name,score) VALUES (\"$name\", \"$score\")"; $result1 = mysql_query($sql1); } } else { $sql1 = "INSERT INTO $db_table (name,score) VALUES (\"$name\",\"$score \")"; $result1 = mysql_query($sql1); } $sql2 = "SELECT id FROM $db_table ORDER BY score DESC"; $result2 = mysql_query($sql2); $num = 1; while($r = mysql_fetch_object($result2)) { $result = mysql_db_query($db_name,"SELECT * from $db_table WHERE id='{$r->id}'"); $resultArray = mysql_fetch_array($result); $did = $resultArray["id"]; $name = $resultArray["name"]; $score = $resultArray["score"]; if ($num>$sec_size) { $sql3 = "DELETE FROM $db_table WHERE id='$did'"; $result3 = mysql_query($sql3); } $num++; } } mysql_close ($conn); ?> ---------------------------------- index.php <html> <head> </head> <body leftmargin="0" topmargin="0" rightmargin="0" marginheight="0" marginwidth="0" text="#000000" bgcolor="#FFFFFF"> <center> <? include("http://mattias24.gratiswebb.0lx.net/get_score.php"); ?> </center> </body> </html> --------------------------------- _get_score.php <? //****Made by: Jeroen den Haan***Alias's: jeroen84 / Jer'ul**** include_once ("_data.php"); $conn = mysql_connect($db_host,$db_user,$db_pass); mysql_select_db($db_name,$conn); if ($order=="name") { $sql1 = "SELECT id FROM $db_table ORDER BY name ASC"; } else { $sql1 = "SELECT id FROM $db_table ORDER BY score DESC"; } $result1 = mysql_query($sql1); if (!$flash) { if ($order=="name") { $HTM_1 = "<table cellpadding='0' cellspacing='0' border='0' width=" . $table_width . "> <tbody> <tr align=center><td>" . $table_prop . "<tr align=center> <th bgcolor='" . $t_color . "'>" . $t_font . "#</font></th> <th bgcolor='" . $t_color . "'>" . $t_font . "Name</a></font></th> <th bgcolor='" . $t_color . "'>" . $t_font . "<a href='" . $dis_file . "?sec=1'>Score</font></th> </tr>"; } else { $HTM_1 = "<table cellpadding='0' cellspacing='0' border='0' width=" . $table_width . "> <tbody> <tr align=center><td>" . $table_prop . "<tr align=center> <th bgcolor='" . $t_color . "'>" . $t_font . "#</font></th> <th bgcolor='" . $t_color . "'>" . $t_font . "<a href='" . $dis_file . "?sec=1&order=name'>Name</a></font></th> <th bgcolor='" . $t_color . "'>" . $t_font . "Score</font></th> </tr>"; } echo "$HTM_1"; } $num = 1; while($r = mysql_fetch_object($result1)) { $result = mysql_db_query($db_name,"SELECT * from $db_table WHERE id='{$r->id}'"); $resultArray = mysql_fetch_array($result); $name = $resultArray["name"]; $score = $resultArray["score"]; if ($sec==1) { if ($num<=$sec_size) { $HTML = " <tr bgcolor='" . $m_color . "' align='center'><td>" . $m_font . $num . "</td> <td>" . $m_font . $name . "</font></td> <td>" . $m_font . $score . "</font></td> </tr>"; echo "$HTML"; } } else { if ($num<=$st_size) { if ($flash) { echo "&name$num=$name&score$num=$score"; } else { $HTML = " <tr bgcolor='" . $m_color . "' align='center'><td>" . $m_font . $num . "</td> <td>" . $m_font . $name . "</font></td> <td>" . $m_font . $score . "</font></td> </tr>"; echo "$HTML"; } $num++; } } } if (!$flash) { if ($sec==1) { $HTM_2 = "</tbody></table> </td></tr> <tr align=center> <th bgcolor='" . $t_color . "'>" . $t_font . "<a href='" . $dis_file . "'>Top" . $st_size . "</a></font></th> </tr></table>"; } else { $HTM_2 = "</tbody></table> </td></tr> <tr align=center> <th bgcolor='" . $t_color . "'>" . $t_font . "<a href='" . $dis_file . "?sec=1'>Top" . $sec_size . "</a></font></th> </tr></tbody></table>"; } echo "$HTM_2"; } mysql_close ($conn); ?> ----------------------------------------------------- Please help me out
|
Pages: 1 Prev: Rollover on tree component Next: How to send name and score variables with lingo |