adamlacombe Posted July 10, 2009 Share Posted July 10, 2009 yeah that can be pretty annoying that session_start(); try doing a switch so your index file will look something like: <? include "includes/db.php"; session_start(); switch($_GET['action']){ case 'login': include ('pages/login.php'); break; case 'logout': include ('pages/logout.php'); break; case 'register': include ('pages/register.php'); break; case 'profile': include ('pages/profile.php'); break; case 'profilecp': include ('pages/profilecp.php'); break; case 'messages': include ('pages/messages.php'); break; case 'members': include ('pages/members.php'); break; default: include ('pages/main.php'); break; } ?> much easier I find, I have spent hours once trying to figure out why my query wouldnt work lol and if everything if fixed "topic solved" on the left bottom, click it. oh and also, if you want to switch hosting company's.. I find freehostia works wonders, check em out. Link to comment https://forums.phpfreaks.com/topic/164813-pm-system/page/2/#findComment-873029 Share on other sites More sharing options...
Cetanu Posted July 10, 2009 Author Share Posted July 10, 2009 I don't think switching hosts would be good, since I've already advertised the Freezoka site all over. What does the switch do?!! It looks so strange. Not solved yet; I still need to test the code after I unblock the site...somehow... Link to comment https://forums.phpfreaks.com/topic/164813-pm-system/page/2/#findComment-873037 Share on other sites More sharing options...
adamlacombe Posted July 10, 2009 Share Posted July 10, 2009 for example: http://blah.com/index.php?action=messages the switch will make it so basically you dont have to include your db.php file, session_start();, header, footer etc.. in every single file you have. a little bit easier and less coding in your files. Link to comment https://forums.phpfreaks.com/topic/164813-pm-system/page/2/#findComment-873039 Share on other sites More sharing options...
Cetanu Posted July 10, 2009 Author Share Posted July 10, 2009 I'll look into that. Thanks. Link to comment https://forums.phpfreaks.com/topic/164813-pm-system/page/2/#findComment-873064 Share on other sites More sharing options...
Cetanu Posted July 10, 2009 Author Share Posted July 10, 2009 Hehe, it works, but guess what: the messages don't get deleted! XD Link to comment https://forums.phpfreaks.com/topic/164813-pm-system/page/2/#findComment-873134 Share on other sites More sharing options...
adamlacombe Posted July 10, 2009 Share Posted July 10, 2009 great... lol. umm.... what does your code look like? and u have the switch working? Link to comment https://forums.phpfreaks.com/topic/164813-pm-system/page/2/#findComment-873155 Share on other sites More sharing options...
Cetanu Posted July 10, 2009 Author Share Posted July 10, 2009 No switch. I didn't know I need it. But this is what it looks like: <?php include "db.php"; session_start(); $id=$_GET['id']; mysql_query("DELETE FROM messages WHERE `ID`='$id' AND `to`='{$_SESSION['username']}'"); header('Location: http://mythscape.freezoka.com/pmindex.php'); ?> Link to comment https://forums.phpfreaks.com/topic/164813-pm-system/page/2/#findComment-873156 Share on other sites More sharing options...
adamlacombe Posted July 10, 2009 Share Posted July 10, 2009 look at ur database and make sure sure that id is ID in capitals, if its not in caps then u need to switch the query to: mysql_query("DELETE FROM messages WHERE `id`='$id' AND `to`='{$_SESSION['username']}'"); that may be the prob. Link to comment https://forums.phpfreaks.com/topic/164813-pm-system/page/2/#findComment-873158 Share on other sites More sharing options...
Cetanu Posted July 10, 2009 Author Share Posted July 10, 2009 Changed it. No luck. Could it be that there is no switch? Link to comment https://forums.phpfreaks.com/topic/164813-pm-system/page/2/#findComment-873159 Share on other sites More sharing options...
adamlacombe Posted July 10, 2009 Share Posted July 10, 2009 no thats isnt that prob... umm let me think. Link to comment https://forums.phpfreaks.com/topic/164813-pm-system/page/2/#findComment-873162 Share on other sites More sharing options...
adamlacombe Posted July 10, 2009 Share Posted July 10, 2009 is db.php the file that has your mysql_connect()? and what is a link that you're using to delete? something like http://blah.com/deletepm.php?id=5 ? Link to comment https://forums.phpfreaks.com/topic/164813-pm-system/page/2/#findComment-873165 Share on other sites More sharing options...
Cetanu Posted July 10, 2009 Author Share Posted July 10, 2009 Yes. Link to comment https://forums.phpfreaks.com/topic/164813-pm-system/page/2/#findComment-873169 Share on other sites More sharing options...
adamlacombe Posted July 10, 2009 Share Posted July 10, 2009 you said you couldnt change to_userid to "to" yet, right? well if so then your query should be: mysql_query("DELETE FROM messages WHERE `ID`='$id' AND `to_userid`='{$_SESSION['username']}'"); is that the prob? Link to comment https://forums.phpfreaks.com/topic/164813-pm-system/page/2/#findComment-873170 Share on other sites More sharing options...
Cetanu Posted July 10, 2009 Author Share Posted July 10, 2009 LtfOL, no I did that. Link to comment https://forums.phpfreaks.com/topic/164813-pm-system/page/2/#findComment-873172 Share on other sites More sharing options...
Cetanu Posted July 10, 2009 Author Share Posted July 10, 2009 db.php <?php //db_connect.php $con = mysql_connect("-----","------","------") or die(mysql_error()); $db = mysql_select_db("zoka_3628910_users",$con) or die('Error: '.mysql_error()); function protect($string) { $string = mysql_real_escape_string($string); return $string; }?> Link to comment https://forums.phpfreaks.com/topic/164813-pm-system/page/2/#findComment-873175 Share on other sites More sharing options...
adamlacombe Posted July 10, 2009 Share Posted July 10, 2009 You're using the same login system as me try this: $con = mysql_connect("-----","------","------") or die(mysql_error()); $db = mysql_select_db("zoka_3628910_users",$con); I dont think it has to do with the db but... Im very confused.. I dont see what could be causing it to not delete them. Link to comment https://forums.phpfreaks.com/topic/164813-pm-system/page/2/#findComment-873186 Share on other sites More sharing options...
Cetanu Posted July 10, 2009 Author Share Posted July 10, 2009 Me neither. That didn't work. :-\ How do you know I'm using the same login?! Link to comment https://forums.phpfreaks.com/topic/164813-pm-system/page/2/#findComment-873190 Share on other sites More sharing options...
adamlacombe Posted July 10, 2009 Share Posted July 10, 2009 I checked out ur site and the register page looked the same and in the about section it has tell us about yourself.. and also your db.php has db_connect.php on the top (original file name) lastly the protect function. http://bhaviksblog.com/02/php-login-system-tutorial-part-3/ am I correct? Link to comment https://forums.phpfreaks.com/topic/164813-pm-system/page/2/#findComment-873193 Share on other sites More sharing options...
Cetanu Posted July 10, 2009 Author Share Posted July 10, 2009 Cha, but I changed it to accommodate my members. The profiles have more fields and stuff. Any luck with this problem? Link to comment https://forums.phpfreaks.com/topic/164813-pm-system/page/2/#findComment-873196 Share on other sites More sharing options...
adamlacombe Posted July 10, 2009 Share Posted July 10, 2009 not really... Ill tell ya what, i will PM you my whole messaging file, it has everything all in one file. Link to comment https://forums.phpfreaks.com/topic/164813-pm-system/page/2/#findComment-873200 Share on other sites More sharing options...
Cetanu Posted July 10, 2009 Author Share Posted July 10, 2009 Sounds good. Thanks. Link to comment https://forums.phpfreaks.com/topic/164813-pm-system/page/2/#findComment-873202 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.