-
Posts
3,404 -
Joined
-
Last visited
-
Days Won
55
Everything posted by Ch0cu3r
-
In what file is the logged_in() function located? Is it in the same file as aside.php? If it is not you need to include the file that contains this function before you can use it.
-
Super simple URL rewriting tutorial with .htaccess
Ch0cu3r replied to Stefany93's topic in Apache HTTP Server
Did you look up and down the forum index about half way -
Need a little help with a couple of PhP issues
Ch0cu3r replied to grungeandgaze's topic in PHP Coding Help
Where is the variable $albumreleasedate defined and how is the date formatted in the database? A quick and easy fix (hack) would be to do list($dayth, $month, $year) = explode(' ', $albumreleasedate); $albumreleasedate = $month . ' ' . $year; before the echo line. -
Super simple URL rewriting tutorial with .htaccess
Ch0cu3r replied to Stefany93's topic in Apache HTTP Server
Your post is informative with basic usage of mod_rewrite however this should of been posted in Apache mod_rewrite forum and not here. This is help with PHP code. Do the note mapping files without file extensions can also be achieved by adding MultiViews to Options flag in .htaccess Options +MultiViews -
How do I identify if a number starts with a zero?
Ch0cu3r replied to Fluoresce's topic in PHP Coding Help
Alternative is regex for detecting infinite leading 0's if(preg_match('~^0+~', $page)) { // do 404 } ^0+ checks if $page starts with a 0 and matches 1 or more times However $page[0] == '0' is just as effective. $page[0] is getting the first character from $page. It'll return true if the first character is 0 First one checks if the first character of $page is equal to the string 0 literally (values from urls are treated as strings even if the value is a number). The second one checks to see if $page[0] is false (0 is the same as false). If your want to check for the integer 0 then uses strict comparison $page[0] === 0. This will be false as $page contains a string not a number. -
I guess logged_in is a function? Then you have the parenthesis's (these are the ( and ) characters ) in the wrong place remove the red character (wrong place) and add the blue character (correct place)
-
You're just scaling the image to that size. You're not modifying the image. When scaling distortion can happen. How is the original thumbnail created? And what dimensions are thumbnails.
-
Yes, it needs to be separate. If you had the ajax form submit to itself as your orginal code does you may find the page will duplicate itself within itself. You only want the response form the ajax call to contain the modal html and nothing else. The ajax calls form_process.php and parses the PHP code sending it the data from the form. The PHP code is processed and it returns the HTML code for the modal. If the response from the ajax call is successful then it'll add the modal to the div#wrapper element and it'll be displayed on screen.
-
Have an attempt at it. See what you can come up with. Basically the php code that processes the form data goes in form_process.php. Oh I forgot to link documentation for formAjax http://jquery.malsup.com/form/#api
-
Do you know PHP basic syntax. This is not correct syntax if (logged_in)() === true { Reading the manual on how to properly construct if statements will help http://uk1.php.net/manual/en/control-structures.if.php
-
Here some example code. I have cut most of your PHP code out. form page. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" > <head> <link rel="icon" type="image/png" href="http://www.Website.se/img/favicon.ico"> <title>Website.se</title> <style type="text/css" media="all"> @import "css/global.css"; @import "css/toprightheader.css"; @import "css/anslutning.css"; @import "css/tooltip.css"; @import "popup/css/styles.css"; </style> <!--jQuery--> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script src="http://malsup.github.com/min/jquery.form.min.js"></script> <!-- using AjaxForm JQuery plugin <script src="popup/js/jquery.reveal.js"></script> <script type="text/javascript"> $(document).ready(function() { var options = { url: "form_process.php", // where to submit form to type: "post", // submit method dateType: "html", // returned dataType success: showResponse // function to call on successful form submittion }; // bind form using 'ajaxForm' $('#mailSetupForm').ajaxForm(options); }); function showResponse(responseText) { console.log('success'); $('#wrapper').prepend(responseText); // prepend the modal to #wrapper dib // display modal $('#modal').reveal({ // The item which will be opened with reveal animation: 'fade', // fade, fadeAndPop, none animationspeed: 600, // how fast animtions are closeonbackgroundclick: false, // if you click background will modal close? dismissmodalclass: 'close' // the class of a button or element that will close an open modal }); } </script> </head> <body> <div id="wrapper"> <span style="color:red">*</span> = Required fields must be filled in <form action="?p=mail&atgard=skapa" method="POST" id="mailSetupForm"> <table style="font-size:14px;color:#535353;"> <tr> <td><b>Your name:</b></td><td><input type="text" name="name" size="10"> </td></tr><tr><td></td></tr> <tr><td><b>E-Mail: <span style="color:red">*</span></b></td><td><input type="text" name="user" id="user" size="10"><b> @ <select name="domain" id="domain"> <option id="1" value="Website.se">Website.se</option> </select></b> <label id="output"></label> <img id="tick" src="mail/check/tick.png" width="16" height="16" title="Adressen är ledig"/><img id="cross" src=\"mail/check/cross.png" width="16" height="16" title="Adressen är upptagen"/> </td></tr> <tr><td><b>Password:: <span style="color:red">*</span></b></td><td><input type="password" name="pass1" size="10"> </td></tr> <tr><td><b>Password again: <span style="color:red">*</span></b></td><td><input type="password" name="pass2" size="10"> (Confirmation)</td></tr> <tr><td><b>Code:</b></td><td><input type="text" name="kod" size="8" value="$a" readonly="readonly"> Save this code! Used when requestar new password</td></tr>"; <tr><td> <div align="left"><input type="submit" name="submit" id="button" value="Skapa"></div></tr></table> </fieldset> </form> </body> </html> form_process.php (this is very cut down version of your). <?php //DO NOT EDIT BELOW!// // Protect the Database and MD5 the password. if(isset($_POST['submit'])) { $strName = addslashes( $_POST['name'] ); $strUser = addslashes( $_POST['user'] ); $strDomain = addslashes( $_POST['domain'] ); $strPass1 = addslashes( $_POST['pass1'] ); $strMD5Pass = md5( $strPass1 ); $kod = addslashes( $_POST['kod'] ); //printf('<pre>%s</pre>', print_r($_POST, true)); // only return the modal. Do not return any other html echo <<<HTML <div id="modal"> <div id="heading"> Ditt mailkonto är aktiverat! </div> <div id="boxcontent"> <p><b>Uppgifter:</b><br>Email: $strUser@Website.se<br />Lösenord: (Dolt av säkerhetsskäl)</p> <a href="#" class="button red close"><img src="popup/images/cross.png">Stäng</a> </div> </div> HTML; // DO NOT MODIFY LINE ABOVE } ?>
-
== just compares the two string are identical. strcmp() compares the strings are identical (returns 0), if they are not identical it'll return a value indicating which string is bigger than the other. Quote from manual
-
How you got it set-up right now that is what will happen. You'll need to submit the form with ajax. Then pass the response from ajax to your modal to display the details. The ajax call need to be made here $('#button').click(function(e) { // Button which will activate our modal /* AJAX CALL REQUIRED TO SUBMIT DETAILS TO YOUR SCRIPT*/ /* ADD RESPONSE FROM AJAX TO #MODEL */ /* REVEAL MODEL BELOW */ $('#modal').reveal({ // The item which will be opened with reveal animation: 'fade', // fade, fadeAndPop, none animationspeed: 600, // how fast animtions are closeonbackgroundclick: false, // if you click background will modal close? dismissmodalclass: 'close' // the class of a button or element that will close an open modal }); return false; }); Your PHP script will just need to return just the details you want to be displayed in the model
-
Scrap that didn't read your submit button properly. The model should be located in the same place as your form. Can you tell what you're wanting to do with the modal? When do you want the modal to display?
-
You need to give this submit button the id of button <input type=\"submit\" id=\"button\" name=\"submit\" value=\"Skapa\"> Like so
-
That might just be the problem. Post full your code here
-
remove the AND at the end of the left join line Also you don't need to compare tour_type and tourtype_id again in the where clause as you're doing this comparison in the left join.
-
The text in square brakets is usually referred to as bbcode. Google for bbcode and you'll get tones of parsers/tutorials. See what you will come up with yourself.
-
As you're using javascript are there any errors reported in the browser console when you press the button. To access the console open your page press F12. This bring up the Development Tools, select the console tab, refresh your page and click your button. Any javascript errors reported?
-
Adding two forward slashes (//) in front of lines will comment them out. Commented lines are ignored by PHP. So change header("Location: view.php"); to //header("Location: view.php");
-
radio button choice needs to control dropdown menu content
Ch0cu3r replied to edfou's topic in PHP Coding Help
PHP doesn't respond to events happening in the browser. When the radio box is changed, you'll want to use an Ajax request (javascript) to your script to serve the correct team drop down menu dynamically. JQuery is a javascript library and is relatively easy to use. -
All words highlighted in red/purple are field/table names. These should not have quotes wrapped round them. only field values should be wrapped in quotes.
-
Comment out the header("Location: view.php"); lines. And change all instances of echo "ERROR: Could not prepare SQL statement."; to echo "ERROR: Could not prepare SQL statement.<p>Error: " . $mysqli->error; Any errors displayed?.
-
Remove the quotes around the user_id, users and username fields. MySQL wont treat them as field names but as strings.
-
An alternative is to use file_exists // absolute path to templates $template_dir = $_SERVER['DOCUMENT_ROOT'] . '/templates/'; if(isset($_GET['page'])) { // only get the filename $filename = pathinfo($_GET['page'], PATHINFO_FILENAME); $filepath = $template_dir . $filename . '.html' if(file_exists($filepath)) { // ok include $filepath; } }