|
I don't know if it will be any help, but KDevelop is one of the main C/C++ IDE's for Linux.
Heres a screenshot of KDevelop's GUI. Click
|
|
|
|
|
hello , i have been trying to sort this out for hours , and there are probably 2000 other people who have asked this but when i try and send form results to an email adress from the local host which i set up i get this :
Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in C:\Apache2.2\htdocs\websites\test\process.php on line 6
here is my code in php.ini
[mail function]
STMP = localhost
sendmail_from = me@whatever.com
here is my code in the form process.php
<?php
$name = $_REQUEST['name'];
$message = $_REQUEST['msg'];
mail('me@whatever.com', $message,$name);
?>
i have also downloaded a SMTP piece of software to try and overcome the problem but no result yet ... Thnaks for all your help :P
|
|
|
|
|
You need to add a custom header as a fourth parameter to the mail function, to add your From header. Example:
mail('me@whatever.com', $message, $name, 'From: webmaster@example.com' . "\r\n");
Adam Maras | Software Developer
Microsoft Certified Professional Developer
|
|
|
|
|
Thanks that worked perfectly , by any chance do you know how i can fix this error ?
It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting
or the date_default_timezone_set() function. In case you used any of those methods and you are still
getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/London' for '0.0/no DST'
instead in C:\Apache2.2\htdocs\websites\test\process.php on line 6
Thanks again
|
|
|
|
|
You shouldn't rely on the default timezone of the server. It needs to be explicitly set to the required timezone.
Eg:
date_default_timezone_set( 'Europe/London' );
So put that line before line 6, process.php.
If at first you don't succeed, you're not Chuck Norris.
|
|
|
|
|
Thanks !!!
|
|
|
|
|
hi all,
I am having the problem with arrays in php.
I created two single dimensional array contains some data.
Now i want to compare those arrays and print the values i.e., some items which are common to printed in one color and the rest of the items in other.
Thanks in advance.
|
|
|
|
|
if both arrays are the same size...
$arr1 = array(1,2,3,4,5);
$arr2 = array('a',2,'b','c','d');
$cnt = count($arr1);
echo "<table>";
for($i=0;$i<$cnt;$i++)
{
echo "<tr";
if($arr1[$i]==$arr2[$i])
{
echo " class='match_color'>";
}
else
{
echo " class='nomatch_color'>";
}
echo "<td>".arr1[$i]."</td>";
echo "<td>".arr2[$i]."</td>";
echo "</tr>";
}
echo "</table>";
|
|
|
|
|
When is it correct to use quotes inside of array braces? For example, which is proper:
$i = '2';
print $array[$i]; // without quotes
-or-
$i = '2';
print $array["$i"]; // with quotes
Do both work the same? Or is each different in different circumstances.
Thank you.
|
|
|
|
|
David1922 wrote: Do both work the same?
Technically yes, they do work the same, but the second method is very bad practice. It dosen't serve any purpose, it just wastes processing time as the string has to be compiled to check for variables (which happens to all strings surrounded by double quotes ["]), rather than just having the variable put directly in i.e. the first method.
You should only use quotes in array braces if you have an associative key such as $array['key']; .
Or:
$key = 'key';
echo $array[ $key ];
Hope that helps.
If at first you don't succeed, you're not Chuck Norris.
|
|
|
|
|
Hi all,
I am using multiple check boxes in my page which are generated using the loop.
Now the problem is when i select the check boxs i want the values of the selected the boxes in the another page.
How to do it ?
Remember one thing the name or id of the check boxes are same.
Thanks in advance.
|
|
|
|
|
try accessing the checkboxes like an array.
|
|
|
|
|
Hey, I was wondering how I would code, for a "Users Online Today" thingy, like the one used on IPBfree forums, for like a regular site.... well a php site. I recently created a php membership system on my site, using a tutorial. I was wondering if anyone knew how to code for it to search the Member database, to see who logged on in the 24hr period of time...
Also, along with this request... Does anyone know how to possibly use php to make user pages, of which can be edited by the user, much like the the pages from IPBfree forums.. Like being able to edit sections such as, Age, Website, Email, Interests, Location, and About Me...? I was wondering if I would be able to make that possible through PHP... Once a user Registers, their page is made, like "sitename.com/members/'username'.php" so that from every other page it has the option of "Control Panel" and through there, Edit Profile, Edit Email, Edit Password, and stuff, of which I can add at a later date, but when they click on the edit profile link, they can edit said fields. Then with this, allow for a members page, that shows a list of all the members usernames that once clicked takes the viewer to their profile, which shows said information... Please Help me, I haven't been able to find this information on other sites, I also asked in the IPBfree forums as well and they wouldn't give me any information that I could use other than it will most likely need to be used with a MYSql database. Also I have spent over 100 hrs searching for it. But whatever you can do to help, will be appreciated! Thank-You!
|
|
|
|
|
thebiostyle wrote: I was wondering if anyone knew how to code for it to search the Member database, to see who logged on in the 24hr period of time...
How do you save your user data? You didn't tell. I assume you use a MySQL-DB. Everytime a user logs in, you have to save the login-date/time into your DB. To find out who logged in during the last 24 h, you just have to select the login data where time is less then 24 hours away from now.
thebiostyle wrote: I was wondering if I would be able to make that possible through PHP...
Sure, but not with what little knowledge of PHP you seem to have. You are right, you need major help. But you won't find anybody here, who will present the whole project to you. Try to get the basics and continue from there. If you have a specific problem, then ask.
-create a MySQL-database where you store user data
-create a website in which to show the user data (user profile)
-connect to your database and fetch the appropriate user data
-fill your site with that data
-insert a save-button, to allow the user to change his entry
There are hundreds of examples how to do that. But don't just get one of them and copy them to your project. Try to understand, what has to be done to achive your goal, not just copy and paste.
I'd suggest, you get a beginner's book to start.
(I know this is not the answer you expected.)
"I love deadlines. I like the whooshing sound they make as they fly by." (DNA)
|
|
|
|
|
Well, since you've presumably used mySql to store the user details, why not add a field to the database called something like lastLoginTime.
I'd probably fill that field with the Unix time, since it's much easier to compare two integers than 2 strings.
e.g
$curLoginTime = time(); // number of seconds since Jan 1 1970
Make sure you save this data to the user's lastLoginTime mySql entry.
All you have to do then is run a query that retuns all users.
Run the time command again, subtract 24 * 60 * 60 seconds from the result, and that's the number of seconds elapsed from 1 Jan 1970 to 24 hours prior to the current time. If the user's lastLoginTime is an integer higher than this number, you just found someone that logged in in the last 24 hours.
As for the user management panel thing - that's also relatively easy. You just make sure that every piece of info on the screen you wish to edit has a corresponding field in the mysql database.
Though, I will mention a small thing that may otherwise cause frustration: The general form of the url for a user's personal page will be "sitename.com/members/filename.php?user=userName" - The reason for the difference is that you _don't_ want a new php page for each user, you want to create one page that will handle all of them, just pass the actual user as a variable to the statistics/editing page.
I'd just be inclined at this point of the learning-curve to hit google with "free forum php code" then scan the results for an example that does what you want, or uses a method of achieving something else that you can adapt to your own needs.
Failing that - I'd still use somebody else's as a starting block, just try to add new features to their code.
smithers-jones wrote: But you won't find anybody here, who will present the whole project to you
Me included. While I did indulge the previous request - That was a comparatively small one.
Smithers-jones suggests some useful tactics. Understanding code and not just copying it is perhaps the best advice one can give a fellow coder.
Good Luck!
modified on Friday, January 1, 2010 5:31 PM
|
|
|
|
|
Okay you said....................... "As for the user management panel thing - that's also relatively easy. You just make sure that every piece of info on the screen you wish to edit has a corresponding field in the mysql database.
Though, I will mention a small thing that may otherwise cause frustration: The general form of the url for a user's personal page will be "sitename.com/members/filename.php?user=userName" - The reason for the difference is that you _don't_ want a new php page for each user, you want to create one page that will handle all of them, just pass the actual user as a variable to the statistics/editing page."
Okay, how would I code for the page... of which when I use the is online, clicks on the link, "Control Panel" they can go to a page of which shows links to... "Edit Profile", "Change Password", "Change Email", and so on and so fourth.... Where I will add the "Custom, Editable Fields" to the MySQL table of which the user was registered to.... But the editing page, and link page.... how will I be able to create it like you have shown..... "sitename.com/members/'profile'.php?'id'='userID'"... So that when a user logs on, and they access the editable pages, it has that type of link... with the only exception being their id as the ID they recieved upon registration. Thanks.
|
|
|
|
|
I can't promise you'll like this answer, however -
To use an analogy or a metaphor:
When you've learned to run, I'll be happy to teach you how to do the hurdles.
But if you're still getting the hand of walking, the idea of hurdles is somewhat ludicrous...
|
|
|
|
|
Well... Thats okay, I don't think I shall put it on the site right away, but I would've made sure I code finish the coding by myself, and test it until it works, then save the code for when the site has more activity. Thanks though. Also, I was wondering if it was okay to exchange emails through the site, so I could exchange with you, to let you know when I am ready for the help on this topic. Thanks.
|
|
|
|
|
Yup sure.
e n h z f l e p AT y a h o o . c o m . a u
|
|
|
|
|
Okay... I've seemed to have used some common sense in putting this together... Now all I need is some help to finish it. The "memberlist" page shows fine... it's just the "profile" page... Here is the code for the part of the "memberlist" that will be used with the "profile" page... I want to know if I've done it practically right...
<?
$list_members = mysql_query("SELECT * FROM `members` ORDER BY id");
$list = mysql_fetch_array( $list_members );
while($list = mysql_fetch_array( $list_members ))
{
Print '<tr class="alt"><td><b>';
Print "<form action='profile.php' method='GET'>".$list['username']."<input type='hidden' name='username' value='".$list['username']."' /></b></td><td><input type='hidden' name='user' value='".$list['id']."' /><input type='submit' value='Visit' class='submit'/></form></td><td>".$list['country']."</td><td><a href='".$list['www']."'>".$list['www']."</a></td><td>".$list['browser']."</td></tr>";
}
?>
That is what I use to print out the table of members...
And here is the complete php for the "profile.php" page:
<?
include_once"config.php";
$fetch_users_data = mysql_fetch_object(mysql_query("SELECT * FROM `members` WHERE username='".$_GET['username']."'"));
$fetch_users_id = mysql_fetch_object(mysql_query("SELECT * FROM `members` WHERE id='".$_GET['user']."'"));
?>
<html>
<head>
<title>Members - Profile - <? echo "".$fetch_users_data->username.""; ?> ~ Bio-Designs</title>
<style type="text/css">
<!--
a {color: #000000; text-decoration: none;}a:link {color: #000000} a:visited {color: #000000} a:hover {color:#000000; width:7em} body{color: #FF0000} .dockmenu{ text-align: center; height: 50px; position: relative;}a.dockItem { text-align: center; color: #000;font-weight: bold; text-decoration: none; width: 50px; position: absolute; display: block; bottom: 0;}.dockItem img { border: none; margin: 0 auto 5px auto; width: 75%;}.dockItem span { display: none; positon: absolute;}.dockmenuContainer { height: 50px; left: 76px; position: absolute; top: 40px;}font {color: FF0000;}<!--BODY { scrollbar-arrow-color:#000000; scrollbar-track-color:#000000; scrollbar-shadow-color:#000000; scrollbar-face-color:#FF0000; scrollbar-highlight-color:#FF0000; scrollbar-darkshadow-color:#000000; scrollbar-3dlight-color:#FF0000; } table, td, th{border:0px 1px 0px 1px dashed #FF0000;
padding:2px 2px 2px 2px;} tr.alt { background-color: #FF0000; color: #000000; border: 1px dotted red;}
</style>
<link rel="icon" type="image/gif" href="http://i248.photobucket.com/albums/gg195/Bio-Gfx/thebiostylefavicon.gif">
</head>
<body bgcolor="#000000" onload="$_GET['user']">
<br />
<div>
<div style="text-align: center;">
<img src="http://www.thebiostyle.com/biologoblackv1.0.png" /><br /><br />
<div align="center">
<span style="font-size: 24pt; color: rgb(255, 0, 0);"><u><b>Profile</b></u></span><br /><br />
<table cellspacing="4" cellpadding="4" style=" border:1px dotted red;">
<tr class="alt" style=" border:1px dashed red;">
<td><span style="font-size: 14pt; color: rgb(0, 0, 0);"><center><b><u>Username</u></b></center></span></td>
<td><span style="font-size: 14pt; color: rgb(0, 0, 0);"><center><b><u>Country</u></b></center></span></td>
<td><span style="font-size: 14pt; color: rgb(0, 0, 0);"><center><b><u>WWW</u></b></center></span></td>
<td><span style="font-size: 14pt; color: rgb(0, 0, 0);"><center><b><u>Browser</u></b></center></span></td></tr>
<?
$list_memberinfo = mysql_query("SELECT * FROM `members` WHERE id='".$_GET['user']."'");
$list = mysql_fetch_array( $list_memberinfo );
while($list = mysql_fetch_array( $list_memberinfo ))
{
Print '<tr class="alt"><td><b>';
Print "".$list['username']."</b></td><td>".$list['country']."</td><td><a href='".$list['www']."'>".$list['www']."</a></td><td>".$list['browser']."</td></tr><tr><td><span style="font-size: 14pt; color: rgb(0, 0, 0);"><left><b><u>About</u></b></left></span></td></tr><tr><td>".$list['about']."</td></tr>";
}
?>
</div>
</table>
<br /><br />
<span style="color: rgb(255, 0, 0);">| 2009-<script type="text/javascript">
var d = new Date();
document.write(d.getFullYear());
</script> Bio-Designs |</span><br style="color: rgb(255, 0, 0);" />
<br />
</body>
</html>
It says this when I try to run the page... "
Parse error: syntax error, unexpected T_STRING in profile.php on line 42
"
Should the form method have been "POST"...? Please fix my errors for me... Thanks I tried my best.
|
|
|
|
|
The error message is about the <span style="font-size: 14pt; color: rgb(0, 0, 0);"> bit on line 42 - since it is inside a double-quoted string, the double-quotes have to be escaped with backslashes:
<span style=\"font-size: 14pt; color: rgb(0, 0, 0);\">
This kind of thing is dangerous though:
$list_memberinfo = mysql_query("SELECT * FROM `members` WHERE id='".$_GET['user']."'");
I suggest you Google for "SQL injection".
|
|
|
|
|
Well... Thanks on the first one, but the second one is supposed to be used with the "memberlist" page, to where when they click "visit" it will link them to the profile page of which will take the hidden input of the ".list[id]." which is the id number of the user they chose to visit, as the "'".$_GET['user']."'" so that on the profile page it will automatically "get the id" and print out only the information for that id. So the url will in turn turn out to be like this.....
"profile.php?user=IDOFUSERTHEYCHOSETOVISIT" I need some help with that part of it... I don't know if where I put all the GETs if they should be POSTs... or any other implementation that would help me to get this to work. Thanks.
EDIT: I also added the backslashes to all the "spans" and it now loads the page... but it doesn't print any of the information out... Please help... I would like the finished profile page to look like...
This is what it does read... so I'm not that far into a hole I think...
profile.php?username=USERNAMEOFCHOSENMEMBER&user=IDOFCHOSENMEMBER
"profile.php?user=IDOFUSERTHEYCHOSETOVISIT"
modified on Saturday, January 23, 2010 10:40 AM
|
|
|
|
|
It's not printing anything because of this:
$list_memberinfo = mysql_query("SELECT * FROM `members` WHERE id='".$_GET['user']."'");
$list = mysql_fetch_array( $list_memberinfo );
while($list = mysql_fetch_array( $list_memberinfo ))
Presumably the id is unique, so the first (and only) record is retrieved with the first call to mysql_fetch_array , then it gets called again for the while loop where the value you got first in $list is thrown away. Then the while condition will fail, because you've already got the one record out.
Try changing it to this:
$list_memberinfo = mysql_query("SELECT * FROM `members` WHERE id='".$_GET['user']."'");
while($list = mysql_fetch_array( $list_memberinfo ))
- or you could remove the "while" line instead, maybe replacing it with
if(!empty($list))
As for $_POST and $_GET - GET is the one you want for this. In the GET method, the parameters are passed in as part of the URI. In the POST method, the parameters are passed in the body of the request, and you would need to use a form to do that in HTML. Or you could use $_REQUEST instead, which contains everything from POST and GET, and the cookies too.
|
|
|
|
|
Okay thanks... I guess the first part was just a stupid mistake... even though it worked in the "memberlist" file..... But thanks, it now works. The "Edit Profile" page should include... Such like:
mysql_query("UPDATE `DBNAME`.`TABLE` SET VARIABLE = '$_POST[VARIABLE]'
WHERE username = '$SINGEDINUSERNAME' AND password = '$DIGNEDINUSER'SPASSWORD'");
I believe, and then it would be edited to where the user can edit multiple profile fields of which would be displayed on their profile!! Thanks so much for your help.
Also, how would I be able to make the "Profile" page not include the "username=" in the url...
Also, I tried adding more profile fields to make it seem as though there was 4 tables, when there is actually 1... I tried making it print it all out, now I need help to get it fixed...
here is the code:
<?
include_once"config.php";
$fetch_users_data = mysql_fetch_object(mysql_query("SELECT * FROM `members` WHERE username='".$_REQUEST['username']."'"));
$fetch_users_id = mysql_fetch_object(mysql_query("SELECT * FROM `members` WHERE id='".$_GET['user']."'"));
?>
<html>
<head>
<title>Members - Profile - <? echo "".$fetch_users_data->username.""; ?> ~ Bio-Designs</title>
<style type="text/css">
<!--
a {color: #000000; text-decoration: none;}a:link {color: #000000} a:visited {color: #000000} a:hover {color:#000000; width:7em} body{color: #FF0000} .dockmenu{ text-align: center; height: 50px; position: relative;}a.dockItem { text-align: center; color: #000;font-weight: bold; text-decoration: none; width: 50px; position: absolute; display: block; bottom: 0;}.dockItem img { border: none; margin: 0 auto 5px auto; width: 75%;}.dockItem span { display: none; positon: absolute;}.dockmenuContainer { height: 50px; left: 76px; position: absolute; top: 40px;}font {color: FF0000;}<!--BODY { scrollbar-arrow-color:#000000; scrollbar-track-color:#000000; scrollbar-shadow-color:#000000; scrollbar-face-color:#FF0000; scrollbar-highlight-color:#FF0000; scrollbar-darkshadow-color:#000000; scrollbar-3dlight-color:#FF0000; } table, td, th{border:0px 1px 0px 1px dashed #FF0000; padding:2px 2px 2px 2px;} td.alt {font-size:14pt; color: #000000;} tr.alt { background-color: #FF0000; color: #000000; border: 1px dotted red;}
</style>
<link rel="icon" type="image/gif" href="http://i248.photobucket.com/albums/gg195/Bio-Gfx/thebiostylefavicon.gif">
</head>
<body bgcolor="#000000" onload="$_GET['user']">
<br />
<div>
<div style="text-align: center;">
<img src="http://www.thebiostyle.com/biologoblackv1.0.png" /><br /><br />
<div align="center">
<span style=\"font-size: 24pt; color: rgb(255, 0, 0);\"><font size=\"20pt\" color=\"#FF0000\"><u><b>Profile</b></u></font></span><br /><br />
<table cellspacing="4" cellpadding="4" style=" border:1px dotted red;">
<?
$list_memberinfo = mysql_query("SELECT * FROM `members` WHERE id='".$_GET['user']."'");
while($list = mysql_fetch_array( $list_memberinfo ))
{
Print '<tr class="alt"><td class="alt"><span style=\"font-size: 14pt; color: rgb(0, 0, 0);\"><center><b><u>Username</u></b></center></span></td><td><b>';
Print "".$list['username']."</b></td><td bgcolor=\"#000000\" colspan=\"2\"></td><td class=\"alt\"><td class="alt"><span style=\"font-size: 14pt; color: rgb(0, 0, 0);\"><center><b><u>Email</u></b></center></span></td><td><a href='mailto:".$list['email']."'>Send Message</a></td></tr><tr class="alt"><td class="alt"><span style=\"font-size: 14pt; color: rgb(0, 0, 0);\"><center><b><u>Member Title</u></b></center></span></td><td><b>
".$list['title']."</b></td><td bgcolor=\"#000000\" colspan=\"2\"></td><td class=\"alt\"><td class="alt"><span style=\"font-size: 14pt; color: rgb(0, 0, 0);\"><center><b><u>Country</u></b></center></span></td><td>".$list['country']."</td></tr><tr class="alt"><td class="alt"><span style=\"font-size: 14pt; color: rgb(0, 0, 0);\"><center><b><u>Company</u></b></center></span></td><td><b>
".$list['company']."</b></td><td bgcolor=\"#000000\" colspan=\"2\"></td><td class=\"alt\"><td class="alt"><span style=\"font-size: 14pt; color: rgb(0, 0, 0);\"><center><b><u>Website</u></b></center></span></td><td>".$list['www']."</td></tr><tr class="alt"><td class="alt"><span style=\"font-size: 14pt; color: rgb(0, 0, 0);\"><center><b><u>Joined On: </u></b></center></span></td><td><b>
".$list['date']."</b></td><td bgcolor=\"#000000\" colspan=\"2\"></td><td class=\"alt\"><td class="alt"><span style=\"font-size: 14pt; color: rgb(0, 0, 0);\"><center><b><u>Browser</u></b></center></span></td><td>".$list['browser']."</td></tr><br /><br /><br /><tr class="alt"><td class="alt"><span style=\"font-size: 14pt; color: rgb(0, 0, 0);\"><center><b><u>About</u></b></center></span></td><td><b>
".$list['about']."</b></td><td bgcolor=\"#000000\" colspan=\"2\"></td><td class=\"alt\"><td class="alt"><span style=\"font-size: 14pt; color: rgb(0, 0, 0);\"><center><b><u>Intrests</u></b></center></span></td><td>".$list['intrests']."</td></tr>";
}
?>
</div>
</table>
<br /><br />
<span style="color: rgb(255, 0, 0);">| 2009-<script type="text/javascript">
var d = new Date();
document.write(d.getFullYear());
</script> Bio-Designs |</span><br style="color: rgb(255, 0, 0);" />
<br />
</body>
</html>
Here is the error message:
"Parse error: syntax error, unexpected T_STRING in profile.php on line 35"
Also, here is a link to an image of what I would like it to look like, so you can get a better image of what I was going for...
http://i248.photobucket.com/albums/gg195/Bio-Gfx/profilelayout.png
That should give you everything that I want to be displayed on the profile page... THANKS!!
|
|
|
|
|
thebiostyle wrote:
Print "".$list['username']."</b></td><td bgcolor=\"#000000\" colspan=\"2\"></td><td class=\"alt\"><td class="alt"><center><b><u>Email</u></b></center></td><td><a href='mailto:".$list['email']."'>Send Message</a></td></tr><tr class="alt"><td class="alt"><center><b><u>Member Title</u></b></center></td><td><b>
".$list['title']."</b></td><td bgcolor=\"#000000\" colspan=\"2\"></td><td class=\"alt\"><td class="alt"><center><b><u>Country</u></b></center></td><td>".$list['country']."</td></tr><tr class="alt"><td class="alt"><center><b><u>Company</u></b></center></td><td><b>
".$list['company']."</b></td><td bgcolor=\"#000000\" colspan=\"2\"></td><td class=\"alt\"><td class="alt"><center><b><u>Website</u></b></center></td><td>".$list['www']."</td></tr><tr class="alt"><td class="alt"><center><b><u>Joined On: </u></b></center></td><td><b>
".$list['date']."</b></td><td bgcolor=\"#000000\" colspan=\"2\"></td><td class=\"alt\"><td class="alt"><center><b><u>Browser</u></b></center></td><td>".$list['browser']."</td></tr><br /><br /><br /><tr class="alt"><td class="alt"><center><b><u>About</u></b></center></td><td><b>
".$list['about']."</b></td><td bgcolor=\"#000000\" colspan=\"2\"></td><td class=\"alt\"><td class="alt"><center><b><u>Intrests</u></b></center></td><td>".$list['intrests']."</td></tr>";
Graham gave you the solution earlier. You still have unescaped double quotes in your string, <td class="alt"> in particular.
If at first you don't succeed, you're not Chuck Norris.
|
|
|
|
|