Daniel0
Staff Alumni-
Posts
11,885 -
Joined
-
Last visited
Everything posted by Daniel0
-
Echoing multiple fields depending on a variable
Daniel0 replied to Andrew R's topic in PHP Coding Help
What do you mean by labelling them? -
Small modification (looks nicer and is smaller): [code]<?php session_start(); $con = mysql_connect("localhost","ZackBabtkis","") or die('Could not connect: ' . mysql_error()); mysql_select_db("test", $con); $subject = mysql_real_escape_string($_POST['subject']); $message = mysql_real_escape_string($_POST['message']); $date = date("F j, Y, g:i a"); $sig = isset($_POST['sig']) ? "yes" : "no"; mysql_query("INSERT INTO messages (Username, Sender, Subject, Message, Date, sig) VALUES ('{$_COOKIE['user']}','{$_SESSION['username']}','{$subject}','{$message}', '{$date}', '{$sig}')",$con)) or die('Error: ' . mysql_error()); echo "Your message has been sent to {$user}"; mysql_close($con) ?>[/code]
-
I voted back since I suck at designing (front).
-
PS3 comes with either a 20gb or 60gb hard disk as well :P
-
calculating the difference in ems, and px's
Daniel0 replied to Ninjakreborn's topic in Miscellaneous
Use percentages instead. -
No, but that doesn't matter. A tab is a tab, but in different editors it is presented different. Sometimes it might be 2, 4 or 8 (or user configurable), but a tab is still = \t But it is much easier to just write \t if the editor support it.
-
Else you could just copy a tab and paste it into the replace field.
-
I know you hate myspace, but watch this
Daniel0 replied to steelmanronald06's topic in Miscellaneous
Quite funny in the start, but I got bored half-way. -
This is off-topic, but well... HuggieBear: Instead of [nobbc][b][[/b][b]code][/b] ... [b][[/b][b]/code][/b][/nobbc] you can just type: [nobbc][nobbc][code] ... [/code][/nobbc][/nobbc] ;)
-
I always put them in curly brackets. I think that [code]"Bla bla {$variable} bla bla again"[/code] looks nicer than [code]"Bla bla $variable bla bla again"[/code] It also makes it easier to spot variables.
-
Yeah. You can use $_SERVER['HTTP_REFERER'] to find out what page that linked to it. (I bet it wont take very long before somebody come and tell that it can be spoofed)
-
Put them in an array like this then replace them: [code]$smilies = array( // code => image ':)' => 'smile.gif', ':D' => "smile2.gif', ':(' => 'sad.gif', ); $codes = array_keys($smilies); $the_text = str_replace($codes,$smilies,$the_text);[/code]
-
Try TinyMCE.
-
Of course. First line assigns <album to $output. Then you run through each POST variable and add it to output, then you add the ' />' to close the tag. Finally it is echoed.
-
delete files more than 24 hours old, in a directory
Daniel0 replied to Jim from Oakland's topic in PHP Coding Help
This should do it: [code]if(filemtime($file)+24*3600 > time()) { unlink($file); }[/code] -
Try something like this: [code]$output = "<album"; foreach($_POST as $key => $value) { $output .= " {$key}=\"{$value}\""; } $output .= " />"; echo $output;[/code]
-
Just use the [url=http://php.net/mail]mail[/url] function.
-
Ahh, well ok I see.
-
You could make an anti-leech system.
-
SVN repositories store all revisions of all files so you always can see what user changed what and you can always roll back any changes made and it is therefor awesome for development purposes. Actually there is GUI SVN applications. Linux: [url=http://meld.sourceforge.net/]Meld[/url] Windows: [url=http://tortoisesvn.tigris.org/]TortoiseSVN[/url]
-
Please check my code - licence keys / domain check
Daniel0 replied to jezari's topic in PHP Coding Help
No. A keygen generates a serial/key that would work. You need to keep the way you generate the key secret, so you could do this: - User input serial in config file - Each time the script is run it will open a connection to http://your-site.com/check_key.php?key=bla bla bla - check_key.php on your server will check if the key is valid (and possibly if it is in your customer database). It will return e.g. 1 if it's valid and 0 if it isn't. -
[quote author=techker link=topic=111105.msg450096#msg450096 date=1160505500] so it would look like this? [/quote] Yes. [quote author=techker link=topic=111105.msg450096#msg450096 date=1160505500] can't see your php block? [/quote] The block of PHP code.
-
Please check my code - licence keys / domain check
Daniel0 replied to jezari's topic in PHP Coding Help
I guess it would work. But it would be very easy to make a key generator and thereby be able to register the script without a serial from you. -
Multiply: [code]$var1 * $var2[/code] Addition: [code]$var1 + $var2[/code]
-
If you can do one table, then just do this: [code]$query = mysql_query("SHOW TABLES FROM db_name_here"); while($table = mysql_fetch_row($query)) { $table = $table[0]; // do your stuff here }[/code]