-
Posts
3,404 -
Joined
-
Last visited
-
Days Won
55
Everything posted by Ch0cu3r
-
Linking this form to another php file to store the data
Ch0cu3r replied to JakeForDesign's topic in PHP Coding Help
The action attribute determines where the form is submitted to. Setting the form action to PHP_SELF will submit the form to itself. if you want the form to goto insert.php then you must set the form action to that. Nothing to do with security. That code you are referring to only repopulates the form values. -
Why is PHP handling the countdown? PHP should be used to set the initial time to countdown from. The rest should then be handled by javascript.
-
The code you are using is not complete code, it is only part 1 of a video series (you can only watch the other videos by signing up to their premium service). But to answer your question, in membership.php you need to save the users username to the session when the verify_Username_and_Pass method returns true. $ensure_credentials = $mysql->verify_Username_and_Pass($un, md5($pwd)); if($ensure_credentials) { $_SESSION['status'] = 'authorized'; $_SESSION['username'] = $un; /* save the users username to session */ header("location: index.php"); Now in index.php you should be able to use echo $_SESSION['username']; to display the logged in users username
-
Usually using ajax. <script src="myscript.php?uid=123"></script> PHP will receive the uid querystring parameter. But whatever your PHP script outputs the browser will try to parse it as javascript, as this what the browser expects from a <script> tag.
-
mysqli_query returns a result set. To get out of the result set you need to use one of the mysqli_fetch_* functions $result = mysqli_query("SELECT DOWNLOADS FROM download_manager WHERE id = 'xx'"); // query returns a resultset $data = mysqli_fetch_assoc($result); // get the data from the resultset $body = '<b><font name="Teen" color="#009999" size="11">' . $data['DOWNLOADS'] . '</font></b> ';
-
After sending the email, dont redirect. Just display the second form directly after <?php if(signup form has been submitted) { // send email } ?> // display second form
-
Remove the [] in the name. You only need to have that in the name if you are naming other fields the with same name.
-
You need to replace the while loop while (($file = readdir($directory_handle)) !== false) { ... } with something like $pattern = $directory . DIRECTORY_SEPARATOR . $query . '*'; echo 'Your search pattern ('.$pattern.') matches: '; foreach(glob($pattern) as $file) { // code to list/display files }
-
Read the manual? http://php.net/glob $filesFound = glob('yo*'); // find any files beginning with yo printf('<pre>%s</pre>', print_r($filesFound, true));
-
Use the * character in the pattern to match anything, eg to find any files beginning with yo you'd use yo* as the pattern
-
Is there a question? or problem?
-
yes, Apache is the webserver. Any changes you have made to the servers configuration (either Apache's httpd.conf or PHP's php.ini) the webserver needs to restarted in order for the changes to take affect. LAMP and WAMP are common acronyms used to describe the software stack a server is using for hosting a website. The first letter represents the operating system/environment, So L is is for Linux, W is for Windows and M is for Mac. The other three letters - AMP - represents Apache, PHP and MySQL.
-
Then do as mac_gver suggested to do first or add the following as the first couple of lines in your code <?php error_reporting(E_ALL); ini_set('display_errors', 1); ?> Report the errors here There is hardly any difference between the two. The only difference is you need to add i infront of mysql in the function name, and where the connection resource was optional in the mysql_* function it is now required, and is now the first argument to the function that requires it. The bit you maybe confused by is the OOP aspect. Which is fine just concentrate on the procedural functions. The mysqli documentation always gives code examples in both coding styles. Also I didn't notice this earlier, (as I though you where using mysqli). This $conn = mysql_connect($dbhost, $dbuser, $dbpass, $dbbase); Should actually be $conn = mysql_connect($dbhost, $dbuser, $dbpass) mysql_select_db($dbbase); mysql_connect does not have a forth argument for passing the the database name.
-
If all you're doing is dropping the extension then try just enabling Multiviews Options +Multiviews
-
So how is the company image added to the cmp_image field in your database?
-
How is the $setuser array defined?
-
Using Dropbox API in php, how to show files in user interface
Ch0cu3r replied to nshthmistry's topic in PHP Coding Help
The metadata is an array. To get the information out of the array you need to loop through it. Example code to display files in a table echo '<p>There are ' . count($metadata['contents']) . ' files in ' . $metadata['path'] . ':</p> <table border=1 cellpadding=10> <tr> <th>Name</th> <th>Siize</th> </tr>'; foreach($metadata['contents'] as $file) { echo '<tr> <td>' . $file['path'] . '</td> <td>' . $file['size'] . '</td> </tr>'; } echo '</table>';- 3 replies
-
- dropbox api
- dropbox php
-
(and 2 more)
Tagged with:
-
Please dont just dump code here and expect someone to fix it. You should at least explain what it is you're trying to do. Explain what the code should be doing, and post any error(s) your code is producing.
-
$form_name = $_POST['username']; $form_name = strip_tags($form_name, "'"); $form_name = strip_tags($form_name, '"'); $form_name = strip_tags($form_name, ";"); $form_pass = $_POST['password']; $form_pass = strip_tags($form_pass, "'"); $form_pass = strip_tags($form_pass, '"'); $form_pass = strip_tags($form_pass, ";"); This is code is very insecure, you should use mysql_real_escape_string instead (or better yet convert your code over to use PDO or mysqli and use prepared statements) to protect against sql injection. if(session_is_registered(acp)) session_is_registered is a deprecated function and should not be used. Instead use if(isset($_SESSION['acp']))
-
Your code is only connecting to mysql when your form has been submitted if(isset($_POST['add'])) { $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = 'password'; $dbbase = 'database'; $conn = mysql_connect($dbhost, $dbuser, $dbpass, $dbbase); if(! $conn ) { die('Could not connect: ' . mysql_error()); } ... Move your database connection code outside of the if $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = 'password'; $dbbase = 'database'; $conn = mysql_connect($dbhost, $dbuser, $dbpass, $dbbase); if(! $conn ) { die('Could not connect: ' . mysql_error()); } if(isset($_POST['add'])) { ...
-
Try change @name= to name=
-
When dealing with Javascript make sure you have your browsers console open (try pressing F12 and then clicking the console tab) and making sure no javascript errors are being reported when you click the link for calling the checker javascript function.
-
You need to add the users directory size and the file size for the uploaded file together, if the total is less than 5242880 (5GB) then upload the file, else display error. Example $directory_size = new Directory_Calculator; $usersDirectoryFileSize = $directory_size->size($usersDirectoryPath); // calculate users storage space // NB: make sure $usersDirectoryFileSize['size'] returns the directory size in total bytes, not in english readable format like 1.2GB if(($usersDirectoryFileSize['size'] + $_FILES['file']['size']) < 5242880) { move_uploaded_file($_FILES['file']['tmp_name'], 'upload/destination/'.$_FILES['file']['name']); // add the file to the users storage directory } else { echo 'You have exceeded the 5GB storage space. Please delete some files'; }
-
can't move file from current folder to another
Ch0cu3r replied to ArshSingh's topic in PHP Coding Help
You need to add the directory separators (the / ) in your file paths. $file = "uploads/{$loggedInUser->username}/$folderon/$file_pr"; $movefile = copy($file, "uploads/{$loggedInUser->username}/$folderon/$folder_in/" . $file_pr); //This script can move a file Also note copy does not move a file, but makes a copy of the original file. If you want to physically move the file you'll want to use rename(). Before moving the file you will also want to make sure the the place where the file is being moved to exists. using file_exists(). If it doesn't exists you will want use mkdir() to create the destination folder(s) beforehand. if you're using a *nix based server you'll want to make the uploads/ folder writeable so php can create files and folders