PDA

View Full Version : does anybody know of any series email programs?


nanny
09-27-2007, 12:31 AM
I am looking at having subscribers have emails sent to them as part of a series for a mini course
I have seen a few on the web but not sure if they work. There is the health-tip-buddy that I downloaded but it has this:

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\webserver\www\biz\functions\functions_general.p hp on line 104

Warning: Cannot modify header information - headers already sent by (output started at C:\webserver\www\biz\functions\functions_general.p hp:104) in C:\webserver\www\biz\admin-home.php on line 8


This is line 104 of functions_general.php:

if (mysql_num_rows($result) > 0) {


This is line 8 of admin-home:

header('Location:admin-login.php');


Should it have header("Location: admin-login.php");

The functions used for the first error is this:


function checkLogin($username,$password) {
$result = mysql_query('
SELECT *
FROM exercise_tip_buddy_users
WHERE user_username = "' . $username . '" and
user_password = "' . $password . '"');
if (mysql_num_rows($result) > 0) {
return true;
} else {
return false;
}
}

function checkAdminLogin($username,$password) {
$result = mysql_query('
SELECT *
FROM health_tip_buddy_administrators
WHERE administrators_username = "' . $username . '" and
administrators_pass = "' . $password . '"');
if (mysql_num_rows($result) > 0) {
return true;
} else {
return false;
}
}


I can't see what is at fault here, what am I missing?

domedia
09-27-2007, 12:37 PM
Hi Nanny, did you ask the developer of this script about this error?

nanny
09-27-2007, 11:18 PM
Thanks Domedia I haven't but I shall. I haven't had success in return support for scripts previously.

davidj
09-28-2007, 08:09 PM
where you have this...


mysql_num_rows($result)

try this


@mysql_num_rows($result)


the first error is a warning and by adding an @ you can suppress it
the second error is also a warning but is a symptom of the first

nanny
10-11-2007, 08:07 AM
Hi sorry been away at the beach on a holiday.
I tried to contact the owner of the script but it bounced back.
I also tried applying the @ davidj but now it won't let me login, it breaks the session. Do you think that I change something elsewhere first or just give up???

Thanks for your help. I really like the aspects of this script sending out a series of emails to subscribers using a cron, would be a great advantage.

davidj
10-11-2007, 08:19 AM
dont know who wrote this for you but its a strange one...


function checkLogin($username,$password) {
$result = mysql_query('
SELECT *
FROM exercise_tip_buddy_users
WHERE user_username = "' . $username . '" and
user_password = "' . $password . '"');
if (mysql_num_rows($result) > 0) {
return true;
} else {
return false;
}
}

function checkAdminLogin($username,$password) {
$result = mysql_query('
SELECT *
FROM health_tip_buddy_administrators
WHERE administrators_username = "' . $username . '" and
administrators_pass = "' . $password . '"');
if (mysql_num_rows($result) > 0) {
return true;
} else {
return false;
}
}


you have 2 queries checking user and admin in 2 tables... Why?
just use a generic table and identify admins by adding a user_level column to the table.

1 = user
2 = admin

also its best to use an underscore where you have admin-login.php in your naming convension.

also i cant see where you have your mysql_select_db

you have this SQL...


SELECT *
FROM exercise_tip_buddy_users
WHERE user_username = "' . $username . '" and
user_password = "' . $password . '"'


You dont need to concat vars within double quotes as php will recognise them and parse them.

This is valid...


SELECT * FROM exercise_tip_buddy_users WHERE
user_username = ' $username ' and user_password = ' $password '


Or you could use an sprintf...


$query = sprintf("
SELECT * FROM exercise_tip_buddy_users WHERE
user_username = ' %s ' and user_password = ' %s '",$username ,$password);