FaLgoR 0 Report post Posted February 12, 2005 the download page is not working on my sims website... global vars is turned off, does that effect the download page? here it is, download.php <?$dbhost = 'localhost';$dbuser = ''; // removed for this$dbpass = ''; // removed for this$dbname = 'toxicsims';mysql_connect($dbhost,$dbuser,$dbpass);mysql_select_db($dbname);?><?if(!$id)return;$query = mysql_query("SELECT * FROM objects WHERE id=$id;");$download = mysql_fetch_array($query);if(!file_exists($download[location])){print "File not found.";exit;}mysql_query("UPDATE templates SET clicks=(clicks+1) WHERE id=$id;");header("Location: $download[location]");?> Would anything need to be added, I had some help off my bros m8 to do the insert page. he added the $_POST bits in for me... 42616[/snapback] well man, I think the globals have to be turned on because the page sent an url: download.php?id=1, so, if the globals are turned off it doesn't work. I'll try to found an solution for your problem, and I'll send u another msg if I find it. Share this post Link to post Share on other sites
cragllo 0 Report post Posted February 13, 2005 Thank you FaLgoR, I may be moving all my sites onto one server soon, to save time and hastle, and so global vars will be turned on then.... Not sure yet tho, may cost too much...If and when I do, Ill tell you (If you havent already found a solution that is)Craig. Share this post Link to post Share on other sites
bjrn 0 Report post Posted February 13, 2005 You can do it without the global vars turned on, just instead of having $id in the code you use $_GET['id'].If you think it's too bulky just have $id = $_GET['id'];somewhere at the top of your code. Share this post Link to post Share on other sites
Deaths Aprentice 0 Report post Posted February 13, 2005 let's make insert.php (or something else): <?php if($go){ // if var $go is set mysql_query("INSERT INTO table(name,description,image,location) VALUES ('$name','$desc','$image','$location') or die (mysql_error()); echo "Done!"; exit; } else { // not really required at this case but... ?> <form action="insert.php" method="post"> Name: <input type="text" name="name"><br> Description: <input type="text" name="desc"><br> Image: <input type="text" name="image"><br> Location: <input type="text" name="location"><br> <input type="submit" name="go" value="Submit"> </form> <?php } ?> But don't forget to connect this page with the database. I suggest that you make a new page called conection.php with all the details and connections, and put: include("conection.php"); at the top of the pages which requires an connection. 40226[/snapback] My changes are in bold, some of them are not really needed, but this way it's better EDIT: Heh, sorry, thought there was only 1 page ^.^, didn't see the other replys. PS Have you been trying out with this script, is MySQL down because of this xD? Share this post Link to post Share on other sites
cragllo 0 Report post Posted February 13, 2005 I use this script on my site hosted at Xisto wothoit any problems, my other site is hosted elsewhere, and global vars it turned off for security reasopn, and nothing seems to work... Share this post Link to post Share on other sites