-
Posts
35 -
Joined
-
Last visited
About 0xMatt
- Birthday 05/22/1990
Contact Methods
-
Website URL
http://javelet.me
- Jabber
Profile Information
-
Gender
Male
-
Location
Pooptown, Arkansas
0xMatt's Achievements
Newbie (1/5)
3
Reputation
-
To any of my fellow IRC users reading this, we are in ##phpfreaks on freenode until this is resolved, come play with us
-
Any news on when IRC is gonna be back?
-
Store the ID Number Inside "One" Array Inside For Loop?
0xMatt replied to glassfish's topic in PHP Coding Help
Based on what you've said you know what you should do you just haven't written any code to do so. You want to insert the related IDs onto the thread tables image_file_id column as comma-separated-values. I may be misunderstanding your issue, but this is what it sounds like you want: <?php $desired_width = 110; if (isset($_POST['submit'])) { $j = 0; //Variable for indexing uploaded image for ($i = 0; $i < count($_FILES['file']['name']); $i++) {//loop to get individual element from the array $target_path = $_SERVER['DOCUMENT_ROOT'] . "/gallerysite/multiple_image_upload/uploads/"; //Declaring Path for uploaded images $validextensions = array("jpeg", "jpg", "png"); //Extensions which are allowed $ext = explode('.', basename($_FILES['file']['name'][$i]));//explode file name from dot(.) $file_extension = end($ext); //store extensions in the variable $new_image_name = md5(uniqid()) . "." . $ext[count($ext) - 1]; $target_path = $target_path . $new_image_name;//set the target path with a new name of image $j = $j + 1;//increment the number of uploaded images according to the files in array if (($_FILES["file"]["size"][$i] < 100000) //Approx. 100kb files can be uploaded. && in_array($file_extension, $validextensions)) { if (move_uploaded_file($_FILES['file']['tmp_name'][$i], $target_path)) {//if file moved to uploads folder echo $j. ').<span id="noerror">Image uploaded successfully!.</span><br/><br/>'; $tqs = "INSERT INTO images (`original_image_name`, `image_file`, `date_created`) VALUES ('" . $_FILES['file']['name'][$i] . "', '" . $new_image_name . "', now())"; $tqr = mysqli_query($dbc, $tqs); // Select the ID numbers of the last inserted images and store them inside an array. // Use the implode() function on the array to have a string of the ID numbers separated by commas. // Store the ID numbers in the "image_file_id" column of the "thread" table. $tqs = "SELECT `id` FROM `images` WHERE `image_file` IN ('$new_image_name')"; $tqr = mysqli_query($dbc, $tqs) or die(mysqli_error($dbc)); $fetch_array = array(); $row = mysqli_fetch_array($tqr); $fetch_array[] = $row['id']; /* * This prints e.g.: Array ( [0] => 542 ) Array ( [0] => 543 ) Array ( [0] => 544 ) */ $values = rtrim(implode(', ', $fetch_array)); // Should print, "542, 543, 544" no whitespace if(!mysqli_query($dbc, "INSERT INTO thread (image_file_id) VALUES ('{$values}')")) { die(mysqli_error($dbc)); } // Goes over to create the thumbnail images. $src = $target_path; $dest = $_SERVER['DOCUMENT_ROOT'] . "/gallerysite/multiple_image_upload/thumbs/" . $new_image_name; make_thumb($src, $dest, $desired_width); } else {//if file was not moved. echo $j. ').<span id="error">please try again!.</span><br/><br/>'; } } else {//if file size and file type was incorrect. echo $j. ').<span id="error">***Invalid file Size or Type***</span><br/><br/>'; } } } If this isn't what you want, I would need you to elaborate more on what your end goal is. -
Here's the same question you're asking over on reddit. The first response is by the creator of Laravel. Also, googling the phrase "why choose Laravel" yields a lot of results. I've been using it quite some time, and though I'd really like to learn Symfony, I'm fine with Laravel for the time being.
-
You cannot receive a redirect error if the page isn't even trying to redirect or send with a 3xx. Double check and make sure you modified and saved the correct file and cleared your browsers cache just in case.
-
That has nothing to do with his issue and I question if you actually read the OP's post. stefanlesik, I would ask what your real issue is apart from you not liking how your code is setup. There is another method however, you can build your own custom array set storing the page id as a key and the value as the page url you want. <?php // This pseudo code would need to be replaced with your own setup.// The key is the page id while the value is the url you want to provide. $data = array(1 => 'first_route', 2 => 'second_route'); foreach($data as $page_id => $url){ if(is_page($page_id)) { $appLink = 'http://site.com/' . $url; }} Remember, is_page() accepts things other than the pages id such as the title or slug. e.g is_page('Homepage');
-
Of course you are getting that error, you are redirecting inside your while loop. As for the query failure, you'll need to post the error message supplied.
-
I disagree. If you build your own framework and document the code well, it'd be quite easy to build documentation with tools like apigen or phpdoc, making it easy for developers to understand. Actually, doing that is anything but lazy. Also, say a big company like facebook uses their own framework(if not, the example still stands) which is proprietary. So if I get hired by facebook and later decide to leave, will my knowledge of that framework be 100% useless? In a sense, yes, but only in the sense that I can no longer use their framework. What matters is that you get to broaden your horizons and open up your eyes to new perspectives. That is what PHP and programming in general is all about: learning, creating and then doing it better, over and over again. Nothing is ever useless if you put your time and effort into it, trial and error.
-
eduTrac: An Open Source Student Information System
0xMatt replied to NomadicJosh's topic in Beta Test Your Stuff!
I like it and I think it looks really good. I'm just not too fond of the framework you used as the foundation. -
A problem with a new php website that we're building...
0xMatt replied to eddyb's topic in Miscellaneous
Why are you using phpbb2? even phpbb3 is outdated having it's last release 3.0.11 come out 8/25/2012. Anyway, if you really insist on phpbb2 then I recommend a reCaptcha plugin which still works effectively well. -
It should be done in CI configuration. Honestly though, CI is dead and no longer being updated or maintained. It's even listed as a legacy framework: https://github.com/codeguy/php-the-right-way/wiki/Frameworks
-
return $conn -> affected_rows > 0; Will always return false. return ($conn->affected_rows > 0) ? true : false; is what you want. Edit: Yeah, I had messed up my return statement which threw me off as well.
-
array as session variable on click to some image
0xMatt replied to jasmeet's topic in PHP Coding Help
<?phpsession_start(); $animals = array('cat', 'dog', 'mouse', 'bird', 'crocodile', 'wombat', 'koala', 'kangaroo'); if(isset($_GET['add_animal'])){$_SESSION['animals'][$animals[$_GET['add_animal']]] = 1;} echo '<h1>Animals to choose from</h1>'; foreach($animals as $key=> $value){// and print out the valuesecho "<a href='test2.php?add_animal={$key}'>{$value}</a></br>";} echo '<br/><br/>'; $added_animals = '';foreach($_SESSION['animals'] as $animal => $value){$added_animals .= $animal. ',';} echo 'The animal you have added are: ' . $added_animals; Try that. Obviously change test2.php t your file name before you try it. -
I'm not sure what you mean but it sounds like removing the where clause is what you want. $sql = mysql_query("select imagelocation from store");
-
php registration login functionality using class
0xMatt replied to zohab's topic in Third Party Scripts
Where have you looked? Google has many answers. http://bit.ly/143dznq