-
Posts
241 -
Joined
-
Last visited
Never
Everything posted by pneudralics
-
Anyone having issues displaying images with WAMPSERVER?
pneudralics replied to pneudralics's topic in PHP Coding Help
If I physically go to dreamweaver and insert in the image from the image menu it will not show in that directory, but if I do it to a different directory it'll show? -
Anyone having issues displaying images with WAMPSERVER?
pneudralics replied to pneudralics's topic in PHP Coding Help
Yes the html outputs the image source. I've spent several hours looking at this and can't really figure out what is the issue. All of the php pages are duplicates except for the table name and for some reason this one doesn't display. When I create the directory I set it to 777 with mkdir(). All the other images for are uploaded the same exact way. When I type this in the url section it'll show but if I did that to my php code to display it like that it will not show: C:\wamp\www\image\category\e949357865835300e4933beb58b5dbc0.gif The source code shows exactly as I want it to look like above. But if I do this with wampserver on: http://localhost/image/category/e949357865835300e4933beb58b5dbc0.gif it doesnt show in either -
I have a while loop that grabs image names from the database then displays it in: <img src=\"$websiteurl/icons/$category/$image\" alt=\"\" /> I have different categories for the different images and all of the categories have the same php code but with different table names. I have 3 pages in total. The first 2 pages displays the image fine, but for some reason the 3rd page does not display any of the images. All are duplicates except for the table name in mysql. With wampserver on I can go and type in http://localhost/images/1.jpg it'll show the image for the 1st and 2nd php page, but not for the 3rd php page even though it's a duplicate page of the 1st and 2nd. I can physically see that the image is in the directory, but it won't display for some reason.
-
Why is php deleting by ASC instead of the selected data?
pneudralics replied to pneudralics's topic in PHP Coding Help
Still doesn't work. In view source the value of the delete input has the same id as the image. -
Can't figure why php is deleting by ascending instead of the data that has the delete form. If I have ids 1, 2, 3 showing and try to delete 3, php will delete 1 or if I try to delete 2 php will delete 1. // While there are rows to be fetched... while ($list = mysql_fetch_assoc($result)) { // Get date reading fields $id = $list['id']; $title = $list['title']; $image = $list['image']; $category = $list['category']; echo "<div id=\"displaycolumn\">"; if ($numcolsprinted == $numcolszero) { echo "<table align=\"center\"><tr>"; $numcolsprinted = 0; } if ($numcolsprinted == $numcols) { echo "</tr><tr>"; $numcolsprinted = 0; } echo "<td align=\"center\" width=\"250\"> <b>$title</b> <br /> <img src=\"$websiteurl/backgrounds/$category/$image\" alt=\"$id\" width=\"200\" height=\"200\" style=\"border:solid;border-color:#000000;\" /><br /> <form action=\"backgroundsdelete.php\" name=\"deleteform\" method=\"post\"> <input type=\"submit\" name=\"delete\" value=\"$id\" /> </form> </td>\n"; // Bump up row counter $numcolsprinted++; } // End while loop ?> <div align="center"> <?php // delete database if (isset($_POST['delete'])) { $delete = "DELETE FROM background WHERE id = \"$id\" LIMIT 1"; mysql_query("$delete"); //delete image $deleteimage = "$backgroundsfolder\\$category\\$image"; unlink("$deleteimage"); echo "<font color=\"red\">Background $id deleted.</font>"; } // delete end ?> </div>
-
[SOLVED] How do I make a subfolder inside of a folder?
pneudralics replied to pneudralics's topic in PHP Coding Help
<?php mkdir("C:\wamp\www\", 0700); ?> Does the new name go after www\? The above gives me the error: Warning: mkdir() [function.mkdir]: Invalid argument in C:\wamp\www\test.php on line 2 -
[SOLVED] How do I make a subfolder inside of a folder?
pneudralics posted a topic in PHP Coding Help
I was looking at mkdir() but didn't really get it. Tried mkdir("pathgoeshere", 0700); All I get is file exists. I want to make a folder inside of a folder and be able to name it at the same time. Thanks. -
I want to save this to the database. After uploading the image and creating a new name for it I want to put it into $code before saving it into the database: $code = " <style type=\"text/css\"> body { background-image:url('urlgoeshere$newname'); } </style> "; The issue is it won't work if it's inside the if (isset). It seems like I need a way to get the newname from the uploading and add outside if the if(isset).
-
I'm designing a webpage with WAMP now. The webpage is designed with css. I noticed sometimes my while loop doesn't display the data unless I left click anywhere on the page. When I left click on the pages somewhere all the data becomes visible. Without the data being visible I can right click, look at the source and it shows in the source, its just not visible on the page itself. This seems to happen on and off when I load the page.
-
How do I pass a drop down form option to a url?
pneudralics replied to pneudralics's topic in PHP Coding Help
Yes I understand that. Just wasn't sure if the readers got what I was talking about so I just put it there. -
How can I pass the value of the option to a url? I tried doing it with get but the variable I have set is always empty. <select name="select"> <option> </option> </select>
-
Thanks. Why is it that you need single quotes instead of double with a variable in it? Wouldn't single read it as $categoryvariable instead of whatever the $categoryvariable actually is?
-
Select count is returning more than the category specified. I want to limit the count to $categoryvariable, but it seems like I'm still getting more than the specified count. $categoryvariable = $_GET['category']; $sql = "SELECT COUNT(*) FROM category WHERE category = \"$categoryvariable\"";
-
I got it to display but how do I make it so it's not all one line? The below will show all the results in one line. <select name="category"> <option> <?php $querycategory = 'SELECT * FROM category'; if ($cresult = mysql_query ($querycategory)) { while ($crow = mysql_fetch_array ($cresult)) { $category = $crow['category']; echo "$category"; } } ?> </option> </select>
-
I received an email from a teacher at a university with a .edu email address. By doing some googling the email is a scam email offering me millions. Anyways so I was wondering if it's possible to send an email showing that it is sent from a different email address without knowing any login info on the email address you want to show in the email. Example: I send you an email from [email protected] but when you receive the email it can say [email protected] or something I don't want to know how to do it. I just want to know if it's possible so I can reply back to the teacher and tell them to change their password or something.
-
I can't seem to figure this out. Everything seems to work fine with WAMP until I upload it online. Warning: Cannot modify header information - headers already sent by ..on line 96 which is: header ('Location: index2.php'); <?php //Start session session_start(); include ('../c/connect.php'); $ip = $_SERVER['REMOTE_ADDR']; /* THIS PAGE ASKS 1 QUESTION PRIOR TO REDIRECTING TO THE MAIN LOGIN PAGE. */ ?> <center> <br /> <b>YOUR IP IS: <?php echo"$ip"; ?></b> <br /> <b>Login below to proceed...</b> <br /> <br /> <?php //Select and Retrieve and print question/answer query $qselect = "SELECT * FROM question"; if ($qresult = mysql_query ($qselect)) { while ($row = mysql_fetch_array ($qresult)) { $question = $row['question']; $answer = $row['answer']; $answer = mysql_real_escape_string ($answer); } } //Select and Retrieve username $uselect = "SELECT * FROM admin"; if ($uresult = mysql_query ($uselect)) { while ($row = mysql_fetch_array ($uresult)) { $username = $row['username']; $username = mysql_real_escape_string ($username); } } //Select and Retrieve password $pselect = "SELECT * FROM admin"; if ($presult = mysql_query ($pselect)) { while ($row = mysql_fetch_array ($presult)) { $password = $row['password']; $password = mysql_real_escape_string ($password); } } //We need to select all the ips from the database and compare them to the current one $countip = mysql_query ("SELECT COUNT(ip) AS currentip FROM ip WHERE ip = '$ip'"); $totalcountip = mysql_fetch_array($countip); //Put array in a variable for total current ip count $totalcurrentip = $totalcountip['currentip']; //Get date and time $timestamp = time(); //If there are 5 or more of the same ips that entered a wrong input we will add the ip in the ipbanned database if ($totalcurrentip > 4) { //See if the ip exist $selectipbanned = "SELECT ip FROM ipbanned"; if ($selectipbannedresult = mysql_query ($selectipbanned)) { while ($row = mysql_fetch_array ($selectipbannedresult)) { $ipbanneddata = $row['ip']; } } //If ip does not exist add it to database else redirect to error.php if ($ipbanneddata != $ip) { mysql_query ("INSERT INTO ipbanned (ip) VALUES ('$ip')"); } else { header ('Location: error.php'); } } //Select and Retrieve banned ips $ipbannedselect = "SELECT ip FROM ipbanned"; if ($ipbannedresult = mysql_query ($ipbannedselect)) { while ($row = mysql_fetch_array ($ipbannedresult)) { $ipbanned = $row['ip']; } } //Form submission //If current ip does not equal banned ips we allow the form else we direct it to error.php if ($ip != $ipbanned ) { if (isset ($_POST['submit'])) { if ( (!empty ($_POST['username'])) && (!empty ($_POST['password'])) ) { //Check username and password if ( ($_POST['username'] == "$username") && ($_POST['password'] == "$password") ) { //Check answer if (!empty ($_POST['answer']) ) { if ($_POST['answer'] == "$answer") { $_SESSION['username'] = "$username"; //Redirect to index2.php header ('Location: index2.php'); exit (); } else { //Insert ip to database mysql_query ("INSERT INTO ip (ip,time) VALUES ('$ip','$timestamp')"); echo '<font color="red">Your answer was incorrect.</font><br />'; } } else { echo '<font color="red">You left something blank.</font><br />'; } } else { //Insert ip to database mysql_query ("INSERT INTO ip (ip,time) VALUES ('$ip','$timestamp')"); echo '<font color="red">Wrong username or password.</font><br />'; } } else { echo '<font color="red">You left something blank.</font><br />'; } }//End submit if } else { //If ip is banned we redirect to error.php header ('Location: error.php'); } ?> <br /> <form action="index.php" method="post"> Username <input type="text" name="username" size="20" maxlength="20" /> <br /> <br /> Password <input type="password" name="password" size="20" maxlength="20" /> <br /> <br /> <b> <?php echo "$question"; ?> </b> <br /> <br /> Answer <input type="text" name="answer" size="20" maxlength="20" /> <br /> <br /> <input type="submit" name="submit" value="Submit" /> </form> </center>
-
How do I display the latest uploaded picture on a page?
pneudralics replied to pneudralics's topic in PHP Coding Help
This is my upload script. No I'm not using any cms. <?php //This is the page for uploading the gallery section session_start(); if(!isset($_SESSION['username'])){ require ("error.php"); } else { include ('header.php'); ?> <table width="800" align="center"> <tr> <td align="center"> This section uploads the images to the Gallery section. <br /> This will change the image name to a random 32 character name and the extension to .jpg. <br /> Recommend 800px max width for the images or it'll start stretching the pages. <br /> To delete images click the View Gallery below, click the image you want to delete and click delete. </td> </tr> <tr> <td> <br /> [<a href="gallery.php">Delete Images</a>] <br /> <br /> <?php //Image variable/constant image folder upload $galleryupload = GALLERYUPLOAD; if (isset($_POST['submit'])) { //Start image upload //Check for an image make new name with md5 $newname = md5(time()*rand(1,99999).$_FILES['image']['name']); $newname2 = $newname.'.jpg'; //Check for main image if (move_uploaded_file ($_FILES['image']['tmp_name'], GALLERYUPLOAD."$newname2")) { echo '<font color="red">Image uploaded successfully.</font><br />'; } else { echo '<font color="red">Problem uploading image.</font><br />'; } }//End isset submit ?> <form enctype="multipart/form-data" action="gallery.php" method="post"> <b>Upload Gallery Image</b> (100KB Max) <br /> <input type="hidden" name="MAX_FILE_SIZE" value="102400" /> <input type="file" name="image" size="50" /> <br /> <br /> <input type="submit" name="submit" value="UPLOAD" /> </form> </td> </tr> </table> <?php }//End session else ?>