Jump to content

wildteen88

Staff Alumni
  • Posts

    10,480
  • Joined

  • Last visited

    Never

Everything posted by wildteen88

  1. Better to use: if ($count != 0) { echo "($count) <BR/>\n"; }
  2. Basically means MySQL cannot find a field called “stepnumber” within the tutorials table. Make sure you have spelt the field name correctly (check with the tutorials table schema)
  3. no setting needs to be enabled in order to run phpinfo. Unless for some reason you have added phpinfo to the disable_functions directive for some reason. By default this directive is empty. Not sure what you mean by: Why do you need to see it 10 times? You'll get the same results every time unless you change either the servers or phps configuration in between each refresh.
  4. Whats a backlink/inlink? Do you want to capture the websites url the user came from to get to yours?
  5. Code works fine here. Code used to test bbcode function: $text = "Hello [i]world[/i] [code=php:0]<?php echo 'hello'; ?> Done"; $text = bbcode($text); echo $text;[/code] How are you calling the bbcode function?
  6. Add spaces into your regex pattern: [^A-Za-z0-9 ]
  7. When you echo $athu1 you should use $auth1['Authorised']
  8. You in the right thread?
  9. Do you want to remove those characters from $title and $description? Add the following lines: $title = ereg_replace("[^A-Za-z0-9]", "", $title); $description = ereg_replace("[^A-Za-z0-9]", "", $description); Before the following: // add url info to database: $title = mysql_real_escape_string($title); $description = mysql_real_escape_string($description);
  10. $auth1 will return 'resource id #4' because mysql_query only returns a result resource number which links to the returned record set. You will have to use mysql_fetch_assoc in order to get the data out of the record set. Also why on earth are you using Word for creating a web page? Extremely bad idea! Puts in crap loads of invalid markup.
  11. Only need to one foreach loop: <?php $url_list = file_get_contents('xxxx'); $url_list = str_replace(array("\r\n", "\r", "\n"), "\n", $url_list); $urls = explode("\n", $url_list); // connect to your database here foreach($urls as $url) { list($id, $title, $description) = array_map('urldecode', explode('&', $url)); // add url info to database: $title = mysql_real_escape_string($title); $description = mysql_real_escape_string($description); // prepare query $sql = "INSERT INTO tbl_name (id, title, description) VALUES('$id', '$title', '$description')"; // run query mysql_query($sql); } ?>
  12. You'd do the query within the foreach loop after this line: list($id, $title, $description) = array_map('urldecode', explode('&', $url)); Eg: // connect to your database here foreach($urls as $url) { list($id, $title, $description) = array_map('urldecode', explode('&', $url)); // add url info to database: $title = mysql_real_escape_string($title); $description = mysql_real_escape_string($description); // prepare query $sql = "INSERT INTO tbl_name (id, title, description) VALUES('$id', '$title', '$description')"; // run query mysql_query($sql); } Change the example query so it works with your database.
  13. $_GET will only work if the urls are coming from daveh33's website. daveh33 is getting them from an external webpage.
  14. Maybe: <?php $url_list = file_get_contents('list-of-urls.html'); $url_list = str_replace(array("\r\n", "\r", "\n"), "\n", $url_list); $urls = explode("\n", $url_list); foreach($urls as $url) { list($id, $title, $description) = array_map('urldecode', explode('&', $url)); echo '<p>' . $id . '<br />' . $title . '<br />' . $description . "</p>\n"; } ?>
  15. What is your string then? Post an example of the extension webpage/site you are linking to, to get the 'urls'
  16. If its an external webpage then look in to file_get_contents to get the (html) source code.
  17. Are you capturing a url from an external website and the url is formatted like so: 'id=ID&title=Title&description=Description If so the following should work: <?php $url = 'id=2048&title=The+World&description=The+world+description+here'; $url_vars = explode('&', $url); foreach($url_vars as $url_var) { list($var, $value) = explode('=', $url_var); $$var = urldecode($value); } echo $id . '<br />' . $title . '<br />' . $description; ?>
  18. You'll want to use the e pattern modifier if you want to call a function in the replacement. However you cannot have html and php code in the replacement together if you use this modifier. That is why other third party apps use functions for parsing php code. Working example: <?php $search = array( '/\[s\](.*?)\[\/s\]/is', '/\[b\](.*?)\[\/b\]/is', '/\[i\](.*?)\[\/i\]/is', '/\[u\](.*?)\[\/u\]/is', '/\[img\](.*?)\[\/img\]/is', '/\[url\](.*?)\[\/url\]/is', '/\[url\=(.*?)\](.*?)\[\/url\]/is', '/\[php\](.*?)\[\/php\]/ies' ); $replace = array( '<s>$1</s>', '<strong>$1</strong>', '<em>$1</em>', '<u>$1</u>', '<img src="$1" />', '<a href="$1">$1</a>', '<a href="$1">$2</a>', 'highlightPHP(\'$1\')' ); function highlightPHP($code) { $html = '<table style="border-style: dashed; background-color: #FFF; border-width: thin;" align="center"> <tr><td align="left">' . highlight_string($code, true) . '</tr></td></table>'; return $html; } $text = 'Hello [i]world[/i] [code=php:0]<?php echo \'hello\'; ?> Done'; $html = preg_replace($search, $replace, $text); echo nl2br($html); ?>[/code]
  19. Remember earlier I got you you to change the port Apache listens too for TCP/IP requests, you changed it to 8080 instead of using the default which was 80. Anytime you go to localhost now you must state the port number too. Glad everything is working now.
  20. Yes that is fine. You use localhost as the hostname when mysql is installed on the same server the website is hosted off. For selecting a database your just specify the name of the database, not the path of where the database is stored - that is all handled by mysql.
  21. Do you have the mysqli extension (php_mysqli.dll) enabled within the php.ini You can only use the mysqli_* functions with the mysqli extension. You cannot use them with the standard mysql extension. Also mysqli is only for PHP5 or greater.
  22. It'll be better if you use an array: function parse_smilies($txt) { $smilies_symb = array('', '', ''); $smilies_html = array('<img src="smilie.gif">', '<img src="sad.gif">', '<img src="wink.gif">'); $txt = str_replace($smilies_symb, $smilies_html, $txt); return $txt; } $s = "this is some text with a smilie face "; $s = parse_smilies($s); echo $s;
  23. Can you attach Apaches httpd.conf file here. Maybe you have a stray mis-configuration setting. I'm not sure what else to suggest. Make sure you are going http://localhost:8080/ and not just http://localhost/ when viewing phpinfo.php. ALso did you remove all files in D:/apache2/htdocs ? What is displayed when you go to localhost? You should see all files and folders stored in your htdocs folder.
  24. You can use css for this. Look into CSS print media. Basically you set all the elements in your page to display:none; that your don't want to be printed in your print stylesheet, call this stylesheet print.css for example. You then link to this style sheet using a link tag in the head, eg: <link rel="stylesheet" media="print" href="print.css" type="text/css" /> When a user goes to print the page your browser will use the print.css file rather than your normal stylehsheet.
  25. same output no change. Tested in FF, IE 7 and Safari (Win). I cannot see how $_POST displays differently.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.