wildteen88
Staff Alumni-
Posts
10,480 -
Joined
-
Last visited
Never
Everything posted by wildteen88
-
Run the script again. Then refresh the browser window. You should now get your cookie back. If you dont make sure you have cookies enabled. Why do you need to refresh the window? This is becuase, when you first run the script, you are setting the cookie. But when you refresh the browser window. The cookie is retrieved. Its to do with an inviside set of information a browser sends with every request which is called the header. So on every page reguest the browser firstt checks whether there is any valid cookies set for your site, or any site are visiting. If there are cooies for that site it'll send the cookie data with the header information. Then PHP processes this header information getting cookies. This why you have to refresh your browser window in order to get the cookie you have just set.
-
Change $PHP_SELF to $_SERVER['PHP_SELF'] and $id to either $_POST['id'] or $_GET['id'] This is becuase webmonkey did this tutorial with register_globals enabled and you dont. I would advise you carrying on with that tutorial as it is out of date.
-
This is called BBCode. Search google for BBCode Inserter or something like that. It requires javascript. But to replace the BBCodes ie [ b]hello[/b] in to [b]hello[/b] will require the use of regular expressions. [url=http://www.phpfreaks.com/forums/index.php/topic,101566.msg402102.html#msg402102]Here[/url] is a very basic BBCode Parser, it parses bold, italic and underline BBCode.
-
Yeah, you'll want to use javascript. DynamicDrive.com hasd a few pre-made scripts lying about there for what you want to do. Prehaps you are look for something like [url=http://www.dynamicdrive.com/dynamicindex10/topmsg.htm]this[/url]. NOTE look down at bottom of page and scroll up and down you'll notice a message overlayed at the bottom.
-
Beacuase it intefere with nl2br and the whitepace characters (\n, \r, etc).
-
remove stripslashes.
-
Hellusius you might want to look into [url=http://www.php.net/in-array]in_array[/url] if you are storing your pages filenames in an array. Also ozPATT your code is very unsecure, as i can come along and do this: yoursite.com/index.php?page=http://www.mybadsite.com/nastyfile.php and nastyfile.php will have some malicous code which could pertentially screw up your site, and possibly others too.
-
nl2br has been around since PHP3. Check it out [url=http://uk2.php.net/manual/en/function.nl2br.php]here[/url]
-
Why not just use nl2br()? Alot simpler. Does the samething. nl2br converts any newline characters (\r\n, \r, \n) to < br /> (without the space before the br).
-
Looks like your host has setup an alias within the server config file. However they appear of missconfigured something as it is not a good idea to allow someone to type in php.ini in the browser to view php setup, instead they should display the phpinfo, rather than the raw php.ini file. Looks your host doesnt quite know what they are doing!
-
You encrypt/decrypt strings with basic encryption such as base64_encode/decode
-
Fearpig please download the zipped binaries version for PHP5, now extract the contents of the zip file over your existing PHP directory. As the installer has a few files missing. Now move the libmysql.dll to the C:\WINDOWS folder, or C:\WINNT if the WINDOWS folder doesnt exist. Also move the php.ini to the same folder too. Make sure you have setup the extension_dir line within the php.ini correctly too. Also if you want to use msql/mssql I think you'll also want to move the msql.dll file too to the same folder as the php.ini. Whats results do you get now?
-
[quote author=redarrow link=topic=101891.msg403687#msg403687 date=1153904664] ok mate pm me anytime ok. [/quote] Kinda hard that when the PM system is disabled.
-
This will only be possible if you are the Admin of the site, ie you have ftp/control panel access to your site. Sessions by default are stored on the server, usually within a folder called tmp which should be out of reach from public access, as its outside your servers document root. But if the sessions data is being written to a cookie, (not the session id), then I would advise you either get the host to change this, or to write your own session handler.
-
Enabling SQLite in PHP 5.1.4
wildteen88 replied to jfdutcher's topic in PHP Installation and Configuration
When you make changes to the php.ini or move any files around within the PHP folder, you must restart the server. Also move any php_*.dll files back into the ext folder. And just move the php.ini to the WINDOWS folder. Restart your server. Is PHP now reading the correct php.ini. Also it is a good idea to add the your PHP folder to the WINDOWS PATH variable. To do this do the following: First goto Start > Control Panel (make sure its set to classic view) > System > Advanced Tab Now click the Environment Variables button. Look for the Path variable within the System Variables window, scroll down if needed. Select it and press the Edit button. When the Edit System Variable window appears, immediatly press the End key on your keyboard, dont delete anything that is selected. Now add a semi-colon if there isnt one already to the left of the curser. Now type in C:\php; Click OK to close the Edit System Variable Window. Click OK to close the System Variables Window, Click OK to close the System Properties window. Now restart your PC in order for the new path variable to become available. Now PHP should be able to access its own folder, therefor you dont need to move any files around. -
If you want to type the 'Pole' character you press Shrift+\ (forward slash) which produces | If your keybaord is setup as American I think it may be different. But it should work.
-
Use mysql_fetch_assoc mysql_fetch_result doesnt exist.
-
Use [url=http://www.php.net/number_format]number_format[/url] [code=php:0]$number = '123456789'; echo number_format($number, '0', '.', ',');[/code]
-
If your data is in an array, you can use something like [url=http://uk2.php.net/manual/en/function.arsort.php]asort[/url], or many of the other sort functions for arrays. However It'll be easier to use the ORDER BY clauase to order the results.
-
Rather than do this: [code]<? $price = $_POST['price']; if ($price == "") { echo"Sorry you didn't fill in the price field."; exit(); } if(is_numeric($price])) { $query = "INSERT INTO sold (price) VALUES ('$price')"; $result = mysql_query($query); } else { echo "Sorry you may only enter Numbers in the price field.Please go back and fix you're mistakes."; } ?>[/code] I'd do this: [code]<?php if(isset($_POST['price']) && !empty($_POST['price']) && is_numeric($_POST['price'])) { $price = addslashes($_POST['price']); $query = "INSERT INTO sold (price) VALUES ('$price')"; $result = mysql_query($query); } else { echo "PLease verify you have filled in the price field correctly"; } ?>[/code]
-
It is becuase of the single quotes, this should work: [code]<?php $bg = array('#CCCCCC','#EEEEEE'); $i=0; while ($sq = mysql_fetch_assoc($data)) { print '<tr><td class="team22" style="background-color:'.$bg[$i%2].';"><a href="index.php?show=sq'.$sq->short.'"><img src="symbols/games/'.$sq->game.'">'.$sq->name.'</a></td></tr>'; $i++; } ?> <?php } ?>[/code] EDIT: Didnt copy correctly
-
Use is numeric: [code]<?php if(isset($_POST['submit'])) { if(is_numeric($_POST['numb'])) { echo "Is numeric!"; } else { echo "Is not numeric!"; } } ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <input type="text" name="numb" value="<?php echo @$_POST['numb']; ?>" /><br /> <input type="submit" name="submit" value="Check number" /> </form>[/code] Or you can use ereg
-
This: [code]while ($sq = mysql_fetch_query($result, MYSQL_ASSOC)) {[/code] is supposed to be this: [code]while ($sq = mysql_fetch_assoc($result)) {[/code]
-
You'll probably want to use wordwarp to addin a new line character every 20 characters. The use count and explode to get number of lines like so: [code]<?php $text = "The quick brown fox jumped over the lazy dog."; $newtext = wordwrap($text, 20, "<br />\n"); echo $newtext . '<br /><br />'; echo 'There are ' . count(explode("\n", $newtext)) . ' lines'; ?>[/code]
-
Is that the full code? As it looks incomplete to me. As your my_date, and a few other functions are nonexistant and half the html is missing.