t_machine
Members-
Posts
104 -
Joined
-
Last visited
Never
Everything posted by t_machine
-
How to prevent media link from playing when clicked
t_machine replied to t_machine's topic in PHP Coding Help
Thank you all very much for the help. The script Orio posted works perfect but I too am worried about the security issue. My links are taken from a database so they are not included in the $_GET or $_POST method. Will this still be a security issue for my site? Example: ..mysql query $filename = $row['url']; I then use that $filename for the rest of the script. Will I be fine with that setup? Thanks -
hi, I am wondering if anyone can help with this problem. I have a downloads page that lists media files(.mp3, .mov). The problem is that when the user clicks the link, the file opens inside their media player. How can I let the user see the "save as" dialog box instead of immediately playing the file. Thanks for any help:)
-
Hi, I hope someone can help me with this problem. I am creating a plugins folder that I will use to store php files. I also store other folders within that "plugins" folder. The problem I have is getting the script to read only the the .php files and skip subfolders. Plugins[main folder] ->plugin1.php ->plugin2.php ->screenshot[folder] ->downloads[folder] How to keep the script from checking the folders (screenshots, downloads..) This part of my script filters the main folder and parent but not subfolders if ($file!= "." && $file!= "..") { How do i get that code to not check subfolders
-
[SOLVED] How to skip first result in array foreach loop
t_machine replied to t_machine's topic in PHP Coding Help
Sorry about that, I went with the first reply using the $i counting. Thanks again -
[SOLVED] How to skip first result in array foreach loop
t_machine replied to t_machine's topic in PHP Coding Help
Thank you all very much I figured there was a function to skip it but I wasn't sure which it was. Thanks again. -
Hi, I am wondering if someone could help me with this problem. I have an array that contains both key and value. The first key/value is used to store a heading so it is not needed in the rest of the loop. How can I skip that first key/value and display the rest. Example: $myarray = array("key1"=>"heading", "key2"=>1, "key3"=>2....... Without knowing the key/value of the first result, how can I skip it foreach($myarray as $k =>$v){ //if first key skip //else continue the loop } Thanks in advance
-
[SOLVED] Is it possibe to sum values while in loop?
t_machine replied to t_machine's topic in PHP Coding Help
Thanks very much. Works great -
I am wondering if anyone could help with this problem I would like to know if it's possible to add values while using a foreach loop. In the array below I have values lesser and greater than 10. I was wondering if during the loop I can check if the value is higer than 10 and basically sum all the values greater than 10. Example: $myarray = array(12, 6, 25, 2, 1, 15, 20); foreach($myarray as $val){ if($val >10){ //STARTING ADDING TO THE NEXT VALUE THAT IS GREATER THAN 10 } } Thanks for any help
-
[SOLVED] How to get first key and value from array?
t_machine replied to t_machine's topic in PHP Coding Help
Thank you very much It works perfectly -
Hi, I am wondering if anyone can help with this problem. I would like to get only the first key and value from my array. Example $myarray = array('linkname1'=>'linkurl', 'linkname2'=>'linkurl2', 'linkname3'=>'linkurl3'); What I would like is to get only the first "linkname1" and "linkurl" It will be use in my codes -> <a href="linkurl">linkname1</a> Thanks for any help
-
[SOLVED] How to add a <br> after 3 results?
t_machine replied to t_machine's topic in PHP Coding Help
Thank you very much. It works perfectly now -
hi, I am wondering if anyone could help me solve this issue. I am using a foreach loop and i would like to add a line break after three records then repeat the process. Example: foreach($array as $v){ echo $v.' '; } In that example, it will display ( apples oranges banana pumpkin turnips pineapple beer pepsi) How do i get it to display: apples oranges banana pumpkin turnips pineapple beer pepsi etc.... Notice above that after each three results the next three are placed on a new line. How can I accomplish that with my loop. Thanks very much for any help
-
[SOLVED] How to check if it's the last result and remove comma
t_machine replied to t_machine's topic in PHP Coding Help
Thank you very much. It works great -
hi, I am wondering if anyone could help. I have a loop that displays my results and places a comma after each. The problem is that when the last result is displayed, it shows the comma. Example: for loop{ echo $row['test'].', '; } displays... test1, test2, test3, Notice after test3, there is still a comma? How do I remove it and have it display... test1, test2, test3 Thanks for any help
-
Thank you very much for the link but I have one question. How do I get the name of the random thumb image so I can match it with the large pic. I would like it to display like this <a href="link/to/large/pic1_l.jpg"><img src="link/to/thumb/pic1.jpg"></a> Thanks
-
hi, I was wondering if anyone could help with this problem. I have created two folders (thumbs/largepics). I would like the script to view randomly a thumb and link to the larger pic. Example thumbs -> img1.jpg, img2.jpg. myimg.jpg largepics -> img1_L.jpg, img2_L.jpg. myimg_L.jpg The script would then choose for example "img2.jpg" then when clicked display "img2_L.jpg" Thanks for any help
-
[SOLVED] How to get two keys from array loop?
t_machine replied to t_machine's topic in PHP Coding Help
Thanks very much. It works perfectly now -
[SOLVED] How to get two keys from array loop?
t_machine replied to t_machine's topic in PHP Coding Help
Thanks everyone GuiltyGear is close to what i need but the result repeats each keys 1 - 2 2 - 3 3 - 4 4 - 5 The perfect scenario would be the following 1 - 2 3 - 4 5 - 6 7 - 8 I tried the other two examples but my comp nearly crashed from the loops that kept continuing -
I have an array that stores ids, each of which is unique. Is there a way to run a for loop and get two keys at a time instead of only one? Example $id = array(1, 2, 3, 4, 5, 6); for loop.... echo key 1 echo key 2 next loop echo key 3 echo key 4 and so on.... Each key must not appear twice so once a key is displayed, it will be removed from any further loops. I need it to display two keys at a time because I will be pairing them up for the next part of the script. Thanks for any help
-
Thank you all very much I have it working great now.
-
Thanks everyone for the replies AndyB does have the right idea but I am not sure how to implement it. Using that code, how would I know if 32 is a power of 2? I guess for simplicity I could just add those numbers in an array(2, 4, 6.....) then check if total matches in the array. I would prefer if a function could be created instead to check if the total matches, is a power of 2. Thanks
-
I am creating a tournament script and need to have total matches as a multiple of 2 (2, 4, 8, 16, 32... ). How can i check the number to see if it's ok. example $matchesNum = 38;//obviously this is not a multiple How would I check that number to make sure it was 32 or 64... Thanks for any help
-
Thank you both very much for the help Either of eregi or cmgmyr's example works great for what I needed.
-
Hi, I am wondering if someone could help with this. I would like to check if a word exist in a string and if yes do something. example: $string = 'This website is cool'; How to I check if the word 'website' exists in that string? Thanks
-
[SOLVED] Warning: Variable passed to each() is not an array
t_machine replied to t_machine's topic in PHP Coding Help
Thank you very much . It works perfectly now.