PHP - Convert .java To .php - Please Help Me Urgently
import java.util.Scanner; public class bijele { public static void main (String[] args) { Scanner in = new Scanner(System.in); int[] neededPieces = {1,1,2,2,2,8}; String[] currentPieces = in.nextLine().split(" "); for (int i = 0; i < 6; i++) { neededPieces[i] -= Integer.parseInt(currentPieces[i]); System.out.print("" + neededPieces[i] + " "); } } }
Similar TutorialsHi guys, I am not a coder, but more a graphic designer and I am currently designing a ccbill affiliate program in which I urgently need to find a way to code the following: When people visit the affiliate page, affiliates are able to log in by entering their 6 digit ccbill affiliate ID. Once they log in, they are redirected to the affiliate area, where all affiliate links are embedded with their unique ID. I have seen many affiliate sites using this simple "set cookie" script but for the life of me, can I find it online!! .. absolutly no chance. I have been looking for a way to do this for around 6 months now. Here are some examples I found on google of affiliates that are using this type of code: [links to sexually oriented sites removed.] < this is the layout I want to follow, ie three steps at the bottom of the page, with the third being the login It seems they are all using a pho file to do this. Can anyone please, please help me with this, as I think this forum is my last resort after 6 months of searching for a way to do this. Many thanks! Hi Guys, I am a bit of a PHP noob and I am hoping for a bit of help. My deadline to have this working is tomorrow. Basically I want to display a table which shows all the events I have signed upto. However, my code is creating windows within itself and separate tables which are all over the place. Here is my code: <?php session_start(); $email = $_SESSION['email']; include '../dbconn.php'; include '../includes/functions2.php'; $query2 = "SELECT * FROM billing where email='$email'"; $result2 = mysql_query($query2); $num_rows = mysql_num_rows($result2); while($row2 = mysql_fetch_array($result2, MYSQL_ASSOC)) { $query3 = "SELECT * FROM events where id='$row2[eventid]'"; $result3 = mysql_query($query3); while($row3 = mysql_fetch_array($result3, MYSQL_ASSOC)) { ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <link rel="shortcut icon" href="../images/favicon.ico"> <meta http-equiv="Content-Type" content="text/html; charset=iso8859-1" /> <meta name="keywords" content="Ghost Hunts, Ghost Hunting, Ghost Hunt Suppers, Overnight Ghost Hunt, Haunted Nights, Ghost Hunting Weekends, Paranormal Events, Most Haunted Tours, Most Haunted, Haunted Places, Anyone There?, Fright Nights, Haunted Happenings, Haunted Gatherings, The Hoff, Scott Mills, Yvette Fielding" /> <meta name="description" content=" Paranormal team, organising ghost hunts accross the UK. With many famous guests, only at Anyone There?" /> <link href="style.css" rel="stylesheet" type="text/css" /> <title>Anyone There :. Haunted Experiences</title> </head> <script LANGUAGE="JavaScript" SRC="overlib.js"></script> <body> <div id="container"> <div id="header"> </div> <div id="nav"> <ul> <li><a href="cprotected.php" class="selected" title="Events">My Events</a></li> <li><a href="feedback.php">Feedback</a></li> <li><a href="index.php">Logout</a></li> </ul> </div> <div id="content"> <div id="page"> <h2><?php echo "Welcome $row1[fname] $row1[sname]"; ?></h2> <br> <h2> <?php echo "Showing $num_rows events. . ."; ?> </h2> <center> <p> <?php $deposit=$row2[quantity]*10; $total=$row2[quantity]*$row2[ticketprice]; $cancel='http://www.anyonethere.co.uk/main/cprotected.php'; $paid='http://www.anyonethere.co.uk/main/paid.php'; echo " <center> <table width='800' class='reference'> <tr> <th>Venue</th> <th>Date</th> <th>Total Price</th> <th>Deposit</th> <th>Remaining</th> <th>Ticket Quantity</th> <th>Status</th> </tr> "; if ($row2[status]=='0') { echo "<tr>"; echo "<td>$row3[venue]</td> "; echo "<td>$row3[date]</td> "; echo "<td>£$total</td> "; echo "<td>£$deposit</td> "; echo "<td>£$row2[owe]</td> "; echo "<td>$row2[quantity]</td> "; echo "<td>Pay Deposit</td></tr>"; } elseif ($row2[status]=='1') { echo "<td>$row3[venue]</td> "; echo "<td>$row3[date]</td> "; echo "<td>£$total</td> "; echo "<td>£$deposit</td> "; echo "<td>£$row2[owe]</td> "; echo "<td>$row2[quantity]</td> "; echo "<td bgcolor='orange'>PAY OUTSTANDING BALANCE</td></tr>"; } elseif ($row2[status]=='2') { echo "<td>$row3[venue]</td> "; echo "<td>$row3[date]</td> "; echo "<td>£$total</td> "; echo "<td>£$deposit</td> "; echo "<td>£$row2[owe]</td> "; echo "<td>$row2[quantity]</td> "; echo "<td bgcolor='green'>Paid</td></tr>"; }}} echo "</table>"; ?> </p> </div> <div class="clear"></div> </div> <div id="footer"> <p>© 2011 Anyone The The UK's #1 for Haunted Events</p> </div> </div> </body> </html> Please can somebody give me a pointer in the right direction, it will be a life saver? Thanks in Advance, Dan I have set up my PayPal IPN and it works perfectly when sending test IPN's using the IPN Simulator on the PayPal developer website. When I change the ssl in this line Code: [Select] $fp = fsockopen ('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30);to Code: [Select] www.paypal.com It no longer works. It comes back as INVALID, not VERIFIED. Anyone know what the problem could be? My IPN is below. You'll see there is entries into the log table, this is just for testing purposes, and how I found out that it's coming back as INVALID and not VERIFIED. Thanks Denno <?php //connect to the database here include "../scripts/connect_to_mysql.php"; //------------------------------- // PHP 4.1 // read the post from PayPal system and add 'cmd' $req = 'cmd=_notify-validate'; foreach ($_POST as $key => $value) { $value = urlencode(stripslashes($value)); $req .= "&$key=$value"; } // post back to PayPal system to validate $header .= "POST /cgi-bin/webscr HTTP/1.0\r\n"; $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; $header .= "Content-Length: " . strlen($req) . "\r\n\r\n"; $fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30); // assign posted variables to local variables $team_name = $_POST['item_name']; $item_number = $_POST['item_number']; $payment_status = $_POST['payment_status']; $payment_amount = $_POST['mc_gross']; $payment_currency = $_POST['mc_currency']; $txn_id = $_POST['txn_id']; $receiver_email = $_POST['receiver_email']; $payer_email = $_POST['payer_email']; $first_name = $_POST['first_name']; $last_name = $_POST['last_name']; $associated_club = $_POST['custom']; $contact_number = $_POST['invoice']; if (!$fp) { // HTTP ERROR } else { fputs ($fp, $header . $req); while (!feof($fp)) { $res = fgets ($fp, 1024); if (strcmp ($res, "VERIFIED") == 0) { //User code is added below here $dateField=date("Y-m-d H:i:s"); $sqlCommand = "INSERT INTO log VALUES('','$dateField','$payment_status','$payment_amount','$payment_currency','1','0')"; $update = mysql_query($sqlCommand, $myConnection); if($payment_status == "Completed"){ if($payment_amount == '40.00' && $payment_currency == "AUD"){ //process payment and enter information into database $sqlCommand = "INSERT INTO teams VALUES ('','$first_name','$last_name','$associated_club','$team_name','$contact_number','1')"; $update = mysql_query($sqlCommand, $myConnection); } } //User code is added above here } else if (strcmp ($res, "INVALID") == 0) { // log for manual investigation $dateField=date("Y-m-d H:i:s"); $sqlCommand = "INSERT INTO log VALUES('','$dateField','$payment_status','$payment_amount','$payment_currency','0','1')"; $update = mysql_query($sqlCommand, $myConnection); } } fclose ($fp); } echo "$sqlCommand"; ?> I have purchased a ad manager type script and have put so much work in to the site but i cannot get the cron file to execute properly due to errors. The makers of the script arent answering my emails so I am left to find the answer myself im hoping some experts can shine a light on this for me
I have the cron running once daily as required
the error messages are as follows:
/home2/net2you/public_html/2xx.co.uk/include/CronStats.php: line 1: ?php: No such file or directory /home2/net2you/public_html/2xx.co.uk/include/CronStats.php: line 2: syntax error near unexpected token `;' /home2/net2you/public_html/2xx.co.uk/include/CronStats.php: line 2: `ob_start();' I have installed the script on two different hosts and get the exact same errors. any help would be much appriciated the contents of the cron file are below ______________________________________________ <?php Hi Coders,
any body can convert the following code into codeigniter.
if($_GET['type'] == 'country'){ $result = mysql_query("SELECT name FROM country where name LIKE '".strtoupper($_GET['name_startsWith'])."%'"); $data = array(); while ($row = mysql_fetch_array($result)) { array_push($data, $row['name']); } echo json_encode($data); }Thanks How can I echo this as seconds? $date_at_timezone = new DateTimeZone('Asia/Shanghai'); $date = new DateTime(); $date->setTimezone($date_at_timezone); echo $date->format('l dS F Y h:i:s A') . "Asia/Shanghai<br>"; Olá,
I have this codE:
$cb = 'str_replace("' . $this->LE . '", "", "<$1>");'; $encoded_value[$key] = preg_replace("/<([^>]+)>/e", $cb, $encoded_value[$key]);error: "PHP message: PHP Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead How can i transform this code to preg_replace_callback ? thanks I have come across a little feature I need to create to be able to upload .doc files and convert them to .pdf using PHP. I was wondering if anyone had any idea how I would go about achieving this, I am not asking for the code, I'm just asking on how it could be accomplished...I've searched Google and other PHP related forums but none have the answer to which I am looking for. Any ideas or suggestions are greatly appreciated. Regards, PaulRyan. I have the following code in javascript, I would like to rewrite it in PHP, if someone can help thank you very much. my code: http://pastebin.com/Jnt8RiYj I have some words are written by UTF-8. I want to use PHP to convert them to NCR DECIMAL. This is my words. After Convert: Sorry my bad English. Thanks advance This is TEXT FILE my Source. (attach File) [attachment deleted by admin] how to convert php pages to api Hey guys I'm having a bit of a problem trying to convert this string to UTF-8 encoding Quote 組ですが、 中には5- 6本のおす すめ番組の エッセンス が、ぎっし り詰まって います。 I've used $strTem = mb_convert_encoding($strTem, "UTF-8", "auto"); and while that detects the correct current encoding it doesnt change it at all and utf8_encode doesnt work at all, dont know what to use. Thanks I'm having trouble with a few pages on xcart with the charsets. The problem we're having is that we need to have both utf-8 and iso type charsets as we're getting garbled code on some pages. What I can do is set the utf-8 on all pages and then encode the garbled code into utf-8. Is there a function that does this in PHP or any modules I can use? Thanks Hi, I have songs that I have uploaded. There are tracks in each song. So I want my users to click download and they'll be able to download all of the tracks combined in a zip file. I have seen this hapening on several sites. Can any body tell me how that works using PHP codes / classes Regards, Faisal
Hello guys. Im not familiar with PHP but I was asked to convert our Homepage which uses a Database to store tickets from 5.x to 7.3.9 . Now I get this error:
I'd appreaciate any help from you guys, tia. :) Hi, I was wondering if anyone has experience with using php to convert a powerpoint presentation on a Linux OS with Apache web server. The idea would be that a user uploads a powerpoint file that is converted server-side to individual png/jpg files for each slide so that a subset of these slides can be shown as a preview in an image slider. Does anyone know if this can be done on a Linux OS with Apache web server? I came across some solutions for windows versions of php (http://www.php.net/manual/en/com.requirements.php). Hope anyone can help me. Hello again How to convert size from taken from sql as the numbers and converted to MB in php? Hello I'm building a backend to allow a client to upload images to his site. But my client has a lot of images in tiff format so i'd like to be able to convert tiff to jpg and only after that upload the image. i'm using the command move_uploaded_file to upload the original image and then i'm resizing the image and creating a new one and delete the original. now i want to add to my script a way to convert the original tiff to jpeg, resize save and delete the original here is my code that it's working fine: Code: [Select] if ($_FILES['foto']['name'] == "") { $dir = "images/spacer.gif"; } else { $size = 124; // the thumbnail height $filedir = 'img/ambientes/'; // the directory for the original image $thumbdir = 'img/ambientes/'; // the directory for the thumbnail image $prefix = 'small_'; // the prefix to be added to the original name $maxfile = '200000'; $mode = '0666'; $userfile_name = $_FILES['foto']['name']; $userfile_tmp = $_FILES['foto']['tmp_name']; $userfile_size = $_FILES['foto']['size']; $userfile_type = $_FILES['foto']['type']; if (isset($_FILES['foto']['name'])) { $prod_img = $filedir.$userfile_name; $prod_img_thumb = $thumbdir.$prefix.$userfile_name; move_uploaded_file($userfile_tmp, $prod_img); chmod ($prod_img, octdec($mode)); $sizes = getimagesize($prod_img); $aspect_ratio = $sizes[0]/$sizes[1]; if ($sizes[0] <= $size) { $new_width = $size; $new_height = abs($new_width*$aspect_ratio); }else{ $new_width = $size; $new_height = abs($new_width/$aspect_ratio); } $destimg=ImageCreateTrueColor($new_width,$new_height) or die('Problem In Creating image'); $srcimg=ImageCreateFromJPEG($prod_img) or die('Problem In opening Source Image'); ImageCopyResampled($destimg, $srcimg, 0, 0, 0, 0, $new_width, $new_height, $sizes[0], $sizes[1]) or die('Problem In resampling'); ImageJPEG($destimg,$prod_img_thumb,90) or die('Problem In saving'); $uploadfile = $prod_img_thumb; imagedestroy($destimg); $fh = fopen($prod_img, 'w') or die("can't open file"); fclose($fh); unlink($prod_img); $dir = $uploadfile; } } anyone can help me? Hi. I have a large amount of data in an excel spread sheet. I have isolated 3 rows containing a date (yyyy-mm-dd plus two decimal values). I saved this as a tab delimited text instead of a comma separated csv. What I want to do is read each line of a text file and split it up into 3 and construct an INSERT INTO sql. the problem is this is not separated by comas for a split function. Can I split on a tab instead? I have used commas in the past only. TIA Desmond.
|