PHP - Flash Games
Is there anyway to have users play flash games on my forum and if they win/etc, send them Forum Gold? Wouldn't it be easy to hack it though by just changing the data being sent from the flash app with tamper data? I want to put a poker flash game on my site, and if users play poker/etc and if they win, I want to run a mysql query to update there account with more "Forum gold" If you will, and I want the poker flash game to have correspond and work with the amount of Forum Gold that they have? Would this have to be custom coded by me If I learn actionscript? OR is there anything out like this that I can use?
Similar TutorialsHey guys. I am building a games website, and I am using ID (example: games.php?id_) to view games with their Title, SWF file to play, and their Image Icon. I am basically fetching information per game using ID that is typed in the URL after my website address containing the '?id_' or '?id='. Can somebody tell me whats wrong with the code I have bellow, because it's not working. I always get parse error (T_STRING) at line 9. This code is inside my games.php page. It doesn't seem to work. ================================ <?php $conn = mysql_connect("host", "username", "password"); mysql_select_db("games"); $game_id = $_GET['id']; $sql = "SELECT * FROM games WHERE id='$game_id' LIMIT 1"; $result = mysql_query($sql, $conn) or die(mysql_error()); $number_of_results = mysql_num_rows($result); while ($result_array = mysql_fetch_array($result, MYSQL_ASSOC)) { $id = $result_array['fldID']; $title = $result_array['fldTitle']; $graphic = $result_array['fldIconSmall']; // Example: game1234.png $swf = $result_array['fldSwfSrc']; // Example: game1234.swf $graphic_file_location = 'http://www.blabla.com/games/images/' . $graphic; $swf_file_location = 'http://www.blabla.com/games/' .$swf; echo '<a href="http://www.blabla.com/games.php?id=' . $id . '"></a>'; echo '<h1>' . $title . '</h1>'; echo '<img src="' . $graphic_file_location . '" width="50" height="50" border="0" />'; echo '<object width="550" height="400">'; echo '<param name="movie" value="' . $swf_file_location . '">'; echo '<embed src="' . $swf_file_location . '" width="550" height="400">'; echo '</embed>'; echo '</object>'; } ?> ================================ Any help would be appreciated since so far this script has not executed at all. I keep getting an error when executing this entire script. I can't find any errors in it either..but it just doesn't work. Hi all am haiving abit of a problem am trying to query 6 categories with 6 games each.With the code i done is only showing one cat with 6 games.
How can i fix this ?.
If you go to games-flash.co.uk you will see at the bottom of the home page that only one cat shows.
php code.
<div class="catgames"> Hey guys, I have been programming for a while and I want to know what sort of design patterns I should look into when making a game? For example what design pattern is best for: Database management User management Forum management Etc I can only think of singleton or factory (for user/forum) I am reasonably new to OOP, but would like to learn it properly, so I thought creating a simple program such as rock-paper-siccors would work to be able to expand it eventually, and hopefully it will teach me reusable code practice. Hi, I own a website called www.gpstudios.com, a flash games site. I didn't design it myself, but since having it built a year ago, I understand pretty much all of the inne workings. I'm a game coder so php makes good sense to me. Anyway, i woudl like to change the way a game info (instructions, description) is fetched. Currently, we have 650 games in our database. The way all the info is gotten is through mySQL. So, what I would like to do is take these lengthy instructions/description strings and put them each into a text file, within the folder destination of the game. Currently though, we don't even have a folder destination for each game, which is also a problem. Some games have extra files, which our site-developers didn't account for. There are several games that we've had to manually put into folders because of this problem (two .xml files cannot be named the same in the same folder) Also, if you go onto my website and click on a game, you get sent to playgame.php?id=xxx The main thing I would like to change though (which I have attempted before, but not succeeded with) would be to change the url adress of the games to something more like: www.gpstudios.com/games/game_name/ This is how most game websites do it. When I tried to do this myself, what I did was to simply create an index.php within the folder of one of the aforementioned games, and within this folder I wrote something as simple as: include("../../../playgame.php?id=xxx"); But upon loading this page, I would receive a load of error messages regarding all the other includes and requires in the playgame.php. So by inserting playgame.php?id=xxx in this deep folder, it destroys all other directory links elsewhere. I investigated and found that inserting set_include_path($_SERVER['DOCUMENT_ROOT']) would fix the problem with all these links, but it didnt - while the page loads, it appears to ignore anything that isn't in the root directory, including images. I tried the include method with loads of different files, and they just wouldn't load correctly if they used anything outside the root directory. And my final wish would be to do all of this automatically. To simply write a php file that I would run once and it would generate all the directories for me. It would need to copy every single description and instructions from mySQL and put them within text files within directories which are named after the game. I would then need to automatically create a load of index.phps for each individual game with some simple code similar to: include("../../../playgame.php?id=xxx"); Obviously it would be silly to create a load of unique index files with a hard copy of playgame.php, incase I want to give my site a makeover at some stage. I'm asking alot aren't I? Well I know that if I was given the code from another games website, I would understand it and it would be easy to implement, but unfortunately, despite searching, downloading and installing over 10 Flash Game arcade scripts, none of them used this method... despite their demo page showing that they do. Mainly, all I need to know is how to is how to generate a php/text file, and then I need to know what method I would use for getting the playgame.php running correctly from within a different folder. I'm pretty sure I could do the rest on my own then. Thanks! Basically I am setting up my own cricket management game, but there are 3 areas that I am slightly stuck on and would appreciate help: 1) When a use registers, I need to create 11 players for their team. For this, I am going to have one text files with first names and one text file with surnames. How can I open each file and select a name and then match them together? 2) I need to create the list of games to be executed at particular times through a cron job. How can I go through all the teams in a table and match them together in games, ensuring everyone plays everyone? If a new player registers, he will be put into a random league and so the games for that league will have to be redone 3) How can I set up a cron job to execute the above games? Each team should play once a day and so if there are 24 teams in a table, there will be 12 games that occur through this cron job. I assume cron jobs are the best thing for this. Any help would be appreciated. Thanks. Hi to all gurus, Here is a small program in flash which calls values from PHP and displays them correctly. path = "http://localhost/xampp/nwjv/php/"; //declare path to php files lvOut = new LoadVars(); //create lv object sending variables OUT to php lvIn = new LoadVars(); //create lv object receiving variables IN from php lvIn.onLoad = function (success) { if(success) { //PHP variable value to textbox InVal = lvIn.returnVal; InTxt = lvIn.retVal; output.text = InVal; output1.text = InTxt; /* output1.text = "No Value"; if(InTxt == 'lo' ) { output1.text = "Low Value"; } if(InTxt == 'hi') { output1.text = "High Value"; } */ }else{ //...or notify of failure output.text = "fail"; } } myBtn.onRelease = function(){ //assign user-input value to lv property called years lvOut.years = years.text; //send to a blank window // lvOut.send(path + "dogyears_new1.php",lvIn,"GET"); lvOut.sendAndLoad(path + "dogyears_new1.php",lvIn,"GET"); }; Hi Guys.
Doing an assignment for uni, and stuck on an error. Ill attach some files to show the problem and any help very much appreciated.
Error and the screen it comes on
Code
<?php $select = mysqli_query($con, "SELECT * FROM categories");
while ($row = mysqli_fetch_assoc($select)) { }
function dispsubcategories($parent_id) {
}
function getnumtopics($cat_id, $subcat_id) {
and the structure of the database
Edited March 28, 2020 by Ben555 Hey guys I'm trying to make browser game and I was wondering if this is possible. 99% of the game is html/php/mysql but I wanted one little mini game to be in flash. after playing the flash game if you win you get +1 of whatever to your account. So my question is can someone program that cross over of flash back into php? Thanks is there anyway with php to run a script to see weather the browser supported flash or not, and if it does/does not support flash to redirect it to to different urls ? thanks for any advice in advance Hey guys, once again I have a question. For the game I'm working on in PHP for practice with MySQL, I want to see if I can use data from a flash document (you play a little game and get x points, you are then given x worth of resources...) I'm not very good with ActionScript, and I dont think ActionScript can connect to mySQL... I'm thinking I could just make a page that the flash program links to, then that gives the points (and I could just have a set amount of points for completing the task...) But then people could just keep going to that page and getting infinite resources... Is there a way I could hide the adress of the page so nobody knows what it is? Thanks! Is there any way to link these together? For example if I create a video player in Flash, can I use it in PHP etc? This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=320884.0 Hi:
I have a wordpress, and I want to publish a flash animation.
I´ve modified the wordpress file sidebar.php with a include to this code in another .php file, but I don´t see nothing, but I don´t have any error... just "white space" instead the animation...
Can you help me with the code??
<? $wmode = "opaque"; $refererId = 258; $bannerId = 210; $width = 250; $height = 250; $link = "http://www.bellross.com/index.php?bannerId=".$bannerId."&refererId=".$refererId; $flashLink = "http://www.bellross.com/index.php?bannerId=".$bannerId."%26refererId=".$refererId; ?> <style type="text/css"> body, object { padding:0; margin:0; } #timekeeper, .link { width: <?= $width?>px; height:<?= $height?>px; } .hand { bottom: 0px; left: 107px; } </style> <link href="wp-content/themes/sahifa/template/style.css" rel="stylesheet" type="text/css"/> <script type="text/javascript"> window.onload = function() { if(document.getElementsByTagName('body')[0].style.MozTransform == '' || document.getElementsByTagName('body')[0].style.WebkitTransform == '' || document.getElementsByTagName('body')[0].style.OTransform == '' || document.getElementsByTagName('body')[0].style.transform == '') { function hand() { handS.style.MozTransform = handS.style.WebkitTransform = handS.style.OTransform = handS.style.transform = 'rotate(' + (time * 6) + 'deg)'; handM.style.MozTransform = handM.style.WebkitTransform = handM.style.OTransform = handM.style.transform = 'rotate(' + (time / 10) + 'deg)'; handH.style.MozTransform = handH.style.WebkitTransform = handH.style.OTransform = handH.style.transform = 'rotate(' + (time / 120) + 'deg)'; } var handH = document.getElementById('handH'); var handM = document.getElementById('handM'); var handS = document.getElementById('handS'); var timekeeper = document.getElementById('timekeeper'); var d = new Date(); var time = d.getSeconds() + 60 * d.getMinutes() + 3600 * d.getHours(); hand(); setInterval(function() {time = time+0.20; hand();}, 200); setInterval(function() {r = new Date(); time = r.getSeconds() + 60 * r.getMinutes() + 3600 * r.getHours(); hand()}, 10000); } }; </script> <script src="wp-content/themes/sahifa/swf/Scripts/swfobject_modified.js" type="text/javascript"></script> <script type="text/javascript"> swfobject.registerObject("FlashID"); </script> <object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="<?= $width?>" height="<?= $height?>"> <param name="movie" value="wp-content/themes/sahifa/swf/timekeeper.swf"> <param name="quality" value="high"> <param name="wmode" value="<?= $wmode?>"> <param name="swfversion" value="8.0.35.0"> <param name="FlashVars" value="clickTAG=<?=$flashLink?>" /> <!-- Cette balise <param> invite les utilisateurs de Flash Player en version 6.0 r65 et ultérieure à télécharger la version la plus récente de Flash Player. Supprimez-la si vous ne voulez pas que cette invite soit visible. --> <param name="expressinstall" value="wp-content/themes/sahifa/swf/Scripts/expressInstall.swf"> <!-- La balise <object> suivante est destinée aux navigateurs autres qu'IE. Supprimez-la d'IE à l'aide d'IECC. --> <!--[if !IE]>--> <object type="application/x-shockwave-flash" data="wp-content/themes/sahifa/swf/timekeeper.swf" width="<?= $width?>" height="<?= $height?>"> <!--<![endif]--> <param name="quality" value="high"> <param name="wmode" value="<?= $wmode?>"> <param name="swfversion" value="8.0.35.0"> <param name="expressinstall" value="wp-content/themes/sahifa/swf/Scripts/expressInstall.swf"> <param name="FlashVars" value="clickTAG=<?=$flashLink?>" /> <!-- Le navigateur affichera le contenu alternatif suivant pour les utilisateurs d'un lecteur Flash de version 6.0 ou de versions plus anciennes. --> <div id="timekeeper"> <a href="<?= $link; ?>" target="_blank" class="link"></a> <img src="template/images/handH.png" class="hand" id="handH" alt="heure"/> <img src="template/images/handM.png" class="hand" id="handM" alt="minute"/> <img src="template/images/handS.png" class="hand" id="handS" alt="seconde"/> </div> <!--[if !IE]>--> </object> <!--<![endif]--> </object>Do you see anything wrong? How can I make this work in my page? I hope you can help me. Thanks. Regards So the site is using a flash section to control navigation. when I click the button pages are not loaded only the flash here is url: Script to control flash generated url Code: [Select] <?php function fudgePage(){ $url = trim(strtolower(preg_replace('([^[:alnum:]\|\/\:\.\_\-])', '', "http://".$_SERVER['SERVER_NAME'].'/'.$_SERVER['REQUEST_URI']))); $parts = parse_url($url,PHP_URL_PATH); $sections = explode('/',trim($parts,'/')); $section = @ trim(substr(ereg_replace('([^[:alnum:]\-])','',$sections[0]),0,50)); $subsection = @ trim(substr(ereg_replace('([^[:alnum:]\-])','',$sections[1]),0,50)); $pages = array(); $pages[''] = "sections/homeContent.php"; $pages['residential'] = "sections/residentialContent.php"; $pages['residential-virtual-tours'] = "sections/virtualTours.php"; $pages['residential-features'] = "sections/featuresContent.php"; $pages['residential-floorplans'] = "sections/floorPlansContent.php"; $pages['residential-site-key-plan'] = "sections/siteKeyContent.php"; $pages['retail'] = "sections/retailContent.php"; $pages['interest'] = "sections/emailContent.php"; $pages['location'] = "sections/locationContent.php"; $pages['contact'] = "sections/contactContent.php"; $pages['news'] = "sections/newsContent.php"; $pages['icon-gallery'] = "sections/galleryContent.php"; $key = @ (!empty($subsection) && $section != 'interest') ? $section.'-'.$subsection : $section ; $page = @ $pages[$key]; return array('subsection' => $subsection, 'section' => $section, 'page' => $page); } ?> INDEX PAGE Code: [Select] <?php $baseurl = 'http://SomDomain.com/'; $baseinc = dirname(realpath(__FILE__)); include('dirty-hack.php'); $params = fudgePage(); $swf = (!empty($params['section'])) ? $params['section'].'.swf' : 'home.swf' ; $include = (!empty($params['page'])) ? $params['page'] : "sections/homeContent.php" ; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <link rel="stylesheet" href="<?php echo $baseurl ?>css/styles.css" type="text/css" media="all" charset="utf-8" /> <!--[if IE]> <link rel="stylesheet" href="<?php echo $baseurl ?>css/ie-styles.css" type="text/css" media="all" charset="utf-8" /> <![endif]--> <script type="text/javascript" language="javascript" src="<?php echo $baseurl ?>js/prototype.js" charset="utf-8"></script> <script type="text/javascript" language="javascript" src="<?php echo $baseurl ?>js/scriptaculous.js" charset="utf-8"></script> <script type="text/javascript" language="javascript" src="<?php echo $baseurl ?>js/effects.js" charset="utf-8"></script> <script type="text/javascript" language="javascript" src="<?php echo $baseurl ?>js/scripts.js" charset="utf-8"></script> <script type="text/javascript" language="javascript" src="<?php echo $baseurl ?>js/fo.js" charset="utf-8"></script> <style type="text/css"> #slideshow { position: relative; width: 310px; height: 422px; } #slideshow div { position: absolute; left: 0; top: 0; } </style> <base href="<?php echo $baseinc ?>" /> </head> <body> <?php /*<script type="text/javascript" language="javascript" src="<?php echo $baseurl ?>js/slideshow.js" charset="utf-8"></script> <script type="text/javascript">new Slideshow('slideshow', 5000);</script> */ ?> <div id="top"> <div id="click-hack" style="float:left; position:absolute; top:250px; z-index:5; width:150px; height:75px; cursor:pointer;" onclick="window.location='<?php echo $baseurl ?>';"><img src="<?php echo $baseurl ?>images/blank.gif" height="75" width="150"></div> <div id="flash"> <div id="flashObject"> </div> <script type="text/javascript" language="javascript" charset="utf-8"> // <![CDATA[ var fo = new FlashObject("<?php echo $baseurl . $swf ?>", "ICONsite", "782", "325", "7", "#0f0f0f",wmode="transparent"); fo.addParam("menu", "false"); fo.addParam("scale", "exactfit"); fo.addParam("wmode", "transparent"); fo.addParam("quality", "high"); fo.addParam("allowScriptAccess", "sameDomain"); fo.write("flashObject"); // ]]> </script> </div> <iframe src="ticker/index.html" width="100%" height="34" frameborder="0" scrolling="no"></iframe> <div id="container"> <?php include($baseinc. $include); ?> </div> <div id="footer" class="clear"> <div id="footerAddress"> <a href="http://www.somedomain.com/" target="_blank"> <img src="images/footer.jpg" alt="" style="overflow: hidden;" /> </a> </div> </div> <div id="footer-nav" class="clear"> <!--img src="images/icon-sm.gif" alt="" /--> <br /> <ul> <li class="none"><a href="<?php echo $baseurl ?>">Home</a></li> <li class="none"><a href="<?php echo $baseurl ?>residential">Residential</a></li> <li class="none"><a href="<?php echo $baseurl ?>residential/virtual-tours">Virtual Tours</a></li> <li class="none"><a href="<?php echo $baseurl ?>residential/features">Features</a></li> <li class="none"><a href="<?php echo $baseurl ?>residential/floorplans">Floorplans</a></li> <li class="none"><a href="<?php echo $baseurl ?>residential/site-key-plan">Site Key Plan</a></li> <li class="none"><a href="<?php echo $baseurl ?>retail">Retail</a></li> <li class="none"><a href="<?php echo $baseurl ?>interest">Available Units</a></li> <li class="none"><a href="<?php echo $baseurl ?>location">Location</a></li> <li class="none"><a href="<?php echo $baseurl ?>contact">Contact</a></li> <li class="none"><a href="<?php echo $baseurl ?>news">News</a></li> <li class="none"><a href="<?php echo $baseurl ?>icon-gallery">Gallery</a></li> <li class="none"><a href="<?php echo $baseurl ?>privacypolicy.php" onclick="oWin('privacypolicy.php', '', '512', '380'); return false;">Privacy Policy</a></li> </ul> <br /> <br /> </div> </div> <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> var pageTracker = _gat._getTracker("UA-1188345-10"); pageTracker._initData(); pageTracker._trackPageview(); </script> </body> </html> Sorry if this isn't the right forum, I wasn't sure where to post this. Alright, so I have a high score submit script, and it goes as follows... This is the actionscript: Code: [Select] on (release) { var usco LoadVars = new LoadVars(); uscore.name = _root.suname; uscore.score = _root.suscore.stime; uscore.game = "alien"; uscore.mode = "survival"; uscore.sendAndLoad("linkhere", uscore, "POST"); play(); } Note: We have also tried: Code: [Select] on (release) { var usco LoadVars = new LoadVars(); uscore.name = _root.suname; uscore.score = _root.suscore.stime; uscore.game = "alien"; uscore.mode = "survival"; var uscoresubmit:LoadVars = new LoadVars(); uscore.sendAndLoad("linkhere", uscoresubmit, "POST"); play(); } The PHP is: <?PHP include('Connect.php'); $name=$_POST['name']; $name=mysql_real_escape_string($name); $score=$_POST['score']; $score=mysql_real_escape_string($score); $game=$_POST['game']; $game=mysql_real_escape_string($game); $mode=$_POST['mode']; $mode=mysql_real_escape_string($mode); if(!empty($game)) { mysql_query("INSERT INTO scores(game, name, score, mode) VALUES ('$game', '$name', '$score', '$mode')"); } ?> I have also tried running a number of things on the "else" of that if(!empty($game)) and nothing has pulled through, so I'm under the notion that it isn't loading the page in sendAndLoad()? It was working before, but it appears to have just stopped, we're not sure what we changed. Any help would be greatly appreciated! Thanks, Xyphon Hi, I'm very new to PHP and i'm trying to delevop an app using flash as the front end via PHP and a mySQL database on my server/host. I currently have two php scripts that I am referencing. The first is used as a login and the second is used to retrieve table data. Both scripts work fine when tested in flash but when I upload the flash file to my server and test online the first (login) refuses to work. The php files are already uploaded to the server and the mySql database is created on my server. I was wondering if there was anything in the script that might be causing this. I can't see why and my brain is starting to degrade rapidly. Can someone have a quick look and tell me if there's something in this script that's preventing this from working online please? my flash variables a user and pass This is the login script that won't work online: <? //this pulls the variables from the flash movie when the user //hits submit. Use this when your global variables are off. //I don't know how to toggle global variables, so I just put //it in all the time ;) $user=$_POST['user']; $pass=$_POST['pass']; //connect to database mysql_pconnect("*****","********","******") or die ("didn't connect to mysql"); mysql_select_db("******") or die ("no database"); //make query $query = "SELECT * FROM jingle WHERE recipient = '$user' AND password = '$pass' "; $result = mysql_query( $query ) or die ("didn't query"); //see if there's an EXACT match $num = mysql_num_rows( $result ); if ($num >=1){ print "status=You're in&checklog=1"; } else { print "status=Sorry, but your user name and password did not match a user name/password combination in our database. Usernames and passwords are entered in from a different file. Thank you for visiting test login script!!&checklog=2"; } ?> and this is the script the does work online: <? /* Retrieves score data from highscores table and returns data and status to Flash errorcode: 0: successful select 1: can't connect to server 2: can't connect to database 3: can't run query */ // fill this in with the right data for your server/database config $server = "*****"; $username = "******"; $password = "******"; $database = "*******"; // get current user $user=$_GET['user']; $pass=$_GET['pass']; // mysql_connect: Open a connection to a MySQL Server // Returns a MySQL link identifier on success, or FALSE on failure. if (!mysql_connect($server, $username, $password)) { $r_string = '&errorcode=1&'; // mysql_select_db: Sets the current active database on the server that's associated // with the specified link identifier. Every subsequent call to mysql_query() // will be made on the active database. // Returns TRUE on success or FALSE on failure. } elseif (!mysql_select_db($database)) { $r_string = '&errorcode=2&'; // mysql_query: Sends a query (to the currently active database // For SELECT, SHOW, DESCRIBE or EXPLAIN statements, mysql_query() returns a // resource on success, or FALSE on error. // For other type of SQL statements, UPDATE, DELETE, DROP, etc, mysql_query() // returns TRUE on success or FALSE on error. } else { $qr = mysql_query("SELECT * from jingle WHERE recipient = '$user' AND password = '$pass'"); if (!qr || mysql_num_rows($qr)==0) { $r_string = '&errorcode=3&msg='.mysql_error().'&'; } else { $r_string = '&errorcode=0&n='.mysql_num_rows ($qr); $i = 0; while ($row = mysql_fetch_assoc ($qr)) { while (list ($key, $val) = each ($row)) { $r_string .= '&' . $key . $i . '=' . stripslashes($val); } $i++; } // add extra & to prevent returning extra chars at the end $r_string .='&'; } } echo $r_string; ?> Thanks in advance What am I doing wrong? All I want is a flash and php email form working. At best i get the elements emailed surrounded by all the html formatiing tags makign it impossible to head or only a few (ie messahe and phone) show up in email sent or more often nothign gets sent at all. In the flash filn I have a send button with Code: [Select] onClipEvent(data){ _root.nextFrame(); } actioned on the form movie in flash And Code: [Select] on(release){ form.loadVariables("email_send.php", "POST"); } script on the send button. The movie where the form is places has 5 fields made with input text with Instant names: Inp_Name Inp_Department Inp_Email Inp_Phone Inp_Message their variables are; name dept phone message Also in the properties theya re all set to HTML rednering is set to off and the webssite is www.chriscreativity.com Why does it not work at all and if it does how do I loose the htmal formings crap and get it to work please Code: [Select] <strong><?php /* --------------------------- php and flash contact form. by www.MacromediaHelp.com --------------------------- Note: most servers require that one of the emails (sender or receiver) to be an email hosted by same server, so make sure your email (on last line of this file) is one hosted on same server. --------------------------- */ $sendTo = "chris.bruneluni@yahoo.co.uk"; $subject = "Message from chriscreativity.com"; // read the variables form the string, (this is not needed with some servers). $headers = $_POST["name"] . $_POST["dept"] . $_POST["email"] . $_POST["phone"]; $message = $_POST["message"]; mail($sendTo, $subject, $message, $headers); ?></strong> [attachment deleted by admin] I have got a flash file that is stored in the database. So I fetch it and put it in a variable then put the variable in the flash embed code where the src is but the flash comes up blank. $file = "SELECT * FROM table WHERE column='$name'"; $file2 = mysql_query($sqlfile); $file3 = @mysql_fetch_assoc($file2); $file4 = $file3['gamefile']; //skip some code to html embed section <object width='550' height='400'> <param name='movie' value='valuename'> <embed src='$file4' width='550' height='400'> </embed> </object> then the page comes up with a white box which when you hover over it says 'file not loaded'. Hey Guys! I have a website in flash where some users can upload a jpg, jpeg image to my server and then approved or denied... The image is resized to 1000 x 1000 max (if its higher than those numbers) I am afraid that my script doesnt have any kind of protection to hacks like "virus.php.jpg" or any other type of attacks due to the lack of knowledge I have on this subject. I am a little bit lost as to what I could do to prevent some of these attacks... I would really appreciate some feedback and or basic lines of prevention code to prevent at least some basic attacks Heres my php code for the image upload: Code: [Select] // Set local PHP vars from the POST vars sent from flash $Name = $_POST['Name']; $itemNumber = $_POST['imageType']; $filename = $_FILES['Filedata']['name']; $filetmpname = $_FILES['Filedata']['tmp_name']; $fileType = $_FILES["Filedata"]["type"]; $fileSizeMB = ($_FILES["Filedata"]["size"] / 1024 / 1000); list($filename, $extension) = explode('.', basename($_FILES['Filedata']['name'])); $filename = $Name; $target = $filename . $itemNumber . "." . $extension; // Place file on server, into the images folder move_uploaded_file($_FILES['Filedata']['tmp_name'], "../Winner_Images/".$target); ini_set("memory_limit","30M"); $source_pic = "../Winner_Images/".$target; $destination_pic = "../Winner_Images/".$target; $max_width = 1000; $max_height = 1000; $src = imagecreatefromjpeg($source_pic); list($width,$height)=getimagesize($source_pic); $x_ratio = $max_width / $width; $y_ratio = $max_height / $height; if( ($width <= $max_width) && ($height <= $max_height) ){ $tn_width = $width; $tn_height = $height; }elseif (($x_ratio * $height) < $max_height){ $tn_height = ceil($x_ratio * $height); $tn_width = $max_width; }else{ $tn_width = ceil($y_ratio * $width); $tn_height = $max_height; } $tmp=imagecreatetruecolor($tn_width,$tn_height); imagecopyresampled($tmp,$src,0,0,0,0,$tn_width, $tn_height,$width,$height); imagejpeg($tmp,$destination_pic,100); imagedestroy($src); imagedestroy($tmp); Thanks a lot in advance!! Cheers! |