PHP - Php Code Needed To Write To Parallel Lpt1 Port
I have a small project. I have a control board that is connected to the parallel port.
It controls 8 strips of LED on the LPT1 port. I can turn these on and off via the command prompt, using LPTOUT.exe ie lptout 1 turns on the 1st LED lptout 2 will turn off 1st LED and turn on 2nd, lptout 4 turns on 3rd and 2nd off, etc 1, 2, 4, 8, 16, 32, 64, 128. and combinations ie lptout 3 turns on LEDS 1 and 2, and so on. However lptout seems very unresponsive sometimes I have to do lptout 1 twice before LED 1 turns on. Is there another command I can use to write to LPT1 port. I need some PHP code to control the outputs. I want to sequence the outputs ie 1on (1second) 2on (1 second) 3 on (1 second) 4 on etc. to 8, then all off then repeat. Can anyone help me. THANK YOU. Similar TutorialsHello guys, I am new to PHP programming. I am trying to figure out how to use PHP language to transmit/write characters to a USB port device at 9600 baud rate 8-N-1. Basically I just need the PHP coding to allow me to send stuff to the USB device but I have no idea how I can interface this. I did some researching but most were for RS-232 COM Port. I can't find the proper one for USB. If someone can help me out, that would be awesome. Thank you! Hi, I upgraded my XAMPP to the version 1.8.3 (win32) recently. Apache failed to start and I got the following error In order to solve my problem I have been told to use multi threading, In my research I have found parallel because thread is not recommended for web server environments, What is CLI? php.net has the info but I may just be a little stupid, When looking for more information, I found something called compose, which I may need to install, but I am using shared hosting so it may not be possible. I have found that many hosts are unwilling to do anything beyond the basics.
1. Can parallel be used without installing these added dependencies or packages? Hi Guys, I'm really [confused] about this however what I have so far is create a simple HTML form, instructing the end user to enter a list of keywords with links to replace them with in the following format: A keywords followed by a comma and then URL and semicolon: For example: birds,http://www.birdwatching.com/; snakes,http://www.whales.com/; horses,http://www.horse.com/; What I have done next is split each word with its associated url after each newline and then placed all the words into 1 array and all the urls into another array, using the following code: preg_match_all('/(.*),(.*);/',$wordsurls, $phrase); $wds = $phrase[1]; $rurls = $phrase[2]; foreach($wds as $wd) { $words_array[] = $wd; } foreach($rurls as $rurl) { $urls_array[] = $rurl; } All that works perfectly fine but now I wish to search a string to find each of those keywords, and if they exist I would like to replace them with the URL. I believe this can be done using Parallel Array matching but do not know how to go accomplishing this. Could someone please help me? Thank you in advance. M I have a web site where users can gain points, when they use my site. For example, if the user spends $10.00 then the user will get 10 points. In my web site there is a list of 10 retails (name). When the user clicks the link it will redirect to retailers website, where user can buy items. How can I find out how much the user has spent on the retailer? Thank you. Hi there, I am working on a PHP Ecommerce website. We have multiple Suppliers on the website listing their products. Now when a customer buys multiple products belonging to multiple suppliers, the payment has to go to those different respective suppliers through a single Paypal checkout. I have come to know that there is a way of doing is using Paypal Parallel payments method. Its he http://feefighters.com/blog/paypal-announces-adaptive-payments-parallel-payments-and-chained-payments-functionality-via-api/ Anybody here has a working demo of how it works. Kindly reply. Thank you! All comments feedback are always welcomed! Can you suggest a better way to write this code (I didn't create it):
<body onload="getParameterByName('url')"> <a href="" id="urllink" >Click Here</a> </body>so, I don't have to change the <body> tag? suggestions on how to write this code better I have a form that has 2 textboxes in it. The php listed below...confirms that the passwords match, confirms that there are at least 6 characters in in, confirms that there is at least 1 number. I am doing mostly if statements with it, but I was wondering if there was a better way to write. Code: [Select] <!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> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <form name="form1" method="post" action="<?PHP $_SERVER['PHP_SELF'] ?>"> <table width="100%" border="1"> <tr> <th scope="row"> <strong>New password: </strong> <input type="password" maxlength="15" name="password"></th> <th scope="row"> <strong>New password confirmed: </strong> <input type="password" maxlength="15" name="confirm_password"></th> <th scope="row"><input type="submit" name="update" value="Update Password" /></th> </tr> </table> </form> <?PHP //verify that the update button is pressed if (isset($_POST['update'])) { //verify that the passwords match if($_POST['password'] == $_POST['confirm_password']) { echo "passwords match"; echo "<br>"; } //verify that the password and password confirmation was entered elseif ((isset($_POST['password'])) && ($_POST['confirm_password'])) { echo "Password and confirm password set"; echo "<br>"; } //verify that the # of characters was entered elseif (strlen($_POST['password'])<6) { $num_char=strlen($_POST['password']); echo "Please enter more characters"; echo "<br>"; } //find out if number exsist if (strlen($_POST['password'])>5) { $subject = $_POST['password']; preg_match_all('/[0-9]/', $subject, $matches); $count = count($matches[0]); //echo $count; if ($count <=1) echo "Please enter in at least 1 number you currently have: " .$count; }//close of verification of both boxes entered }//close of $_POST ?> </body> </html> This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=327190.0 <?php $result = "SELECT * FROM portfolio"; $result = mysql_query ($result) or die (mysql_error()); $i=0; while($row = mysql_fetch_assoc($result)) { if($i==0) echo '<div class="portfolioPage">'; if($i==2) $divclass = 'portfolioProjectWrapper borderWhite'; else $divclass = 'portfolioProjectWrapper borderGray'; echo ' <div class="'.$divclass.'"> <a href="portfolioPage.html" class="image asyncImgLoad" title="img/'.$row['image290x290'].'"></a> <p class="imageDesc">'.$row['image290x290_phot'].'</p> <h3 class="title">'.$row['title'].'</h3> <p class="subtitle">'.$row['subtitle'].'</p> <p class="desc"> '.substr($row['description'], 0, 1200).' <a href="portfolioPage.html" class="commonLink">Read more</a> </p> </div> '; if($i==2) echo '</div>'; if(i==2) $i=0; else $i++; } ?> Please help me im backward at this been along time. Hi there, I've looked into the PHP superglobal array $_SERVER, but could not find a variable that stores the plugins a client has on his/her browser such as firefox and google chrome. The point here is to detect if a user has hacking addons such as firebug and inspect element installed, and displays an error message telling the user to disable such plugins in order to access site content. Is it possible to accomplish such tasks? Please help. this is an array returned after parsing YAMl file using spyc api. i want to write a code to to extract value related to key topic name and put in a separate 1d array say $topicnames Array ( [1] => Array ( [topicname] => singapore travels [rev] => 250 => Array ( [25] => Array ( ) [topicname] => airlines [rev] => 24 ) [1] => Array ( [35] => Array ( ) [topicname] => shubham [rev] => 65 ) ) [2] => Array ( [topicname] => singapore entertainment [rev] => 210 => Array ( [45] => Array ( ) [topicname] => night safari[rev] => 54 ) i tried using simple for loop but not working.. pl help me out. I am a complete newbie. I have installed xampp. I created a database and the tables but that is all. I need to create all my relationships and test my database. to do this, do I now need to write the php code to view the results in a browser or... do I do it in MySQL. If so, Can someone just point me in the direction I need to go for my next step.
Thanks
The following code looks at my MySQL database at the due_owner field. This is a date field & if the due_owner date is less within 6 days of the current date, it sends an email to the $email variable. This code works great! The only issue I have is, is there ANY way for me to adjust this code so it will stop sending emails after the date listed in the due_owner field? At this time, the email address listed in teh $email variable still gets an email after the date in the due_owner field. If this is not possible, is it possible to adjust the code so it will only send the email one time? I have this code as part of a script that runs each night at midnight...Thanks Code: [Select] <?php include('connection.php'); $number_of_days_before = 6; $email = "employee1@email.org"; $reminder_details = ""; $todays_date = date( "Ymd" ); echo $todays_date; $year = substr($todays_date, 0, 4); $month = substr($todays_date, 4, 2); $date = substr($todays_date, 6, 2); $trigger_date = date("Ymd", mktime(0,0,0,$month, $date-$number_of_days_before,$year)); echo $trigger_date; $result = mysql_query( "SELECT due_owner, employee, pacts, dock, name, lname FROM psrinfo WHERE employee='Jane Doe' AND due_owner <= $trigger_date" ); $nr = mysql_num_rows( $result ); while( $row = mysql_fetch_array( $result ) ) { $reminder_details .= "Name: ".$row["fname"]." ".$row["lname"]."\n"; $reminder_details .= "PACTS Number: ".$row["pacts"]."\n"; $reminder_details .= "Dock: ".$row["dock"]."\n"; $reminder_details .= "Due to Owner: ".$row["due_owner"]."\n\n\n"; } mysql_free_result( $result ); if( !empty( $nr ) ) { $mailheader = "From: The Reminder System <$email>\nX-Mailer: Reminder\nContent-Type:text/plain"; mail("$email", "Due to Within 6 Days", "$reminder_details", "$mailheader"); } ?> Hello, I have successfully made a script that will upload images to the album of my facebook page easily. Following is the link to that script http://radiations3.com/facebook/facebook_upload.php Now when i used the same script to upload status directly to my wall then the script is doing nothing kindly let me know what is the problem with my code Code: [Select] //posting to the page wall $attachment = array('message' => 'this is my message', 'access_token' => $access_token, 'name' => 'This is my demo Facebook application!', 'caption' => "Caption of the Post", 'description' => 'this is a description', 'picture' => 'http://radiations3.com/images/logo.png', ); $status = $facebook->api('/194458563914948/feed', 'POST', $attachment); // my page id =123456789 var_dump($status); I have 99% of the code written but I still need a line or two but can't figure it out. Due_Attny is a date field. This code looks at my MySQL database & if the due_attny field is between todays date & the trigger date it will send an email to the $email variable. There is also a field in my MySQL database named a_mail_sent that by default is set to 0 which means an email has not been sent. I need to edit this code so it will look at the a_email_sent field & if the value is 0, it sends the email & updates the a_email_sent field to 1 which means the email has been sent. If the a_mail_sent field has a value of 1, I don't need the email to be sent. Can somoeone help me out with this code? Thanks Code: [Select] <?php include('connection.php'); // DB connection // Constants $number_of_days_before = 6; $email = "emailaddress@mail.org"; $reminder_details = ""; $todays_date = date( "Ymd" ); echo $todays_date; $year = substr($todays_date, 0, 4); $month = substr($todays_date, 4, 2); $date = substr($todays_date, 6, 2); $trigger_date = date("Ymd", mktime(0,0,0,$month, $date+$number_of_days_before,$year)); $insertquery = "UPDATE psrinfo SET a_mail_sent=1 WHERE employee='Employee1'"; mysql_query($insertQuery) or die ('Error updating database'); echo $trigger_date; $result = mysql_query( "SELECT a_mail_sent, due_attny, employee, pacts, dock, fname, lname FROM psrinfo WHERE employee='Employee1' AND due_attny BETWEEN $todays_date AND $trigger_date" ); $nr = mysql_num_rows( $result ); while( $row = mysql_fetch_array( $result ) ) { $reminder_details .= "Name: ".$row["fname"]." ".$row["lname"]."\n"; $reminder_details .= "PACTS Number: ".$row["pacts"]."\n"; $reminder_details .= "Dock: ".$row["dock"]."\n"; $reminder_details .= "Due to Attny: ".$row["due_attny"]."\n\n\n"; } mysql_free_result( $result ); if( !empty( $nr ) ) { // Send reminder email $mailheader = "From: Reminder System <$email>\nX-Mailer: Reminder\nContent-Type:text/plain"; mail("$email", "PSR Due Within 6 Days", "$reminder_details", "$mailheader"); } ?> I have a mysql database. I have some PHP code that I can view the mysql data & add data to the mysql database. I've attached a photo to look at. You will see an "Edit" button at the end. I need to be able to click on the edit button & it will bring up another page so I can edit that particular record. I do have an ID field in the mysql database that is set to auto inrement so each record has it's own ID. I have no clue where to start as I know very little about PHP. The mysql database name is flow & the table name is info. The fields in the database that you see in the photo is due_ge, due_ny, and due_rk. The page I go to view the data in the mysql database is named view.php & the file I use to enter a new record is named add.php. If I could click the "edit" button to somehow edit these date fields that would be great!! Could someone start me in the right direction? Hi, Posted here as it is in regards to PHP code making MySQL queries. Let's say i had this code below: <?php # Databse query $query = mysql_query("SELECT id, admin, username, first_name, last_name, email FROM `users` WHERE username = '$username' AND password = '$password' LIMIT 1"); # Check login query if(!$query){ echo 'Oops'; } else { echo 'Login Succesful'; } ?> Now this code with slight difference: <?php # Databse query $query = mysql_query("SELECT id, admin, username, first_name, last_name, email FROM `users` WHERE username = '$username' AND password = '$password' LIMIT 1"); # Check login query if(!$query){ echo 'Oops'; } else { if (mysql_num_rows($query) == 1) { echo 'Login Succesful'; } else { echo 'Login Details Invalid'; } } ?> Now my question is in the second lot of code; i am doing a check to ensure that the query is true in terms of username and password match database login credentials by doing mysql_num_rows as in code . Basically do i need to do that extra check in the second lot of code or is the first lot of code fine in checking username and password match database and if not return oops and return Oops if query fails for any other reason ? not sure if i am creating more code that is needed. I am slightly confused see in whether the extra check in second lot of code is needed or not. Could someone please explain in simple terms to me if it is or not and why? Thanks This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=355529.0 I have a webpage where the candidates can attach their resumes and send to the admin.These attachments are saved in the mysql db as blob datatype.In another webpage the admin needs to download all this resumes and see the content. How will i code for that. |