Jump to content

IrOnMaSk

Members
  • Posts

    149
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Male

IrOnMaSk's Achievements

Member

Member (2/5)

0

Reputation

  1. Hi guys, I'm using this upload/extract zip script. I wonder if I can modify the script to link the file after it is unzip. Now it just unzip and show the content, I want to give the link to that content. Please let me know if this even possible with the code below. <form enctype="multipart/form-data" action="index.php" method="POST"> Upload a Zip Archive (*.zip): <input name="zip" type="file" /><input type="submit" value="Upload" /> </form> <?php /* UnZip on Server - using PHP by 3scriptz.com */ //check if file is uploaded if(isset($_FILES['zip'])){ require_once('pclzip.lib.php'); //include class $upload_dir = 'uploads'; //your upload directory NOTE: CHMODD 0777 $filename = $_FILES['zip']['name']; //the filename //move file if(move_uploaded_file($_FILES['zip']['tmp_name'], $upload_dir.'/'.$filename)) echo "Uploaded ". $filename . " - ". $_FILES['zip']['size'] . " bytes<br />"; else die("<font color='red'>Error : Unable to upload file</font><br />"); $zip_dir = basename($filename, ".zip"); //get filename without extension fpr directory creation //create directory in $upload_dir and chmodd directory if(!@mkdir($upload_dir.'/'.$zip_dir, 0777)) die("<font color='red'>Error : Unable to create directory</font><br />"); $archive = new PclZip($upload_dir.'/'.$filename); if ($archive->extract(PCLZIP_OPT_PATH, $upload_dir.'/'.$zip_dir) == 0) die("<font color='red'>Error : Unable to unzip archive</font>"); //show what was just extracted $list = $archive->listContent(); echo "<br /><b>Files in Archive</b><br />"; for ($i=0; $i<sizeof($list); $i++) { if(!$list[$i]['folder']) $bytes = " - ".$list[$i]['size']." bytes"; else $bytes = ""; echo "".$list[$i]['filename']."$bytes<br />"; } unlink($upload_dir.'/'.$filename); //delete uploaded file } ?> Thanks
  2. Thanks for your reply jj, it makes sense. I'm not sure though to how I implement that into the script. So here's how I check to see if username/password match when user login. <?php // Connects to your Database mysql_connect("localhost", "Sopoan", "Javascrip1") or die(mysql_error()); mysql_select_db("member") or die(mysql_error()); //Checks if there is a login cookie if(isset($_COOKIE['ID_my_site'])) //if there is, it logs you in and directes you to the members page { $username = $_COOKIE['ID_my_site']; $pass = $_COOKIE['Key_my_site']; $check = mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error()); while($info = mysql_fetch_array( $check )) { if ($pass != $info['password']) { } else { header("Location: members.php"); } } } //if the login form is submitted if (isset($_POST['submit'])) { // if form has been submitted // makes sure they filled it in if(!$_POST['username'] | !$_POST['pass']) { die('You did not fill in a required field.'); } // checks it against the database if (!get_magic_quotes_gpc()) { $_POST['email'] = addslashes($_POST['email']); } $check = mysql_query("SELECT * FROM users WHERE username = '".$_POST['username']."'")or die(mysql_error()); //Gives error if user dosen't exist $check2 = mysql_num_rows($check); if ($check2 == 0) { die('That user does not exist in our database. <a href=registration.php>Click Here to Register</a>'); while($info = mysql_fetch_array( $check )) { $_POST['pass'] = stripslashes($_POST['pass']); $info['password'] = stripslashes($info['password']); $_POST['pass'] = md5($_POST['pass']); //gives error if the password is wrong if ($_POST['pass'] != $info['password']) { die('Incorrect password, please try again.'); } else { // if login is ok then we add a cookie $_POST['username'] = stripslashes($_POST['username']); $hour = time() + 3600; setcookie(ID_my_site, $_POST['username'], $hour); setcookie(Key_my_site, $_POST['pass'], $hour); //then redirect them to the members area header("Location: members.php"); } } } else { // if they are not logged in ?> <form action="login.php" method="post"> <table border="0"> <tr><td colspan=2><h1>Login</h1></td></tr> <tr><td>Username:</td><td> <input type="text" name="username" maxlength="40"> </td></tr> <tr><td>Password:</td><td> <input type="password" name="pass" maxlength="50"> </td></tr> <tr><td colspan="2" align="right"> <input type="submit" name="submit" value="Login"> </td></tr> </table> </form> <?php } ?> Thanks
  3. Hey guys, How do I check to see if the user has been login on the page that they are on? I have a login and I want users to login before then can go to other pages. thanks guys,
  4. so the images is always show up by their default sizes? check the deminsion of the image once loaded against the actual image and see if they are the same
  5. demonstration: "I ain't gotcha"
  6. @KDM: FYI- this could be condensed into one statement if you wanted; like: if (isset($_POST['submit']) && $car_class == FALSE) { // code to execute } no, don't do that!!! the, reason, is i'm kidding
  7. in this case if it is named.. "subment" ... yup, thnx AK47 i can't type today :'(
  8. it's more a question of css but i'm sure people can answer it... try change these two lines if not working trying this
  9. if you want to check if the send button was click use if(isset($_POST['subment'])) { if( condition) { //if $car_class is false execute code here } } the isset will check if the button is pressed assument the button is named 'submit'
  10. totally agree. i feel like the manual is for the elites lol, maybe just me and there's a fine line between being uniqu/speical and nerd/geek
  11. i usually have a hard time understanding the manual actually because they don't explain much just show you with examples... i go there for syntax not for understanding but not all people are a like we all are unique and special like everyone else lol
  12. is that line 421? here's the structure of if statement if( condition ) { //execute code if condition is true } you didn't close the codition ")" so close the condition after the ==False
  13. that's too abvious that's y i didn't even mention!!! if that's the case, i'll go hurt myself :'(
×
×
  • 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.