How to configure FFMPEG with Xampp in Ubuntu - php

Hi i am i trying to merge videos using ffmpeg with Php.Now i installed Xampp in ubuntu.and FFMEPG also i installed in Ubuntu.I searched ffmpeg.dll file but its not dound in the directory.but i add the extension in the php.ini file like below my code
;extension=php_bz2.dll
;extension=php_ffmpeg.dll
;extension=php_curl.dll
;extension=php_dba.dll
;extension=php_exif.dll
;extension=php_fileinfo.dll
This is my test code for ffmpeg.
<?php
extension_loaded('ffmpeg') or die('Error in loading ffmpeg');
$vid = realpath('1.mp4');
$ffmpegInstance = new ffmpeg_movie($vid);
echo "getDuration: " . $ffmpegInstance->getDuration() . "<br />".
"getFrameCount: " . $ffmpegInstance->getFrameCount() . "<br />".
"getFrameRate: " . $ffmpegInstance->getFrameRate() . "<br />".
"getFilename: " . $ffmpegInstance->getFilename() . "<br />".
"getComment: " . $ffmpegInstance->getComment() . "<br />".
"getTitle: " . $ffmpegInstance->getTitle() . "<br />".
"getAuthor: " . $ffmpegInstance->getAuthor() . "<br />".
"getCopyright: " . $ffmpegInstance->getCopyright() . "<br />".
"getArtist: " . $ffmpegInstance->getArtist() . "<br />".
"getGenre: " . $ffmpegInstance->getGenre() . "<br />".
"getTrackNumber: " . $ffmpegInstance->getTrackNumber() . "<br />".
"getYear: " . $ffmpegInstance->getYear() . "<br />".
"getFrameHeight: " . $ffmpegInstance->getFrameHeight() . "<br />".
"getFrameWidth: " . $ffmpegInstance->getFrameWidth() . "<br />".
"getPixelFormat: " . $ffmpegInstance->getPixelFormat() . "<br />".
"getBitRate: " . $ffmpegInstance->getBitRate() . "<br />".
"getVideoBitRate: " . $ffmpegInstance->getVideoBitRate() . "<br />".
"getAudioBitRate: " . $ffmpegInstance->getAudioBitRate() . "<br />".
"getAudioSampleRate: " . $ffmpegInstance->getAudioSampleRate() . "<br />".
"getVideoCodec: " . $ffmpegInstance->getVideoCodec() . "<br />".
"getAudioCodec: " . $ffmpegInstance->getAudioCodec() . "<br />".
"getAudioChannels: " . $ffmpegInstance->getAudioChannels() . "<br />".
"hasAudio: " . $ffmpegInstance->hasAudio();?>
When i run this in xammp the output coming like this
Error in loading ffmpeg
kindly give some solution for me
thanks in advance.

Related

Border between rows in calling sql database

I'm not able to do borders between rows and I'm not sure why
Please help me.
<?php
$con = mysql_connect("localhost","root","");
if (!$con) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db("mysql", $con);
$result = mysql_query("SELECT * FROM `cloud team` WHERE `Vendor` = 'Juniper' ");
echo "<table align='center' bgcolor='#F9F0F0' border='#190707' cellspacing='#190707'>
<tr>
<th><font color='red'>Juniper</font></th>
</tr>";
while($row = mysql_fetch_array($result)) {
echo "<tr>";
echo "<td align='center' style='vertical-align:text-top' width='500px'>";
echo "<a ='send.php'>" . " " . $row['Vendor'] . " " . $row['MGMT IP'] . " " . $row['Version'] . " " . $row['GUI User'] . " " . $row['GUI Pass'] . " " . $row['Notes'] . "</a></td>";
echo "</tr>";
}
echo "</table>";
mysql_close($con);
?>
the output of this code looks like this :
And I want borders between rows ..
Any help?
If you are looking for a border between the rows in the result, not rows in the html table, then just change your line from this
echo "<a ='send.php'>" . " " . $row['Vendor'] . " " . $row['MGMT IP'] . " " . $row['Version'] . " " . $row['GUI User'] . " " . $row['GUI Pass'] . " " . $row['Notes'] . "</a></td>";
to this
echo "<a ='send.php'>" . " </td.<td> " . $row['Vendor'] . " </td.<td> " . $row['MGMT IP'] . " </td.<td> " . $row['Version'] . " </td.<td> " . $row['GUI User'] . "</td.<td> " . $row['GUI Pass'] . "</td.<td> " . $row['Notes'] . "</a></td>";
And you really should use PDO or mysqli instead of mysql for the connection, as Strawberry kindly pointed out.

HTML & PHP Information Table

So i'm hosting servers and trying to make a table displaying the information server name players etc i have a script that displays this but i suck at css, What i'm trying to get is a little like in this website http://echelon.kthx.at/pubbans.php
<?php
include ("BC2Conn.php");
// opens a connection to gameserver
$BC2Conn = new BC2Conn("31.185.143.136", 48888);
if (!$BC2Conn->isConnected()) {
echo "Connection could not be established. " .
"To debug, set '-d' as 3rd parameter to new connection.<br />" .
"<br />" .
"Example: \$BC2Conn = new BC2Conn(\"127.0.0.1\", 48888, \"-d\");";
return 0; // stop executing this script
}
// secure login
// $BC2Conn->loginSecure("password");
// unsecure login (not salted)
// some random serverinformation
echo "Servername: " . $BC2Conn->getServerName() . "<br />";
echo "Players: " . $BC2Conn->getCurrentPlayers() . "/" . $BC2Conn->getMaxPlayers() . "<br />";
echo "Playmode: " . $BC2Conn->getCurrentPlaymodeName() . "<br />";
echo "Current Map: " . $BC2Conn->getCurrentMapName() . "<br /><br /><br /><u>Players:</u><br /><br />";
// playerlist
$playerNames = $BC2Conn->getPlayerlistNames();
foreach ($playerNames as $key => $content) {
if ($BC2Conn->getPlayerClantag($content) != "") {
echo "[" . $BC2Conn->getPlayerClantag($content) . "]";
}
echo " " . $BC2Conn->getPlayername($content) . " - Kills: ";
echo $BC2Conn->getPlayerKills($content) . " | Deaths: ";
echo $BC2Conn->getPlayerDeaths($content) . " | Score: ";
echo $BC2Conn->getPlayerScore($content) . "<br />";
}
// logout
$BC2Conn->logout();
?>

GeoIP not showing all info

so i have this error , i downloaded the lastest
geoipcity.inc | geoipregionvars.inc | GeoLiteCity.dat
so here is my code :
<?php
/**
* Querying against GeoIP/Lite City
* This will fetch country along with city information
*/
include("geoipcity.inc");
include("geoipregionvars.php");
$giCity = geoip_open("GeoLiteCity.dat",GEOIP_STANDARD);
$ip = "99.99.99.99";
$record = geoip_record_by_addr($giCity, $ip);
echo "Getting Country and City detail by IP Address <br /><br />";
echo "IP: " . $ip . "<br /><br />";
echo "Country Code: " . $record->country_code . "<br />" .
"Country Code3: " . $record->country_code . "<br />" .
"Country Name: " . $record->country_name . "<br />" .
"Region Code: " . $record->region . "<br />" .
"City: " . $record->city . "<br />" .
"Postal Code: " . $record->postal_code . "<br />" .
"Latitude: " . $record->latitude . "<br />" .
"Longitude: " . $record->longitude . "<br />" .
"Metro Code: " . $record->metro_code . "<br />" .
"Area Code: " . $record->area_code . "<br />" ;
geoip_close($giCity);
?>
and here is my problem that
not all resulst are shown :
Country Code: SA
Country Code3: SA
Country Name: Saudi Arabia
Region Code:
City:
Postal Code:
Latitude: 25
Longitude: 45
Metro Code:
Area Code:

fwrite function writes nothing to the file

I am trying to write data into a txt file, but It won't work. there is no error. it just won't work.
here is the code
if (isset($_REQUEST['submit']))
{
$hour = $_REQUEST['hour'];
$family = $_REQUEST['family'];
$how = $_REQUEST['how'];
$will = $_REQUEST['will'];
$fun = $_REQUEST['fun'];
$kind = $_REQUEST['kind'];
$device = $_REQUEST['device'];
$study = $_REQUEST['study'];
$agree = $_REQUEST['agree'];
$text = "hour :" . $hour . "<br />" . "family" . $family . "<br />" . "تطابفق با درس" . $how . "<br />" . "سرگرمی های غیر مجازی : " . $will . "<br />" . "نوع سرگرمی :" . $fun . "<br />" . "kind : " . $kind . "<br />" . "device " . $device . "<br />" . "اثیر بر درس" . $study . "<br />" . "کنترل " . $agree . "<br />" ;
fopen('/1.txt', "r");
fwrite('/1.txt',"hour :" . $hour . "<br />" . "family" . $family . "<br />" . "تطابفق با درس" . $how . "<br />" . "سرگرمی های غیر مجازی : " . $will . "<br />" . "نوع سرگرمی :" . $fun . "<br />" . "kind : " . $kind . "<br />" . "device " . $device . "<br />" . "اثیر بر درس" . $study . "<br />" . "کنترل " . $agree . "<br />");
fclose('/1.txt');
}
do note that there is an "else" that includes all the aforementioned input fields that I used in the code , and that I am executing on localhost.
thanks
You cannot write to it since you are opening it as read-only:
$handle = fopen('/1.txt', "r");
Instead:
$handle = fopen('/1.txt', "w"); // to write only, if you need to read and write use 'w+'
You also need to store fopen in a $handle so you can write to it later.
Documentation: http://www.php.net/manual/en/function.fopen.php
Now the first parameter for fwrite should be $handle:
fwrite($handle, "hour :" . $hour . "<br />" . "family" . $family . "<br />" . "تطابفق با درس" . $how . "<br />" . "سرگرمی های غیر مجازی : " . $will . "<br />" . "نوع سرگرمی :" . $fun . "<br />" . "kind : " . $kind . "<br />" . "device " . $device . "<br />" . "اثیر بر درس" . $study . "<br />" . "کنترل " . $agree . "<br />");
Documentation: http://www.php.net/manual/en/function.fwrite.php
At the end you should also close with $handle:
fclose($handle);
Documentation: http://www.php.net/manual/en/function.fclose.php
You are opening the file as read-only, with the ruse w instead. And you need to pass fwrite the return of fopen as first argument, not the filename:
$f = fopen('/1.txt', "w");
fwrite($f,"hour :" . $hour . "<br />" . "family" . $family . "<br />" . "تطابفق با درس" . $how . "<br />" . "سرگرمی های غیر مجازی : " . $will . "<br />" . "نوع سرگرمی :" . $fun . "<br />" . "kind : " . $kind . "<br />" . "device " . $device . "<br />" . "اثیر بر درس" . $study . "<br />" . "کنترل " . $agree . "<br />");
fclose($f);
You have to pass in a 'w' to write to a file.
$handle = fopen('/1.txt', "w");
Passing in 'r' makes it so you are opening a 'read-only' file.
Much simpler:
file_put_contents('/1.txt', $text);

Multiple table echos not displaying in page

The above code is designed to display info stored in sql table. everything is corresponding to the titles in the table and in the correct order. however the page it is from is only displaying the first 2 columns and not the others. everything looks as if it is in order to me. is my statement wrong?
<?php
$con=mysqli_connect("xxx","y","y","yyyy");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT * FROM tripdata ");
while($row = mysqli_fetch_array($result))
{
echo $row['trip_id'] . " " . $row['image'] . " " . $row['date'] . " " . $row['destination'] . " " . $row['hl'] . " " . $row['cost'] . " " . $row['blurb'] . " " . $row['whatinc'] . " " . $row['whatopt'] . " " . $row['itin'] . " " . $row['depinfo'] . " " . $row['ppcode'];
echo "<br>";
}
mysqli_close($con);
?>
maybe you can try using assoc
while($row = mysqli_fetch_assoc($result))
{
echo $row['trip_id'] . " " . $row['image'] . " " . $row['date'] . " " . $row['destination'] . " " . $row['hl'] . " " . $row['cost'] . " " . $row['blurb'] . " " . $row['whatinc'] . " " . $row['whatopt'] . " " . $row['itin'] . " " . $row['depinfo'] . " " . $row['ppcode'];
echo "<br>";
}
i usual use this and no problem
assoc is index name based on field name
but array is based on number (0, 1, 2, 3)
Strange. Try do loop instead:
do {
echo $row['trip_id'] . " " . $row['image'] . " " . $row['date'] . " " . $row['destination'] . " " . $row['hl'] . " " . $row['cost'] . " " . $row['blurb'] . " " . $row['whatinc'] . " " . $row['whatopt'] . " " . $row['itin'] . " " . $row['depinfo'] . " " . $row['ppcode'];
echo "<br>";
} while($row = mysqli_fetch_array($result));

Categories