Jump to content

beta0x64

Members
  • Posts

    47
  • Joined

  • Last visited

    Never

Everything posted by beta0x64

  1. I think he means an image manipulation library like imagick or gd This might do what you want, don't quote me: http://www.php.net/manual/en/function.imagickdraw-annotation.php You could save it in whatever format you desire to minimize the quality loss.
  2. $phone and $company do not have any value inherently. They must receive values sent to the script from the form by the method POST. Look here: $Name = Trim(stripslashes($_POST['Name'])); $Email = Trim(stripslashes($_POST['Email'])); $Comments = Trim(stripslashes($_POST['Comments'])); This is where the variables $name, $email and $comments receive values based on the form values that have been POST'd to the script. There is no space for $phone or $company. You could solve this easily by appending $Phone = Trim(stripslashes($_POST['Phone']); $Company = Trim(stripslashes($_POST['Company']); Also, look at your form. It's a little copy and pasted, I can tell that. <label for="Email" >Company Name:</label> <br /> <input type="text" name="Company Name" id="Company" class="inputValue"/> <span class="required">*required</span><br /> <br /> <label for="Email" >Phone Number:</label> <br /> <input type="text" name="Phone Number" id="Phone" class="inputValue"/> <span class="required">*required</span><br /> needs to become <label for="Company" >Company Name:</label> <br /> <input type="text" name="Company" id="Company" class="inputValue"/> <span class="required">*required</span><br /> <br /> <label for="Phone" >Phone Number:</label> <br /> <input type="text" name="Phone" id="Phone" class="inputValue"/> <span class="required">*required</span><br /> The name attribute is what is used by $_POST, iirc. < /lecture> Here's two functions that can make learning a lot easier. var_dump or print_r. You could do a var_dump($_POST); or print_r($_POST); to get everything inside of that variable. Also if you're really in a pinch, there are many PHP tutorials on the 'net as well as youtube. You could also outsource it! A simple thing like that wouldn't have cost very much. Happy scripting!
  3. I have an idea of what might be causing this. We'll go in varying levels of severity/debugging. Try putting the reply-to immediately after the from. Make sure to \r\n it. If the new last header (Cc:) doesn't work, then you can assume that you need a final \r\n, which is normal in HTTP packets (I'm not sure about SMTP). From RFC2822 (http://www.faqs.org/rfcs/rfc2822.html),
  4. Flash is actually slow and plays flv s not avis or mpg. Also you cut out a lot of the mobile market with flash. Just do an embed. The video player is dependent on the user agent.
  5. I think you should use session variables instead but yea... If you were planning on doing it through a database query, you must watch out for them to get access by changing the ref id to malicious code... Just a warning
  6. You should check if the variables exist before referencing them otherwise. Do this with the isset method. isset($_POST["variables"]);
  7. Sourecode: <script type="text/javascript" src="http://jqueryui.com/latest/jquery-1.4.2.js"></script> <script type="text/javascript" src="jquery.tablesorter.js"></script> <script type="text/javascript" src="jquery.table2csv.js"></script> <script type="text/javascript" src="jquery.livequery.min.js"></script> <script type="text/javascript"> // we will add our javascript code here $(document).ready(function() { $("table").addClass("tablesorter").tablesorter(); $("button").livequery("click", function() { $("td input").each(function (idx, elem) { var val = $(this).attr("value"); $(this).html(val); }); $("table").table2csv({ callback: function(csva, name) { $("<form action='gridparser.php' method='post'><input type='hidden' name='filename' value='" + name + "' /><input type='hidden' name='csv' value='" + csva + "' /></form>").appendTo('body').submit().remove(); } }); }); }); </script> if you upload a csv file, then export that csv, it gives the error: Unexpected call to method or property access. jquery-1.4.2.js, line 4075 character 5 That code is: append: function() { return this.domManip(arguments, true, function( elem ) { if ( this.nodeType === 1 ) { this.appendChild( elem ); } }); }, Any clues? I tried toying with the IE8 developer tool, but to no avail.
  8. and repeat the row numbers for consistency good idea! that could be done in ajax, too though I have a feeling that the client wants to keep the page as similar to the current setup as possible (this is being exported from Excel, so a wide spreadsheet isn't a new concept
  9. I have a table for, well, displaying tabular data. However, I am curious as to how I can make the best possible user interface... See, it has many columns, and will not fit completely on one page/viewport. What makes this a little bit trickier is that I plan on having an input box at the top for queries, which will return valid rows to this interface. This means that it's pretty flexible at this point. Any ideas? Maybe I'm overcomplicating
  10. Well, there are actually many different ways you could do this, as you can imagine. I don't see why you don't do something like this: echo "<string>"; foreach ($boxdata as $bkey => $bdatum) { echo "$bkey = $bdatum<br />"; } echo "</string>"; this way you don't actually have to deal with two arrays. you can get the key right from the foreach loop
  11. What are you having trouble with figuring out? It certainly sounds like you know what you want to accomplish. I would start out by working through your code in pseudocode. That is, connect to mysql connect to db if table not exists create table numrows = number of rows foreach row in table row = random_number() for i=0;i < numrows;i++ mysql(select status, credits from table where value = i) . . . then figure out what you need to work on to make it happen
  12. What thorpe said. A lot of that could be put into functions as well. Proper spacing, functions, etc.. make for fast, clean, and easy to read (and debug) code.
  13. You have not checked if $error exists there. You only check if it is_array, assuming that it is there, but the only time $error is declared is inside the scope of your if statements. Long story short, add at the top $error = 0 or change the if statement on line 41 to if (isset($error) && is_array($error)) { Also, next time, please put your code in php tags by clicking the php button above the smilies; it's very helpful.
  14. You could use AJAX/jQuery to load the file dynamically. There are many file upload scripts available. How about like http://www.uploadify.com/demo/ ?
  15. <table border="0" cellpadding="2px" width="600px"> <?php $result=mysql_query("SELECT * FROM products"); while($row=mysql_fetch_array($result)){ ?> <tr> <td><img src="<?php $row['picture'] ?>" /></td> <td> <b><?php $row['name'] ?></b><br /> <?php $row['description'] ?><br /> Price:<big style="color:green">$ <?php $row['price'] ?></big><br /><br /> <input type="button" value="Add to Cart" onclick="addtocart(<?php $row['serial']?>)" /> </td> </tr> <tr><td colspan="2"><hr size="1" /></td> You should either use the notation <?php=$row['price']?> or use echo $row['price'], because all this does is reference the variable $row with a key, but not do anything with it. Whatever is echo'd or print'd to the user is what is displayed as HTML. Everything else is processed before the page loads. So yea. Replace those with something sensible!
  16. First, this should probably go in the PHP Regex section. Second, you need to add delimiters to the regex. Like this: $invalid_chars = '/[^A-Za-z0-9+_.!*(),-]/'; $repeated_chars = '/-{2,}/'; Third, you probably also want to add a + or * to the character class in $invalid_char. And finally, http://www.php.net/manual/en/reference.pcre.pattern.posix.php Have fun.
  17. I've used Fedora Core for about 3 years now. I dual-boot Windows and FC10, but I think I've booted into Windows like twice (just to see if it was still there ) Anyway, I just ordered a netbook, so my plan is to install eeebuntu on it, then either use http://www.thinstation.org/ or http://www.ltsp.org/ to setup a thin client server with a new box for dual-boot on the netbook (probably ubuntu as well, but I should experiment..it's easy with a thin client). That way, when I'm home, I can use the power of a desktop in the kitchen or my bed or "office", and when I'm out, I have the netbook to play with! Thoughts?
  18. OK, looking at it now, the Tokenizer library does in fact add in an offset, which is what my main problem with using it was. I'll use it. Thanks guys!
  19. I understand that; I just find that my way is actually easier.
  20. Awww, but now how will I show off my l33t regex skillz? Anyway, the Tokenizer also grabs functions inside of classes (but strangely not functions inside of functions, hmmm), which is not what I want, per se. I think I should stick with my current M.O., especially because I've already coded most of it... Thanks, though!
  21. Well, I'm trying to make a program that will split source code files into classes, functions, and everything else. const C_pattern = "/^(?P<type>abstract\s+|final\s+)?class\s(?P<name>[a-z_][a-z0-9_]*)\s*(extends\s(?P<parent>[a-z0-9_]+)\s*)?(implements\s(?P<interfaces>([a-z0-9_,\s])+)\s*)?\{/imS"; const F_pattern = "/^function\s+(?P<name>[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)\s*\((?P<operands>[\$a-z0-9_,\s]*)\)\s*\{/imS"; The one thing I am concerned about is functions inside of functions, classes inside of functions, functions inside of classes, etc. if the user does not use proper tabs. I think that I can determine the offset of the match, then replace that match with a require_once(), like nothing happened! This would work even inside of a class, correct? In order to handle the functions inside of classes problem, well I just parse classes first and delete them! (Don't worry, I plan on doing all of this inside a tmp file, so deletion is not a problem) What do you guys think?
  22. Hey guys, do you think that this is a good regex to capture a class declaration? /^(?P<type>abstract\s|final\s)*class\s(?P<name>[a-z0-9_]+)\s*(extends\s(?P<parent>[a-z0-9_]+)\s*)?(implements\s(?P<interfaces>([a-z0-9_,\s])+)\s*)?\{/imS Am I missing anything? Is it possible for a class to be both abstract and final, too? Can I do something to break the interfaces up into named subpatterns that are predictable (inter1, inter2, inter3, etc.), or will I have to do that with explode or something as I'm assuming? Output on example subject: Array ( [0] => Array ( [0] => class patsSQL extends MySQL implements patsInfo, patsDisplay { [1] => class Controller { ) [type] => Array ( [0] => [1] => ) [1] => Array ( [0] => [1] => ) [name] => Array ( [0] => patsSQL [1] => Controller ) [2] => Array ( [0] => patsSQL [1] => Controller ) [3] => Array ( [0] => extends MySQL [1] => ) [parent] => Array ( [0] => MySQL [1] => ) [4] => Array ( [0] => MySQL [1] => ) [5] => Array ( [0] => implements patsInfo, patsDisplay [1] => ) [interfaces] => Array ( [0] => patsInfo, patsDisplay [1] => ) [6] => Array ( [0] => patsInfo, patsDisplay [1] => ) [7] => Array ( [0] => [1] => ) )
  23. This worked for me: preg_replace('/[^a-zA-Z0-9&\s]/i', '', 'Echo! & t\/h/\e $Bunnymen%*()@ '); The result is Echo & the Bunnymen Perhaps the problem is with the ampersand itself when being passed to the search in your code? I suggest htmlentities() or htmlspecialchars(). It's also possible that the ampersand means bitwise AND or something in whatever context you're using it.
  24. The name will scare you, but investigate the concepy of a neural network. If you can make each tile its own "neuron," you can determine where your character is and the next available place closest to your destination, the next available place closer to the destination, the next, the next, and so on. This is also good for coding in a "discovery" system, kinda like any RTS where there is a fog of war.
  25. True, but what's more is that what you have described is something like a Trojan and a CSRF combined. Not only have you stolen the nonce, but you are also coming from the same IP, the same UA, the same everything. You essentially are the user. The beauty of a "good" CSRF is that you can embed it into an image or something that even a remote user you're not familiar with can be attacked by. Yours is an extreme case that is less than favorable to the amateur hacker, and I would like to remind you that every system can be compromised (unless of course it's not plugged in! haha). I would think a better vector would be to use WireShark or something to catch the nonce, if it's not HTTPS. Otherwise yours would probably be one of the few ways to pull that exploit off.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.