Current location: Hot Scripts Forums » Programming Languages » Perl » how to change code from php to perl


how to change code from php to perl

Reply
  #1 (permalink)  
Old 07-07-08, 04:33 PM
winracer's Avatar
winracer winracer is offline
Newbie Coder
 
Join Date: Jul 2008
Location: Georgia
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
Talking how to change code from php to perl

is there a way to change this code to perl that is from http://www.programmingtalk.com/showt...2&goto=newpost

PHP Code:

<html>
<head>
<style>
.td1_pad
{
 padding-right:10px;
 }
.td2_pad
{
 padding-top:10px;
 text-align:center;
 }
</style>
</head>
<body>
<?php
if(!file_exists("counter.txt"))
{
 
$f=fopen("counter.txt","w");
 
fwrite($f,'1');
 
fclose($f);
 }
if(!empty(
$_POST["web_addr"]))
{
 if(
preg_match('^http\://[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(/\S*)?$^',$_POST["web_addr"]))
 {
  
$_POST["web_addr"]=str_replace("watch?","/",$_POST["web_addr"]);
  
$_POST["web_addr"]=str_replace("=","/",$_POST["web_addr"]);
  
$ct=file_get_contents("counter.txt");
  
$file_name="web_addr_".$ct.".html";
  
$ct++;
  
$f=fopen("counter.txt","w");
  
fwrite($f,$ct);
  
fclose($f);
  
$data="<object width='425' height='344'>
         <param name='movie' value='"
.$_POST["web_addr"]."&hl=en&color1=0x006699&color2=0x54abd6'></param>
         <embed src='"
.$_POST["web_addr"]."&hl=en&color1=0x006699&color2=0x54abd6' type='application/x-shockwave-flash' width='425' height='344'></embed>
         </object>"
;
  
$f=fopen($file_name,'w');
  
fwrite($f,$data);
  
fclose($f);
 echo 
"THANKS HERE IS YOUR YOUTUBE VIDEO</br>.$data<br />";
 }
 else{echo 
"You didn't enter a web address.<br />";}
 }
?>
<form action="#" method="POST">
<table cellspacing="0" cellpadding="0">
 <tr>
  <td class="td1_pad">Enter web address here:</td><td><input type="text" name="web_addr" value="http://"></td>
 </tr>
 <tr>
  <td class="td2_pad" colspan="2"><input type="submit" value="Submit"></td>
 </tr>
</table>
</form>
</body>
</html>

Last edited by Nico; 07-07-08 at 05:25 PM. Reason: Wrappers.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 07-08-08, 12:45 AM
curbview.com's Avatar
curbview.com curbview.com is offline
Junior Code Guru
 
Join Date: May 2006
Posts: 555
Thanks: 0
Thanked 0 Times in 0 Posts
Sure! Are you willing to pay a person for there time and have this moved to the Job Offers Section?
__________________
Whatever you decide, you should make sure best security methods are used and practiced. Should you really need more help, PM me.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 07-08-08, 03:41 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,074
Thanks: 11
Thanked 88 Times in 83 Posts
I'm wondering why you asked people to write it in PHP in first place?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 07-08-08, 08:15 AM
winracer's Avatar
winracer winracer is offline
Newbie Coder
 
Join Date: Jul 2008
Location: Georgia
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
I thought I could use it to pull into my perl script. I was wrong.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 07-08-08, 02:24 PM
winracer's Avatar
winracer winracer is offline
Newbie Coder
 
Join Date: Jul 2008
Location: Georgia
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
thanks for your help, you can pull php code in to perl
see http://www.programmingtalk.com/showt...2&goto=newpost
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
I have a short code that works on PHP 5 but not on PHP 4...please help! INTEL PHP 9 03-28-08 09:20 AM
Need help finding PHP code errors Elle0000 PHP 4 10-08-06 02:31 PM
Change file owner and/or permission with perl SISCharlie Perl 7 10-01-06 08:04 PM
Perl code : print "." x 20; - How to do it with PHP ? kevin PHP 2 07-04-03 05:29 AM


All times are GMT -5. The time now is 06:37 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.