Jump to content

TripRev

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Everything posted by TripRev

  1. Thanks teynon and xyph, using mysql_fetch_assoc to put the results into an array before using them solved the problem.
  2. OK, here's more code. <?php include('funcs.php'); include('dbconnect.php'); session_start(); setDef($userMsg); setDef($_GET['userMsg']); setDef($_GET['listNum']); setDef($_SESSION['uid']); setDef($_SESSION['viewhash']); setDef($_SESSION['edithash']); $selectList = mysql_query('SELECT * FROM the_table WHERE id = '.$_GET['listNum'],$con); if( mysql_num_rows($selectList) ==1 ){ $userCanView = false; $userCanEdit = false; $editPassSet = false; if( mysql_result($selectList,0,'viewhash') == 'anyone' ){ // for some reason, this line is setting the resultset $selectList to be blank $userCanView = true; } if( $_SESSION['viewhash'] == mysql_result($selectList,0,'viewhash')){ $userCanView = true; } if( $_SESSION['edithash'] == mysql_result($selectList,0,'edithash') ){ $userCanView = true; $userCanEdit = true; } if( $_SESSION['uid'] == mysql_result($selectList,0,'owner') ){ $userCanView = true; $userCanEdit = true; } if( mysql_result($selectList,0,'edithash') != 'no' ){ $editPassSet = true; }elseif(mysql_result($selectList,0,'edithash') == $_SESSION['edithash']){ $userCanEdit = true; } // load the list's items $selectItems = mysql_query('SELECT * FROM the_table WHERE list_id = '.$_GET['listNum'].' AND status = "live" ORDER BY pos ASC, added DESC',$con); }else{ $userMsg = '<p class="msgError">That list does not exist. </p>'; header('Location:user.php?userMsg='.urlencode($userMsg)); } // redirect user to passreq.php if list requires a view password if( mysql_result($selectList,0,'owner') != $_SESSION['uid'] ){ $listViewhash = mysql_result($selectList,0,'viewhash'); if( ($listViewhash != 'no') && ($listViewhash != 'anyone') && ($listViewhash != $_SESSION['viewhash']) ){ header('Location:'.$siteURL.'/passreq.php?l='.$_GET['listNum'].'&type=view'); } // redirect to login page if user does not have view permission at least }elseif( !$userCanView ){ $userMsg = '<p class="msgError">You do not have permission to view that list. </p>'; header('Location:'.$siteURL.'/user.php?userMsg='.urlencode($userMsg)); } ?> Dumping out $selectList before and after the second IF shows that it's happening there. Driving me nuts!
  3. It's the resource, resulting from this: $selectList = mysql_query('SELECT * FROM the_table WHERE id = '.$_GET['listNum'],$con);
  4. Ok, this really takes the biscuit. I've been trying to debug this for hours and can't find the problem. Basically I have the result of a MySQL query stored in the var $selectList and before this code, the resultset has results in it. if( mysql_result($selectList,0,'viewhash') == 'anyone' ){ $userCanView = true; } but after, the fields have all become [empty string]. The fieldnames are intact, just the values have been set to [empty string] by the above code somehow. I've attached a screenshot of the var $selectList dumped out before and after this code. That is all that's between the 2 dumps. Serious driving me insane. Any suggestions much appreciated. Thanks. [attachment deleted by admin]
  5. Hi all, I'm looking to buy some hosting to transfer some domains to and manage sites on. Every time I think I've made a decision, I read a horror story that puts me off. I'm not ready for dedicated hosting yet but was wondering your opinions on the best deals on shared Linux hosting. I'm in the UK so would prefer a UK-based host but it is not essential. I do however need to be able to transfer .co.uk domains to them... I just purchased a month with GoDaddy and then discovered they don't accept .uk domains so I will be cancelling and trying to get a refund Main things I want are the ability to manage multiple sites/domains with the same hosting package, some mySQL databases and reliable performance for under the £10 ($15) per month mark. There are so many conflicting reviews out there, it's a minefield. I've been using a host called streamline.net for a long time and their performance and service support is terrible. Can't wait to get away from them. Thanks to anyone who can make any suggestions. T
  6. Hi all, thanks in advance for any advice anyone can give. I'm going to build a picture-rating site which will allow users to join, submit their own pictures and rate other people's pics. All submitted pics will be tagged, categorised and there will also be RSS feeds for newly submitted, top rated etc. So I need to start with a CMS like Drupal or Joomla with Gallery plugin, right? Well, I've looked at some CMS' and they all seem to: A) Look terrible/cluttered, and B) are far too complex for what I want the site to do. As I'm primarily a front-end developer, something about customised CMS' designs always just makes me cringe - they all seem to look the same and I will want to have pernickety control over all the small interface details. Also the site doesn't need a lot of the functionality that large CMS' offer. Users just need to be able to browse, join, submit pics and rate pics. So, I was thinking about using a PHP framework (CakePHP has cought my eye) and building it from scratch. Can anyone confirm that this is a viable option rather than use a CMS or am I insane? I've done a few basic PHP/MySQL sites before and have been looking for an excuse to learn about a PHP framework. This is a personal project (not for a client) so would be a good opportunity to take the time to learn a framework. Or maybe the more experienced developers among you can tell from the way I'm writing that I should stick to using a CMS? Cheers T
  7. Hi all, thanks in advance for any advice anyone can give. I'm going to build a picture-rating site which will allow users to join, submit their own pictures and rate other people's pics. All submitted pics will be tagged, categorised and there will also be RSS feeds for newly submitted, top rated etc. So I need to start with a CMS like Drupal or Joomla with Gallery plugin, right? Well, I've looked at some CMS' and they all seem to: A) Look terrible/cluttered, and B) are far too complex for what I want the site to do. As I'm primarily a front-end developer, something about customised CMS' designs always just makes me cringe - they all seem to look the same and I will want to have pernickety control over all the small interface details. Also the site doesn't need a lot of the functionality that large CMS' offer. Users just need to be able to browse, join, submit pics and rate pics. So, I was thinking about using a PHP framework (CakePHP has cought my eye) and building it from scratch. Can anyone confirm that this is a viable option rather than use a CMS or am I insane? I've done a few basic PHP/MySQL sites before and have been looking for an excuse to learn about a PHP framework. This is a personal project (not for a client) so would be a good opportunity to take the time to learn a framework. Or maybe the more experienced developers among you can tell from the way I'm writing that I should stick to using a CMS? Cheers T
×
×
  • 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.