wildteen88
Staff Alumni-
Posts
10,480 -
Joined
-
Last visited
Never
Everything posted by wildteen88
-
OK done a little testing. <?php if(isset($_POST['submit'])) { $word_list = $_POST['word']; preg_match_all('|(\s+)<option value="([a-z]+)">([a-z ]+)</option>|is', $word_list, $matches); foreach($matches[2] as $image_name) { $image = 'http://images.neopets.com/neoboards/avatars/' . $image_name . '.gif'; if(file_exists($image)) { echo '<img src="'.$image.'" /><br />'; } else { echo $image . ' does not exist<br />'; } } echo '<br />'; } ?> <form method="post"> Code:<br /> <textarea name="word" cols="60" rows="10"><?php echo @$_POST['word']; ?></textarea><br /> <input type="submit" name="submit" value="Get Images" /> </form>
-
Sorry I didn't see this post.
-
Why didn't you tell us that before?
-
Woops my mistake, change: $words_array = explode('_', $words_text); to $words_array = explode(' ', $words_text);
-
Yes you are partly right. This echo "<tr style=\"class: $class;\">\n"; should be: echo "<tr class=\"$class\">\n";
-
Change: while($row = mysql_fetch_array( $result )) { // Print out the contents of each row into a table echo "<tr>\n"; echo "<td><a href='delete.php?id=".$row['id']."'>".$row['id']."</a></td>\n"; echo "<td>".$row['name']."</td>\n"; echo "<td>".$row['score']."</td>\n"; echo "<td>".$row['ipaddress']."</td>\n"; echo "<td>".$row['date']."</td>\n"; echo "</tr>\n"; } echo "</table>"; to $i = 0; // setup a counter while($row = mysql_fetch_array( $result )) { // alternate colors $color = ($i%2 == 0) ? '#33FF00' : '#0000FF'; // Print out the contents of each row into a table echo "<tr style=\"background-color: $color;\">\n"; echo "<td><a href='delete.php?id=".$row['id']."'>".$row['id']."</a></td>\n"; echo "<td>".$row['name']."</td>\n"; echo "<td>".$row['score']."</td>\n"; echo "<td>".$row['ipaddress']."</td>\n"; echo "<td>".$row['date']."</td>\n"; echo "</tr>\n"; $i++; // increment counter } echo "</table>";
-
I updated my post above.
-
Is the code part of an HTML form which is a pull down menu? The user selects an image name from the menu, submits the form and whaterver was selected from the menu is displayed? EDIT: I see what you're doing to now. You should use explode to separate each word. eg: $words_text = $_POST['word']; $words_array = explode('_', $words_text); foreach($words_array as $word) { $image = 'http://images.neopets.com/neoboards/avatars/' . $word . '.gif'; if(file_exists($image)) { echo '<img src="'.$image.'" /><br />'; } }
-
You have have output on line 47 in index_part2.php. You cannot have any form of output before the use of the header or set_cookie functions.
-
Where is $id coming from? If its from the url you should use $_GET['id']
-
How would you know whether an image corresponds to a piece of text? You'll need to post some example data. As for whether to use a database it is up to you. A flat file database may be best. But I cant really suggest a solution until I understand your question further.
-
Yes. PHP will parse the code in the replacement parameter. Without the modifier PHP will teat the code in the replacement as text.
-
In order for that address to work Apache will have to be listening on port 1131 Also Ensure your firewall is not blocking internal connections to port 1131 too.
-
mysql functions and internal server error
wildteen88 replied to lilwing's topic in PHP Installation and Configuration
Have you set up the extension_dir directive in the php.ini to point to your php extension folder too? Also make sure php is reading the php.ini you are modifying. To check this create a script call this info.info and add the following code to it: <?php phpinfo(); ?> Run info.php from your site and make sure the Loaded Configuration File line reads the correct path to where your php.ini is located to. If its not finding your php.ini then you'll need to correct this first in order for PHP to load the mysql extension. -
mysql functions and internal server error
wildteen88 replied to lilwing's topic in PHP Installation and Configuration
Check your servers error logs. This is where the true error message for why the Internal Server Error message occurs You may be getting the error because your may not have enabled the MySQL extension for PHP yet? -
That's because you have to use the e regex modifier (at the end of your regex pattern): Aslo make sure you parse your code bbcodes before any other bbcodes.
-
Is the code you posted above placed in a function which has the same name as your class? eg: class class_name { // NOTE: the following is for PHP4 ONLY // a constructor is function which has the same name as the class function class_name() { // add any code here that you want to run whenever the class is initiated } // NOTE: If you are using PHP5 then use the following instead: function __construct() { // add any code here that you want to run whenever the class is initiated } } I would recommend you to read the manual to get yourself familiar with the OOP syntax. PHP5 OOP (Advanced) PHP4 OOP (Basic)
-
Preventing Access to Directory Path From Client Browsers
wildteen88 replied to parka's topic in Apache HTTP Server
Place a .htaccess file in your inc directory and use the following: order allow,deny deny from all This will prevent anyone from accessing yoursite.com/inc or yoursite.com/inc/somefile.php This will not stop your PHP scripts from working. PHP does not use Apache when including files via include/require. PHP will use the filesystem defined by the operating system. -
If you have installed WAMP then use the following details Host name: localhost Port number: 3306 User name: root The root user does not have a password defined by default so leave it empty. As for creating the database first this should not be necessary you should be able to do this via mysql_phpgenerater. You can easily create a database using phpmyadmin (Left click the WAMP taskbar icon and select phpMyAdmin from the menu) too.
-
Really! You've already set one up in your MySQLDB class!
-
You'll have to use $database->query() to call the query method in your MySQLDB class. In order to call the query method inside another classes method you can use MySQLDB::query() Alternatively you could just create a constructor in your Process class which connects to mysql automatically.
-
im using WAMP2.0...but having problems!!
wildteen88 replied to darkmonk's topic in PHP Installation and Configuration
I'd post your problems over at wampserver.com you'll get more response there. -
Installing Curl on Windows PHP 5.2.4
wildteen88 replied to bendurber's topic in PHP Installation and Configuration
php_curl.dll requires two external libraries which are libeay32.dll and ssleay32.dll. These two file should be present in the root of your PHP installation folder. If your PHP folder is added to the PATH correctly then the curl extension should load without any problems. Also ensure your have setup the extension_dir directive to point to your PHP extension folder, eg extension_dir="C:/php/ext" -
i want to work on PHP but my apache not working
wildteen88 replied to aman_batra's topic in Apache HTTP Server
What code have you used in test.php? What do you mean by "nothing flashes" PHP runs server side so you must invoke the webserver (Apache) in order for your php scripts to be parsed. There is no alternative way of executing a PHP script (unless you want to use the command line which will return the raw text). -
Yes use a new rewrite rule for your condition: RewriteRule ^hub$ ?open=hub [L] Also I do not suggested the use of (.+) as it is greedy. If all you want to do is match numbers then use ([0-9]+) for letters use ([a-zA-z]+) etc.