-
Posts
3,404 -
Joined
-
Last visited
-
Days Won
55
Everything posted by Ch0cu3r
-
First notice message can be solved by checking to see if the HTTPS server exists $base_url = (isset($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . '/'; Second error can solved with $keys = array_keys($path); $last = end($keys); // OR just $last = count($path) - 1;
-
Look at edit below You are passing the new_package() method an undefined variable $new_package echo $manage->new_package($new_package); You cannot call new_package with an undefined variable. EDIT. Looking at the source for the new_package method it doest need anything passed to it. Change line 1245 in core-management to public function new_package() { Call new_package using echo $manage->new_package();
-
Your code should be <?php if(isset($_POST['username']) && isset($_POST['password'])) { $username = mysql_real_escape_string($_POST['username']); $password = md5($_POST['password']); if (!empty($username) && !empty($password)) { $query = "SELECT `id` FROM `users` WHERE `username`='$username' AND `password`='$password'"; if ($query_run = mysql_query($query)) { if (mysql_num_rows($query_run) == 1) { $user_id = mysql_result($query_run,0,'id'); $_SESSION['user_id'] = $user_id; header('location: require.php'); } else { echo 'Invalid username or password'; } } else { echo 'Query error: ' . mysql_error(); exit; } } else { header("Location:jquery.php") ; } } ?> <!doctype html> <html> <head> <link type="text/css" rel="stylesheet" href="css.css"/> </head> <body> <div class="lol"> <h1 class="header">Thecatch</h1> <div id="header"></div> </div> <form action="<?php $current_file;?>" method="POST"> <div class="lol3">Email or Username<br/><input class="class1" type="text" name="username" size="19"> <label class="label" for="pass">Password</label> <input class="class2" type="password" name="password" size="19" > <input class="classname" type="submit" Value="LogIn"><br> <input class="check" type="checkbox" name="stay" value="Stay signed In"><p class="para7">Keep me logged in</p><br> </form></div> </body> </html>
-
requinix did. Replace print_r ($value); with $string = $value->string; $string will be the data you want to serialize in the database?
-
PHP Newbie Upload Link Scripting/Folder Question
Ch0cu3r replied to graphxsman's topic in PHP Coding Help
No, the public_html file is fine. This is most probably caused by an error. To see what the error could be either look at your servers error log or enable error reporting. Add these two lines after <?php to enable error reporting display_errors(1); error_reporting(E_ALL);What errors are shown? -
You cannot access the some_db() database method from outside of user class. You can only access that method from within the users class using $this->db->some_db(); The database object is stored within the $db property for the users class If you need to use the some_db() method outside of the users class. Then use the database object $myDB->some_db():
-
Session Variables Across Different Browsers
Ch0cu3r replied to rghollenbeck's topic in PHP Coding Help
Your code is fine. But are you are calling session_start at the top of the page that uses $_SESSIONS? -
If you're directly linking to secound.php in a hyperlink, like <a href="http://yoursite.com/secound.php">Link</a> then you cannot prevent direct access to that file, as you are linking directly to it. Are you only wanting to prevent access to secound.php if the user has not been to index.php first?
-
Maybe debug_print_backtrace may help you?
-
You cannot use set cookies after you have sent any output to the browser. Quote from php.net/setcookie
-
When setting cookies you cannot access them immediately after. When you reload the page the cookie data will be available.
-
I cant tell you that as I don't how the $data array is being populated.
-
looking at the array structure for $data, The category is within a sub array called revision_post. You'll need to use $data['revision_post']['category'][0]
-
That code above is to replace this code in log.php $login=login($username,$password); if($login===false){ //$error[]= echo "That username and password combination is incorrect"; } else { // set username session // redirect user to home //die($login); $_SESSION['user_id']=$login; header('location:index.php'); exit(); } Replace // successfully logged in! with the code you want to run when user successfully logs in Replace // did not successfully login with the code you want to run when the user does not successfully login. You can remove printf('<pre>%s</pre>', print_r($_SESSION, true));. it is only there to display what is stored within the $_SESSION variable when login is successful. The code in reply #9 replaces the code in init.php
-
The logged_in function should work as before, no need to modify it. No need to use the user_data function as data is already in the $_SESSION variable Do not use $user_data, use $_SESSION init.php should be if(logged_in() === true) { $session_user_id = $_SESSION['user_id']; if(user_active($_SESION['username']) === false){ session_destroy(); header('Location:index.php'); exit(); } } how Is the password changed?
-
This is nothing to do with PHP. There is most probably a .htaccess file some where that has mod_rewrite rules defined so site.com/filename.drac actually calls site.com/index.php?drac=filename. Somewhere in your code the modules() function from include.php is called so modes/filename.php is included.
-
You could do $array = array(5 => 'first', 3 => 'first', 2 => 'secound', 4 => 'secound'); $array_values = array_unique(array_values($array)); printf('<pre>%s</pre>', print_r($array_values, true)); foreach($array_values as $value) { echo $value .' = ' . array_sum(array_keys($array, $value)) . '<br />'; }
-
You do not need the user_data() function any more. This has now been merged with the login() function. The login function stores the users data in the $_SESSION. Instead of using the $user_data variable to get the users data you now use $_SESSION. When you want to echo the users name, you use <?php echo $_SESSION['name'];?> Instead of $user_data['name']
-
make sure status.php is in the same folder as index.php. What url are you using to view status.php and what url are using to view index.php?
-
Echo/Print info from Array from Session Variable
Ch0cu3r replied to jay83rr's topic in PHP Coding Help
Try looking to see what is stored within the whole of $_SESSION variable printf('<pre>%s</pre>', print_r($_SESSION, true)); If the product info is not in the session then your shopping cart is most likely storing the products information within the database. The $_SESSION['pdf_quote']['id'] varibale could hold the product id, This is used in database query to get the products information. You will want to look at your shopping carts documentation on how it stores and retrieves products in the database. -
Echo/Print info from Array from Session Variable
Ch0cu3r replied to jay83rr's topic in PHP Coding Help
What specific data do you need from that array? What are you trying to do? -
pressing back or refresh button without losing form data URGENT!
Ch0cu3r replied to hitman47's topic in PHP Coding Help
Maybe the following article may help http://shiflett.org/articles/how-to-avoid-page-has-expired-warnings -
Echo/Print info from Array from Session Variable
Ch0cu3r replied to jay83rr's topic in PHP Coding Help
Do you want to see what is stored in these arrays? You can use print_r for that printf('<pre>%s</pre>', print_r($_SESSION['pdf_quote'], true)); -
pressing back or refresh button without losing form data URGENT!
Ch0cu3r replied to hitman47's topic in PHP Coding Help
You should not rely on the browsers back button to allow users to re-edit forms. You should provide a way for the user to go back and edit the forms so they are pre populated with the data they entered, or if you want the user to go back a page, then provide a link/button to that page or you could redirect the user with header() for an automatic redirect. If you need to clear a form you should use the forms reset button, not the browsers refresh button.