
krike
Members-
Posts
35 -
Joined
-
Last visited
Never
About krike
- Birthday 11/26/1988
Contact Methods
- MSN
-
Website URL
http://cmstutorials.org
Profile Information
-
Gender
Not Telling
-
Location
Belgium
krike's Achievements

Newbie (1/5)
0
Reputation
-
In codeIgniter I have the following returned array: Array ( [0] => stdClass Object ( [id] => 1 [name] => 01. Underworld [userid] => 1 [order] => 1 ) [1] => stdClass Object ( [id] => 2 [name] => 02. Pain in the ass [userid] => 1 [order] => 2 ) ) I need the to save the id into a variable and send it as parameter for the new functions, but I don't know how to do this. Any help would be appreciated, this is the controller function: /*###################################################*/ function members_area() /*###################################################*/ { global $site_title; $this->load->model('membership_model'); if($this->membership_model->get_villages()): $villages = $this->membership_model->get_villages(); $data['rows'] = $villages; echo "<pre style='text-align:left;'>"; print_r($villages); echo "</pre>"; $id = 1;//this should be dynamic, but how? if($this->membership_model->get_tasks($id)): $data['tasks'] = $this->membership_model->get_tasks($id); endif; endif; $data['title'] = $site_title." | Your account"; $data['main_content'] = 'account'; $this->load->view('template', $data); }//end of function members_area
-
internal server error when browsing pages that do not exist
krike replied to krike's topic in Apache HTTP Server
I finally finished the website and uploaded the files but I'm still getting the internal server error. if you go to http://cmstutorials.org/testing.php (which doesn't exist) it will give and internal server error. when I remove the line to rewrite the other pages it works fine so I guess there is something wrong with that line. RewriteRule ^(.+[^/])$ $1.php [QSA,L] -
I finally found it, the if-statement that checked if the image was uploaded allready returned true, so for some reason it didn't work because of that. if(($filetype == "image/gif") || ($filetype == "image/jpeg") || ($filetype == "image/pjpeg") || ($filetype == "image/png")): if(move_uploaded_file($filetmp, $path)): return(true); else: throw new exception (_imagenotuploaded_); endif; else: throw new exception (_allowedextentions_); endif; I changed it to if(($filetype == "image/gif") || ($filetype == "image/jpeg") || ($filetype == "image/pjpeg") || ($filetype == "image/png")): if(!move_uploaded_file($filetmp, $path)): throw new exception (_imagenotuploaded_); endif; else: throw new exception (_allowedextentions_); endif; and now it will wright the url of the image into the database.
-
it will upload the image but not process the query, i use a if-statement to see if the query was done succesfully or not, if not an exception will be thrown. but I get the success message so I don't get it... this is the form: <table class="add_tutorial"> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data"> <tr> <td><label><?php echo _submittitle_; ?></label></td> <td><input class="forminput" type="text" name="title" id="title" size="40" value="<?php if(isset($_POST['title'])){echo $_POST['title'];} ?>" /></td> </tr> <tr> <td><label><?php echo _tutorialavatar_; ?></label></td> <td><input class="forminput" type="file" name="tutorial_thumb" id="tutorial_thumb" size="40" /> <br /> <small> <ul> <li>Only jpeg, png and gif are allowed! Your image should be exactly 72*72!</li> </ul> </small> </td> </tr> <tr> <td><label><?php echo _tutorialdescription_; ?></label></td> <td><textarea class="forminput" name="description" id="description" cols="45" rows="5"><?php if(isset($_POST['description'])){echo $_POST['description'];} ?></textarea></td> </tr> <tr> <td><label><?php echo _tutoriallink_; ?></label></td> <td><input class="forminput" type="text" name="tutorial" id="tutorial" size="60" value="<?php if(isset($_POST['tutorial'])){echo $_POST['tutorial'];} ?>"/></td> </tr> <tr> <td><label><?php echo _tutorialcategory_; ?></label></td> <td> <select name="category_tutorial" id="category_tutorial"> <?php $category = mysqli_query($link, "SELECT category_id, category_name FROM categories"); while($categories = mysqli_fetch_object($category)) { ?> <option value="<?php echo $categories->category_id; ?>"><?php echo $categories->category_name; ?></option> <?php } ?> </select> </td> </tr> <tr> <td><label for="tags"><?php echo _tags_; ?></label></td> <td> <input id="tags" class="forminput" name="tags" type="text" size="30" value="<?php if(isset($_POST['tags'])){echo $_POST['tags'];} ?>"/> <br/><small>Seperate each tag with a space</small> </td> </tr> <tr> <td><label for="captcha_code"><?php echo _tutorialantispam_; ?></label></td> <td> <img src="<?php echo $siteurl; ?>includes/captcha.php" alt="<?php echo _tutorialcaptcha_; ?>" title="<?php echo _tutorialcaptcha_; ?>" /><br /> <small><?php echo _tutorialspamtext_; ?></small><br /> <input class="forminput" name="captcha_code" type="text" size="30" /> </td> </tr> <tr> <td><input class="button" type="submit" name="submit_tutorial" value="<?php echo _tutorialsubmit_; ?>" /></td> </tr> </form> </table>
-
I have a form to input some data in the database, it works when I do not upload an image, when I do it won't work and I just can't find what's wrong. this is the setter of my class case "image": $this->m_simage = $p_sValue; break; this is the getter of my class case "image": $vResult = $this->m_simage; break; this is the code in my php page //Image is optional so check if the user submitted an image if(isset($_FILES['tutorial_thumb']['name']) && !empty($_FILES['tutorial_thumb']['name']) && isset($_FILES['tutorial_thumb']['tmp_name']) && ! empty($_FILES['tutorial_thumb']['tmp_name'])): //Check if an image was uploaded, otherwise use the category thumbnail $filename = $_FILES['tutorial_thumb']['name']; $filetmp = $_FILES['tutorial_thumb']['tmp_name']; $filetype = $_FILES['tutorial_thumb']['type']; $filesize = $_FILES['tutorial_thumb']['size']; //Check the image size, it should be exactly 72*72 //if(!Validator::ImageSizeBetween($filetmp, 73, 71, 73, 71)): throw new exception ("Your image must be exactly 72*72 !"); endif; //if the size is ok save the path to the image $rand = rand(1111,9999); $path = 'images/tutorials/'.$rand.$filename; //send the path the the image setter $tutorial->image = $path; else: $filename = "nofile"; $filetmp = "nofile"; $filetype = "nofile"; $filesize = "nofile"; $path = 'images/category/'.mysqli_real_escape_string($link, $_POST['category_tutorial']).".png"; $tutorial->image = $path; endif; and this is the function in my class /*###############################################*/ public function tutorialSubmit($userid, $filetype, $filetmp, $path) /*###############################################*/ { global $link; //check if a file was uploade if($filetype != "nofile"): //Check the filetype first, if it was succesfyll upload the image if(($filetype == "image/gif") || ($filetype == "image/jpeg") || ($filetype == "image/pjpeg") || ($filetype == "image/png")): if(move_uploaded_file($filetmp, $path)): return(true); else: throw new exception (_imagenotuploaded_); endif; else: throw new exception (_allowedextentions_); endif; endif; //Set up the insert query $sqlquery ="INSERT INTO tutorials (title, url, description, tutorial_thumb, tags, category_id, user_id) VALUES ('".$this->m_stitle."', '".$this->m_surl."', '".$this->m_sdescription."', '".$this->m_simage."', '".$this->m_stags."', '".$this->m_scategory."', '".$userid."') "; echo $this->m_simage; //Check if the query was executed succesfully if(mysqli_query($link,$sqlquery)): return (true); else: throw new exception(_tutsubmissionunsucces_); endif; }// end of tutorialSubmit I echo $this->m_simage;, when there I don't upload an image I see the ling to the category image but when I upload I see nothing... if you find the problem let me know
-
internal server error when browsing pages that do not exist
krike replied to krike's topic in Apache HTTP Server
I've cut all the lines except the one you say you tested, it still didn't work so I removed both /cmstut then it gave me the 404 not found rather then 505. I guess that gives a problem working on localhost, but when I go live the /cmstut will be removed anyway to match the domain, so I think it will be fixed then. if not I'll reply again thanks for your quick answers and help -
internal server error when browsing pages that do not exist
krike replied to krike's topic in Apache HTTP Server
still getting the server error. maybe it's because I'm working localy..? -
internal server error when browsing pages that do not exist
krike replied to krike's topic in Apache HTTP Server
I'm working on localhost, in my www folder I have a folder cmstut, all my files are in there. If I don't add the /cmstut it will redirect me to http://localhost/shop/index if I browse for http://localhost/cmstut/shop/index But that's not the problem, I have a php file and would browse it normally like http://localhost/cmstut/deposit.php, by rewritting it I can browse the same file as http://localhost/cmstut/deposit now when I browse a file that does not exist by using the normal link http://localhost/cmstut/randomfile.php or using the rewrite rule http://localhost/cmstut/randomfile that will give me a 505 internal server error -
internal server error when browsing pages that do not exist
krike replied to krike's topic in Apache HTTP Server
what do you mean I redirect pages that does not exist? where do you see !-d? I only get an internal server error when I type a url of a page that DOES NOT exist, so they don't get the 404 not found but 505 internal server error. all the rest is working fine. and the rewritebase /cmstut/ is just to make it work localy on my wamp server. I just tried to delete each line to see what is causing the problem and it's the line that should remove the php extenion of all pages. #rewrite all other pages RewriteRule ^(.+[^/])$ /cmstut/$1.php [QSA,L] -
The following code works perfectly but when I browse a page that doesn't exist I get an internal server error. RewriteEngine on #RewriteCond %{REMOTE_HOST} !^81\.165\.9\.219 #RewriteRule .* http://www.iv-designs.org/maintenance/maintenance.html [R=302,L] RewriteBase /cmstut/ RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ - [L] #tutorial rewrites RewriteRule ^index/page/([0-9]+)$ /cmstut/index.php?page=$1 [QSA,L] RewriteRule ^tutorial/([0-9]+)$ /cmstut/view_tutorial.php?tutorial_id=$1 [QSA,L] RewriteRule ^submitted/([0-9]+)$ /cmstut/submitted_tutorial.php?tutorial_id=$1 [QSA,L] RewriteRule ^add_favorite/([0-9]+)$ /cmstut/add_favorites.php?tutorial_id=$1 [QSA,L] RewriteRule ^favorites/(.*)$ /cmstut/favorites.php?username=$1 [QSA,L] RewriteRule ^user/(.*)$ /cmstut/profile.php?username=$1 [QSA,L] RewriteRule ^edituser/(.*)$ /cmstut/edit_profile.php?username=$1 [QSA,L] RewriteRule ^search/category/([0-9]+)$ /cmstut/search.php?category_id=$1 [QSA,L] RewriteRule ^search/category/([^/]+)/page/([0-9]+)$ search.php?category_id=$1&page=$2 [QSA,L] RewriteRule ^search/tags/([^/]+)$ /cmstut/search.php?tags=$1 [QSA,L] RewriteRule ^search/tags/([^/]+)/page/([^/]+)$ /cmstut/search.php?tags=$1&page=$2 [QSA,L] RewriteRule ^search/(.*)$ search.php?search=$1 [QSA,L] RewriteRule ^search/([^/]+)/page/(.*)$ search.php?search=$1&page=$2 [QSA,L] RewriteRule ^feature_tutorial/extend/([0-9]+)$ /cmstut/feature_tutorial.php?action=extend&tut=$1 [QSA,L] #shop rewrites RewriteRule ^shop/item/([^/]+)$ /cmstut/shop/item.php?item=$1 [QSA,L] RewriteRule ^shop/item/([^/]+)/page/([0-9]+)$ /cmstut/shop/item.php?item=$1&page=$2 [QSA,L] RewriteRule ^shop/item_preview/(.*)$ /cmstut/shop/item_preview.php?itemid=$1 [QSA,L] RewriteRule ^shop/downloads/([^/]+)$ /cmstut/shop/downloads.php?download=$1 [QSA,L] RewriteRule ^shop/downloads/page/([0-9]+)$ /cmstut/shop/downloads.php?page=$1 [QSA,L] RewriteRule ^shop/cat/([^/]+)$ /cmstut/shop/cat.php?cat=$1 [QSA,L] RewriteRule ^shop/cat/([^/]+)/page/([0-9]+)$ /cmstut/shop/cat.php?cat=$1&page=$2 [QSA,L] #rewrite all other pages RewriteRule ^(.+[^/])$ /cmstut/$1.php [QSA,L] #remove last trailing slash RewriteRule (.+)/$ /cmstut/$1 [L,R=301] RewriteRule (.+)/$ /cmstut/shop/$1 [L,R=301]
-
fixed, if you still have a problem let me know
-
yes I know I completely forgot about it. I'll fix it asap, I was going to change a few things anyway
-
darn I thouht i fixed that. thanks for letting me know
-
could you be more precise or show me a screenshot, that would help. also tell me what resolution you have.
-
thanks, I fixed the fieldset problem in IE and the legend problem in chrome. and about the validator thanks , I have the validator plugin for firefox and shows me no error.. weird.