wildteen88
Staff Alumni-
Posts
10,480 -
Joined
-
Last visited
Never
Everything posted by wildteen88
-
If you just want the version number use a function called phpversion()
-
That site also sells Win98Se too for $62 [url=http://www.webcommunitysoftware.com/onlinestore/merchant2/merchant.mvc?Screen=PROD&Product_Code=osw98se&Category_Code=]CLICKY[/url]
-
I listen to anything really, however I mainly listen to Dance. Prehaps not a faviourite for some or even most of you here, he he. I have a few gigs of music.
-
In order to make it auto scroll you'll have to use javascript, howver you cannot run PHP and Javascript together. When javascript starts PHP would of finished. If you want to run them together you'll want to use ajax.
-
Your script is very unsecure, and can lead to sql injection attacks, as r-it mentioned above. To prevent SQL Injection attacks you should consider using mysql_real_escape_string. It would be a good idea to encrypt the users password too, using md5 or sha-1 Also you should use the POST method rather than the GET method, as people will be able to see the username and password in the URL. Whereas POST sends the data in the background.
-
Rather than doing each function seperatly, I'd do it all in one line. [code]//Set name $name = htmlentities(strip_tags($_POST['name']));[/code] Also for each text field, I'd add the maxlength attribute to set the maxumin number of characters for each field. Then you dont need to use wordwrap.
-
Adding a colored border around the outside of a table
wildteen88 replied to DaveLinger's topic in CSS Help
This should do it: [code]table { border: 5px solid #FFFFFF; }[/code] This will affect all tables on your webpage. If you give your table a class name called say, tbl-border, you can do this instead: [code]table.tbl-border { border: 5px solid #FFFFFF; }[/code] Also this wont affect the table cells, it'll only add a border around the parameter of the table. -
using PHP to authenticate password protected files/folders
wildteen88 replied to bltesar's topic in PHP Coding Help
You can access these files with PHPs file functions, by using file_get_contents, or if they are php scripts use include/require. PHP doesnt send requests through the server to access the files, but the OS, so it wont trigger the authentication dialog box. -
Yes. As those function will stripout any html from those fields, and htmlentities will convert some hmtls characters into their HTML equivalent, for exampe an opeing triangle barcket < will be converted <
-
We have the php manual on the main site, phpfreaks.com Here are links to those functions: [url=http://www.phpfreaks.com/phpmanual/page/function.htmlentities.html]htmlentities[/url] [url=http://www.phpfreaks.com/phpmanual/page/function.htmlspecialchars.html]htmlspecialchars[/url] [url=http://www.phpfreaks.com/phpmanual/page/function.strip-tags.html]strip_tags[/url]
-
Try this code: [code]<?php // setup a function to display our login form function displayForm($user='', $pass='') { echo '<form name="form" method="post" action="' . $_SERVER['PHP_SELF'] .'"> <label for="userlog">Username:</label><br /> <input type="text" name="userlog" value="' . $user .'"><br /> <label for="passlog">Password:</label><br /> <input type="password" name="passlog" value="' . $pass .'"><br /> <input type="submit" name="Submit" value="Login"> </form>'; } //check that the user has submitted the login form if(isset($_POST['Submit'])) { $username = "ink"; $password = "pass"; $realdate = date("d.m.Y"); $username2 = $_POST['userlog']; $password2 = $_POST['passlog']; // if the form has been submitted we'll now check the username and password if($username2 != $username and $password2 != $password) { // if the chekc didnt pass we'll display the following message echo 'Invlid Username or Password, try again'; // and show our login form. displayForm($username2, $password2); } // User has logged in succesfully, s we display the blog else { ?> <div align="center"><h2>Nytt blogginnlegg.</h2></div> <form name="form2" action="index.php?side=bloggsend" method="post" class="style1"> <label for="date">Dato:</label><br /> <input type="text" name="date" class="text2" value="<?php echo $realdate;?>"><br /> <label for="headline">Overskrift</label><br /> <input type="text" name="headline" class="text2"><br /> Innlegg:<br /> <textarea cols="75" rows="25" name="mld" class="text2"></textarea><br /> <div align="right">-Ink</div> <input name="submit" type="submit" class="knapp" value="Send"> <input name="reset" type="reset" class="knapp" value="Reset"> </form> Gamle innlegg:<br /> <br /> <?php $fil = fopen("news.txt", "r"); $innhold = fread($fil, filesize("news.txt")); fclose($fil); echo $innhold; } } // user hasnt submitted the form yet, so we'll display the form. else { displayForm(); } ?>[/code]
-
Move the php.ini file to C:\WINDOWS When you have done that restart Apache. Is PHP now reading the correct php.ini? Also have a read of [url=http://www.phpfreaks.com/forums/index.php/topic,95378.0.html]thread[/url] for enabling the mysql extension. FYI I believe phpMyAdmin requires the php_mysql.dll extension rather than the php_mysqli.dll function.
-
How to display Timestamp in readbale format from MySQL
wildteen88 replied to AdRock's topic in PHP Coding Help
From looking at your code $code->time holds your timestamp. SO what you'll want to do is change: [code]echo($code->time."<BR>");[/code] to: [code]$time = date('F j, Y', strtotime($code->time)) echo '<b>Posted: ' . $time . "</b><br>";[/code] -
To strip any html tags use the function called strip_tags, also use other functions called htmlspecialchars, htmlentities and addslashes.
-
You can either return it as corbin has shown above or make your var2 var global like so: [code]function whatever2() { global $var2; $var2 = "hi"; } // call our function, first whatever2(); // now we will be able to use our variable from the function echo $var2;[/code] By I'd recommend you to use return rather than making your variables global. If you are going to be returning 2 or more variables. I'd return it as an array, and store the array in a variable, like so: [code]<?php function getVars() { $var = 'hello'; $var2 = 'hey'; $var3 = 'bye'; return array($var, $var2, $var3); } $vars = getVars(); echo '<pre>' . print_r($vars, true) . '</pre>'; ?>[/code]
-
Yeah, that number (2018039464) is a unix timestamp. If you follow kens example above you'll see how to convert that timestamp into a date using PHPs date function, (secound line in kens example above): [code=php:0]echo date('l, F j, Y G:i',2018039464);[/code]
-
You'll want to add the option 'Indexes' to the Options directive for your sites document root (around line 273) in the httpd.conf. When you add that you'll want to save the httpd.conf and restart Apache.
-
crashmaster I would strongly advise you yo validate user input, especially when they login, as at the moment your site is prone to SQL Injection attacks! I would recommend you to use a function called mysql_real_escape_string() on your $username and $password variables in the check_database function.
-
That will work yes. The general syntax is this [code]INSERT INTO tbl_name ([col1, col2....]) VALUES ([Value1, Value2...])[/code]
-
It'd be better if you stored the members username in a session, then you dont need to query the database to get the username.
-
You'll want to use wordwarp: [code]<?php $text = "ttttttttttttttttttthhhhhhhhhhhhhhhhhhhhhhhhhhhiiiiiiiiiiiiiiiiiiiiiiiiissssssssssssssssssssssss aaaaaaaaaaaaaaaaa lllllllllllllllllllllllllllllllllllllllllllloooooooooooooooooooooooooooooooooooooooooooooooooooooonnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnngggggggggggggggggggggggggggggggg pppppppppppppppppppppppppppppppppppppppppppppppppppoooooooooooooooooooooooooooooooooooooooooooooooooooooooosssssssssssssssssssssssssssssssssssssssssssssssssssssstttttttttttttt."; $newtext = wordwrap($text, 200, "<br />", true); echo $newtext; ?>[/code]
-
Do somtyhing like this: [code]$text = str_replace(array("\r", "\n"), '', $text);[/code] That'll remove the newlines. Make sure you use this after nl2br, otherwise nl2br wont work.
-
You'll want to use nl2br, it converts newlines into html line breaks. The newlines are there still but the browser ignores them
-
No you dont you can select multiple records at any one time, by clicking the checkbox for each record you want to edit. The same applies for tables too.
-
When you upload your files you are supposed to upload them to special area, which from looking what was posted earlier, you are supposed to upload your files to the htdocs folder. When you upload a file you are going to be using PHP to open that file to read/write contents to you'll need to set some permission for that file. Which you can do by Right clicking the file and selecting properties from the menu within your FTP program. Somewhere in the properties dialog box you should find a CHMOD area. It'll either be a textbox, with about 9 textboxes. What you'll want to do is the change the number so it reads 0775. Once it reads 0775 or 775 the file will now the correct permissions for PHP to opne/read and write to the file.