Jump to content

ukferret

Members
  • Posts

    17
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

ukferret's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I have the code for inserting data to a database form a form (Code below) but I want the data to be entered upon a page loading, how would I do this? <?php require_once('Connections/connect.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO members (username, last_date) VALUES (%s, %s)", GetSQLValueString($_POST['username'], "text"), GetSQLValueString($_POST['last_date'], "text")); mysql_select_db($database_connect, $connect); $Result1 = mysql_query($insertSQL, $connect) or die(mysql_error()); $insertGoTo = "index2.php"; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); } ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <form method="post" name="form1" action="<?php echo $editFormAction; ?>"> <input type="hidden" name="username" value="<? php echo session_MM_Username ?>" size="32" /> <input name="submit" type="submit" value="Insert record" /> <input type="hidden" name="last_date" value="<?php echo date("j, n, Y"); ?>"> <input type="hidden" name="MM_insert" value="form1"> </form> <p> </p> </body> </html>
  2. I got around it by doing as you first suggested and echo'ing off that line instead of doing it seperatly and it works great cheers, oh and you do have to include white spaces echo substr($file, 2333); Many thanks.
  3. This is the code in my script and it deos not remove the forst or last 2092 characters! got any ideas? <?php substr($file, 2092); echo $file; ?>
  4. I am looking to delete the first 240 charcters from a string, anyone have any ideas how I would do this? and would I include white spaces or not?
  5. OK it was worth a go cheers guys, your input is most appreciated. K
  6. Alright guys cheers Is there a way to put something into the clipboard??
  7. Is it possible to clear the notebook or cache on a visitors PC with php?? I am trying to stop people copying the txt from a site by either selecting the txt and copying to clipboard or taking a screen shot. I have been told that this is possible with PHP but am yet to find anything in the manual!! all I can find is informatin about clearing the server cache.
  8. If it is just a basic form, for example name, age BOD you can setup the form on your site, and get the visitor to enter the details then just post the data to their handleer page via a pop up, this way the data is submitted to the third party and your visitor stays on your website. Also look into using iFrames instead of frames.
  9. I am using the Dreamweaver user authentication script for a members are but with the login details username and password I also want 2 variables past to the next page. the forum poists to a php function - <form action="<?php echo $loginFormAction; ?>" method="POST" name="log-in" id="log-in"> and here is the top part of the function - $loginFormAction = $_SERVER['PHP_SELF']; if (isset($_GET['accesscheck'])) { $_SESSION['PrevUrl'] = $_GET['accesscheck']; } //Image Verification posts $_POST['imver'] = $_POST['imver']; $_POST['new_string'] = $_POST['new_string']; The bottom two line is what I want to pass to the next page, but it isn't am I doing something wrong???
  10. Cheers MadTachie That wouldn't of even crossed my mind all works great now, thanks.
  11. Firstly here is the code; <?php $username = $_SESSION['username']; $to = $_SESSION['email']; $subject = 'Snooker Profiles Registratin Confirm'; $message = '<b>Welcome to our website</b><br/><br/>Your Username is- $username'; $headers = 'From: mail@domain.com' . "\r\n" . 'Reply-To: mail@domain.com' . "\r\n" . 'Return-Path: mail@domain.com' . "\r\n" . 'Content-type: text/html; charset=iso-8859-1' . "\r\n" . 'MIME-Version: 1.0' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); $message = wordwrap($message, 70); mail($to, $subject, $message, $headers); ?> I have several SESSIONS being sent from a previous page and I want to put the info in the SESSION into the body of the email, this line; $message = '<b>Welcome to our website</b><br/><br/>Your Username is- $username'; is where I am having the problems! the SESSION I have changed into a string and the string prints out as $username instead of the value. I am sure I need to escape it again but I just can not get my head around it, can anybody help?
  12. OK great I will go and check that out
  13. Can I use curl to get the contents of a div tag from a remote page?? Basically I want to say goto www.awebsite.com/page.html and gather all of the info in a div say <div id="mydiv">Content I want</div>
  14. I have a custom made CMS with dynamic and static page all coded with the php extention and I am looking to add a visitor tracking system to the site very similar to the one which SMF uses. In my CMS I use the User Authentication script which is pre set in Dreamweaver, so member sessions are MM_Username, MM_Type and I have also set 6 other custom sessions. Here is my problem there are so many pre designed systems out there I just do not know which to choose! I would like to code it myself but connot find a good tutorial for this. The features I would require are; Guest (No sessions) tracking ie; 6 guests online (Click and you will see what pages they are at) Members, full list, when you click their name it takes you to the page they are on. List of users active today. Can anyone point me in the direction of a good tutorial or a pre made system? Cheers Kev
  15. I am I right in saying that if you use sessions which are created from forms you will need Register_Globals turned on!! most shared hosting providers have this turned off for security.
×
×
  • 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.