-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
i stopped read form here what are you talking about ?
-
[SOLVED] looping thru array like for loop
MadTechie replied to smilesmita's topic in PHP Coding Help
can you post you code -
this will remove the duplicates in one go will save to Newshadow%00.txt ie shadow%00.txt contains test1,test1,test1,test1,test1,test1,test1,test1,test1,test1,test2,test3,test3,test4,test5 new file test1,test2,test3,test4,test5 <?php $file = "shadow%00.txt"; if (file_exists($file)) { $file_content=file_get_contents($file); }else{ $cf = fopen($file, "w") or die("Error: file does not exist, and it can not be created.<BR>Please check permissions in the directory or create a file with coresponding name."); fputs($cf, ","); fclose($cf); } $tmp = explode(",", $file_content); $tmp = array_flip ( $tmp ); $tmp = array_flip ( $tmp ); $tmp = implode(",", $tmp); file_put_contents ( "New".$file, $tmp ); ?>
-
very true.. much better
-
just check if the exists first! what do you have so far ?
-
[SOLVED] looping thru array like for loop
MadTechie replied to smilesmita's topic in PHP Coding Help
lol, my bad try this $n=0; $key = "_filename"; while ( array_key_exists(($n+1).$key, $therray) ) { echo $therray[($n).$key]; echo $therray[($n+1).$key]; $n++ } i really should review my code before posting it, -
erm... thats weird ? is this in a class ? 60 lines apart!
-
[SOLVED] Why does this display incorrectly..
MadTechie replied to SirChick's topic in PHP Coding Help
OK now open the file (directly) that displays the <?php $QuoteResult = 'Result: You search the train station from top to bottom and find $3!'; blar blar blar blar blar it should say or a blank screen if so post the code you are using to include / display this file if not and it displays <?php $QuoteResult = 'Result: You search the train station from top to bottom and find $3!'; if($QuoteResult == 'Result: You search the train station from top to bottom and find $1!') {................ .......... then can you attach that file to the next post -
[SOLVED] looping thru array like for loop
MadTechie replied to smilesmita's topic in PHP Coding Help
ok use array_key_exists instead $n=0; $key = "_filename"; while ( array_key_exists($therray[($n+1).$key]) ) { echo $therray[($n).$key]; echo $therray[($n+1).$key]; $n++ } -
personally i would use ajax.. erm.. have a popup with for details you could have the details.php?href='id=<?php echo $rs_prop["id"];' then on the details.php page you use $_GET['id'] to pull all the details of that records id, and then could also update the "counter field" at the same time!
-
gerkintrigg & cmgmyr in one $query="SELECT * FROM table"; if(mysql_query($query){ echo '<script language="javascript">alert("notification message goes here");</script>'; } for confirm (example i found) <html> <head> <script type="text/javascript"> <!-- function confirmation() { var answer = confirm("Leave tizag.com?") if (answer){ alert("Bye bye!") window.location = "http://www.google.com/"; } else{ alert("Thanks for sticking around!") } } //--> </script> </head> <body> <form> <input type="button" onclick="confirmation()" value="Leave Tizag.com"> </form> </body> </html>
-
both use the same javascript.. (not php) you are aware that the current code will show the phone numbers in the html source, if you want more control from the PHP side you may want to move to an ajax route or have a "full details" popup.
-
[SOLVED] looping thru array like for loop
MadTechie replied to smilesmita's topic in PHP Coding Help
what code do you have so far ? surely something like this $total = (count($therray) /33) for($n=0,$n<$total,$n++) { echo $therray[$n."_filename"]; echo $therray[($n+1)."_filename"]; } would work! -
[SOLVED] Why does this display incorrectly..
MadTechie replied to SirChick's topic in PHP Coding Help
create a new file called phpinfo.php containing (nothing more) <?php phpinfo(); ?> open the file directly what displays ? if you see <?php phpinfo(); ?> then its a server problem -
nothing much echo's CP: startImage to the page flushs the page and resets the timer.. i used a it a few times so created i function instead CP function function CP($Num) { echo "CP: $Num<br />"; ob_flush(); flush(); set_time_limit ( 0 ); }
-
LOL okay (shame the include were valid and the CSS link wasn't)
-
maybe use onmouseover instead of onclick ?
-
yes and the script above will do that!! download.php?file=videos/video.mp4 $_GET['file'] and create the mySQL entry..etc display averts then redirect to download.php?hash=$hash and have $_GET['hash'] for the downloads
-
soo what was the problem ?
-
[SOLVED] Why does this display incorrectly..
MadTechie replied to SirChick's topic in PHP Coding Help
and why not ? single and double quotes both have their uses.., i would probably used singles as well! -
have a MySQL database that have 3 fields file, hash, timestamp if the timestamp is greater than the time+(10*60*60) then delete the records now on a php page have the link something like ?file=782d1a1a7a0a34c39995e1fa95efdbf5 Now the 782d1a1a7a0a34c39995e1fa95efdbf5 is NOT the filename hash its something like md5(time().$filename) this is stored in the database under hash and the file name in the file field.. now when someone clicks the link ?file=782d1a1a7a0a34c39995e1fa95efdbf5 look up in the database to find hash=$_GET['file'], and pull the filename now use readfile to pull that data, search form for forced downloads i hope that makes sense
-
bank.php shows black background on firefox.. this is not really a PHP question !
-
[SOLVED] Why does this display incorrectly..
MadTechie replied to SirChick's topic in PHP Coding Help
you opening that file directly or including it ? or something else ? does it display like that if you open it directly ? have you tried another php file to check its not the server ? -
OK new style i may of messed the paths up but the logic follows this create the 300x300 then from that create the 140x140 using the same function so it will upload create the 300 image then open the 300 image and create the 140 image.. this should reduce the time and memory required.. <?php if(isset($_POST['sent'])) { unset($submit); if (isset($_POST['sent'])) { $submit = true; }else{ die('Error: No file got sent'); } if($_FILES['file']['name']) { $arr = getimagesize($_FILES['file']['tmp_name']); list($width, $height, $type, $attr) = getimagesize($_FILES['file']['tmp_name']); if($type == FALSE) { header("Location: uplodsmalpic3.php?picnum=$num"); exit(); }elseif($type != 2){ header("Location: uplodsmalpic3.php?picnum=$num"); exit(); } } } $fieldname = $_FILES['file']; // make a note of the directory that will recieve the uploaded file // full url $uploadsDirectory = $_SERVER['DOCUMENT_ROOT'] . $directory_self . 'uploads/'; $uploadsDirectory = './uploads/'; //Upload image $uploadFilename = $uploadsDirectory.$fieldname['name']; // now let's move the file to its final location and allocate the new filename to it move_uploaded_file($fieldname['tmp_name'], $uploadFilename); $uploadedphoto = $uploadsDirectory.$fieldname['name']; $user = $_SESSION['MM_Username']; CP("1"); $a = rand(1,99); resizeimage('./uploads/'.$fieldname['name'], './smallpics/',300); rename("smallpics/".$fieldname['name'], "smallpics/".$user.$a.$fieldname['name']); $smallpics = './smallpics/'.$user.$a.$fieldname['name']; CP("2"); resizeimage("smallpics/".$user.$a.$fieldname['name']), './thumbnails/',140); rename("thumbnails/".$fieldname['name'], "thumbnails/".$user.$a.$fieldname['name']); $smallimage = './thumbnails/'.$user.$a.$fieldname['name']; CP("3"); unlink($uploadedphoto); function CP($Num) { echo "CP: $Num<br />"; ob_flush(); flush(); set_time_limit ( 0 ); } function resizeimage($name, $topath, $maxSize) { //$filename = './uploads/'.$name; $filename = $name; if(file_exists($filename)) { ini_set('memory_limit', '500M'); $image = imagecreatefromjpeg($filename); //unresized image $im_info = getimagesize($filename); //unresized image $im_width = $im_info[0]; $im_height = $im_info[1]; $im_flag = $im_info[2]; //max height: 140px; max width: 140px if($im_width >= $im_height) { $im_divice = $im_width / $maxSize; }else { $im_divice = $im_height / $maxSize; } $thumb_width = $im_width / $im_divice; $thumb_height = $im_height / $im_divice; //create empty image ini_set('memory_limit', '500M'); CP("startImage"); $thumb = imagecreatetruecolor($thumb_width, $thumb_height); //resize image imagecopyresampled($thumb, $image, 0, 0, 0, 0, $thumb_width, $thumb_height, $im_width, $im_height); if(imagejpeg($thumb, $topath.$name, 80)) { //image-resource, filename, quality return 1; } imagedestroy($thumb); //destroy temporary image-resource imagedestroy($image); //destroy temporary image-resource } } ?>
-
OK, lts rethink this.. the routine does 3 things 1. upload the image 2. create a thumbnail 3. create a standard size image (no larger than 300x300) correct ?