Jump to content

phily245

Members
  • Posts

    47
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

phily245's Achievements

Member

Member (2/5)

0

Reputation

  1. I've logged in multiple times (nd am currently logged in), but I cannot find any session files in the /tmp directory :/
  2. Hi all, I have a session problem on my development site. Whenever I go to my login screen at www.mydomain.com/my/path/index.php, i get the following error messages: However, when I go to mydomain.com/my/path/index.php, the error messages aren't there. I am very confused. We don't have an SSL (which google suggested it could be) or any whitespace between the opening php tag. I have chmoded the /tmp directory to 777 but to no avail. Any ideas? My opening code is below: <?php session_start(); require_once("includes/db_connector.php"); include("includes/cms_class.php"); include("includes/login_class.php"); loginForwarder(); $issue = checkLoginIssue(); if (isset($_POST["login"])) { loginUser($_POST["email"], $_POST["password"]); } ?> <!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"><!-- InstanceBegin template="/Templates/my_template.dwt.php" codeOutsideHTMLIsLocked="false" -->
  3. http://lmgtfy.com/?q=php+login+tutorial
  4. I had an extra i in $_POST["expiryDate"] when submitting the date. I just want to crawl away and hide in shame.
  5. <?php echo $_POST["startDate"]; ?> echos 20-11-2011 (if the date selected is the 20th November 2011)
  6. It's meant to validate to 3rd August. We expect the user to enter it this way, as the end users are from the UK (like me) and we use dd-mm-yyyy. I also have an instruction to do it this way in the label on the field which the user enters the date into. I think a select statement will be overkill, as the dates needed can be from tomorrow to in multiple years time.
  7. It's still not working, gah! I tried what you suggested, then I tried using another one I found on google and slightly modified: <?php if(!preg_match('/^(19|20)\d\d[-](0[1-9]|1[012])[-](0[1-9]|[12][0-9]|3[01])$/', $expiryDate) or !preg_match('/^(19|20)\d\d[-](0[1-9]|1[012])[-](0[1-9]|[12][0-9]|3[01])$/', $startDate)) { $issue = "9"; return $issue; } ?> I need the - seperator so that I can use explode() on the date function. When I get this working with just a -, I'm going to add support for [- \/\.] and a switch statement for the explode.
  8. move: <?php $query = "INSERT INTO carmansa.t_imagenes (id_categoria,imagen_antes_txt_esp,imagen_despues_txt_esp,imagen_antes_txt_eng,imagen_despues_txt_eng,imagen_before,imagen_after) ". "VALUES ('$categoria','$textoantesesp','$textodespuesesp','$textoanteseng','$textodespueseng','$image1','$image2')"; mysql_query($query) or die('Error, query failed : ' . mysql_error()); ?> to after: <?php header("Location: PC_images_inserted.php"); } ?> The code is currently inside the for loop, so it will insert records twice. I'd recommend coding on notepad++ or another program with similar syntax highlighting, as it highlights your curly braces and shows what is contained inside loops and if statements etc.
  9. Have you put the query inside the for loop?
  10. Thanks for the advice. I changed my regex to the following code, but it still wouldn't work. <?php if(!preg_match('/^\d{2}-\d{2}-\d{4}$/', $expiryDate)) { $issue = "9"; return $issue; } if(!preg_match('/^\d{2}-\d{2}-\d{4}$/', $startDate)) { $issue = "9"; return $issue; }?>
  11. Hi lingo, I missed a line out. This: <?php //Declare the target location and move the file there $target = $target . ${image.$i}; $target = $target . basename(${image.$i}); move_uploaded_file(${tmpImage.$i}, $target); ?> Needs to be this: <?php //Declare the target location and move the file there $target = 'uploads/'; //Declare your upload path here $target = $target . ${image.$i}; $target = $target . basename(${image.$i}); move_uploaded_file(${tmpImage.$i}, $target); ?> And your new query should be inside the for loop beneath where you add to the array and look like this: <?php $query = "INSERT INTO carmansa.t_imagenes (id_categoria,imagen_antes_txt_esp,imagen_despues_txt_esp,imagen_antes_txt_eng,imagen_despues_txt_eng,imagen_before,imagen_after) ". "VALUES ('$categoria','$textoantesesp','$textodespuesesp','$textoanteseng','$textodespueseng','$target','$target')"; ?> I'm not sure why you need to enter the file path in twice though, is that a mistake?
  12. You need this: <?php $from = "$string@website.com" ?> to be this: <?php $from = $string."@website.com"; ?>
  13. Hi, I'm using the JQuery UI datepicker to insert a date into a form field, but I need validation in case the user enters the date by hand. The date needs to be dd-mm-yyyy. I currently have this: <?php if(!preg_match('/^\d{2}\/\d{2}\/\d{4}$/', $expiryDate)) { $issue = "9"; return $issue; } if(!preg_match('/^\d{2}\/\d{2}\/\d{4}$/', $startDate)) { $issue = "9"; return $issue; } ?> But it's not working and I'm pretty sure its the regex.
  14. On your form, have this for all the file uploads <label for="image[]">LABEL HERE</label><input type="file" name="image[]" id="image[]" /> Then, use this script inside your "if submitted" if statement to upload your files <?php //Declare the variables for the first image $image1 = $_FILES['image']['name'][0]; $tmpImage1 = $_FILES['image']['tmp_name'][0]; $imageError1 = $_FILES['image']['error'][0]; //Declare the variables for the second image $image2 = $_FILES['image']['name'][1]; $tmpImage2 = $_FILES['image']['tmp_name'][1]; $imageError2 = $_FILES['image']['error'][1]; //For both the images for ($i = 1; $i <= 2; $i++) { //If there is a file if(${image.$i} != '' && ${tmpImage.$i} != ''){ //If there is an error with the file uploaded if(${imageError.$i} > 0) { //Provide an error message }else{ //encode the image name for the www urlencode(${image.$i}); //If magic quotes are off if(!get_magic_quotes_gpc()) { ${image.$i} = addslashes(${image.$i}); $target = addslashes($target); } //Declare the target location and move the file there $target = $target . ${image.$i}; $target = $target . basename(${image.$i}); move_uploaded_file(${tmpImage.$i}, $target); } }else{ //If there is an error with the file uploaded if(${imageError.$i} > 0) { //Provide an error message }else{ //Declare the target $target = '../img/none.jpg'; } //Add the target to the fileinsert array $fileinsert[]=$target; } ?> [code]
×
×
  • 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.