Skip to content
WJunction - Webmaster Forum

Need Some help in PHP plz.......

Status
Not open for further replies.

DevilLnC

Established Member
361
2010
13
Hello GUY plz help me with PHP and this code.....Actually i don't really know PHP so i just watched some tute and wrote this Code

Code:
<form method="post" action="">
<input type=text size=8 />
<input type=submit />
</form>

<? php

$url=_GET('submit');

<object id="flashplayer" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="600" height="400">
<param name="movie" value="player.swf" />
<param name="allowFullScreen" value="true" />
<param name="allowScriptAccess" value="always" />
<param name="FlashVars" value="plugins=plugins/proxy.swf&proxy.link=$url" />
<embed name="flashplayer" src="player.swf"  FlashVars="plugins=plugins/proxy.swf&proxy.link=$url"  type="application/x-shockwave-flash" allowfullscreen="true"  allowScriptAccess="always" width="600" height="400" />
</object>

?>
But when i use it in my Site it gave me this error

Code:
[B]Parse error[/B]:  syntax error, unexpected T_VARIABLE in [B]/home/allskip/public_html/wp-content/themes/UltraLight/page.php[/B] on line [B]42[/B]
 

10 comments

Code:
<form method="get" action="test.php">
Enter url: <input type="text" name="link" />
<input type="submit" value="Submit" />
</form>

<?php
$url= $_GET["link"];
?>

<object id="flashplayer" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="600" height="400">
<param name="movie" value="player.swf" />
<param name="allowFullScreen" value="true" />
<param name="allowScriptAccess" value="always" />
<param name="FlashVars" value="plugins=plugins/proxy.swf&proxy.link=$url" />
<embed name="flashplayer" src="player.swf"  FlashVars="plugins=plugins/proxy.swf&proxy.link=$url"  type="application/x-shockwave-flash" allowfullscreen="true"  allowScriptAccess="always" width="600" height="400" />
</object>

Modified it according to my knowledge. Do test it :)

Method should be GET in form when you are using GET, and the syntax of get is $_GET :)
 
Try this:
PHP:
<form method="GET" action="enteryoururl.php">
Enter url: <input type="text" name="link" />
<input type="submit" value="Submit" />
</form>

<?php
if (isset($_GET["link"])) {
$url= $_GET["link"];
echo '<object id="flashplayer" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="600" height="400">
<param name="movie" value="player.swf" />
<param name="allowFullScreen" value="true" />
<param name="allowScriptAccess" value="always" />
<param name="FlashVars" value="plugins=plugins/proxy.swf&proxy.link=$url" />
<embed name="flashplayer" src="player.swf"  FlashVars="plugins=plugins/proxy.swf&proxy.link=' . $url . '"  type="application/x-shockwave-flash" allowfullscreen="true"  allowScriptAccess="always" width="600" height="400" />
</object>';
}
?>

However, i would suggest you this one using the POST method:
PHP:
<form method="POST" action="enteryoururl.php">
Enter url: <input type="text" name="link" />
<input type="submit" value="Submit" name="Submit" />
</form>

<?php
if (isset($_POST["link"]) and isset($_POST["Submit"])) {
$url= $_POST["link"];
echo '<object id="flashplayer" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="600" height="400">
<param name="movie" value="player.swf" />
<param name="allowFullScreen" value="true" />
<param name="allowScriptAccess" value="always" />
<param name="FlashVars" value="plugins=plugins/proxy.swf&proxy.link=$url" />
<embed name="flashplayer" src="player.swf"   FlashVars="plugins=plugins/proxy.swf&proxy.link=' . $url . '"   type="application/x-shockwave-flash" allowfullscreen="true"   allowScriptAccess="always" width="600" height="400" />
</object>';
}
?>
 
OK the problem is you can't just stick html code in between <?php and ?>

You need to echo that code. Secondly what are you defining in the get a filename?

You didn't explain that in the form so how would anyone know.

TO fix the error possibly since you are not showing 42 lines of code try replacing the object code with this:
PHP:
echo '
<object id="flashplayer" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" 
 width="600" height="400">
 <param name="movie" value="player.swf" />
 <param name="allowFullScreen" value="true" />
 <param name="allowScriptAccess" value="always" />
 <param name="FlashVars" 
value="plugins=plugins/proxy.swf&proxy.link='.$url.'" /> 
<embed name="flashplayer" src="player.swf" 
 FlashVars="plugins=plugins/proxy.swf&proxy.link='.$url.'" 
 type="application/x-shockwave-flash" allowfullscreen="true" 
 allowScriptAccess="always" width="600" height="400" /> </object>';
 
Last edited:
Try this:
PHP:
<form method="GET" action="enteryoururl.php">
Enter url: <input type="text" name="link" />
<input type="submit" value="Submit" />
</form>

<?php
if (isset($_GET["link"])) {
$url= $_GET["link"];
echo '<object id="flashplayer" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="600" height="400">
<param name="movie" value="player.swf" />
<param name="allowFullScreen" value="true" />
<param name="allowScriptAccess" value="always" />
<param name="FlashVars" value="plugins=plugins/proxy.swf&proxy.link=$url" />
<embed name="flashplayer" src="player.swf"  FlashVars="plugins=plugins/proxy.swf&proxy.link=' . $url . '"  type="application/x-shockwave-flash" allowfullscreen="true"  allowScriptAccess="always" width="600" height="400" />
</object>';
}
?>
However, i would suggest you this one using the POST method:
PHP:
<form method="POST" action="enteryoururl.php">
Enter url: <input type="text" name="link" />
<input type="submit" value="Submit" name="Submit" />
</form>

<?php
if (isset($_POST["link"]) and isset($_POST["Submit"])) {
$url= $_POST["link"];
echo '<object id="flashplayer" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="600" height="400">
<param name="movie" value="player.swf" />
<param name="allowFullScreen" value="true" />
<param name="allowScriptAccess" value="always" />
<param name="FlashVars" value="plugins=plugins/proxy.swf&proxy.link=$url" />
<embed name="flashplayer" src="player.swf"   FlashVars="plugins=plugins/proxy.swf&proxy.link=' . $url . '"   type="application/x-shockwave-flash" allowfullscreen="true"   allowScriptAccess="always" width="600" height="400" />
</object>';
}
?>


took out all of the errors but when i CLick on Submit Button it says Nothng Found, the enteryoururl.php in action what should i put in it ????
 
action="enteryoururl.php" is the file where the form should be submitted

leave action="" if you have the php code on the same page with the form
or enter the filename of the file where your php code is
 
ah ha thanks BRO u saved my Ass :D worked Like a Butter now haha just 1 more lil help :D i have a One more URL Box for another host can u tell me how to make it worked with single URL box ??
 
Simply recieve the details from the same variable :|
$_GET["link"] if using GET METHOD or $_POST["link"] if POST
Then output the data
 
Step 1 is getting it working which the others above are doing a good job trying to help you with but Step 2 is probably more important and making sure it's secure.

What your doing is letting people enter a url but your not doing any security checks to see if it's a real url or a hacking attempt with malicious code.
Easiest ways of adding security are with strip_tags by finding
PHP:
$url= $_POST["link"];
Replace with:
PHP:
$url= strip_tags($_POST["link"]);
or you can use htmlentities
and find
PHP:
$url= $_POST["link"];
Replace with:
PHP:
$url= htmlentities($_POST["link"]);
or even both and have
PHP:
$url= htmlentities(strip_tags ($_POST["link"]));

Their are other more complicated ways and you can use regex checks to make sure it's a url etc but as your just starting these are probably the easiest to understand.
 
Status
Not open for further replies.

About the author

D
Established Member · Joined
361
Messages
13
Reactions
18
Points
Grow your business

Advertise on WJunction

Connect with an established international community of webmasters, hosting providers, developers and online entrepreneurs.

  • Premium & Premium+ Sticky
  • Dedicated section banners
  • Site-wide banner advertising
Explore advertising options
Back
Top Bottom