OxyNews is a small news management system for PHP/MySQL which you can use on websites to display little snippets of news you want to post, or even use it as a weblog system. The system uses two files to view the news: a onfig file which holds the MySQL table information and holds it as variables for use in other scripts (for instance, "$phpUserLogin_mysql_table" is the table for the registered users, "$oxynews_rows["id"]" is the id of the user who posted news, etc).
I wanted to put a little hack in the OxyNews script so that people who posted news on my site would be able to have the option of having a user profile if they wanted. I've added extra columns in the "users" MySQL table for their bio, where they live etc. I have also added a column (called profiles) which has a variable of either 1 or 0 (set in the form used to register additional users) so that if it is set at 0, then the user doesnt want to have a profile, and if it is 1 they do. The hack I used in the oxynews_view.php file to show whether they have a profile or not is as follows:
$oxynews_profile_sql = "SELECT * FROM $phpUserLogin_mysql_table WHERE id=".$oxynews_news_rows["id"]."";
$oxynews_profile_result = mysql_query($oxynews_profile_sql);
$oxynews_profile_result = mysql_fecth_array($oxynews_profile_result);
if($oxynews_profile_result[0] = "0") {
$oxynews_news = ereg_replace('<profile>', "<img src=".$oxynews_root."images/login_card_none.gif alt=No&amp;nbsp;Profile&amp;nbsp;for&amp;nbsp;".$oxynews_news_rows["author"].">", $oxynews_news);
}
else {
$oxynews_news = ereg_replace('<profile>', "<a href=./profiles.php?".$oxynews_profile_result."><img src=".$oxynews_root."images/login_card.gif alt=".$oxynews_news_rows["author"]."&amp;acute;s&amp;nbsp;Profile border=0></a>", $oxynews_news);
}
The problem is, I have added a couple of users and pasted news with each of them, and even when I have set some of the users "profile" variable to 0, it still shows that the user has a profile 😕 I was wondering if anyone could help me, cause I am losing my hair over it :mad: