Jump to content

jeppers

Members
  • Posts

    157
  • Joined

  • Last visited

    Never

Everything posted by jeppers

  1. Ok done that but nothing it is very sad that this is stopping me from moving on, any more clues.. can u see if that code runs on your server please
  2. ok this problem must be with my apache server as you say nothing is wrong with it but on mine nothing happens so is there any idea on what it could be and what i could do with it thanks
  3. i have been looking at this code for about an hour, when i load it up nothing shows up on the screen. i am sure it is simple but as you know he longer you look the hard it gets to spot the error.. <?php //reg.php //address error handling ini_set ('display_errors', 1); error_reporting (E_ALL & ~E_NOTICE); //set the page title ini_set ('TITLE', 'register'); //basic html formatting print '<div id="leftcontent"> <h1>Registration Form</h1> <p>Register so that you can take advantage of this, that and other things.</p>'; //check if the form has been submitted if (isset ($_POST['submit'])) { $problem = FALSE; // no problems so far //check each value if (empty ($_POST['username')) { $problem = TRUE; print '<p>Please enter your username</p>'; } if(empty ($_POST['first_name'])) { $problem = TRUE; print '<p>Plase enter your First Name</P>'; } if (empty ($_POST['last_name'])) { $problem = TRUE; print '<p>Please enter your Last Name</p>'; } if (empty ($_POST['email'])) { $problem = TRUE; print '<p>Please enter your email</p>'; } if (empty($_POST['password1'])) { $problem = TRUE; print '<p>Please enter your Password</p>'; } if ($_POST['password1'] != $_POST['password2']){ $problem = TRUE; print '<p>Your password did not match your confirmed password!</p>'; } if (!$problem) { // if there weren't any probles... print '<p>You are now registered!<br />Okey, you are not really registerd but...</p>'; }else { // forgoten field. print '<p>Please try again!</p>'; } }//end of handle for if //Display the form print '<form action="register.php" method="post"><p>'; print 'Username:<input type="text" name="username" size="20" value="' . $_POST['username'] . '"/><br />'; print 'First Name: <input type="text" name="first_name" size="20" value="' . $_POST['first_name'] . '"/><br />'; print 'Last Name: <input type="text" name="last_name" size="20" value="' . $_POST['last_name'] . '"/><br />'; print 'Email Address: <input type="text" name="email" size="20" value="' . $_POST['email'] . '"/><br />'; print 'Password: <input type="password" name="password1" size="20" /><br />'; print 'Confirm Password: <input type="password" name="password2" size="20" /><br />'; <input value="submit" name="submit" value="Register!" /></p> </form> //complete the html formatting stuff. print '</div>'; include ('templates/footer.php'); // need the footer ?>
  4. so when it is in the fil all i have to do is create a link to that code on the website and then it will download the file required.. is that correct
  5. not sure what to with it i have changes the file name as you can see down below and then i tried to load it and nothing... is it supposed to come up with a box asking me if i would like to save it... please help as i am a little slow
  6. <?php // force to download a file // ex, ( [url=http://localhost/php/download.php?file=C:/Apache]http://localhost/php/download.php?file=C:/Apache[/url] Group/Apache2/hongkong.php ) // hope this can save your time :-) $file = $_REQUEST['file']; header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Type: application/force-download"); header( "Content-Disposition: attachment; filename=".basename($file)); header( "Content-Description: File Transfer"); @readfile($file); ?> can any one help i need to direct this code to a file which i want to download any ideas at the moment it just downloads a blank document and i am not sure on how to change the outcome
  7. hi there i am just wondering if it is possible to be able to download an CV from a web site for example i want to be able to put my cv online and then for some to be able to download it can it be done and where could i look to get some code thanks
  8. thanks very much as a beginner i greatly thank u one day i hope to be able to help other people....
  9. after some testing and the use of a mysql testing script i have come to the understanding that it must be my code but i just can't see where so if you have any idea or a slight wim what it could, it would be most helpful this is the code <?php function dbConnect($type) { if ($type == 'query') { $user = paul; $pwd = mouse; } else { exit('Unrecognized connection type'); } $conn = mysql_connect(sql1.bravehost.com, paul, mouse) or die ('Cannot connect to server'); mysql_select_db('fiction-1261311') or die ('Cannot open database'); return $conn; } ?>
  10. <?php function dbConnect($type) { if ($type == 'query') { $user = paul; $pwd = mouse; } else { exit('Unrecognized connection type'); } $conn = mysql_connect(sql1.bravehost.com, $paul, $mouse) or die ('Cannot connect to server'); mysql_select_db('fiction-1261311') or die ('Cannot open database'); return $conn; } ?>
  11. thanks for that but the first problem is that it won't connect to the site at all it stops before it gets to the password and username. the error message is Warning: mysql_connect() [function.mysql-connect]: Unknown MySQL server host 'sql1bravehostcom' (1) in /misc/13/000/126/295/2/user/web/jeppers90.com/fiction_mysql.inc.php on line 11 Cannot connect to server any ideas
  12. Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /misc/13/000/126/295/2/user/web/jeppers90.com/fiction_mysql.inc.php on line 11 Cannot connect to server i did that and this was the message i got back any other ideas
  13. is anything wrong with this code as it works on localhost but when uploaded to server it just says that "Unknown MySQL server host" i am so baffled so if you could help it would be good.... <?php function dbConnect($type) { if ($type == 'query') { $user = nm; $pwd = ps; } else { exit('Unrecognized connection type'); } $conn = mysql_connect(sql1.bravehost.com, nm, ps) or die ('Cannot connect to server'); mysql_select_db('fiction-1261311') or die ('Cannot open database'); return $conn; } ?>
  14. Warning: mysql_connect() [function.mysql-connect]: Unknown MySQL server host 'sql1bravehostcom' (1) in /misc/13/000/126/295/2/user/web/jeppers90.com/includes/fiction_mysql.inc.php on line 11 Cannot connect to server this message is what i get when i try to upload it to a webserver.. things i have done set up database put in correct information from the database in to my php form. what ever i try i can't seem to set it up has anyone got any ideas, has anyone had this problem, any help
  15. where do i put that is it in the login page
  16. hear is my scrip for my login and what i want it to do is when different passwords are entered i want it to go to different places (people say simple but i just don't get it) <?php // process the script only if the form has been submitted if (array_key_exists('login', $_POST)) { // start the session session_start(); // include nukeMagicQuotes and clean the $_POST array include('includes/corefuncs.php'); nukeMagicQuotes(); $textfile = 'C:/private/filetest03.txt'; if (file_exists($textfile) && is_readable($textfile)) { // read the file into an array called $users $users = file($textfile); // loop through the array to process each line for ($i = 0; $i < count($users); $i++) { // separate each element and store in a temporary array $tmp = explode(', ', $users[$i]); // assign each element of the temp array to a named array key $users[$i] = array('name' => $tmp[0], 'password' => rtrim($tmp[1])); // check for a matching record if ($users[$i]['name'] == $_POST['username'] && $users[$i]['password'] == $_POST['pwd']) { $_SESSION['authenticated'] = 'paul'; break; } } // if the session variable has been set, redirect if (isset($_SESSION['authenticated'])) { header('Location: http://localhost/gallery.php'); exit; } // if the session variable hasn't been set, refuse entry else { $error = 'Invalid username or password.'; } } // error message to display if text file not readable else { $error = 'Login facility unavailable. Please try later.'; } } ?> from hear it always goes to the gallery not sure on what to do but hear is the code i have put on the admin page <?php session_start(); ob_start(); // if session variable not set, redirect to login page if (!isset($_SESSION['authenticated']) || $_SESSION['authenticated'] != 'paul') { header('Location: http://localhost/login.php'); exit; } ?> i hope you will help
  17. do you know where a good tutorial is please can i have the link thanks
  18. fair enough well just this then i want to assign a password to an admin page but i have read so many tutorials i am confused can you give me an example of what it could be like to protect a page using a flat file password system to store the users passwords.. sad but i am begging lol
  19. can any one give me a script which will show me how session control works... i have been confused for along time so this is my last chance to it before i have to hand my project in.... it sad that i have brought my self to this level but it too hard too late thanks peeps i hope you can and will help i am so stuck
  20. it was the or command i wanted but even though i have it did nothing for me thanks for the help
  21. no way its in a book i am looking at but i have no clue where to look for the command on the key board like this II but just 2 strait lines where can i find it
  22. i can find it on the key board but i need it and i will try to describ it the best i can it is like 2 vertical lines means the same i think like this II but i don't know where it is on the key board can you help
  23. i want to create a management area but finding it hard to direct the user to that page is there any good tutorials which can help... i have started a session control but i want to make it so only a manger can get to one area... what can i do please help.
  24. hi there i am working on a gallery where you can upload a image and it will create a thumb nail. the problem is that is says that it has been entered in to the directory bub when i try to view the image the large image appears and the thumb just comes up as text..... i thought about this so i copied the big image and placed it in the thumbs folder and reloaded the web page and there was the thumb nail. so i guessing its a directory problem but i can't see it... is there any chance you bright people of the php world can help <?php define('THUMBS_DIR', 'c:/test/images/thumbs/'); define('MAX_WIDTH', 200); define('MAX_HEIGHT', 150); // process the uploaded image if (is_uploaded_file($_FILES['image']['tmp_name'])) { $original = $_FILES['image']['tmp_name']; // begin by getting the details of the origin<a href="create_thumb.php">Create thumbnail image</a>al list($width, $height, $type) = getimagesize($original); // calculate the scaling ratio if ($width <= MAX_WIDTH && $height <= MAX_HEIGHT) { $ratio = 1; } elseif ($width > $height) { $ratio = MAX_WIDTH/$width; } else { $ratio = MAX_HEIGHT/$height; } // strip the extension off the image filename $imagetypes = array('/\.gif$/', '/\.jpg$/', '/\.jpeg$/', '/\.png$/'); $name = preg_replace($imagetypes, '', basename($_FILES['image']['name'])); // move the temporary file to the upload folder $moved = move_uploaded_file($original, UPLOAD_DIR.$_FILES['image']['name']); if ($moved) { $result = $_FILES['image']['name'].' successfully uploaded; '; $original = UPLOAD_DIR.$_FILES['image']['name']; } else { $result = 'Problem uploading '.$_FILES['image']['name'].'; '; } // create an image resource for the original switch($type) { case 1: $source = @ imagecreatefromgif($original); if (!$source) { $result = 'Cannot process GIF files. Please use JPEG or PNG.'; } break; case 2: $source = imagecreatefromjpeg($original); break; case 3: $source = imagecreatefrompng($original); break; default: $source = NULL; $result = 'Cannot identify file type.'; } // make sure the image resource is OK if (!$source) { $result = 'Problem copying original'; } else { // calculate the dimensions of the thumbnail $thumb_width = round($width * $ratio); $thumb_height = round($height * $ratio); // create an image resource for the thumbnail $thumb = imagecreatetruecolor($thumb_width, $thumb_height); // create the resized copy imagecopyresampled($thumb, $source, 0, 0, 0, 0, $thumb_width, $thumb_height, $width, $height); // save the resized copy switch($type) { case 1: if (function_exists('imagegif')) { $success = imagegif($thumb, THUMBS_DIR.$name.'_thb.gif'); $thumb_name = $name.'_thb.gif'; } else { $success = imagejpeg($thumb, THUMBS_DIR.$name.'_thb.jpg', 50); $thumb_name = $name.'_thb.jpg'; } break; case 2: $success = imagejpeg($thumb, THUMBS_DIR.$name.'_thb.jpg', 100); $thumb_name = $name.'_thb.jpg'; break; case 3: $success = imagepng($thumb, THUMBS_DIR.$name.'_thb.png'); $thumb_name = $name.'_thb.png'; } if ($success) { $result .= "$thumb_name created"; include('insert_test.php'); } else { $result .= 'Problem creating thumbnail'; } // remove the image resources from memory imagedestroy($source); imagedestroy($thumb); } } ?> all help and comments are helpful thanks
×
×
  • 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.