
Shockdot
Members-
Posts
27 -
Joined
-
Last visited
Everything posted by Shockdot
-
I changed the PHP code to the below. However, it's saying that $_FILE['file'] is not set.... <?php if(isset($_FILES['file'])) { for($i = 0; $i < count($_FILES['file']['name']); $i++) { echo($_FILES['file']['name'][$i]); echo($_FILES['file']['type'][$i]); echo($_FILES['file']['tmp_name'][$i]); echo($_FILES['file']['error'][$i]); echo($_FILES['file']['size'][$i]); } } else { echo("Not Set"); } ?>
-
Hey, I'm trying to create a multiple image upload function for my website... However, it keeps saying this... ( ! ) Notice: Undefined index: file in C:\wamp\www\VAF\admin\uploadpic.php on line 3 Call Stack # Time Memory Function Location 1 0.0004 679336 {main}( ) ..\uploadpic.php:0 Here's my code. <?php ob_start(); session_start(); include("Config.php"); if(isset($_SESSION['username'])) { $username = $_SESSION['username']; $permission = $_SESSION['permission']; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link type="text/css" rel="stylesheet" href="CSS/CSS.css" /> <title><?php echo($title); ?></title> </head> <body> <div class="container"> <div class="loginContainer"> <img src="Images/BGTop.jpg" alt="VAF Studio" /> <?php if(isset($username)) { ?> Welcome <?php echo($username); ?>, please select what you would like to do from the list provided below... <ul> <li><a href="<?php echo($addPics); ?>">Add Pictures</a></li> <li><a href="<?php echo($addVids); ?>">Add Videos</a></li> <li><a href="<?php echo($changePrices); ?>">Change Prices</a></li> <li><a href="logout.php">Logout</a></li> </ul> <form action="uploadpic.php" method="post" enctype="multipart/form-data"> <label for="file">Filename: </label> <input type="hidden" name="MAX_FILE_SIZE" value="90000" /> <input type="file" name="file[]" id="file" multiple="true" /> <input type="submit" name="submit" value="Upload" /> </form> <?php } else { ?> <form action="checklogin.php" method="post" class="loginForm"> <label for="username">Username: </label> <input type="text" name="username" id="username" /> <br /> <label for="password">Password: </label> <input type="password" name="password" id="password" /> <br /> <input type="submit" value="Login" class="loginSubmit" name="loginsubmit" id="loginsubmit" /> </form> <?php if(isset($_GET['state'])) { if($_GET['state'] = "invalid") { ?> <div class="clear"></div> <div class="loginError"> Invalid Username or Password. </div> <?php } } } ?> </div> </div> </body> </html> <?php $files = array(); $fdata = $_FILES['file']; if(is_array($fdata['name'])) { for($i = 0; $i < count($fdata['name']); $i++) { $files[] = array( "name" => $fdata['name'][$i], "type" => $fdata['type'][$i], "tmp_name" => $fdata['tmp_name'][$i], "error" => $fdata['error'][$i], "size" => $fdata['size'][$i]); echo($files[$i]); } } else { $files[] = $fdata; } ?> Help would be greatly appreciated!
-
I'm not sure how I could go about switching testimonials..
-
So I'm trying to make a testimonial panel for my website that displays 2 testimonials at a time. The testimonials are stored in a MySQL Database. So basically, what I want it to do is this. 1) Somehow identify which 2 testimonials to select first. 2) Display those 2 testimonials for 20 seconds. 3) Select & display the next 2 testimonials for 20 seconds with fadein and fadeout javascript. 4) Infinite repeat of this, displaying all testimonials stored in the database. I'm trying to accomplish this through the use of AJAX, PHP, & JavaScript. Here is my code so far. GetTestimonials.php <?php require_once("Config.php"); require_once("CommonFunctions.php"); mysqlConnect($SQLHost, $SQLUsername, $SQLPassword, $SQLDatabase) or die('Error: ' . mysql_error()); $id1 = $_GET['id1']; $id2 = $_GET['id2']; $query1 = "SELECT description, author FROM testimonials WHERE id = $id1"; $query2 = "SELECT description, author FROM testimonials WHERE id = $id2"; $result1 = mysql_query($query1) or die(mysql_error()); $result2 = mysql_query($query2) or die(mysql_error()); $row1 = mysql_fetch_array($result1); $row2 = mysql_fetch_array($result2); $description1 = $row1['description']; $author1 = $row1['author']; $description2 = $row2['description']; $author2 = $row2['author']; ?> <div class="uniqueTestimonial"> <img src="Images/oQuote.jpg" alt="'" /> <?php echo($description1); ?> <img src="Images/cQuote.jpg" alt="'" /> <br /> <div class="author"> - <?php echo($author1); ?> </div> </div> <div class="uniqueTestimonial"> <img src="Images/oQuote.jpg" alt="'" /> <?php echo($description2); ?> <img src="Images/cQuote.jpg" alt="'" /> <br /> <div class="author"> - <?php echo($author2); ?> </div> </div> <?php mysql_close(); ?> TestimonialsWidget.php <script> function showTestimonial(firstID, secondID) { if (str == "") { document.getElementById("testimonialsBox").innerHTML=""; return; } if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp = new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("testimonialsBox").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","GetTestimonials.php?id1=" + firstID + "?id2=" + secondID, true); xmlhttp.send(); } </script> <div class="testimonialsContainer"> <div class="testimonialsTitle"> <h3>Testimonials</h3> </div> <div class="testimonialsBox" id="testimonialsBox"></div> </div> index.php <?php require_once("Config.php"); require_once("CommonFunctions.php"); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title><?php echo($Title); ?> - Home</title> <link href="CSS/CSS.css" type="text/css" rel="stylesheet"> <script src="JS/jquery.js" type="text/javascript"></script> <script> function loopTestimonial() { window.setInterval(showTestimonial(), 5000); } </script> </head> <body onLoad="loopTestimonial()"> <div class="container"> <div class="headerContainer"> <div class="headerContent"></div> </div> <div class="clear"></div> <div class="contentContainer"> <div class="topContent"> <div class="left"> <?php require_once("TestimonialsWidget.php"); ?> </div> <div class="right"></div> </div> </div> </div> </body> </html>
-
I want to add a few links to the footer of this template, but I have no idea how to decode this... echo eval(stripslashes(base64_decode('DWVjaG8gZXZhbChzdHJpcHNsYXNoZXMoYmFzZTY0X2RlY29kZShcJ0lHVmphRzljSncwZ0lDQWdQQzlrYVhZK0lBMEpDUWtKQ1FrSkNRa0pQR1JwZGlCamJHR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YkRsellWYzFiRmd6WkhsWldFSjNXbGhLWTBscU5EaGFSMnd5U1VkT2MxbFlUbnBRVm5kcFdtMDVkbVJIVm5sWU1uaHdZbTFXWTBscU5EaE1NbEp3WkdvME9Fd3lVbkJrYWpST1ExRnJTa05XWkd4WmEwNTJXa2RXZVVsRWVHaEpSMmg1V2xkWk9WaERTblJaVjJ4elpFYzRObUpIVm1oaWJWSjVZbmt4Y0dOdE9YVlJSMmgyWkVjeGFHRlhkM1ZaTWpsMFdFTkpLMVJIVm1oaWJWSjVZbmt4U21OdE9YVlFRemxvVUdkclowbERRV2RKUTBGblNVTkJaMGxCTUVwRFVXdEtVRU01YTJGWVdTdEVVV3RLUTFGck9GcEhiREpKUjJ4clVGWjNhVnB0T1haa1IxWjVXRE5LY0ZveWFEQllRMGtyUkZOQlowbERRV2RKUTBGblNVTkJTa05SYXpoYVIyd3lTVWRzYTFCV2QybGlSemx1WWpFNWFHTXpVbmxrVnpGalNXbzBPRXd5VW5Ca2FqUk9RMUZyU2tOVWQzWmFSMnd5VUdjd1NrTlJhMHBRUjFKd1pHbENhbUpIUm5wamVqRmpTVzFPYzFwWFJubFlRMGtyVUVNNWEyRllXU3RFVVd0S1ExUjNkbHBIYkRKUVp6QktRMVIzZGxwSGJESlFhVUZPU1VOQlowbEVkM1phUjJ3eVVHbEJaMGxEUVdkRVVXczRUREpTY0dScU5HZEVWSGQyV2tkc01sQnNkMjVQZHpBOVhDY3BLU2s3RFE9PVwnKSkpOw0='))); Can someone please help me out?
-
preg_match that checks for lower/upper case letters, numbers, spaces, etc.
Shockdot replied to Shockdot's topic in Regex Help
Not necessary. <?php $input = 'this-0_is$%a.test!!,foobar'; $expr = "~^[-a-z0-9_:%$'.,!]+$~i"; var_dump( preg_match($expr, $input) ); ?> outputs int 1 The issue is his test string isn't what he expects it to be. Garbage in = garbage out. Alright so I did a test and this is what happens. Input String: This is a test string $bla bla ! : , ' ? . - _ What $strin makes that into: This is a test string $bla bla ! : , \' ? . - _ But on a site note.... If i were to do Input String: This is $10 What $string makes that into: $This is $10 it doesn't change.... So something is still wrong because it doesn't change the string... -
preg_match that checks for lower/upper case letters, numbers, spaces, etc.
Shockdot replied to Shockdot's topic in Regex Help
Still same problem -.-. -
preg_match that checks for lower/upper case letters, numbers, spaces, etc.
Shockdot replied to Shockdot's topic in Regex Help
I thought it had something to do with that, but I removed $NewBDescription = stripslashes($NewBDescription); $NewBDescription = mysql_real_escape_string($NewBDescription); and the same thing still happens. -
preg_match that checks for lower/upper case letters, numbers, spaces, etc.
Shockdot replied to Shockdot's topic in Regex Help
<?php session_start(); require_once("Config.php"); mysql_connect($DBHost, $DBUsername, $DBPassword) or die("Can't connect to MySQL Server..."); mysql_select_db($DBName) or die ("Can't connect to database..."); $BUsername = $_SESSION['ID']; $NewBDescription = $_POST['BDesc']; $NewBDescription = stripslashes($NewBDescription); $NewBDescription = mysql_real_escape_string($NewBDescription); if(characterCheck($NewBDescription) == false) { $_SESSION['DescError'] = "The description you enter contained some invalid characters. You may only use letters, numbers, spaces, %, :, $, !, ., -, _, and ,."; header("location: profile.php?id=$BUsername"); } else { mysql_query("UPDATE $DBAccountsTbl SET description='$NewBDescription' WHERE username='$BUsername'") or die(mysql_error()); header("location: profile.php?id=$BUsername"); } ?> <?php function characterCheck($string) { $result = true; if(!preg_match("~^[-a-z0-9_:%$'.,!]+$~i", $string)) { $result = false; } return $result; } ?> And the output for what you gave me is <pre>Array ( ) </pre>. -
preg_match that checks for lower/upper case letters, numbers, spaces, etc.
Shockdot replied to Shockdot's topic in Regex Help
When I enter into the field something like, Jesus', or anything containing an apostrophe it returns as if it would return something that is not allowed to be used... Also when I type something like, The price is $10, it will return as it would return something that is not allowed to be used... But only if I put the $ before other characters. -
preg_match that checks for lower/upper case letters, numbers, spaces, etc.
Shockdot replied to Shockdot's topic in Regex Help
Thanks! Is there anyway to add an ' to that list? When I add it, it doesn't verify properly... "~^[-a-z0-9_:%$'.,!]+$~i" -
How do I restrict people from spamming a like button?
Shockdot replied to Shockdot's topic in PHP Coding Help
My client wants the user to be logged in or they can't like it. I got it working . Simply made another table that logged a username, the business they are liking, and has the 4 categories on it. When the user clicks the like button it adds the info to the table, if its already added it updates the appropriate category field, and if that field is already liked then it does not add an additional like to the business. Thanks guys! -
How do I restrict people from spamming a like button?
Shockdot replied to Shockdot's topic in PHP Coding Help
Yah, that's what I wanted. The issue was storing the liked status properly, but I believe that I've resolved the issue.... Currently coding it now, I'll let you guys know haha. Thanks! -
I'm creating a website for a client. The website is basically a huge phone book on local business'... I've created a like form system for various categories, such as Customer Service, Cleanliness, quality, and speed of service. The problem I'm having is that users are able to click the like button without restrictions.... Which is bad haha... I'm looking for a way that if a user likes one of the categories, it is logged and he can no longer like that category. Any ideas?