PDA

View Full Version : Another website help



syun_ukiya
06-11-2010, 06:36 PM
Military Dog Tags Generator : Make and buy personalized Dogtags online for people and pets. (http://www.mydogtag.com/)

can someone tell me how he was able to change the text based on the input? I mean is it javascript, php or what not.

Can I copy or do something like this by reading the source-code or parts of it are hidden?

Hythloday
06-16-2010, 05:29 PM
You seem to have an idea of what language they're speaking (php or javascript), how to look at what they've said (view-source), and what YOU want to say in that language...

So go learn the language and say it.

It won't be as easy as stealing some code. Not that you're saying you'd want to steal, are you? You may even slide by with a very minimal understanding of what you're actually coding.

PHP Coding Tutorials - Search for PHP Coding Tutorials on Pixel2Life (http://www.pixel2life.com/tutorials/php_coding/)

Remember: be persistent and don't take the easy route.

o_O
06-17-2010, 02:02 AM
This particular example is coded in PHP, which is a server-side language so you won't be able to take code from it to recreate it.

My favourite way to approach this task would be to use a PHP comboform. That is, a PHP script that can render one or more different pages, depending on whether or not the user has submitted a form or not. A simple example of this is below.
As for how the developer managed to make the text on the dog tags change based upon the input; you'll notice that they're dynamically generated images. There are a few PHP modules that are capable of that, but the best (and the one that was probably used here) is GD2. You'd have to do some reading on the GD2 API to figure out how to use it properly.



<html>
<head>
<title>PHP Comboform example</title>
</head>
<body>
<?php
if (count($_POST) > 0) {
// if the $_POST array contains data then the form must have been submitted already.
echo 'Hi '. $_POST['name'] .', you have already clicked the submit button.';
} else {
// otherwise we render the form.
echo '<form name="comboform" method="post" action="'. $_SERVER['PHP_SELF'] .'">\n';
echo ' <input type="text" name="name" />\n';
echo ' <input type="submit" name="submit" />\n';
echo '</form>';
}
?>
</body>
</html>

Disclaimer: I haven't tested this so you might need to correct a few silly errors to make it work. Additionally, $_SERVER['PHP_SELF'] is one of the more exploitable parts of PHP and this script has no defense whatsoever against cross-site scripting, so make sure you do your homework on PHP security. :p