Jump to content

thyscorpion

Members
  • Posts

    46
  • Joined

  • Last visited

    Never

Everything posted by thyscorpion

  1. I am starting a new project which is mainly creating a smooth GUI with SQL DB access and 150GB worth of flash and animaton mpgs. was wondering which language would be more robust and easy on the systems.. the matter will be on a server from which the multiple clients will access the media ...
  2. Thanks! :-) i had just figured it out and after testing it was coming back to the forum to write what u wrote . :-) thanks.. it works now! sweeeet...
  3. well you can simply check the counter value every time the index.php loads and display it accordingly. The counter could be stored in a txt file .. or on a DB or as XML...
  4. I have my php on both fedora and on windows xp pro... but i am using windows currently.
  5. YEs you were right. i switched on the errors and i got this: "Fatal error: Call to undefined function imagecreatefromjpeg() in D:\www\ankur\upload2existingalbum.php on line 47" how do i install GD support to my PHP installation?
  6. this might help: http://www.webcheatsheet.com/PHP/file_upload.php cheers
  7. Hi , I got this code from a tutorial.. and it is not working on my php 5 server. according to me it stops working after this line. ( nothing i echo after it comes on teh screen.).. $img = imagecreatefromjpeg( $pathToImages.$philename ); echo "done so far... "; i am confused as to what could be the problem. am i using the imagecreatefromjpeg( ); wrongly? Please Advise... Thanks //////////////////////////////////////////////////////////////////////////////////////////////// // ------------------------------------------------------------------------------------------------------------------------------ function createThumbs( $pathToImages, $pathToThumbs, $thumbWidth, $philename ) { // open the directory // $dir = opendir( $pathToImages ); // loop through it, looking for any/all JPG files: // while (false !== ($fname = readdir( $dir ))) { // parse path for the extension // $info = pathinfo($pathToImages . $fname); // continue only if this is a JPEG image // if ( strtolower($info['extension']) == 'jpg' ) // { echo "Creating thumbnail for ".$philename." <br />"; echo "pathToImages:".$pathToImages."\n<br>"; echo "path = "."".$pathToImages.$philename.""."\n <br>"; // load image and get image size $img = imagecreatefromjpeg( $pathToImages.$philename ); echo "done so far... "; $width = imagesx( $img ); $height = imagesy( $img ); echo "width:".$width." height:".$height."\n <br>"; // calculate thumbnail size $new_width = $thumbWidth; $new_height = floor( $height * ( $thumbWidth / $width ) ); echo "new width:".$new_width." new height:".$new_height."\n <br>"; // create a new temporary image $tmp_img = imagecreatetruecolor( $new_width, $new_height ); // copy and resize old image into new image imagecopyresized( $tmp_img, $img, 0, 0, 0, 0, $new_width, $new_height, $width, $height ); // save thumbnail into a file imagejpeg( $tmp_img, "".$pathToThumbs.$philename."" ); // } // } // close the directory // closedir( $dir ); } $phath = "images/gallery_pics/".$album_id ."/"; $phathT= "images/gallery_pics/".$album_id ."/t/"; // call createThumb function and pass to it as parameters the path // to the directory that contains images, the path to the directory // in which thumbnails will be placed and the thumbnail's width. // We are assuming that the path will be a relative path working // both in the filesystem, and through the web for links createThumbs($phath,$phathT,100,$filename); // ------------------------------------------------------------------------------------------------------------------------------ ///////////////////////////////////////////////////////////////////////////////////////
  8. hi people, I am building a personal website where i also have a gallery and also some other pages that i would like to restrict access depending who is logged in. can anyone suggest a good way to implement a page wise user access/denial? { the page names and details are also stored on mysql as some of the pages are generated by the user (new gallery albums etc....) } Any idea would be welcome. Till now i only had two layers of restriction ( either u are a family member or u are not).. which i indicated on the user records.. but now with user generated albums .. i need to devise a way to control access to those php generated pages also.. (eg: the album names are kept in a table in mysql).. thanks a ton..
  9. understood. i will write the static part then.. will get back to you after that.. :-) cheers..
  10. yes thanks for the info. i knew all that. and the reason i was targeting php was merely to see if it could be done by me. The reason i didn't go for flash was exactly for the reasons you point out. But now i agree with you php might not be a good option as well! :-) hence... please help me in deciding what should i ultimately use for the web gallery. (it won't be a huge gallery.... 10 to 50 albums with 5 to 20 pics each in its peak!..) thanks for you patience in explaining the various languages... appreciate it.
  11. Hmm, understood. will css/js be able to give similar results? any links you can provide for me to learn how to do it? I agree flash is a much more slick and smooth looking option for my kind of work. but i have no clue about flash programming.. hence i was looking at php or js etc.. but if you have a link about a good flash tutorial to help me build a similar project. i will be thankful.
  12. hi, i am a not so new and not so old php developer and was planning to make a photo gallery like LinPHA for my site on my own. hence needed help along the way. i am sure a lot of you must be familiar with LinPHA http://linpha.sourceforge.net/wiki/index.php/Main_Page first question i have is how to make that tree like view for the albums like in window's explorer. (I am planing to use XML to store the path and info about the albums/pictures). any help will be welcome. i need a nudge to get started.. I am in no way looking for someone to do it for me. as i want to learn to do it myself. thanks guys..
  13. hi, thanks.. just wanted to ask one more thing.. i see i can get hrs mins and secs from the tdate.gethours() etc functions.. what is the function to get the date ( day month year) cause i need to negate it to the target date and then show the countdown..
  14. hi, i wrote this code for the time.. but i cant seem to find a way to refresh the time left values every second ( as a real time timer) Please help.. // Define your target date here $targetYear = 2007; $targetMonth = 10; $targetDay = 23; $targetHour = 12; $targetMinute = 00; $targetSecond = 00; // End target date definition $targetDate = mktime($targetHour,$targetMinute,$targetSecond,$targetMonth,$targetDay,$targetYear); // Define date format $dateFormat = "Y-m-d H:i:s"; $targetDateDisplay = date($dateFormat,$targetDate); $actualDateDisplay = date($dateFormat,$actualDate); echo "<br><br><center><p>Target Date decided: ".$targetDateDisplay."</p><br><br>"; echo "<div id=\"ccolor\">"; $actualDate = time(); $secondsDiff = $targetDate - $actualDate; $remainingDay = floor($secondsDiff/60/60/24); $remainingHour = floor(($secondsDiff-($remainingDay*60*60*24))/60/60); $remainingMinutes = floor(($secondsDiff-($remainingDay*60*60*24)-($remainingHour*60*60))/60); $remainingSeconds = floor(($secondsDiff-($remainingDay*60*60*24)-($remainingHour*60*60))-($remainingMinutes*60)); echo "<font color=red size=4> $remainingDay days, $remainingHour hours, $remainingMinutes minutes, $remainingSeconds seconds </font></center>"."<br>"; echo "</div>";
  15. Thanks :-) i am fool i didn't read up on javascripts! :-) cheerio
  16. Hey thanks.. One Question though.. Can i also instead of reloading the file. just direct to the page? (i am using POSTDATA on the same file.) so a simple loading of the php file instead of the reload/refresh option will work better. as when i use ur above code.. it warns me of POSTDATA being sent again. :-) sorry to trouble you again. my mistake. i should have been more clear.
  17. Hi, I looked and looked for half a day and have not found a solution for my problem, hence i am posting it here. I want to reload my php page once. I can't use header func as i need to run a lot of code and html tags before i require the reload. (say in the middle of the php page.) so its safe to assume i have given a load of chars to the browser before i want to reload/redirect to the same page. :-) Can anyone suggest any ideas on how to go about doing this automatically? Thanks a Ton....
  18. hi, Thanks for your effort and time.. i realized i had to just tweak the logic of the IF and other loops in the code to make it work.. thanks.. Its working now! Cheerio
  19. hey Koobazaur, i did that with my second php file which i shared in this topic above. still i am getting the same problem. any ideas?
  20. hmm u got a valid point there Wuhtzu. I just added tried this code in addition to the code i shared with u above . the above code was "index.php" i have added another line at the end of the code (after being logged in.) which directs a new script page which does exactly what you point out is missing in my index.php. but still the page doesn't work. here are the codes of the two pages: <?php // Start the login session session_start(); ?> ..................... ..............[Rest of HTML] ..................... <div id="footer"> <img src="images/footer.jpg" alt="Ankur Bakshi 'Copy Right'\"> <?php include("dbinfo.inc.php"); $db = mysql_connect(localhost,$user,$password) or die("Couldn't connect to the database."); mysql_select_db($database) or die("Couldn't select the database"); // Add slashes to the username, and make a md5 checksum of the password. $_POST['user'] = addslashes($_POST['user']); $_POST['pass'] = md5($_POST['pass']); $result = mysql_query("SELECT count(id) FROM people WHERE user_pw='$_POST[pass]' AND username='$_POST[user]'") or die("Couldn't query the user-database."); $num = mysql_result($result, 0); mysql_close(); if (!$num) { // When the query didn't return anything, // display the login form. echo "<form id='login' action='$_SERVER[php_SELF]' method='post'>"; echo "<!--Username:--><input type='text' class='theInput' name='user' />"; echo "<!--Password: --><input type='password' class='theInput' name='pass' />"; echo "<input type='submit' value='login' class='theSubmit' name='Submit' /></form>"; } else { // Start the login session //session_start(); // We've already added slashes and MD5'd the password $_SESSION['user'] = $_POST['user']; $_SESSION['pass'] = $_POST['pass']; // All output text below this line will be displayed // to the users that are authenticated. Since no text // has been output yet, you could also use redirect // the user to the next page using the header() function. // header('Location: page2.php'); echo "<h1>Welcome</h1><a href='logout.php'>Logout</a>"; echo "You're now logged in. Try visiting <a href='login.php'>login page</a>."; echo "You are authenticated as " . $_SESSION['user'] . "<br>"; } ?> </div> </div> </body> </html> Second file (picked up from a tutorial) ( to my knowledge it points back to the index.php page if session is not found. <?php session_start(); // Start the login session if (!$_SESSION['user'] || !$_SESSION['pass']) { // What to do if the user hasn't logged in // We'll just redirect them to the login page. header('Location: index.php'); die(); } else { // If the session variables exist, check to see // if the user has access. include("dbinfo.inc.php"); $db = mysql_connect(localhost,$user,$password) or die("Couldn't connect to the database."); mysql_select_db($database) or die("Couldn't select the database"); $result = mysql_query("SELECT count(id) FROM users WHERE user_pw='$_SESSION[pass]' AND username='$_SESSION[user]'") or die("Couldn't query the user-database."); $num = mysql_result($result, 0); mysql_close(); if (!$num) { // If the credentials didn't match, // redirect the user to the login screen. header('Location: index.php'); die(); } } // All output text below this line will be displayed // to the users that are authenticated. echo "<h1>Access Granted</h1>"; echo "You see? It travelled over these two pages.<br><br>"; echo "You are authenticated as " . $_SESSION['user'] . "<br>"; echo "The MD5 checksum of your password is " . $_SESSION['pass']; ?>
  21. SORRY i have used the session_start(); command in my page. its before the <html> tag of my file. (its shown in the code i attached with my first post. am i doing it wrong? oops! :-P i feel like an ass! lol yup i accidently commented the session_start func.. SORRY i have removed it. but still no change in my problem... when i login.. after that if i just load the same page again also. the login form comes up again. To my knowledge it shouldn't.. :-)
  22. i have used the session_start(); command in my page. its before the <html> tag of my file. (its shown in the code i attached with my first post. am i doing it wrong?
×
×
  • 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.