jackthenoob Posted June 2, 2009 Share Posted June 2, 2009 I'm new to programing and i decided to start with php. I have been working on my first project but i reached a point in the project where I'm stuck. When the user clicks on one link i want to be able to check and see if there is another mp3 file in the ftp folder then start the next download automatically and have it repeat the process until there are no new file in the folder to download. I know how to use loops so checking for the mp3 files should be easy, but i need to know how to automatically start downloads. Here's what i have so far. CODE:: http://www.mediafire.com/download.php?cyjygjnmmdg PAGE-EXAMPLE:: password= jack greg tod tom dog cat http://phpproject_001.t35.com/ I have no idea if my code is inefficient and i could use less code to achieve what I'm doing or what. Any help would be great. Quote Link to comment https://forums.phpfreaks.com/topic/160684-need-help/ Share on other sites More sharing options...
Maq Posted June 2, 2009 Share Posted June 2, 2009 I'm not downloading anything, please post the relevant code. Quote Link to comment https://forums.phpfreaks.com/topic/160684-need-help/#findComment-848005 Share on other sites More sharing options...
jackthenoob Posted June 3, 2009 Author Share Posted June 3, 2009 ok sorry for the confusing post. What i'm trying to do is make a program that receives a password from a user then checks to see if the password is one that is in the $pass array and what book it is then displays the download page for that book. And i needed help getting the download link on that page to download all 45 chapters but have only one download link that needs to be clicked on. Here is the code for the index page. <html> <head> <link rel="stylesheet" type="text/css" href="css\CssSheet.css" /> </head> <body> <center> <img src="img/Header.PNG" /> </center> <div class="passbox"> <br> <br> <center> <form name="input" action="Pass_Check.php" method="post"> <p>Type the password you recived at the end of your order.<br> <sub>Make sure that all letters are capitalized.</sub></p> <br> <input type="text" name="password" size="20"> <input type="submit" value="GO"> </forum> </center> </div> </body> </html> and the code for the password check. I was thinking that there might be a easier way to check what book the password is for. <?php include ("Var_Start.php"); if(in_array($pass,$arr)) { while($looper==0) { if($pass==$arr[$a]) { include ("Page_Display.php"); $looper=1; } else { $a++; }; }; } else { print "PASSWORD NOT RECOGNIZED <br><br> Please use the back button and retype your password.<br>Make sure that all letters are capitalized."; } ?> This is the include ("Var_Start.php"); files code. <?php $arr=array("jack","greg","tod","tom","dog","cat"); $pass=$_POST["password"]; $a=0; $looper=0; ?> and this is the include ("Page_Display.php"); files code <html> <body> <head> <link rel="stylesheet" type="text/css" href="css\CssSheet.css" /> </head> <body> <div class="bookpage"> <span class="linkstitle"> <span class="title"> <center> <?php include ("Render_Title.php"); ?> </center> </span> <span class="links"> <center> <?php include ("Render_Links.php"); ?> </center> </span> </span> <br> <br> <span class="info"> <hr> <center> <h3>:: Book Info ::</h3> <?php include ("Render_Info.php"); ?> </center> </span> </div> </body> </html> The include ("Render_Links.php"), include ("Render_Title.php") and include ("Render_Info.php") are just ifelse statements that check to see what password was submited and show the book cover image, the books information and the books download links. This is my first project other than doing basic if statements and having it print text if the condition was true. Any help getting my code better organized or patching up security holes would be appreciated. EDIT:: some dude on another forum showed me that i could use headers to force the browser to start a download. http://us2.php.net/manual/en/function.header.php but what exactly do i use to tell when the download is finished?? Quote Link to comment https://forums.phpfreaks.com/topic/160684-need-help/#findComment-848258 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.