Jump to content

duncan_cowan

Members
  • Posts

    109
  • Joined

  • Last visited

Everything posted by duncan_cowan

  1. duncan_cowan

    Mail

    for some reason now in the link in the email it says: why does it say "Resource id #17" instead of their act_num???
  2. duncan_cowan

    Mail

    i have tried this but when i get the email the link doesnt show up!?
  3. duncan_cowan

    Mail

    in the script there is a line with the following code: $rand = mysql_query("SELECT act_num FROM unactivated_users WHERE username = ".$_POST['uname']."") or die("Find act_num Error"); i have managed to get the email to be sent as html but this line isnt working for some reason please could some one help??Thanks in advance!!
  4. duncan_cowan

    Mail

    When I use your idea the error message is : Parse error: syntax error, unexpected T_VARIABLE in /home/i04wasp/public_html/regmail.php on line 13 but when i use my first script the e-mail is sent fine but the message shows the html tags.What can i do to make the message be displayed as html?
  5. duncan_cowan

    Mail

    Please could you tell me what is wrong with this script: <?phprequire("protected/db_connect.php");$rand = mysql_query("SELECT act_num FROM unactivated_users WHERE username=".$_POST['uname']);// Some data for the message$mailTo = $_POST['email'];$mailFrom = "activation@wasper_rocker.co.uk";$mailFromName = "World War 6";$mailSubject = "Account Activation";$mailMessage = "<html><body>".$_POST['uname']."<br />Thank you for registering an account with World War 6.<br /><br />To activate your account please click this address or copy it to your browser:<br /><a href='http:\\www.wasper-rocker.co.uk/activate.php?act_num=$random'title='http:\\www.wasper-rocker.co.uk/activate.php?act_num=$random'></a>.<br /><br />If you have any problems activating your account please reply to <a href='mailto:activation@wasper-rocker.co.uk?subject=Activation Problems'>this email address</a>.</body></html>";$headers = 'MIME-Version: 1.0 . \r\n';$headers .= 'Content-type: text/html; charset=iso-8859-1 . \r\n';$headers .= 'From: $mailFromName <$mailFrom> . \r\n';// Send mailmail($mailTo, $mailSubject, $mailMessage, $headers);?> ??? thanks
  6. i have found out what was wrong with it and fixed it it was because there was a space inbetween army & species: $insert = "INSERT INTO unactivated_users (username,password,regdate,email,location,show_email,last_login,act_num,army species) For some reason this was stopping it from working even though the name of the row in the table had a space in aswell!!
  7. Hi I ran this code to put info from a form into a file but for some reason it just says "DB Error: syntax error" when it is run.CODE: Why does it say this please??
  8. I have already tried that but the script i used from the topic went all wrong! I have tried this but it now says : ???
  9. now it just says: ???
  10. Im Not Understanding!!?also when i run my script it says: ???
  11. that is all the sorce code apart from the file with the database information. All the script is meant to do is show how many users are logged in and how many are on the website and then the total.
  12. duncan_cowan

    SQL update

    i have a script that shows the number of users online and it adds a row to a table with the users ip address, the time, the file from which the table was updated, and whether they are logged in or not. i have edited it so that if their ip address is already one of the rows then it will just update it so that it doesnt add an other row but it just keeps adding an other row!!the script is: <?include "config.php";$t_stamp = time();$timeout = $t_stamp - $to_secs;mysql_connect($server, $db_user, $db_pass) or die ("Useronline Database CONNECT Error");$check = mysql_query("SELECT * FROM CJ_UsersOnline WHERE ip='$REMOTE_ADDR'");$result = mysql_num_rows("$check");if ($result>="1") {mysql_query("UPDATE CJ_UsersOnline SET timestamp = '$t_stamp' WHERE ip = '$REMOTE_ADDR'") or die("Database UPDATE Error");} else {mysql_db_query($db, "INSERT INTO CJ_UsersOnline VALUES ('$t_stamp','$REMOTE_ADDR','$PHP_SELF','0')") or die("Database INSERT Error");}mysql_db_query($db, "DELETE FROM CJ_UsersOnline WHERE timestamp<$timeout") or die("Database DELETE Error");$resultt = mysql_db_query($db, "SELECT DISTINCT ip FROM CJ_UsersOnline WHERE file='$PHP_SELF'") or die("Database SELECT Error");$resultl = mysql_db_query($db, "SELECT DISTINCT ip FROM CJ_UsersOnline WHERE logged=1") or die("Database SELECT Error");$resultul = mysql_db_query($db, "SELECT DISTINCT ip FROM CJ_UsersOnline WHERE logged=0") or die("Database SELECT Error");$total = mysql_num_rows($resultt);$logged = mysql_num_rows($resultl);$ulogged = mysql_num_rows($resultul);mysql_close();if ($logged == 1){ echo "$logged Member Online<br />";}else{ echo "$logged Members Online<br />";}if ($ulogged == 1){ echo "$ulogged Guest Online<br />";}else{ echo "$ulogged Guests Online<br />";}if ($total == 1){ echo "$total Person Online<br />";}else{ echo "$total People Online<br />";}?> please could some one tell me what is wrong?
  13. duncan_cowan

    form

    Thanks Lots!!!!!!!!!!!
  14. duncan_cowan

    PHP editor

    i think rapid php is good
  15. duncan_cowan

    form

    what do you mean??oh i see the comma!!
  16. duncan_cowan

    form

    I forgot to note that the database connect script is (the username and password have been replaced): <?php//require the PEAR::DB classes.require_once 'DB.php';$db_engine = 'mysql';$db_user = 'i04wasp_duncan';$db_pass = '*********';$db_host = 'localhost';$db_name = '*******';$datasource = $db_engine.'://'. $db_user.':'. $db_pass.'@'. $db_host.'/'. $db_name;$db_object = DB::connect($datasource, TRUE);/* assign database object in $db_object, if the connection fails $db_object will containthe error message. */// If $db_object contains an error:// error and exit.if(DB::isError($db_object)) { die($db_object->getMessage());}$db_object->setFetchMode(DB_FETCHMODE_ASSOC);// we write this later on, ignore for now.include('check_login.php');?> this script is now included at the top of the other file.
  17. duncan_cowan

    form

    i have a html form and a php page that processes the form but when i run the process it comes up with this error:"Fatal error: Call to a member function on a non-object in /home/i04wasp/public_html/regformcheck.php on line 18"the process file contains: <?php // uncomment next line if running on PHP below 4.2.0$random = rand(1000000000, 9000000000); // between 0 and 100 inclusive if (!$_POST['uname'] | !$_POST['passwd'] | !$_POST['passwd_again'] | !$_POST['email']) { die('You did not fill in a required field.'); } // check if username exists in database. if (!get_magic_quotes_gpc()) { $_POST['uname'] = addslashes($_POST['uname']); } $name_check = $db_object->query("SELECT username FROM users WHERE username = '".$_POST['uname']."'"); if (DB::isError($name_check)) { die($name_check->getMessage()); } $name_checkk = $name_check->numRows(); if ($name_checkk != 0) { die('Sorry, the username: <strong>'.$_POST['uname'].'</strong> is already taken, please pick another one.'); } // check passwords match if ($_POST['passwd'] != $_POST['passwd_again']) { die('Passwords did not match.'); } // check e-mail format if (!preg_match("/.*@.*..*/", $_POST['email']) | preg_match("/(<|>)/", $_POST['email'])) { die('Invalid e-mail address.'); } // no HTML tags in username, website, location, password $_POST['uname'] = strip_tags($_POST['uname']); $_POST['passwd'] = strip_tags($_POST['passwd']); $_POST['website'] = strip_tags($_POST['website']); $_POST['location'] = strip_tags($_POST['location']); // check show_email data if ($_POST['show_email'] != 0 & $_POST['show_email'] != 1) { die('Nope'); } /* the rest of the information is optional, the only thing we need to check is if they submitted a website, and if so, check the format is ok. */ // now we can add them to the database. // encrypt password $_POST['passwd'] = md5($_POST['passwd']); if (!get_magic_quotes_gpc()) { $_POST['passwd'] = addslashes($_POST['passwd']); $_POST['email'] = addslashes($_POST['email']); $_POST['website'] = addslashes($_POST['website']); $_POST['location'] = addslashes($_POST['location']); } $regdate = date('m d, Y'); $insert = "INSERT INTO users ( username, password, regdate, email, location, show_email, last_login act_num) VALUES ( '".$_POST['uname']."', '".$_POST['passwd']."', '$regdate', '".$_POST['email']."', '".$_POST['location']."', '".$_POST['show_email']."', 'Never' '$number')"; $add_member = $db_object->query($insert); if (DB::isError($add_member)) { die($add_member->getMessage()); } $db_object->disconnect();?> what is wrong???i have solved that problem by putting a database connection into it!! But now it says:"DB Error: syntax error"???
  18. i have added this code to a page <?phprequire 'protected/db_connect.php';$query = "SELECT * FROM armies ORDER BY strength DESC LIMIT 10";$result = mysql_query($query) or die("error couldnt execute query");echo "<table border='0'> <tr> <td><center><font color='#FFFFFF'>Name</td> <td><center><font color='#FFFFFF'>Strength</td> </tr>";while ( $row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td><center><font color='#FFFFFF'>" . $row['army name'] . "</td>"; echo "<td><center><font color='#FFFFFF'>" . $row['strength'] . "</td>"; echo "</tr>"; }echo "</table>";?> but when i run it it displays the numbers in this order: 9 7 7 6 5 4 3 2 1211why?
  19. duncan_cowan

    VS.Php

    i see why you mistook me english can be a confusing language sometimes!!!
×
×
  • Create New...