-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
try this <?php class media_handler { function convert_media($filename, $rootpath, $inputpath, $outputpath, $width, $height, $bitrate, $samplingrate) { $outfile = ""; $rPath = $rootpath."\ffmpeg"; $size = $width."x".$height; $outfile =$filename; $size = Width & "x" & Height; $outfile = 'out_file.flv'; $ffmpegcmd1 = "ffmpeg -i ".$inputpath."\\".$filename. " -acodec mp3 -ar " .$samplingrate." -ab ".$bitrate." -f flv -s ".$size." ".$outputpath."\\".outfile; $ret = shell_exec($ffmpegcmd1); return $outfile; } function set_buffering($filename,$rootpath,$path) { $_rootPath = rootpath."\\flvtool"; $ffmpegcmd1 = "flvtool2 -U ".Path."\\".$filename; $ret = shell_exec($ffmpegcmd1); } function grab_image($filename, $rootpath, $inputpath,$outputpath, $no_of_thumbs, $frame_number, $image_format, $width, $height) { $_rootpath = rootpath."\\ffmpeg"; $size = width. "x".height; $outfile = "sample.png"; $ffmpegcmd1 = "ffmpeg -i ".$inputpath."\\".filename." -vframes ".$no_of_thumbs." -ss 00:00:03 -an -vcodec ". $image_format." -f rawvideo -s ".$size. " ". $outputpath."\\".$outfile; $ret = shell_exec($ffmpegcmd1); return $outfile; } } $_mediahandler as new media_handler; $rootpath ="./"; $nputpath = $rootpath."/Default"; $outputpath = $rootpath. "/FLV" $ThumbPath = $rootpath. "/Thumbs" $source = $HTTP_POST_FILES['file1']['tmp_name']; $name = $HTTP_POST_FILES['file1']['name']; $fileSize = $HTTP_POST_FILES['file1']['size']; $filetype = $HTTP_POST_FILES['file1']['type']; $dest = ''; copy($source, $inputpath.$name); $outfile = $_mediahandler.convert_media($name,$rootpath, $inputpath, $outputpath, 320, 240, 32, 22050); $image_name = $_mediahandler.grab_image($outfile, $rootpath, $outputpath, $thumbpath, 1, 2, "png", 110, 90); $_mediahandler.Set_Buffering($outfile, $rootpath, $outputpath); ?>
-
change $_mediahandler AS NEW media_handler; to } $_mediahandler AS NEW media_handler; also youtube is slow due to the heavy traffic, and not the software, as for the "creating your own" should you be writting the code if your "creating you own" ?
-
oops should be lower case id ie action="emailform.php?id='.$_GET['id'].'" But in anycase why you using the ID field? the form doesn't pass it ? infact how does the form know who to send the email to ?
-
try this <?php echo '<form name="frmsendmail" method="post" action="emailform.php?ID='.$_GET['ID'].'" onSubmit="return ValidationForm()">'; ?>
-
probably pasre the page, using http://uk2.php.net/manual/en/function.file-get-contents.php http://uk2.php.net/manual/en/ref.xml.php then store in a database maybe... the most effective way really depends what you want to do with it,
-
yep, var_dump() and print_r(), are very usful
-
either add it to the action ie echo "<form action='?ID={$_GET['ID']}' >"; or add a hidden field or <input type="hidden" name="ID" value="<?php echo $_GET['ID'];?>">
-
for testing change $submit = $_POST['submit']; if($submit != "") { to $submit = $_POST['submit']; var_dump($submit); //debug if($submit != "") {
-
i guess you could try replacing for ($n=1;$n<50;$n++) { with for ($l=65;$l<91;$l++) { $n = chr($l);
-
true you seam to of taken it out mysql_select_db("real",$conn) or die("Unable to select database"); if( !isset($_GET['id']) ) exit("Nothing Selected"); // error capture $art = (int)$_GET['id']; //clean $sql = "SELECT * FROM items WHERE id=$art"; //ADD BACK IN as for the email not working, your link to the email MUST have ?id=number or ie will fails hence the error capture
-
if($miles <=30 && $service_type == 1){ $etd = "Same Day."; } //true so $etd = "Same Day."; if($miles <=3000 && $service_type == 1){ $etd = "8-9 Days."; } //Also true so NOW .. $etd = "8-9 Days."; try this if($miles <=3000 && $service_type == 1){ $etd = "8-9 Days."; } if($miles <=30 && $service_type == 1){ $etd = "Same Day."; }
-
also change $art = $_GET['id']; to if( !isset($_GET['id']) ) exit("Nothing Selected"); // error capture $art = (int)$_GET['id']; //clean
-
[SOLVED] Why this code makes a blank page?
MadTechie replied to kporter.porter's topic in PHP Coding Help
as a guess i'll say the problem is here SessionStart(); if (GetSessionVar("username")) { RefreshToUrl("member.php"); exit; } -
<?php header("Content-type: text/plain"); for ($n=1;$n<50;$n++) { $seed = "http://www.site.com/?page=$n"; $data = file_get_contents($seed); if (preg_match_all("/http:\/\/[^\"\s']+/", $data, $links)) { for ($i=0;$i<count($links[0]);$i++) { echo $links[0][$i]. "\n"; } } } ?>
-
keywords is an array not a string try this $keywords = preg_split("/[\s,]+/", trim($_POST['keyword'])); $keys = ""; foreach($keywords as $K) { $keys .= "AND (Abstract LIKE '%$K%' OR town LIKE '%$K%')"; } $sql = "SELECT * FROM items WHERE (country='$targetb' OR continent='$targetb') AND (type='$type' OR alltype='$type') $keys ORDER BY id DESC"; its a quick untested draft
-
It will NOT stop DDOS attacks but can slow some of them down if (!preg_match('%https?://([^/]+)%i', $_SERVER['HTTP_REFERER']))) { Exit ( 'warning - your operation has been banned. '); } But will also cause problems for some users, who are not doing anything bad.. so to sum up, its more trouble that its worth..
-
you have 2 groups dep1_employee[] and dep2_employee[], the script gets the value from the option selected (1 or 2) thus dep = X (1 or 2) make sense ?
-
Need final help regarding updating lists on page
MadTechie replied to rooney's topic in PHP Coding Help
Na, your just missing the closing form tags ie echo "<form name='approve' method='post' action='pending.php'>\n"; echo "<input type= 'Submit' name= 'approve' value='approve' "; echo "<input type= 'hidden' name= 'ID' value='{$id[$i]}' "; echo"</form>"; echo"</td>"; -
[SOLVED] Upload file and create directory for each user?
MadTechie replied to sayedsohail's topic in PHP Coding Help
basic filename filter $file_name = preg_replace('/[^a-z0-9]/si', '', $file_name); -
Need final help regarding updating lists on page
MadTechie replied to rooney's topic in PHP Coding Help
If "its very very very urgent." then it should be in the freelance section.. maybe try this echo "<form name='approve' method='post' action='pending.php'>\n"; echo "<input type= 'Submit' name= 'approve' value='approve' "; echo "<input type= 'hidden' name= 'ID' value='{$id[$i]}' "; echo"</td>"; if(isset($_POST['approve'])) { $ID =(int)$_POST['ID']; $sql = "UPDATE table info SET approval=1 WHERE id=$ID "; $result = mysql_query($sql); } Then move the code below the //Trying to perform the desired action but not working above the code $query="SELECT * from info where approval=0"; -
Review the Javascript code as Javascript CAN use <input name = "check[]" type = "checkbox" value = "'value1'"/> EDIT: example <form action="" name="myform"> dep 1<input type="checkbox" name="department[]" value="1" onclick="checkall(this)"><br> emp 1<input type="checkbox" name="dep1_employee[]" value="1"><br> emp 2<input type="checkbox" name="dep1_employee[]" value="2"><br> emp 3<input type="checkbox" name="dep1_employee[]" value="3"><br> <br> dep 2<input type="checkbox" name="department[]" value="2" onclick="checkall(this)"><br> emp 4<input type="checkbox" name="dep2_employee[]" value="4"><br> emp 5<input type="checkbox" name="dep2_employee[]" value="5"> </form> <script type="text/javascript"> function checkall(dep) { var empls = document.myform['dep' + dep.value + '_employee[]']; for (var i = 0; i < empls.length; i++) { empls[i].checked = dep.checked? true : false; } } </script>
-
Post the code for include_test.php lines 5 to 15 will be fine (i guess)
-
Convert Unicode value to ASCII value for use in Query
MadTechie replied to rocafreestyler's topic in PHP Coding Help
if you have extra characters then your not encoding it correctly, either in the html or the database (i guess it could just be a font issule), if the that function fails when no $encryptedString is passed just an error check! e.g. if (empty($encryptedString)) return false; -
Convert Unicode value to ASCII value for use in Query
MadTechie replied to rocafreestyler's topic in PHP Coding Help
erm... i don't understand what your trying to do, but mySQL supports Unicode have you got the correct CHARACTER SET and COLLATE ? ie CHARACTER SET utf8 COLLATE utf8_general_ci; do you have a example ? -
this should display some useful data, <?PHP session_start(); $dbHost = "localhost"; $dbUser = "root"; $dbPass = "*******"; $dbDatabase = "users"; $db = mysql_connect("$dbHost", "$dbUser", "$dbPass") or die ("Error connecting to database."); mysql_select_db("$dbDatabase", $db) or die ("Couldn't select the database."); $user = addslashes($_POST['username']); $pass = sha1($_POST['password']); echo "User: $user<br>Pass: $pass<br>"; //removed for debugging #$result=mysql_query("SELECT * FROM `simple` WHERE `username`='$user' AND `password`='$pass' LIMIT 1"); //debug $result=mysql_query("SELECT * FROM `simple` WHERE `username`='$user'"); echo "<pre>";print_r($result); die; if(mysql_num_rows($result)==1){ $_SESSION[user]=mysql_fetch_assoc($query); echo 'Success!'; header( "Location: searchlogin.php" ); }else { echo 'Incorrect login name or password. Please try again.'; } ?> also check both the database password and the encrypted the same way