Jump to content

Twentyoneth

Members
  • Posts

    118
  • Joined

  • Last visited

    Never

About Twentyoneth

  • Birthday 08/12/1988

Contact Methods

  • MSN
    lover_boy699@hotmail.com
  • Website URL
    http://12.27.247.70:8000/music

Profile Information

  • Gender
    Male
  • Location
    Glasgow, KY

Twentyoneth's Achievements

Member

Member (2/5)

0

Reputation

  1. I'm using "$working dir = getcwd()" like this: if ($user == $workingdir) { so if a user logs in as "ThoMas", and the url they went to was "thomas", it poses a problem....
  2. Well, what I mean is, how can I make it where you cannot get to this address: http://whatever.com/ThoMas by typing http://whatever.com/thomas I need this for some code that checks to see if the user is the same as the directory they are in to show certain code. But also when a guest visits the site via http://whatever.com/thomas, the code that checks for ThoMas doesn't work...
  3. I have looked in the php.ini file and the apache config file, and I didn't see anything that would let me force exact dir names. Did I miss something?
  4. I have directories like "New" and "Old", you can get to them by typing "New" "new" "old" "old", not recognizing the capital letters, how to I make it where only type "New" and "Old" will work because they have capitals in them, also for dirs like "NewOld", you can get to them by typing "NewOld" or "newold", I need capitalization recognition....any help?
  5. I am trying to write a file that contains php in it...it worked fine when the forms action was itself, except that it would write the wrong data to the file, because I was using variables that were used elsewhere in the page. Needless to say, I moved the forms action to it's own personal page, and now it will not open the file to write to it, I am thinking it's because it is in a different directory than the form itself... mcomponents.php (included in the index file via ?func=mcomponents.php) <?php echo "<td vAlign='top' align='center'> <center>This form is to select which components you would like to appear on your page for others to see. For example, if you would not like for anyone other than yourself to view your age, simply choose no, and then submit.<br><br><b>Be sure to set all components!</b></center> <form action='components/mcomponents2.php' method='POST'> <table border='0' cellpadding='5px' cellspacing='0'> <tr> <td> About Me: </td> <td> <select name='aboutme'> <option value='yes'>Yes</option> <option value='no'>No</option> </select> </td> <td> </td> </tr> <tr> <td> Age: </td> <td> <select name='age'> <option value='yes'>Yes</option> <option value='no'>No</option> </select> </td> <td> </td> </tr> <tr> <td> Banner: </td> <td> <select name='banner'> <option value='yes'>Yes</option> <option value='no'>No</option> </select> </td> <td> </td> </tr> <tr> <td> Comments: </td> <td> <select name='comments'> <option value='yes'>Yes</option> <option value='no'>No</option> </select> </td> <td> </td> </tr> <tr> <td> Contact: </td> <td> <select name='contact'> <option value='yes'>Yes</option> <option value='no'>No</option> </select> </td> <td> </td> </tr> <tr> <td> Email: </td> <td> <select name='email'> <option value='yes'>Yes</option> <option value='no'>No</option> </select> </td> <td> </td> </tr> <tr> <td> Friends: </td> <td> <select name='friends'> <option value='yes'>Yes</option> <option value='no'>No</option> </select> </td> <td> </td> </tr> <tr> <td> Interests: </td> <td> <select name='interests'> <option value='yes'>Yes</option> <option value='no'>No</option> </select> </td> <td> </td> </tr> <tr> <td> Name: </td> <td> <select name='name'> <option value='yes'>Yes</option> <option value='no'>No</option> </select> </td> <td> </td> </tr> <tr> <td> Posts: </td> <td> <select name='posts'> <option value='yes'>Yes</option> <option value='no'>No</option> </select> </td> <td> </td> </tr> <tr> <td> Profile Picture: </td> <td> <select name='profilepicture'> <option value='yes'>Yes</option> <option value='no'>No</option> </select> </td> <td> </td> </tr> <tr> <td> Sex: </td> <td> <select name='sex'> <option value='yes'>Yes</option> <option value='no'>No</option> </select> </td> <td> </td> </tr> <tr> <td> Sexual Preference: </td> <td> <select name='sexualpref'> <option value='yes'>Yes</option> <option value='no'>No</option> </select> </td> <td> </td> </tr> <tr> <td> Subscription: </td> <td> <select name='subscriptions'> <option value='yes'>Yes</option> <option value='no'>No</option> </select> </td> <td> </td> </tr> <tr> <td> User Menu: </td> <td> <select name='usermenu'> <option value='yes'>Yes</option> <option value='no'>No</option> </select> </td> <td> </td> </tr> <tr> <td> Welcome Note: </td> <td> <select name='welcome'> <option value='yes'>Yes</option> <option value='no'>No</option> </select> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> <input type='submit' name='submit' value='submit' /> </td> </tr> </table> </form>"; ?> mcomponents2.php <?php if ($_POST['submit']) { $paboutme = $_POST['aboutme']; $page = $_POST['age']; $pbanner = $_POST['banner']; $pcomments = $_POST['comments']; $pcontact = $_POST['contact']; $pemail = $_POST['email']; $pfriends = $_POST['friends']; $pinterests = $_POST['interests']; $pname = $_POST['name']; $pposts = $_POST['posts']; $pprofilepicture = $_POST['profilepicture']; $psex = $_POST['sex']; $psexualpref = $_POST['sexualpref']; $psubscriptions = $_POST['subscriptions']; $pusermenu = $_POST['usermenu']; $pwelcome = $_POST['welcome']; $writefile = ("components/list.php"); $write = "<?php $aboutme = '" . $paboutme . "'; $age = '" . $page . "'; $banner = '" . $pbanner . "'; $comments = '" . $pcomments . "'; $contact = '" . $pcontact . "'; $email = '" . $pemail . "'; $friends = '" . $pfriends . "'; $interests = '" . $pinterests . "'; $name = '" . $pname . "'; $posts = '" . $pposts . "'; $profilepicture = '" . $pprofilepicture . "'; $sex = '" . $psex . "'; $sexualpref = '" . $psexualpref . "'; $subscriptions = '" . $psubscriptions . "'; $usermenu = '" . $pusermenu . "'; $welcome = '" . $pwelcome . "'; ?>"; $writewrite = fopen($writefile, 'w') or die("Sorry, your components list could not be updated at this time, please try again later<br><br>"); fwrite($writewrite, $write); fclose($writewrite); echo "Your components list has been modified.<br><br>"; } ?> How do I get it to open the file?
  6. I have gotten it working with this code, once I realized that it reversed and echo'd them, just kept doing it, it is because the top number was telling it when to stop echoing, so this fixed it, alot of code, but it works $dir = "comments/"; $numberfile = "info/cammount.php"; $topnumber = file_get_contents($numberfile); $count = 0; $total = 0; $gettotal = scandir($dir, 1); foreach($gettotal as $totalvalue) { if ($totalvalue !== "." && $totalvalue !== "..") { $total++; } } if ($total >= $topnumber) { $value = scandir($dir, 1); while ($count < $topnumber) { foreach($value as $file) { if($file !== "." && $file !== ".." && $count < $topnumber) { $date = substr($file, 0, 2) . "/" . substr($file, 2, 2) . "/" . substr($file, 4,2); $time = substr($file, 7, 2) . ":" . substr($file, 10, 4); $user = substr($file, 17, -4); $timestamp = ("Posted on <span class='date'>" . $date . "</span> at <span class='time'>" . $time . "</time> by <span class='user'>" . $user . "</span>"); $commentlink = $dir.$file; $picfile = ("../" . $user . "/pictures/default/default.php"); $picture = file_get_contents($picfile); $comment = file_get_contents($commentlink); echo "<div class='usercomment'> <table cellpadding='0' cellspacing='0' width='100%'> <tr> <td class='usercommentpic'> <a href='../" . $user . "'><img src='" . $picture . "' width='120px' height='120px'></img></a> </td> <td vAlign='top'> <table width='100%' height='100%' class='commentspace' cellpadding='0' cellspacing='0'> <tr> <td class='timestamp'> " . $timestamp . " </td> </tr> <tr> <td class='usercommentcomment' vAlign='top'> " . $comment . " </td> </tr> </table> </td> </tr> </table> </div> <br>"; $count++; } } } } elseif ($total < $topnumber) { $value = scandir($dir, 1); while ($count < $total) { foreach($value as $file) { if($file !== "." && $file !== ".." && $count < $topnumber) { $date = substr($file, 0, 2) . "/" . substr($file, 2, 2) . "/" . substr($file, 4,2); $time = substr($file, 7, 2) . ":" . substr($file, 10, 4); $user = substr($file, 17, -4); $timestamp = ("Posted on <span class='date'>" . $date . "</span> at <span class='time'>" . $time . "</time> by <span class='user'>" . $user . "</span>"); $commentlink = $dir.$file; $picfile = ("../" . $user . "/pictures/default/default.php"); $picture = file_get_contents($picfile); $comment = file_get_contents($commentlink); echo "<div class='usercomment'> <table cellpadding='0' cellspacing='0' width='100%'> <tr> <td class='usercommentpic'> <a href='../" . $user . "'><img src='" . $picture . "' width='120px' height='120px'></img></a> </td> <td vAlign='top'> <table width='100%' height='100%' class='commentspace' cellpadding='0' cellspacing='0'> <tr> <td class='timestamp'> " . $timestamp . " </td> </tr> <tr> <td class='usercommentcomment' vAlign='top'> " . $comment . " </td> </tr> </table> </td> </tr> </table> </div> <br>"; $count++; } } } }
  7. $file = scandir($dir, 1); while ($count < $topnumber) { foreach($file as $value) { if($value !== "." && $value !== "..") { echo "this is " . $value . "<br>"; $count++; } } } That returns this: this is 020107-11-57am - Test.php this is 020107-11-27am - Test.php this is 020107-11-57am - Test.php this is 020107-11-27am - Test.php this is 020107-11-57am - Test.php this is 020107-11-27am - Test.php this is 020107-11-57am - Test.php this is 020107-11-27am - Test.php this is 020107-11-57am - Test.php this is 020107-11-27am - Test.php It's a start?
  8. Sorry, you were posting at the same time I was editing, but my current code and what not is up a post.
  9. Yes, but I have never used scandir, so I am not quite familiar with how to use it all that well :S This is my current code: <?php $dir = "comments/"; $numberfile = "info/cammount.php"; $topnumber = file_get_contents($numberfile); $count = 0; if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = scandir($dh, 1)) !== false) { if($file !== "." && $file !== ".." && $file !== "Thumbs.db" && $count < $topnumber) { $date = substr($file, 0, 2) . "/" . substr($file, 2, 2) . "/" . substr($file, 4,2); $time = substr($file, 7, 2) . ":" . substr($file, 10, 4); $user = substr($file, 17, -4); $timestamp = ("Posted on <span class='date'>" . $date . "</span> at <span class='time'>" . $time . "</time> by <span class='user'>" . $user . "</span>"); $commentlink = $dir.$file; $picfile = ("../" . $user . "/pictures/default/default.php"); $picture = file_get_contents($picfile); $comment = file_get_contents($commentlink); echo "<div class='usercomment'> <table cellpadding='0' cellspacing='0' width='100%'> <tr> <td class='usercommentpic'> <a href='../" . $user . "'><img src='" . $picture . "' width='120px' height='120px'></img></a> </td> <td vAlign='top'> <table width='100%' height='100%' class='commentspace' cellpadding='0' cellspacing='0'> <tr> <td class='timestamp'> " . $timestamp . " </td> </tr> <tr> <td class='usercommentcomment' vAlign='top'> " . $comment . " </td> </tr> </table> </td> </tr> </table> </div> <br>"; $count++; } } closedir($dh); } } ?> It only returns 10 blank comments, there is only 2...and they are not blank. Did I do it wrong?
  10. How would I implement that into my current code?
  11. I have a page, where you can comment, making comments is fine, but listing them is seeming to be a bit of a task for me. The problem is, it will display the first file (comment) in the directory. Rather than the latest or last. <?php $dir = "comments/"; $numberfile = "info/cammount.php"; //contains max number of comments allowed to be displayed $topnumber = file_get_contents($numberfile); $count = 0; if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { if($file !== "." && $file !== ".." && $file !== "Thumbs.db" && $count < $topnumber) { //$file is the files in the "comments/" directory, the filename looks like this: 020107-11-57am - Test.php $date = substr($file, 0, 2) . "/" . substr($file, 2, 2) . "/" . substr($file, 4,2); $time = substr($file, 7, 2) . ":" . substr($file, 10, 4); $user = substr($file, 17, -4); $timestamp = ("Posted on <span class='date'>" . $date . "</span> at <span class='time'>" . $time . "</time> by <span class='user'>" . $user . "</span>"); $commentlink = $dir.$file; $picfile = ("../" . $user . "/pictures/default/default.php"); $picture = file_get_contents($picfile); $comment = file_get_contents($commentlink); echo "<div class='usercomment'> <table cellpadding='0' cellspacing='0' width='100%'> <tr> <td class='timestamp'> " . $timestamp . " </td> </tr> <tr> <td class='belowtimestamp'> <table cellpadding='0' cellspacing='0' width='100%'> <tr> <td class='usercommentpic'> <img src='" . $picture . "' width='120px' height='120px'></img> </td> <td class='usercommentcomment' vAlign='top'> " . $comment . " </td> </tr> </table> </td> </tr> </table> </div>"; $count++; } } closedir($dh); } } ?> Any ideas on how to get it to show the last 10 rather than the first 10?
  12. It will not include the file at all :S
  13. It is empty, and the path is the same for all of the files....(I would use a database, but I have experience, I have no idea how to do it :S)
  14. Same outcome, anyother solutions, or workarounds?
×
×
  • 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.