premiso
Members-
Posts
6,951 -
Joined
-
Last visited
-
Days Won
2
Everything posted by premiso
-
You do not want to escape it, you want to urlencode / urldecode the data.
-
Javascript / AJAX would need to be used to accomplish what you want.
-
Add a database field to the users table called, "Last Activity" if this value is less than 15 minutes show them as being online / logged in. If not show them as being logged out.
-
You can put the ad in an i-frame and refresh the i-frame or use AJAX and put the ad in a DIV and re-generate it using that. If the AJAX way, look into jQuery.
-
When the user logs in, how is their "validation" data stored? Sessions, Cookies?
-
cURL is safer because it can only access webpages, where as file can access any file on your server given the right path etc. It is better to use the proper tool for fetching webpage data (as cURL is much more efficient and quicker at it then file).So for instance if you have a form that says, "Enter URL of Link" when they pass it in you have something like: file($_POST['link']); that can open up your server for them to retrieve any file / code.
-
I do not know of any double unique constraints that would work in the way you describe. It will most likely have to be done on the code side (unless I am mistaken which I doubt I am).
-
Not exactly sure why they are displayed on the page (I guess it could be hte browser) But a valid HTML tag does not have a space before the tag name: < br /> as you can see you have a space before the b. The valid way would be doing it without a space: <br />
-
Display thumbnails as square while retaining aspect ratio
premiso replied to jamiet757's topic in PHP Coding Help
Cropping is exactly what you want, you can do this just with a php script that takes in the file then loads that into memory and then manipulates the memory of it, leaving the original intact. You should be able to find a tutorial about how to do this using google: http://www.google.com/search?ie=UTF-8&oe=UTF-8&sourceid=navclient&gfns=1&q=php+crop+image -
I fail to see how this could be PHP related. It is most likely on the Client side with the javascript / AJAX and as such I doubt the error is in the code provided. Moving to the AJAX forms, you may want to provide the HTML that this code is being used on.
-
PHP - Display ALL files in ALL folders in a specific directory.
premiso replied to Gamerz's topic in PHP Coding Help
You will probably need a recursive function, but look into glob (the user comments may help was wall) and or the scandir functions. -
Pending any syntax errors I may have created here is one way to do it: <?php if (isset($_POST['submit'])) { $title = "Little Boy Who?"; $output = <<<HERE <h3> Little Boy {$_POST['color']}, come blow your {$_POST['instrument']}!<br> The {$_POST['anim1']}'s in the {$_POST['place']}, the {$_POST['anim2']}'s in the {$_POST['vegetable']}.<br> Where's the boy that looks after the {$_POST['anim3']}?<br> He's under the {$_POST['structure']}, {$_POST['action']}. </h3> HERE; }else { $title = "Story"; $output = <<<HERE <h3> Please fill in the blanks below, and I'll tell you a story</h3> <form method = "post" action = "Story.php"> <table border = 1> <tr> <th>Color:</th> <th> <input type = "text" name = "color" value = ""> </th> </tr> <tr> <th>Musical Instrument</th> <th> <input type = "text" name = "instrument" value = ""> </th> </tr> <tr> <th>Animal</th> <th> <input type = "text" name = "anim1" value = ""> </th> </tr> <tr> <th>Another Animal</th> <th> <input type = "text" name = "anim2" value = ""> </th> </tr> <tr> <th>Yet another animal!</th> <th> <input type = "text" name = "anim3" value = ""> </th> </tr> <tr> <th>Place</th> <th> <input type = "text" name = "place" value = ""> </th> </tr> <tr> <th>Vegetable</th> <th> <input type = "text" name = "vegetable" value = ""> </th> </tr> <tr> <th>A structure</th> <th> <input type = "text" name = "structure" value = ""> </th> </tr> <tr> <th>An action</th> <th> <select name = "action"> <option value = "fast asleep">fast asleep</option> <option value = "drinking cappuccino">drinking cappuccino</option> <option value = "wandering around aimlessly">wandering around aimlessly</option> <option value = "doing nothing in particular">doing nothing in particular</option> </select? </th> </tr> <tr> <td colspan = 2> <center> <input type = "submit" name="submit" value = "tell me the story"> </center> </td> </tr> </table> </form> HERE; } ?> <!doctype html public "-//W3C//DTD HTML 4.0 //EN"> <html> <head> <title><?php echo $title; ?></title> </head> <body> <h1><?php echo $title;?></h1> <?php echo $output; ?> </body> </html> EDIT: Fixed the post variables to be correctly accesed.
-
Why don't you show him how to fix it instead of criticizing people for not mentioning it? At least explain what you are talking about. @twilltegxa: He is talking about SQL Injection, your code is prone to it with that syntax you will want to use mysql_real_escape_string to prevent it on any GET / POST data that you plan on entering into the database: $derived = "select * from derived_values where identity = '".mysql_real_escape_string($_GET['identity'])."'"; Will prevent that, but be sure to check that magic_quotes are off to prevent double escaping. (This can be checked with get_magic_quotes_gpc if they are on, I would stripslashes on the data before applying the escape string or turn them off)
-
I am taking that you want to fetch all players: $playername = mysql_query("SELECT playername FROM `players` LIMIT 1"); Should do just fine.
-
Sure, the way you would do it would be in the code and not in the DB. A simple query to check: SELECT id FROM table WHERE col1 = someint AND col2 = someint; If it exists then you do not insert it and re-generate a number, granted the more columns you have the potentially longer this process could take.
-
Can you not perform basic math? The 60 is the seconds, so time()+60 (seconds) is 1 minute ahead. Times that by another 60 it becomes an hour, so if you want it to be an hour and a half you can do 60 seconds times 90, which would make 90 minutes or an hour and a half.
-
Batch process multiline input from textarea
premiso replied to soycharliente's topic in PHP Coding Help
$lines = explode("\r\n", $batch); You need double quotes for \r\n to be taken as their real characters. The single quotes takes the literally. -
$expire_hour = time()+60*60; $expire_min = time()+60;
-
How to check the type of a variable's value?
premiso replied to gwolgamott's topic in PHP Coding Help
is_array checks a value to see if it is an array or not. -
http://www.micronovae.com/ModRewrite/ModRewrite.html You will need mod-rewrite which IIS has to have a 3rd party plugin to do, see the link above for more information.
-
It was not my intention to start a "my thing is bigger than yours" competition. I simply saw that we had 2 different solutions and decided to post mine as well (as I had it written already no use to waste it). EDIT: And you do not need the if check for the space in my code it will decode / encode just fine with out I found out!
-
A function I just created out of my ass to do it: <?php function decodeSpaces($message, $which="decode") { $function = (strtolower($which) == "encode"?"base64_encode":"base64_decode"); if (strstr($message, " ") === false) { return $function($message); } $message = explode(" ", $message); $decoded = ""; foreach ($message as $msg) { $decoded .= $function($msg) . " "; } return $decoded; } function encodeSpaces($message) { return decodeSpaces($message, "encode"); } $message = "This is my message to encode!"; $encMsg = encodeSpaces($message); $decMsg = decodeSpaces($encMsg); echo "Encoded $message looks like:<br />$encMsg<br/><br/> Decoded looks like:<br />$decMsg"; ?> EDIT: Just combined some duplicate code.
-
You may have a look at this script, as it may better suit your needs / be easier for you to understand: http://snippets.dzone.com/posts/show/3044
-
www.recaptcha.net is my preference.