[SOLVED]Need some help *large code*
Moderator: General Moderators
[SOLVED]Need some help *large code*
the last switches( act=del and act=edit) arent working properly, they dont show anything
http://users.skynet.be/fa321669/cnhelp.txt
http://users.skynet.be/fa321669/cnhelp.txt
Last edited by Diod on Wed Oct 27, 2004 8:26 am, edited 1 time in total.
-
kettle_drum
- DevNet Resident
- Posts: 1150
- Joined: Sun Jul 20, 2003 9:25 pm
- Location: West Yorkshire, England
Hmm. Why not try and seperate your code into more functions and then simply have one switch that controls which function will be called. The codes a bit messy at the moment, but im sure that i see you declairing a function in the middle of a switch statment, and then also using a switch with only one option - you can simply use an if statment there instead.
Its hard to say without indenting the code, but you might have placed the code you expect to run in a segment that isnt run as the conditions arent right.
Its hard to say without indenting the code, but you might have placed the code you expect to run in a segment that isnt run as the conditions arent right.
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
sry, cant post it, 500 error message, even with edit
try looking http://codedump.nutextonline.com/view/412
try looking http://codedump.nutextonline.com/view/412
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
I dont have time to look through the code right now but I noticed you mispelled mysl_error at one point, also I recommend removing all the @ because they silence the errors.
To debug your script trying echoing things to see if the script reaches a certain point, for example,
($auth->logged_in) {
echo 'it got here';
switch (@$_GET['action']) {
This will isolate the problem, it looks like $auth_logged_in is returning FALSE, therfor the switch never goes run. Also, try putting in a default to see if it is being run
To debug your script trying echoing things to see if the script reaches a certain point, for example,
($auth->logged_in) {
echo 'it got here';
switch (@$_GET['action']) {
This will isolate the problem, it looks like $auth_logged_in is returning FALSE, therfor the switch never goes run. Also, try putting in a default to see if it is being run
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Code: Select all
$result = mysql_query($query,$db) or die("<b>A fatal MySQL error occured</b>.\n<br />Query: " .$query. "<br />\nError: (" .mysql_errno(). ") " .
mysql_error());mysql_errno is for the number of the error and mysql_error is just the error itself
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
an excellent KISS scenario. this sort of script shows why i prefer to have one script for each task.
does this mean people can "decide" they want to become an admin?
Sure the .tpl files don't have a call do die() ?
Code: Select all
$admin = (@$_POST['admin'] == 'true' ? true : false);Sure the .tpl files don't have a call do die() ?
-
kettle_drum
- DevNet Resident
- Posts: 1150
- Joined: Sun Jul 20, 2003 9:25 pm
- Location: West Yorkshire, England
Go bored and look through the script.
1) Dont put the br2nl function in the switch.
2) Dont put anything inside of the switches except function calls - so take out all your code from them and put them in functions.
3) You write over the $result var. You put the results in it at the start of the code, and then do a while() on them at about line 140 and then write over that var inside of the loop.
4) Dont keep using echos on each line, you can just use one and put all the text in it:
Just start to clean your code up or you will never find the error.
1) Dont put the br2nl function in the switch.
2) Dont put anything inside of the switches except function calls - so take out all your code from them and put them in functions.
3) You write over the $result var. You put the results in it at the start of the code, and then do a while() on them at about line 140 and then write over that var inside of the loop.
4) Dont keep using echos on each line, you can just use one and put all the text in it:
Code: Select all
echo "
several
lines
of
text
";ok ill do it right now... 
thx
EDIT: i edited it, here is the link http://users.skynet.be/fa321669/cnhelp.txt
thx
EDIT: i edited it, here is the link http://users.skynet.be/fa321669/cnhelp.txt
i edited again...
here is the link to:
index: http://users.skynet.be/fa321669/index.txt
edit_news.tpl: http://users.skynet.be/fa321669/edit_news.txt
delete_news.tpl http://users.skynet.be/fa321669/delete_news.txt
here is the link to:
index: http://users.skynet.be/fa321669/index.txt
edit_news.tpl: http://users.skynet.be/fa321669/edit_news.txt
delete_news.tpl http://users.skynet.be/fa321669/delete_news.txt