wildteen88
Staff Alumni-
Posts
10,480 -
Joined
-
Last visited
Never
Everything posted by wildteen88
-
If its on your own computer, you dont need to use FTP! Just copy the files to the htdocs folder or whatever folder Apache is setup to use to server the files to the intranet/internet.
-
Set up to test sending emails from PHP on local PC
wildteen88 replied to griffon's topic in PHP Coding Help
mail doesnt support any authentication in order to login to sign in to an SMTP server to send an email, so doing username:[email protected] will not work or any other method. The SMTP address can only be smtp.hostname.com or IP based. In order for mail to work the SMTP server will need to be open to the public, as in no username/password set in order to send an email. -
You are using exit within your if/else statment. So when PHP first loops through the foreach loop your code will stop. Remove the exit; keywords and you're code and should give you the following result: [code]word is okword is okword is okword is oksorry but that word is band[/code]
-
Yeah if its not returning any errors, then it successfully connect to the MySQL server.
-
Try this: [code=php:0]<?php include("config.php"); if (!isset($logged['username'])) { if (!isset($_POST['login'])) { echo <<<HTML <center> <form method="post"> username: <input type="text" name="username" style="border: 1px solid adc3ce; font-family: tahoma; font-size: 8pt; color= black; background-color: transparent"> password: <input type="password" name="password" style="border: 1px solid adc3ce; font-family: tahoma; font-size: 8pt; color= black; background-color: transparent"> <input type="submit" value=" login " name="login" style="border: 1px solid adc3ce; font-family: tahoma; font-size: 8pt; color= black; background-color: transparent"> </form> </center> HTML; } elseif (isset($_POST['login'])) { // the form has been submitted. We continue... $username=$_POST['username']; $password = md5($_POST['password']); // the above lines set variables with the submitted information. $info = mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error()); $data = mysql_fetch_array($info); if($data['password'] != $password) { // the password was not the user's password! echo "Incorrect username or password!"; } else { // the password was right! $query = mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error()); $user = mysql_fetch_array($query); // gets the user's information setcookie("id", $user['id'], time()+3600); /* expire in 1 hour */ setcookie("pass", $user['password'], time()+3600, "/~rasmus/", ".bretx-designs.x1topsites.com", 1); // the above lines set 2 cookies. 1 with the user's id and another with his/her password. echo ("Thank You! You will be redirected"); // modify the above line...add in your site url instead of yoursite.com } } } else { // we now display the user controls. echo <<<HTML Welcome {$logged['username']} - <a href="editprofile.php">Edit Profile</a> - <a href="members.php">Member List</a> - <a href="logout.php">Logout</a> HTML; } ?>[/code]
-
Localhost only works in Firefox, and not IE
wildteen88 replied to pixy's topic in PHP Installation and Configuration
Redownload the flash plugin, FF may not have the plugin installed. Also about PHP now working with IE. PHP isnt browser dependant as it runs on the server. So I dont know why its not wokring with IE. -
Try this: [code]$connect = mysql_connect ("localhost", "host", "fakepw") or die ("Unable to connect to the database: " . mysql_error()); [/code] It should now return an erroir message from mysql this time, which should tell you why it is failing.
-
To setup mod_rewrite in windows. You need to open httpd.conf and find: [code]#LoadModule rewrite_module modules/mod_rewrite.so[/code] Now remove the # infront of that line. Save the httpd.conf file and restart Apache, mod_rewrite is now available Now when you want to use mod_rewrite you'll want to create a .htaccess file inside in the folder which you want to perform the rewrite rules, the Following is what you'll need to place inside the .htaccess file: [code]RewriteEngine On[/code] To turn on the rewrite engine, after that you put your rewrite rules etc. To create an .htaccess file in Windows, you'll want to open up Notepad. Then goto File > Save In the filename type in .htaccess. Now underneath the filename box, make sure the file type is set to All Files and not Text File. Now click save.
-
I wasa subscribed to the Freelancing forum. However my subscription didnt remain. You should be able to resubcribe to threads
-
Problem making index.php default page
wildteen88 replied to Eiolon's topic in PHP Installation and Configuration
I think you need to restart ISS in order for the new ISS settings to come available. -
The code should be this: [code=php:0]function smilies($forum) { // defines the emoticons $emoticonarray = array( ":)" => "smile.gif", ":King:" => "king.gif", ":*" => "kiss.gif" ":lol:" => "lol.gif", ":loser:" => "loser.gif", ":money:" => "moneybag.gif" ":muscle:" => "muscle.gif", ":no:" => "no.gif", ":nono:" => "nono.gif" ":offwall:" => "offwall.gif", ":ohboy:" => "ohboy.gif", ":pc:" => "pc.gif" ":please:" => "please.gif", ":rofl:" => "rofl.gif", ":roll:" => "rolleyes.gif" // generates the search and replace arrays foreach($emoticonarray as $emoticon => $img) { $search[] = $emoticon; $replace[] = "<img src="emoticons/" . $img . "" alt="" . $emoticon . "" />"; } // searches the text passed to the function $text = str_ireplace($search, $replace, $text); // return the value return $forum; } function showthread($id, $start) { $query = doquery("SELECT * FROM {{table}} WHERE id='$id' OR parent='$id' ORDER BY id LIMIT $start,100", "forum"); $query2 = doquery("SELECT title FROM {{table}} WHERE id='$id' LIMIT 1", "forum"); $row2 = mysql_fetch_array($query2); $page = "<table width=\"100%\"><tr><td style=\"padding:1px; background-color:black;\"><table width=\"100%\" style=\"margins:0px;\" cellspacing=\"1\" cellpadding=\"3\"><tr><td colspan=\"2\" style=\"background-color:#dddddd;\"><b><a href=\"forum.php\">Forum</a> :: ".$row2["title"]."</b></td></tr>\n"; $count = 1; while ($row = mysql_fetch_array($query)) { if ($count == 1) { $page .= "<tr><td width=\"25%\" style=\"background-color:#ffffff; vertical-align:top;\"><span class=\"small\"><b>".$row["author"]."</b><br /><br />".prettyforumdate($row["postdate"])."</td><td style=\"background-color:#ffffff; vertical-align:top;\">".nl2br(smilies($row["content"]))."</td></tr>\n"; $count = 2; } else { $page .= "<tr><td width=\"25%\" style=\"background-color:#eeeeee; vertical-align:top;\"><span class=\"small\"><b>".$row["author"]."</b><br /><br />".prettyforumdate($row["postdate"])."</td><td style=\"background-color:#eeeeee; vertical-align:top;\">".nl2br(smilies($row["content"]))."</td></tr>\n"; $count = 1; } } $page .= "</table></td></tr></table><br />"; $page .= "<table width=\"100%\"><tr><td><b>Reply To This Thread:</b><br /><form action=\"forum.php?do=reply\" method=\"post\"><input type=\"hidden\" name=\"parent\" value=\"$id\" /><input type=\"hidden\" name=\"title\" value=\"Re: ".$row2["title"]."\" /><textarea name=\"content\" rows=\"7\" cols=\"40\"></textarea><br /><input type=\"submit\" name=\"submit\" value=\"Submit\" /> <input type=\"reset\" name=\"reset\" value=\"Reset\" /></form></td></tr></table>"; display($page, "Forum"); }[/code]
-
Okay. place your smiles function code before this line: [code]function showthread($id, $start) {[/code] Now change this: [code]if ($count == 1) { $page .= "<tr><td width=\"25%\" style=\"background-color:#ffffff; vertical-align:top;\"><span class=\"small\"><b>".$row["author"]."</b><br /><br />".prettyforumdate($row["postdate"])."</td><td style=\"background-color:#ffffff; vertical-align:top;\">".nl2br($row["content"])."</td></tr>\n"; $count = 2; } else { $page .= "<tr><td width=\"25%\" style=\"background-color:#eeeeee; vertical-align:top;\"><span class=\"small\"><b>".$row["author"]."</b><br /><br />".prettyforumdate($row["postdate"])."</td><td style=\"background-color:#eeeeee; vertical-align:top;\">".nl2br($row["content"])."</td></tr>\n"; $count = 1; }[/code] to this: [code]if ($count == 1) { $page .= "<tr><td width=\"25%\" style=\"background-color:#ffffff; vertical-align:top;\"><span class=\"small\"><b>".$row["author"]."</b><br /><br />".prettyforumdate($row["postdate"])."</td><td style=\"background-color:#ffffff; vertical-align:top;\">".nl2br(smilies($row["content"]))."</td></tr>\n"; $count = 2; } else { $page .= "<tr><td width=\"25%\" style=\"background-color:#eeeeee; vertical-align:top;\"><span class=\"small\"><b>".$row["author"]."</b><br /><br />".prettyforumdate($row["postdate"])."</td><td style=\"background-color:#eeeeee; vertical-align:top;\">".nl2br(smilies($row["content"]))."</td></tr>\n"; $count = 1; }[/code] It should now parse any smilie code.
-
You cannot just put $str = smilies($str); anywhere and expect it to work. If you zip your forum code up and provide a link to download it and I'll see if I can see where it'll need to be placed. At the moment I cannot tell where it'll need to placed as I need to see the code in order to know that.
-
I see why it is cheap. It is becuase it is actually OEM software. I think its illegal to sell OEM software on itsown, unless you buy hardware with it. I think thats how the OEM license if based of. I'm not sure though.
-
mysql_real_escape_string includes the htmlentities function so there will be no need to use it again.
-
Do you have a setting called register_globals enabled? You can check this by running this: [code=php:0]<?php phpinfo(); ?>[/code] Scroll down looking for the register_globals setting, check that the two columns to the right are set to Off if it is enabled this your problem as you can use $_SESSION['location'] and $location to access the session data for location.
-
Wherer you put the code I have no idea, as I dont know what your forum code is. So its impossible for me to tell the exact location. This is why I recommend you to contact the developer of the script which might be able to help. Also you dont use this code exactly: [code]$str = smilies($str);[/code] You'll need to change $str to the variable your script uses to hold the forums message.
-
To stop html you should use strip_tags which will remove any html in a string. Yes that'll be better just incase a setting called magic quotes is enabled.
-
Have you installed any mods for your forum? If you have this could well be the problem. If not then make sure you have uploaded the all files correctly. Also for better help I suggest you goto http://www.phpbb.com to get support. They will have a better idea why you are getting this error.
-
Yes much better security wise. Also theres no need to use the htmlenties function with the mysql_real_escape_string. However the layout of code could be better.
-
That cade isnt a function yet as you havent defined it. In order for it be a function you do this: [code]function function_name() { // code for function }[/code] So this is what its supposed to be: [code]function smilies($text) { // defines the emoticons $emoticonarray = array( ":)" => "smile.gif", ":King:" => "king.gif", ":*" => "kiss.gif" ":lol:" => "lol.gif", ":loser:" => "loser.gif", ":money:" => "moneybag.gif" ":muscle:" => "muscle.gif", ":no:" => "no.gif", ":nono:" => "nono.gif" ":offwall:" => "offwall.gif", ":ohboy:" => "ohboy.gif", ":pc:" => "pc.gif" ":please:" => "please.gif", ":rofl:" => "rofl.gif", ":roll:" => "rolleyes.gif" // generates the search and replace arrays foreach($emoticonarray as $emoticon => $img) { $search[] = $emoticon; $replace[] = "<img src="/emoticons/" . $img . "" alt="" . $emoticon . "" />"; } // searches the text passed to the function $text = str_ireplace($search, $replace, $text); // return the value return $text; }[/code]
-
Black would be good, prehaps #333333 which is not pure black but a dark grey/come black color, or very dark green, or prehaps red to add a bit pf contrast to the green header.
-
In order for that code you'll need to create a function for it, call it smilies. Then when you goto use it you use $str = smilies($str); Which will convert any smilie code within the variable $str, $str can be any variable. You'll have to place this code within the file that displays your forum messages. And wrap your smilies function around the variable that holds the message. Prehaps if you ask the developer that created the forum for you may be able to help with that.
-
The codes fine, its becuase of the site is using the incorrect quotes instead of ‘ it is supposed to be ' and the same applies to ” which is supposed to be " I have changed you code above and it should now work. This should now work: [code]<?php // defines the emoticons $emoticonarray = array( ':)' => 'smile.gif', ':King:' => 'king.gif', ':*' => 'kiss.gif', ':lol:' => 'lol.gif', ':loser:' => 'loser.gif', ':money:' => 'moneybag.gif', ':muscle:' => 'muscle.gif', ':no:' => 'no.gif', ':nono:' => 'nono.gif', ':offwall:' => 'offwall.gif', ':ohboy:' => 'ohboy.gif', ':pc:' => 'pc.gif', ':please:' => 'please.gif', ':rofl:' => 'rofl.gif', ':roll:' => 'rolleyes.gif'); // generates the search and replace arrays foreach($emoticonarray as $emoticon => $img) { $search[] = $emoticon; $replace[] = '<img src="/emoticons/' . $img . '" alt="' . $emoticon . '" />'; } // searches the text passed to the function $text = str_ireplace($search, $replace, $text); // return the value return $text; ?>[/code]
-
This [url=http://ryanslife.net/2006/07/12/php-simple-emoticon-support/]site teaces[/url] you how to create a smilie parser.