Jump to content

matthew9090

Members
  • Posts

    135
  • Joined

  • Last visited

    Never

Everything posted by matthew9090

  1. itnt this thread supposed to be in the 3rd party scripts section then?
  2. now ive tryed another way which works but then won't stop showing names once the timer has finished <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript"> $(document).ready(function() { var number = 2; function countdown() { setTimeout(countdown, 1000); $('#box').html("Selecting person in " + number + " seconds"); number --; if (number<0) { keywords = [ "name1", "name2", "name3", "name4", "name5" ] var keyword = keywords[Math.floor(Math.random()*keywords.length)] document.write(keyword); number = 0; } } countdown(); }); </script> <center> <div id="box"> </div> </center>
  3. i've got this code: <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript"> $(document).ready(function() { var number = 10; var url = "index.php?number=0"; function countdown() { setTimeout(countdown, 1000); $('#box').html("Selecting person in " + number + " seconds"); number --; if (number<0) { window.location = url; number = 0; } } }); </script> <center> <div id="box"> <?php error_reporting(0); $file = file('names.txt'); $rand_line = rand(0, sizeof($file) - 1); $line = $file[$rand_line]; if ($_GET['number']=="0") { echo $line; } else { ?> <script type="text/javascript"> countdown(); </script> <?php } ?> </div> it is meant to when the javascript number = 0 show a random line from file but it comes up with undefined index 'number' on line 28
  4. thats an auto refresh i need it to refresh when you click a button
  5. also i need to refresh it by a button.
  6. if your text file has 1 per line then you need to read it line by line and somehow put each line into an array which if your using that tutorial i gave u.
  7. iv'e looked at lots of code but none of them seem to work. i need to refresh the div tag in my page. <div id="div" name="div"> //content here </div>
  8. the problem was that because it is an onchange function, if it has only 2 options then it would start on the first one so you can only change to the second option so by adding a third one at the top you can click both.
  9. thanks for all your help but i've found a simpler solution, just to add 1 more blank option at the top.
  10. it needs to look like this: Header Header website list 1 website list 2 website list 1 website list 2 and i've got this code: <?php $file1 = array_map('trim',file('websites.txt')); foreach ($file1 as $link) { echo "<a href='$link'>$link</a>"; } ?> <?php $file2 = array_map('trim',file('websites2.txt')); foreach ($file2 as $link2) { echo "<a href='$link2'>$link2</a>"; } ?> but i don't know how to put it into a table that looks like above.
  11. i'm back again and i am not very good with tables as the <tr> and <td> tags confuse me i need to put 2 sets of links into 2 columns in the table and they come out jumbled up. <table> <tr> <th>column 1</th> <th>column 2</th> </tr> <?php $sites = array_map('trim',file('websites.txt')); //read the whole file into an array & trim the newline character from the end of each line foreach ($sites as $link) { echo "<tr><td><a href='$link'>$link</a></td>"; } $sites = array_map('trim',file('websites2.txt')); //read the whole file into an array & trim the newline character from the end of each line foreach ($sites as $link) { echo "<td><a href='$link'>$link</a></td></tr>"; } ?> </table>
  12. http://website1.com http://website2.com .....
  13. I have this code so far: $file = fopen("file.txt", "r"); while(!feof($file)) { echo "<a href=" . fgets($file). ">" . fgets($file) . "</a><br />"; } fclose($file); but if i use fgets twice (like above) it makes the link, link to the previous result
  14. i'm thinking something like this? <?php if (isset($_GET['Time'])) { ?> <script type="text/javascript"> //javascript code here </script> <?php } ?> <form action="<?php $_SERVER['self']; ?>" method="get"> <select name="Time" onchange="this.form.submit();"> <option id="1" value="New">New</option> <option id="2" value="Old">Old</option> </select></form> but i don't know how to use javascript to swap them round. any ideas?
  15. sorry i meant i have a basic html form with a drop down selection box with 2 options ('old' and 'new'). but i don't know how to swap the drop down options around once you've clicked the other because there is only 2 options you can't click the other one.
  16. there is a tutorial about this: http://www.youtube.com/watch?v=5y1HyQLg2dU&list=PLFA954987101252EF&index=25
  17. i meant file_get_contents
  18. change $bad_words = file($words_text); to $bad_words = file_get_contents($words_text); i think
  19. i have a basic html form with a drop down selection box with 2 options ('old' and 'new'). when you click one it swaps them round to you can click the other because it is an onchange event. <form action="<?php $_SERVER['self']; ?>" method="get"> <select name="Time" onchange="this.form.submit();"> <option value="New">New</option> <option value="Old">Old</option> </select></form>
  20. thanks people! it works now, it was the path.
  21. thanks guys that really helped but 1 more thing is that i downloaded a flash game then it came with a html page set up so i clicked it and the game played fine but when i put the flash file into my website through the form it comes up with the exact same html code apart from the directory (which should be right) and comes up as a white box. downloaded <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="640" height="480"> <param name="movie" value="firstflight.swf"> <param name="quality" value="high"> <embed src="firstflight.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="640" height="480"> </embed> </object> mine <object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='640' height='480'> <param name='movie' value='firstflight.swf'> <param name='quality' value='high'> <embed src='games/flash/firstflight.swf' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='640' height='480'> </embed> </object>
  22. <form method="post" action="game_upload.php"> Name of the game: <input type="test" maxlength="10" name="name" /><br /> Game file: <input type="file" name="file" id="file" /><br /> <input type="submit" value="Submit" name="submit" /> </form>
  23. i am making a game upload site and here is my full code undedited: <html> <head> <title>Quickplay</title> <link rel="stylesheet" type="text/css" href="style/main.css" /> <link rel="stylesheet" href="style/menu_style.css" type="text/css" /> </head> <body> <?php include('includes/header.php'); ?> <div id="content"> <?php error_reporting(E_ALL); $name = $_POST['name']; $file = $_FILES['file']; echo "<p>" . $_FILES['file']['tmp_name']; $moved = move_uploaded_file($_FILES['file']['tmp_name'], "games/flash/$file"); if ($moved) { echo "<p>moved!"; } else { echo "<p>did not move!"; } echo $name . "<p><br />" . $file . "<p>"; if (strlen($name)>10) { echo "name too long"; } else { include('includes/connect.php'); $random = rand(1000000000, 2000000000); $start = "<a href ="; $end = ">$name</a>"; $link = "games/" . $random . ".php"; mysql_query("INSERT INTO games (gamename, gamefile, link) VALUES('$name', '$file', '$link') "); $sqlfile = "SELECT * FROM games WHERE gamefile='$file'"; $file2 = mysql_query($sqlfile); $file3 = @mysql_fetch_assoc($file2); $file4 = $file3['gamefile']; $fp = fopen("$link", 'w') or die('error'); $html = " <html> <head> <title>Quickplay - $name</title> <link rel='stylesheet' type='text/css' href='../style/main.css' /> <link rel='stylesheet' href='../style/menu_style.css' type='text/css' /> </head> <body> <div class='title'><img src = '../images/logo.png' width='275' height='100' align='top'></img></div> <ul id='menu'> <li><a href='../index.php' target='_self'>Home</a></li> <li><a href='../games.php' target='_self'>Games</a></li> <li><a href='../forum.php' target='_self'>Forum</a></li> <li><a href='../upload.php' target='_self'>Upload Game</a></li> <li><form><a>Search games</a><input type='text' width='10' id='search' /></form></li> </ul> <div id='content'> <h2>$name</h2> <object width='432' height='330' title='game'> <param name='movie' value='games/flash/$file4' /> <param name='quality' value='high' /> <embed src='games/flash/$file4' type='application/x-shockwave-flash' width='432' height='330'></embed> </object> </div> <?php include('../includes/footer.php'); ?> </body> </html> "; fwrite($fp, "$html"); fclose($fp); mysql_close($con); echo "<p>Success!</p><p><a href='index.php'>Go back</a>"; } ?> </div> <?php include('includes/footer.php'); ?> </body> </html>
×
×
  • 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.