Jump to content

antwonw

Members
  • Posts

    13
  • Joined

  • Last visited

Contact Methods

  • Website URL
    http://anthonywhitephotography.com

Profile Information

  • Gender
    Not Telling

antwonw's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Alrighty, Thanks anyways. I thought it might be possible but I am learning. So in case you're wondering this is what I did. In Head <script> // ======================================= // set the following variables // ======================================= // Set speed (milliseconds) var speed = 5000 // Specify the image files var Pic = new Array() // don't touch this // to add more images, just continue // the pattern, adding to the array below Pic[0] = 'images/main/image1.jpg' Pic[1] = 'images/main/image2.jpg' Pic[2] = 'images/main/image3.jpg' Pic[3] = 'images/main/image4.jpg' Pic[4] = 'images/main/image5.jpg' Pic[5] = 'images/main/image6.jpg' Pic[6] = 'images/main/image7.jpg' Pic[7] = 'images/main/image8.jpg' Pic[8] = 'images/main/image9.jpg' Pic[9] = 'images/main/image10.jpg' Pic[10] = 'images/main/image11.jpg' // ======================================= // do not edit anything below this line // ======================================= var t var j = 0 var p = Pic.length var preLoad = new Array() for (i = 0; i < p; i++){ preLoad[i] = new Image() preLoad[i].src = Pic[i] } function runSlideShow(){ document.images.SlideShow.src = preLoad[j].src j = j + 1 if (j > (p-1)) j=0 t = setTimeout('runSlideShow()', speed) } </script> Body line <body onload="runSlideShow();"> My image in the Body <img src="image1.jpg" name="SlideShow" width="780px" height="469" /> Again, thanks for the point in the right direction!!
  2. So I have this script below that will look for my jpgs in a certain folder and then randomly display them. It works great but I am wanting to take this one step further. I am wanting to make it so the image changes to another random image from the same folder at a certain interval--say 3 seconds. But I am not wanting it to reload the page. I realize I could do this with Java but I don't want to for several reasons, one being that some people have Java disabled and I still want it to change the image. So does anyone have any suggestions? I am a new-self-taught-learning PHP coder. Thanks! <?php /* * Name your images 1.jpg, 2.jpg etc. * * Add this line to your page where you want the images to * appear: <?php include "randomimage.php"; ?> */ // Change this to the total number of images in the folder $total = "11"; // Change to the type of files to use eg. .jpg or .gif $file_type = ".jpg"; // Change to the location of the folder containing the images $image_folder = "images/random"; // You do not need to edit below this line $start = "1"; $random = mt_rand($start, $total); $image_name = $random . $file_type; echo "<img src=\"$image_folder/$image_name\" alt=\"$image_name\" />"; ?>
  3. AWESOME!!! Thanks for the help!!! Here is what I did. if ($error == '') { $redirectUrl = "/galleries"; print "<script type=\"text/javascript\">"; print "window.location.href = '$redirectUrl'"; print "</script>"; } else echo $error; Again, thanks for the help!!!
  4. So I take it no one can help me out or at least point me in the right direction? I can't use MYSQL unfortunately.
  5. Problem is I can read and understand PHP to a limit but writing it is another thing for me. I'm self taught and still learning.
  6. So does anyone have a suggestion for another PHP Authentication Application that is purely PHP. I can't do SQL/Databases at all or else I would. Any ideas or suggestions? I also need it to redirect to a different page once login. Thanks!
  7. I still got the same thing! Warning: Cannot modify header information - headers already sent by (output started at C:\Inetpub\vhosts\site.org\httpdocs\login.php:28) in C:\Inetpub\vhosts\site.org\httpdocs\login.php on line 78
  8. Can anyone help me? It'd be very much appreciated!
  9. This did not work. I got a return error of the follow: Warning: Cannot modify header information - headers already sent by (output started at C:\Inetpub\vhosts\site.org\httpdocs\login.php:28) in C:\Inetpub\vhosts\site.org\httpdocs\login.php on line 77 Any suggestions? Thanks! AW
  10. Hey, So I have implemented a login script to my site. The only problem is when it loads it refreshes the page and displays "Welcome $username! You are logged in! Visit the Galleries Page!" I tried using a "header('Location: /galleries/');" to redirect on login but I couldn't get it to work. Here is my login page login.php <?php require_once('common.php'); $error = '0'; if (isset($_POST['submitBtn'])){ // Get user input $username = isset($_POST['username']) ? $_POST['username'] : ''; $password = isset($_POST['password']) ? $_POST['password'] : ''; // Try to login the user $error = loginUser($username,$password); } ?> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Galleries</title> <link rel="stylesheet" type="text/css" media="screen" href="css/login.css" /> </head> <body bgcolor="000000"> <table id="rotator" border="0" width="100%" height="100%"> <tr> <td align="center"> <table id="loginbox" border="0" width="339" height="339"> <tr> <td> <table border="0" background="" width="280" height="280" align="center"> <form name="loginform" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <tr> <td colspan="2" height="40px"> </td> </tr> <tr> <td align="center" colspan="2"> <h2>Login</h2> </td> </tr> <tr height="5px"> <td align="center"> <font color="#ffffff"> Username: </font> </td> <td> <input class="text" type="text" name="username" size="18" maxlength="18"> </td> </tr> <tr height="5px"> <td align="center"> <font color="#ffffff"> Password: </font> </td> <td> <input class="text" type="password" name="password" size="18" maxlength="18"> </td> </tr> <tr height="60px"> <td align="center" colspan="2"> <input class="text" type="submit" name="submitBtn" value="Login"> <input class="text" type="reset" name="Clear" value="Clear"> </td> </tr> <tr> <td align="center" colspan="2" height="50px"> <?php if (isset($_POST['submitBtn'])){ ?> <?php if ($error == '') { echo "<h3>Welcome $username! <br/>You are logged in!<br/><br/></h3"; echo '<h3><a href="/galleries/">Visit the Galleries Page!</a></h3>'; } else echo $error; ?> <?php } ?> </td> </tr> </form> </table> </td> </tr> </table> </td> </tr> </table> </body> </html> Here is the common.php file common.php <?php session_start(); function registerUser($user,$pass1,$pass2){ $errorText = ''; // Check passwords if ($pass1 != $pass2) $errorText = "Passwords are not identical!"; elseif (strlen($pass1) < 6) $errorText = "Password is to short!"; // Check user existance $pfile = fopen("pwd.asp","a+"); rewind($pfile); while (!feof($pfile)) { $line = fgets($pfile); $tmp = explode(':', $line); if ($tmp[0] == $user) { $errorText = "The selected user name is taken!"; break; } } // If everything is OK -> store user data if ($errorText == ''){ // Secure password string $userpass = md5($pass1); fwrite($pfile, "\r\n$user:$userpass"); } fclose($pfile); return $errorText; } function loginUser($user,$pass){ $errorText = ''; $validUser = false; // Check user existance $pfile = fopen("pwd.asp","r"); rewind($pfile); while (!feof($pfile)) { $line = fgets($pfile); $tmp = explode(':', $line); if ($tmp[0] == $user) { // User exists, check password if (trim($tmp[1]) == trim(md5($pass))){ $validUser= true; $_SESSION['userName'] = $user; } break; } } fclose($pfile); if ($validUser != true) $errorText = "<font color='red'>Invalid username or password!</font>"; if ($validUser == true) $_SESSION['validUser'] = true; else $_SESSION['validUser'] = false; return $errorText; } function logoutUser(){ unset($_SESSION['validUser']); unset($_SESSION['userName']); } function checkUser(){ if ((!isset($_SESSION['validUser'])) || ($_SESSION['validUser'] != true)){ header('Location: ../login.php'); } } ?> I still want it to display "Invalid username or password!" and the other error's on the login.php page. But I want a successful login to redirect to "galleries.php" Can anyone help me with this. I can't seem figure this one out. Thanks! AW
  11. I finally got it to work with this... Upload File: <form name=upload action="upload.php" method="post" enctype="multipart/form-data"> <input type="file" name="file" size="30"> <input type="submit" value="Upload"> </form> <?php $DestinationDir = "/xampp/htdocs/upload/"; $DestinationFile = $DestinationDir . $_FILES['file']['name']; If (move_uploaded_file($_FILES['file']['tmp_name'], $DestinationFile)) { Echo "File uploaded successfully."; }Else{ Echo $_FILES['file']['error']; } ?> Only problem is I am wanting to add it to another page and I used this... <td> <?php include( "upload.php" ); ?> </td> Well in the other page it doesn't upload. But if I got directly to my 'upload.php' file it does upload. What am I doing wrong? Thanks, Antwonw
  12. Hey, I am trying to write this upload script for my website. But so far there are two things I don't like. 1. They are two separate files 'form.html' and 'uploader.php' 2. The stupid thing isn't uploading in any case What I would like to do... 1. Get it to work 2. Put it in one file Here is the code for the 'form.html' Upload: <form action="uploader.php" method="post" enctype="multipart/form-data"> <input type="file" name="file" size="30"> <input type="submit" value="Upload File"> </form> And here is the code for my 'uploader.php' <?php if($file_name !="") { copy ("$file", "../homes/$file_name") or die("Could not copy file"); } else { die("No file specified"); } ?> So can anyone tell me... 1. What is wrong and why it won't upload 2. How I can merge them together Thanks, Antwonw
×
×
  • 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.