Jump to content

nashyboy

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

nashyboy's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi guys, im using this script i've come across which is working nicely. However there is something that im trying to add. The login script is this... <html> <head> <title>Login</title> </head> <body> <div align="center"> <br> <strong><font color="#999999" size="7" face="Courier New, Courier, mono">A D M I N I S T R A T I O N</font></strong><br> <br> <br> <font color="#FF8000" face="Arial, Helvetica, sans-serif"><strong>This Is A Restricted Area. Please Login ...</strong></font> <br> <br> <form method="post" action="<? echo ($PHP_SELF); ?>"> <table border=0 cols=2 width=200 cellpadding=3 cellspacing=3> <tr> <td width=100><font color="#000080" size="2" face="Arial, Helvetica, sans-serif"> User ID: </font></td> <td width=100> <input type="text" name="uid" size="8"> </td> </tr> <tr> <td width=100><font color="#000080" size="2" face="Arial, Helvetica, sans-serif"> Password: </font></td> <td width=100> <input type="password" name="pwd" SIZE="8"> </td> </tr> </table> <br> <input type="submit" name="submitlogin" value="Login"> </form> </div> </body> </htML> which obviously redirects to the index page which has the following include file <?php include ("access_control.php"); ?> This include file contains... <? include ("config.php"); include ("errors.php"); include ("common.php"); include ("connect.php"); while (list($var, $val) = each ($_REQUEST)) { IF ($var == "cookieid" AND !isset($_COOKIE[cookieid])) { echo ("You can not pass login parameters via GET operations."); exit(); } } reset($_REQUEST); IF (isset($_REQUEST[uid]) AND !isset($_COOKIE[cookieid])) { $grabuser = "SELECT recID FROM user WHERE username = '$_REQUEST[uid]' AND password = '$_REQUEST[pwd]'"; $result = @mysql_query($grabuser); sql_query($result, "$errors[03]"); IF (@mysql_num_rows($result) == 0) { error ("$errors[04]"); include ("login_form.php"); exit(); } ELSE { $userid = @mysql_result($result,0,"recID"); $processing_login = true; $cookie_setter = @setcookie ("cookieid", $userid, time()+$maxlifetime); IF (!$cookie_setter) { error ("$errors[05]"); } ELSE { ?> <META HTTP-EQUIV=Refresh CONTENT="2; URL=index.php"> <font color="#000080" size="2" face="Arial, Helvetica, sans-serif">Please hold one second while we process your login...<br> If this page does not refresh in 3 seconds, <A HREF="index.php">click here</a>. <? exit(); } } } ELSE IF (!isset($_REQUEST[uid]) AND !isset($_COOKIE[cookieid])) { include ("login_form.php"); exit(); } IF ($_REQUEST[action] == "logout") { $cookie_setter = @setcookie ("cookieid", $userid, time()-$maxlifetime); IF (!$cookie_setter) { error ("$errors[05]"); } ELSE { ?> </font> <META HTTP-EQUIV=Refresh CONTENT="2; URL=index.php"> <font color="#000080" size="2" face="Arial, Helvetica, sans-serif"> Please hold one second while we log you out...<br> If this page does not refresh in 3 seconds, <A HREF="index.php">click here</a>. </font><BR> <BR><BR><BR> <? exit(); } } ?> Basically what im trying to do is parse the username value though to the index page, so i can say hello user: $username etc etc. However i can't work out what code to put in on the index page. Can someone help, it would be appreciated. Thanks.
  2. Thats works great however, it doesnt give the line breaks anymore? Also how can i parse the "$name" (from the form) into the subject? Is just displaying as Blah Blah $name
  3. Have tried the various things above but no joy and dont particlatly want to use a mailer would rather have my own code work. i can get away without using the cc if i can send to 2 addresses. however the below doesnt work still.... <?php $to = 'nashy@email.co.uk, ghgfd@alh.co.uk'; $subject = 'test'; $message = "Blah Blah\n\n Name: " . $name . "\n Username: " . $username . "\n Site: " . $site . " \n Role: " . $role . " \n\n Regards\n Selection Services"; $headers .= "From: Can@alh.co.uk\r\n"; mail($to, $subject, $message, $headers); ?>
  4. Guys this is probably very straight forward however, i can't quite work it out. Please see the below code.... <?php $to = 'nashy@email.co.uk, '; $subject = 'test'; $message = "Blah Blah\n\n Name: " . $name . "\n Username: " . $username . "\n Site: " . $site . " \n Role: " . $role . " \n\n Regards\n Selection Services"; $headers .= "CC: ghgfd@alh.co.uk\r\n"; $headers .= "From: Can@alh.co.uk\r\n"; mail($to, $subject, $message, $headers); ?> All works except the cc field. I receive the email stating it has been cc'd to ghgfd@alh.co.uk however its doesnt actually go to them..... If someone could help it would be appreciated. Thanks, Paul
  5. nope none at all. Just not parsing the id value to the next page and displaying it even though it shows in the hyperlink of the previous.
  6. I still having problems as per last post - can anyone help please. Cant figure it out....
  7. Okay thanks. I have done all that and added a new entry. When i come to edit that entry it is not parsing the id value from the results page to the edit_message.php page. I know the hyperlink code in the results page is correct as it shows edit_message.php?id=5 in the status bar. The current page i have to parse the value and then edit is..... <?php $id=$_POST['id']; include("includes/login_details.inc"); mysql_connect ($dbhost, $dbuser, $dbpass) or die (mysql_error()); //Connects to database mysql_select_db ($dbname) or die (mysql_error()); //Selects your database $sql = "SELECT * FROM messages where id = '$id' ";     $result = mysql_query($sql); echo $sql;     if (!$result) {         echo "Could not successfully run query ($sql) from DB: " . mysql_error();         exit;     }         if (mysql_num_rows($result) == 0) {         echo "No Messages Currently Live";     }     // While a row of data exists, put that row in $row as an associative array     // Note: If you're expecting just one row, no need to use a loop     // Note: If you put extract($row); inside the following loop, you'll     //      then create $userid, $fullname, and $userstatus etc     while ($row = mysql_fetch_assoc($result)) { echo "<table width=800 border=0 cellspacing=0 cellpadding=0>           <tr>               <td width=25>&nbsp;</td>               <td><font color=#00CC33 size=3 face=Georgia, Times New Roman, Times, serif><strong>Update               Message<br>             <form action=edited_message.php method=post>               <table width=600 border=0 cellspacing=2 cellpadding=2>                 <tr>                   <td width=138><strong></strong></td>                   <td width=462><input name=id type=text value=";         echo $row["id"]; echo "><input name=messagestatus type=text id=messagestatus value=";         echo $row["messagestatus"]; echo "<br><strong>";         echo $row["requestor"]; echo " | ";         echo $row["date"]; echo " | ";         echo $row["time"]; echo " | <font color=#0066FF><a href='edit_message.php?id="; echo $row["id"]; echo "'>Update Message</strong></font></td>"; echo "</tr></table><br>";     }             mysql_free_result($result); mysql_close(); ?>
  8. Im using phpmyadmin and yes it does appear that the id exists and when i echo the query out after adding it from the form although it adds it to the form in phpmyadmin it echos all except the id which gets shown like this... INSERT INTO users (id, firstname, surname, email, password) VALUES('', 'John', 'Smith' , 'john.smith@bestbitter.com' , 'smooth' ) The form code is <form action="added_user.php" method="post">               <table width="600" border="0" cellspacing="2" cellpadding="2">                 <tr>                   <td width="138"><strong></strong></td>                   <td width="462"><strong><font color="#000000" size="1" face="Verdana, Arial, Helvetica, sans-serif">                     <input name="id" type="hidden">                     </font></strong></td>                 </tr>                 <tr>                   <td><strong><font color="#000000" size="1" face="Verdana, Arial, Helvetica, sans-serif">Firstname</font></strong></td>                   <td><strong><font color="#000000" size="1" face="Verdana, Arial, Helvetica, sans-serif">                     <input name="firstname" type="text" size="30" maxlength="80">                     </font></strong></td>                 </tr>                 <tr>                   <td><strong><font color="#000000" size="1" face="Verdana, Arial, Helvetica, sans-serif">Surname</font></strong></td>                   <td><strong><font color="#000000" size="1" face="Verdana, Arial, Helvetica, sans-serif">                     <input name="surname" type="text" size="30" maxlength="80">                     </font></strong></td>                 </tr>                 <tr>                   <td><strong><font color="#000000" size="1" face="Verdana, Arial, Helvetica, sans-serif">Email</font></strong></td>                   <td><strong><font color="#000000" size="1" face="Verdana, Arial, Helvetica, sans-serif">                     <input name="email" type="text" size="30" maxlength="80">                     </font></strong></td>                 </tr>                 <tr>                   <td><strong><font color="#000000" size="1" face="Verdana, Arial, Helvetica, sans-serif">Password</font></strong></td>                   <td><strong><font color="#000000" size="1" face="Verdana, Arial, Helvetica, sans-serif">                     <input name="password" type="text" size="30" maxlength="20">                     </font></strong></td>                 </tr>                 <tr>                   <td><font color="#000000">&nbsp;</font></td>                   <td><font color="#000000">&nbsp;</font></td>                 </tr>                 <tr>                   <td><font color="#000000">&nbsp;</font></td>                   <td><strong><font color="#000000" size="1" face="Verdana, Arial, Helvetica, sans-serif">                     <input type="reset" name="Reset" value="Reset">                     <input name="Submit" type="submit" id="Submit" value="Submit">                     </font></strong></td>                 </tr>               </table> </form> and the added page is...             <?php $id=$_POST['id']; $firstname=$_POST['firstname']; $surname=$_POST['surname']; $email=$_POST['email']; $password=$_POST['password']; ?> <?php include("..\includes\login_details.inc"); mysql_connect ($dbhost, $dbuser, $dbpass) or die (mysql_error()); //Connects to database echo $dbhost. "<br/>"; echo $dbuser. "<br/>"; echo $dbpass. "<br/>"; echo $dbname. "<br/>"; mysql_select_db ($dbname) or die (mysql_error()); //Selects your database $query = "INSERT INTO users (id, firstname, surname, email, password) VALUES('$id', '$firstname', '$surname' , '$email' , '$password' )"; echo $query. "<br/>"; $result = mysql_query($query) or die("Error: ". mysql_error()); ?>
  9. Hi, Quite new to this.... Can't understand why when i add to a table and echo the sql command, it does not display the id. I have set the id field as auto_increment and primary key and adds to table correctly but when i retrieve all the data from table it doesnt show the id's.... Is there some sort of php configuration i need to change or perhaps i've set up the table uincorrect. CREATE TABLE messages (   id tinyint(5) NOT NULL auto_increment,   messagestatus varchar(20) NOT NULL default '',   time varchar(20) NOT NULL default '',   date varchar(20) NOT NULL default '',   requestor varchar(80) NOT NULL default '',   requestorstatus varchar(20) NOT NULL default '',   message blob NOT NULL,   PRIMARY KEY  (id) ) TYPE=MyISAM; Can someone give me some pointers? Thanks Paul
  10. Hi, I have the following code (different where command...) listed 4 times on my page. The problems appears to be that it doesnt have a close command so it is only showing one connection and then nothing underneath. Currently this page should display... Management no contacts found Internal Support no contacts found Server Team no contacts found Helpdesk Team no contacts found However it appears that bcause the connect has not closed it only shows Management no contacts found and then nothing under at all.... I have tried using the mysql_close() command but no luck. Can anyone help please. My code is this..... <?php include("includes/login_details.inc"); mysql_connect ($dbhost, $dbuser, $dbpass) or die (mysql_error()); //Connects to database mysql_select_db ($dbname) or die (mysql_error()); //Selects your database $sql = "SELECT * FROM contacts where department = 'Server Team' "; $result = mysql_query($sql); //echo $sql; if (!$result) { echo "Could not successfully run query ($sql) from DB: " . mysql_error(); exit; } if (mysql_num_rows($result) == 0) { echo "No Contacts Found"; exit; } // While a row of data exists, put that row in $row as an associative array // Note: If you're expecting just one row, no need to use a loop // Note: If you put extract($row); inside the following loop, you'll // then create $userid, $fullname, and $userstatus while ($row = mysql_fetch_assoc($result)) { echo "<table width=800 border=0 cellpadding=0 cellspacing=0><tr>"; echo "<td width=22></td>"; echo "<td width=128><font size=1 face=Verdana, Arial, Helvetica, sans-serif><strong>"; echo $row["name"]; echo "</strong></font></td>"; echo "<td width=100><font size=1 face=Verdana, Arial, Helvetica, sans-serif>"; echo $row["mobile1"]; echo "</font></td>"; echo "<td width=100><font size=1 face=Verdana, Arial, Helvetica, sans-serif>"; echo $row["phone"]; echo "</font></td>"; echo "<td width=100><font size=1 face=Verdana, Arial, Helvetica, sans-serif>"; echo $row["mobile2"]; echo "</font></td>"; echo "<td width=350><font size=1 face=Verdana, Arial, Helvetica, sans-serif><strong>"; echo $row["jobrole"]; echo "</strong></font></td>"; echo "</tr></table>"; } mysql_free_result($result); ?>
  11. Hi, this is probably something really simple yet i cannot work out the problem. I used php briefly about 5 years ago but have since forgotten it appears most of the basics! Simple thing really - adding to table is not working. Probably something really stupid that im doing wrong but please see below.... This is the form code. <form action="added_user.php" method="post"> <table width="600" border="0" cellspacing="2" cellpadding="2"> <tr> <td width="138">ID (hidden)</td> <td width="462"><input name="id" type="hidden"></td> </tr> <tr> <td>Firstname</td> <td><input name="firstname" type="text" size="30" maxlength="80"></td> </tr> <tr> <td>Surname</td> <td><input name="surname" type="text" size="30" maxlength="80"></td> </tr> <tr> <td>Email</td> <td><input name="email" type="text" size="30" maxlength="80"></td> </tr> <tr> <td>Password</td> <td><input name="password" type="text" size="30" maxlength="20"></td> </tr> <tr> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>&nbsp;</td> <td><input type="reset" name="Reset" value="Reset"> <input name="Submit" type="submit" id="Submit" value="Submit"></td> </tr> </table> </form> And this is the added to page.... <?php include("login_details.inc"); mysql_connect ($dbhost, $dbuser, $dbpass) or die (mysql_error()); //Connects to database mysql_select_db ($dbname) or die (mysql_error()); //Selects your database mysql_query("INSERT INTO users (id, firstname, surname, email, password) VALUES('$id', '$firstname', '$surname' , '$email' , '$password' ) ") or die(mysql_error()); mysql_query($query); mysql_close(); ?> All that happens is it submits and i get a blank page. Nothing gets added to the table. Can someone help.....?
×
×
  • 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.