PHP - Moved: How To Not Process A Folder
This topic has been moved to Apache HTTP Server.
http://www.phpfreaks.com/forums/index.php?topic=355947.0 Similar TutorialsThis topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=305845.0 This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=333010.0 This topic has been moved to HTML Help. http://www.phpfreaks.com/forums/index.php?topic=308625.0 This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=321807.0 This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=308276.0 This topic has been moved to PHP Installation & Configuration. http://www.phpfreaks.com/forums/index.php?topic=332517.0 I got this script: But it give me error, file_get_contents cannot open stream. I need to add the FTP connection with user/pass paramaters. then look in set http url, to get the file contents(images) and transfer to ftp server location. Can Anyone take alook and tell me if I am going down the right path and how to get there. Please Code: [Select] function postToHost($host, $port, $path, $postdata = array(), $filedata = array()) { $data = ""; $boundary = "---------------------".substr(md5(rand(0,32000)),0,10); $fp = fsockopen($host, $port); fputs($fp, "POST $path HTTP/1.0\n"); fputs($fp, "Host: $host\n"); fputs($fp, "Content-type: multipart/form-data; boundary=".$boundary."\n"); // Ab dieser Stelle sammeln wir erstmal alle Daten in einem String // Sammeln der POST Daten foreach($postdata as $key => $val){ $data .= "--$boundary\n"; $data .= "Content-Disposition: form-data; name=\"".$key."\"\n\n".$val."\n"; } // Sammeln der FILE Daten if($filedata) { $data .= "--$boundary\n"; $data .= "Content-Disposition: form-data; name=\"".$filedata['name']."\"; filename=\"".$filedata['name']."\"\n"; $data .= "Content-Type: ".$filedata['type']."\n"; $data .= "Content-Transfer-Encoding: binary\n\n"; $data .= $filedata['data']."\n"; $data .= "--$boundary--\n"; } // Senden aller Informationen fputs($fp, "Content-length: ".strlen($data)."\n\n"); fputs($fp, $data); // Auslesen der Antwort while(!feof($fp)) { $res .= fread($fp, 1); } fclose($fp); return $res; } $postdata = array('var1'=>'today', 'var2'=>'yesterday'); $filedata = array( 'type' => 'image/png', 'data' => file_get_contents('http://xxx/tdr-images/images/mapping/dynamic/deals/spot_map') ); echo '<pre>'.postToHost ("localhost", 80, "/test3.php", $postdata, $filedata).'</pre>'; This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=357935.0 I want to copy everything in templates/blue to the folder code/ However: shell_exec("cp -r 'templates/blue' 'code'"); Creates a folder called blue inside code. I tried cp -r 'templates/blue/*' 'code', but that didn't do anything. Any ideas? Hey guys, I've hit a huge obstacle in my coding process of a script I am writing. It is basically an uploading interface script and it works like this. I have files on my server and I want a user to click a button which fires a php script which in turn fires a bash script which IN TURN fires the uploading program (plowshare). So to make it simple: user logs in, sees upload button. Clicks it, file starts uploading. I then want the user to see "upload initiated" and that's it. The problem is that with what I have now, the script just won't finish loading until the file has been uploaded and as a matter of fact I don't even think it is uploading anything :S Here are the scripts: PHP interface to call the bash script: Code: [Select] <?php error_reporting(E_ALL); function run_in_background($Command, $Priority = 0) { if ($Priority) $PID = shell_exec("nohup nice -n $Priority $Command 2> /dev/null & echo $!"); else $PID = shell_exec("nohup $Command 2> /dev/null & echo $!"); return($PID); } function is_process_running($PID) { exec("ps $PID", $ProcessState); return(count($ProcessState) >= 2); } $file = $_GET['file']; // Location of file relative to the index $where = $_GET['where']; // Absolute index location $absolute = '/var/www/vhosts/animekyun.com/httpdocs/icarus/'; $where = $absolute . $where; //$outfile ='log'; echo $where . $file . '<br>'; echo "<h2>The upload has been initiated!</h2>"; $ps = run_in_background("/bin/sh uploadparser.sh $file $where > $outfile"); while(is_process_running($ps)) //echo $output; ?> Bash script to call uploading program: Code: [Select] #!/bin/sh { FILE=$1 WHERE=$2 FILENAME="/var/www/vhosts/animekyun.com/httpdocs/icarus/debug/debug_mu_$FILE" FILENAME2="/var/www/vhosts/animekyun.com/httpdocs/icarus/debug/debug_multi_$FILE" /usr/local/bin/plowup megaupload "$WHERE$FILE" >> "$FILENAME".txt 2>&1 /usr/local/bin/plowup multiupload "$WHERE$FILE" >> "$FILENAME2".txt 2>&1 } & this works fine when I pass the variables as arguments in CLI I hope i have been clear enough, it does seem rather confusing i have a form for which the data is sent to a process page via jquery like so: Code: [Select] jQuery.post('<?php echo $this->site_root; ?>/modules/new_post_process.php',{ message:jQuery("#message_contents").val() } ,function(data) {etc... new_post_process checks the contents of message like so: if (empty($message) && empty($error)) { $is_error = true; $error = 'Please Enter A Message'; } the problem is that it always throws this message even when the textarea isnt empty. however after the error has appeared if i submit again it goes through fine. I suppressed the error and tried and the database gets populated with an empty value which means it is indeed empty. so why does it work on the second time around? I am using CKEditor for the textarea. everything else gets submitted normally but this textarea. heres the full code: the textarea: Code: [Select] <textarea cols="80" rows="10" id="message_contents"></textarea> Code: [Select] jQuery("#new_post_form").submit(function() { jQuery.post('<?php echo $this->site_root; ?>/modules/new_post_process.php',{ user_name:jQuery("#user_name").val(), redirect_url:jQuery("#redirect_url").val(), subject:jQuery("#subject_field").val(), forum_id:jQuery("#fid").val(), topic_id:jQuery("#tid").val(), method:jQuery("#method").val(), message:jQuery("#message_contents").val() } ,function(data) { if (data == 1) { jQuery("#process_info").removeClass().addClass("subject_okay").html("<img src=\"<?php echo $this->template_path; ?>icons/small_tick.png\" alt=\"icon\" />Redirecting...").fadeIn("slow"); var URL = jQuery("#redirect_url").val(); document.location = URL; } else { jQuery("#reply_btn").css("visibility", "visible"); jQuery("#draft_btn").css("visibility", "visible"); jQuery("#process_info").removeClass().addClass("subject_error").html('<img src="<?php echo $this->template_path; ?>icons/small_error.png" alt="icon" /> ' + data).fadeIn("slow"); } }); and the process page: if (isset($_POST['subject'])) { $message = $_POST['message']; if (empty($message) && empty($error)) { $is_error = true; $error = 'Please Enter A Message'; } if (empty($error) && $is_error == false) { $query = $link->prepare("INSERT INTO ".TBL_PREFIX."posts (p_fid, p_tid, p_poster, p_name, p_content, p_time_posted) VALUES ('$forum_id', '$topic_id', '$user_name', '$subject', '$message', '".$config['time_now']."') ") or die(print_link_error()); echo "1"; } else { echo $error.'-'.$message; } I have this code: $shell = new COM('WScript.Shell'); $shell->Run("C:\WINDOWS\system32\cmd.exe /K ".$ini['indexer']['command'], 0, false); When it runs, it opens the command line, but then when it is done, it leaves the process open. How can I close it when the process is complete? I have a full working order form in PHP. I process it and display it with a process page called "process.php." Whenever this information is displayed on the web page "process.php" I also want it to send me an e-mail with all of the information that it just processed. i.e. Checked checkboxes, text entered, etc. Whenever I try to send the contents of "process.php" to an email $message = include 'process.php'; the process page just goes through an infinite loop displaying itself over and over again instead of sending itself in an email.
Edited by AP_King7, 20 August 2014 - 10:51 AM. hi, is there a way to tell php to do a process again? example: Code: [Select] $draft_number=rand(1, 15); if($draft_number == 5){ START OVER AT TOP } else { $sql1 = "UPDATE names SET draft = '$draft_number' WHERE id = '$uid'"; $result1 = mysql_query($sql1) or die('Error, Check you fields and try again.'); } Hi guys, I want my application to run a triggered process based on time to execute some tasks, what is the best approach? Thanks I have been trying to figure out how this is done? One php file and all that changes is the name of the brand and the logo. This has to be clickable from a menu and also if a user changes the brand name it changes to the appropriate name and logo. Any ideas as to how this is done? If you can guide me in the right direction or give me an example of how this is done would be greatly appreciated. Thanks. http://www.drivermanager.com/en/download-confirmation.php?brand=compaq&logo= This may spill over into java, just not quite sure yet! Basically what I am trying to do, is fill a box with text, click a button which runs a function which send the text in the box via a JSON request to an external server. The JSON works fine, I just want a way of submitting the string which hopefully doesnt involve a form, but its the only way I can think of! Any other ideas? I could use some suggestion on how to model the Checkout Process for my e-commerce site. As I see it, when a person "checks out" there are 5 steps... 1.) Create an Account/Log-In 2.) Enter Addresses 3.) Choose Shipping Options 4.) Enter Payment Details 5.) Review & Place Order I'm trying to avoid having gigantic "God classes" and struggling to figure out how to abstract things in good OOP terms. My Head First: Design Patterns book talked about the "State Pattern" and I'm wondering if that might be a good approach? Maybe each of the 5 steps above could be a "state" in the Checkout Process? What do you think? TomTees Hi all,
I am building a website for my local motorclub.
we are wanting to start taking online payments for membership and events. I have built a members only area - the way to get access is for a member of staff to accept the registration. this is all fine for members who pay via cheque or simular.
I am wanting a sign up process to include the payment page, was going to use paypal as the merchant. So if people want to join the club they are able to do so and get immediate access to the members only page instead of waiting for staff to check if the payment has cleared then set up there account etc.
so basically i need a sign-up form (which is done) then a purchase button at the bottom, which takes the payment and then redirects to the website but 'tells my website the payment has been taken and to give full access'.
I cant really explain how i want it, but i hope you understand from what i have said.
Hey guys my code is like this Code: [Select] <?php if( $_POST["name"] || $_POST["age"] ) { echo "Welcome ". $_POST['name']. "<br />"; echo "You are ". $_POST['age']. " years old."; exit(); } ?> <html> <body> <form action="<?php $_PHP_SELF ?>" method="POST"> Name: <input type="text" name="name" /> Age: <input type="text" name="age" /> <input type="submit" /> </form> </body> </html> The Inputs are taken from form.How do I make it display somewhere at the bottom of the form in the same page.The Output of this code comes up in a new page. |