Jump to content

CircularStopSign

Members
  • Posts

    44
  • Joined

  • Last visited

Everything posted by CircularStopSign

  1. i need to create 1000 folders, 1-1000 but i dont feel like creating it all by hand, is there any loop code that i could use to do this for my web server?
  2. yeah, this works... i was just posting it so everyone could see it.... maybe point out some flaws if they see any.. your the man humpty
  3. for the extensions i just built a simple if statement... i dunno if its safe or w/e but its whati go fo rnow [code] if($FnameExt==$ext_array[0] || $FnameExt==$ext_array[1] || $FnameExt==$ext_array[2] || $FnameExt==$ext_array[3] || $FnameExt==$ext_array[4]){ if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path.'/'.$randomName.".".$FnameExt)) {     echo htmlentities('<a href="http://www.hostmapics.com/"><img src="http://hostmapics.com/'); echo $target_path.'/'.$randomName.".".$FnameExt; echo htmlentities('"></a>'); } else{     echo "There was an error uploading the file, please try again!"; } } else{ echo "Not a valid file extension"; } [/code] when i get to the directories i am either going to use a database or do a random 1-1000 to pick which folder the image is going in
  4. alright thanks... i was thinking something like that, but i wasnt sure.  i think its the same in JS right?
  5. how would i say: if(stuff==array[0] or array[1] or array[2]){ echo "Stuff is equal too 0,1, and 2"; } haha sounds kind of childish but i cant find it anywhere i can only find &&
  6. alright, thanks a lot that really helped, i'll give you my  code just so you can see it if youd like. [code] <?php $Fname=$_FILES['uploadedfile']['name']; //Function to strip the extension of a filename string function strip_ext($name)   {   $ext = strrchr($name, '.');   if($ext !== false)   {   $name = substr($name, 0, -strlen($ext)); } return $name; } // This will get the extension of the filename $FnameExt= end(explode('.',$Fname)); function createRandomName() {     $chars = "abcdefghijkmnopqrstuvwxyz023456789";     srand((double)microtime()*10000000);     $i = 0;     $pass = '' ;     while ($i <= 7) {         $num = rand() % 33;         $tmp = substr($chars, $num, 1);         $pass = $pass . $tmp;         $i++;     }     return $pass; } // Usage $randomName = createRandomName(); //retrieve file name // Where the file is going to be placed $target_path = "images"; /* Add the original filename to our target path.  Result is "uploads/filename.extension" */ $target_path = "images"; $_FILES['uploadedfile']['tmp_name']; if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path.'/'.$randomName.".".$FnameExt)) { //show the user their link     echo htmlentities('<a href="http://www.hostmapics.com/"><img src="http://hostmapics.com/');     echo $target_path.'/'.$randomName.".".$FnameExt;     echo htmlentities('"></a>'); } else{     echo "There was an error uploading the file, please try again!"; } ?> [/code] heres what i need to work on now: -an extension verification script -use a database or random selection for dir 1-1000 for the images/****/name.ext what else do i need? and should i use classes or should i just do everything on this page like i am now?
  7. alright thanks, i'll try it out tomorrow i really appreciate it :)
  8. didnt work... in order to change the file name, dont i have to store the extension some how first?
  9. i changed it to "basename($_FILES['randomName']..." then changed the rest of the "uploadedfile" to randomName also, but im guessing that doesnt work because it doesnt recognize the file because from the form i named it "uploadedfile" so i need somehow to change it from uploadedfile to a randomName...? maybe thats not what you were saying?
  10. wow sorry, that code wasnt supposed to be in there, it doesnt work with the rename function the way i had it... so pretend that isnt in there please, then help me i will take it out thanks, pat
  11. i've looked all over, but i cant figure out how i would change the file name to a randomly generated name... heres my code so far [code] <?php function createRandomName() {     $chars = "abcdefghijkmnopqrstuvwxyz023456789";     srand((double)microtime()*10000000);     $i = 0;     $pass = '' ;     while ($i <= 7) {         $num = rand() % 33;         $tmp = substr($chars, $num, 1);         $pass = $pass . $tmp;         $i++;     }     return $name; } $randomName = createRandomName(); // Where the file is going to be placed $target_path = "images/"; /* Adding the original filename to my target path.  Result is "uploads/filename.extension" */ $target_path = $target_path . basename($_FILES['uploadedfile']['name']); $_FILES['uploadedfile']['tmp_name']; if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {     echo htmlentities('<a href="http://www.hostmapics.com/"><img src="http://hostmapics.com/'); echo $target_path; echo htmlentities('"></a>'); } else{     echo "There was an error uploading the file, please try again!"; } ?> [/code] incorperate the random name and how to rename the file just uploaded? thanks
  12. alright guys, this is finally what iput down and it works. thanks guys [code] if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {     echo htmlentities('<a href="http://www.hostmapics.com/"><img src="http://hostmapics.com/'); echo $target_path; echo htmlentities('"></a>'); } else{     echo "There was an error uploading the file, please try again!"; }[/code]
  13. well i want it to echo so it says the actual code for the link, not just the unerlined link itself
  14. in PHP how do i echo something so it says the code for a link? i tried but it says unexpected '<' in line 89... :(
  15. hey i'm working on a public upload site and for some reason it just says "There was an error uploading the file, please try again!" whenever i try to upload something [code] // Where the file is going to be placed $target_path = "images/"; /* Add the original filename to our target path.  Result is "uploads/filename.extension" */ $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); $_FILES['uploadedfile']['tmp_name'];  if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {     echo "The file ".  basename( $_FILES['uploadedfile']['name']).     " has been uploaded"; } else{     echo "There was an error uploading the file, please try again!"; } [/code] and this is the form that leads to that [code] <form enctype="multipart/form-data" action="photoparse.php" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="100000" /> Choose a file to upload: <input name="uploadedfile" type="file" /><br /> <input type="submit" value="Upload File" /> </form> [/code] ?? i checked everything i think...
  16. everytime someone uploads an image, i would like it to create a page for that specific image such as on imageshack... does anybody know how or what tutorials i could use to figure this out?
  17. im trying to figure out the same thing bro
  18. yes, thank you... there was a space after the closing tag. could you tell me why this happens... for future reference? thanks
  19. <? $dbhost = '***'; $dbusername = '***'; $dbpasswd = '***'; $database_name = '***'; $connection = mysql_pconnect("$dbhost","$dbusername","$dbpasswd")     or die ("Couldn't connect to server."); $db = mysql_select_db("$database_name", $connection)     or die("Couldn't select database."); ?>
  20. I am getting this error: Warning: Cannot modify header information - headers already sent by (output started at db.php:14) in checkuser.php on line 39 line 39 = mysql_query("UPDATE users... [code] if($login_check > 0){     while($row = mysql_fetch_array($sql)){     foreach( $row AS $key => $val ){         $$key = stripslashes( $val );     }         // Register some session variables!         session_register('first_name');         $_SESSION['first_name'] = $first_name;         session_register('last_name');         $_SESSION['last_name'] = $last_name;         session_register('email_address');         $_SESSION['email_address'] = $email_address;         session_register('special_user');         $_SESSION['user_level'] = $user_level;                 mysql_query("UPDATE users SET last_login=now() WHERE userid='$userid'");         header("Location: login_success.php");     } [/code] i cant figure out what is wrong..
  21. alright, this is really starting to frustrate me... now it says "Column count doesn't match value count at row 1" when i try to register this is my regiser.php: [code] <? $first_name = $_POST['first_name']; $last_name = $_POST['last_name']; $email_address = $_POST['email_address']; $password = $_POST['password']; $repassword = $_POST['repassword']; $first_name = stripslashes($first_name); $last_name = stripslashes($last_name); $email_address = stripslashes($email_address);$password = stripslashes($password); $repassword = stripslashes($repassword); if((!$first_name) || (!$last_name) || (!$email_address)){     echo 'You did not submit the following required information! <br />';     if(!$first_name){         echo "First Name is a required field. Please enter it below.<br />";     }     if(!$last_name){         echo "Last Name is a required field. Please enter it below.<br />";     }     if(!$email_address){         echo "Email Address is a required field. Please enter it below.<br />";     }     if(!$password==repassword){         echo "Passwords are not the same.<br />";     }     include 'join_form.html';     exit(); }     # does this user already exist in the database? lets check for that now... $sql_email_check = mysql_query("SELECT email_address FROM users WHERE email_address='$email_address'"); $email_check = mysql_num_rows($sql_email_check);     if($email_check > 0){         echo "<strong>Your email address has already been used by another member in our database. Please use a different Email address!";         unset($email_address);     include 'join_form.html';     exit(); } $sql = mysql_query("INSERT INTO users (first_name, last_name, email_address, password,  signup_date, decrypted_password)         VALUES('$first_name', '$last_name', '$email_address', '$db_password',now())") or die (mysql_error()); if(!$sql){     echo 'There has been an error creating your account. Please contact the webmaster.'; } else {     $userid = mysql_insert_id();     // Let's mail the user!     $subject = "Your Membership at mywebsite.com";     $message = "Dear $first_name $last_name,     You are now registered at our website, http://www.mywebsite.com!         To activate your membership, please login here: http://www.patall8.100webspace.net/login_form.html         Once you activate your membership, you will be able to login with the following information:     Password: $password     Please keep this username and password in a location that is easily accessible by you.         Thanks!     Pat         This is an automated response, please do not reply!";         mail($email_address, $subject, $message, "From:    <mr.monicaclinton@gmail.com@>\nX-Mailer: PHP/" . phpversion());     echo 'Your membership information has been mailed to your email address! Please check it and follow the directions!'; } ?> [/code] and my mySQL query contains: userid first_name last_name email_address password signup_date activated decrypted_password sorry for asking for so much help but ive been trying to figure it out for a couple hours now
  22. i'm still working with the membership code and there isnt a checkuser.php can anyone give me a simple code to check if the username and password match, then send them to login_success.php? thanks in advance
×
×
  • 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.