-
Posts
3,404 -
Joined
-
Last visited
-
Days Won
55
Everything posted by Ch0cu3r
-
Change $posts = array('body' => $post->body, to $posts[] = array('body' => $post->body, And change the foreach loop to $posts = get_posts($connection); foreach ($posts as $post) { echo $post['body'] . "<hr>"; }
-
function seems to be working on one server, but not another
Ch0cu3r replied to skygremlin's topic in PHP Coding Help
Function array dereferencing was added in PHP5.4. You web server uses PHP5.3, so you need to apply your fix Or you could do $tmp = $get_issue_info->fetch(); $get_issue_info_value = $tmp['issue']; -
Doesn't look like it. You need to find the file that is generating the html table.
-
The code you posted is fine, (although it could be improved) there is no suspicious code that is stopping the emails. Are you sure the emails are not being identified as spam? Check your spam folders to see if this is the case. Is msurace@americanhealth.edu the correct email address for the contact form messages to go to? And can you send emails to this address yourself? Is the SMTP settings in the php.ini been changed? The first step is to change the passwords to all accounts on the server so they cant access your server again.
-
Why do you need separate databases? Having multiple connections can over complicate things. To answer you question yes you can connect different servers at the same time. You need to call mysql_connect for each server // first server connection $connection_1 = mysql_connect('hostname1', 'username', 'password'); // select database on first server mysql_select_db('database_one', $connection_1); // second server connection $connection_2 = mysql_connect('hostname2', 'username', 'password'); // select database on second server mysql_select_db('database_two', $connection_2); You'll will then need to pass the connection resource ($connection_1 or $connection_2) when a mysql_* function optionally requires it. That way PHP knows which database you want to interact with. For example when querying the database(s) you need to pass the connection resource as the second argument // query database 1 $db1_result = mysql_query(/* the sql query for database 1*/, $connection_1); // query database 2 $db2_result = mysql_query(/* the sql query for database 2*/, $connection_2);
-
How do you know that and what have they done? What should the code do? and what does it do now?
-
The error means the user localhost has been denied access due to the username/password is incorrect. You need to change the mysql database username and password credentials to what was supplied by your webhost.
-
I can only assume its for their pagination maybe? There is not two sr's. One is a query string variable (sr=8-27) the other is part of a file request (/ref=sr_1_27). How amazon processes the request we wont know.
-
How you have set up the login process is complicated. When the user logs in your are saving the users username and password to the session. And then on each page request you are querying the database to make sure the username and password stored in the session matches a record in the database and if it does you set the $logged variable to true. The second part is unnecessary. If you have already checked their credentials matches there is no need to keep checking the database. Just set a session variable to say they are logged in (eg $_SESSION['logged_in'] = true;) and set any other data to the session that you want to remember about the user such as user id, username, real name, their access level (admin, mod, user) etc. To see if the user is logged in you'd check for the session variable exists if(isset($_SESSION['logged_in']) && $_SESSION['logged_in'] == true) { // allow user to page they are logged in } else { // user is not logged in, redirect/display login form or warning } When they logout you unset the session. I would not advise storing the users credentials in cookies for the remember me feature. Cookies are not secure and you have no control over them.
-
You need to the find the PHP code that generates the HTML table in order for you to change the column positions, where that is we cant tell you that as we dont have the code to look at. If the script is coded correctly you should be able to edit a template file.
-
You need to make the urls for products and and galleries unique, so mod_rewrite can differentiate between the two. I would set up urls to prefix the type of page you are accessing, for example For galleries it would be site.com/gallery/<gallery_id>-<gallery_title>/ For product it would be site.com/product/<product_id>-<product_title>/ As you see having th gallery and product prefixed makes them distinguishable. You'd set the rewrite rules as RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^gallery/([0-9]+)-([a-z0-9_-]+)/?$ viewnote.html?id=$1&title=$2 [L,NC] # rwrite for gallery RewriteRule ^product([0-9]+)-([a-z]+)/?$ nation.html?id=$1&title=$2 [L,NC] # rewrite for product
-
Sounds to me hook/function_hook.php is a copy of include/function_hook.php. If you comment out the include/require for hook/function_hook.php does your app continue to function correctly?
-
The error says the get_tapatlk_location() function has been declared twice. Once in include/function_hook.php on line 4 and a second time in hook/function_hook.php on line 62 (notice the different folder names). The lines of code you have posted is not the problem. You need to remove the duplicate function declaration to clear the errors. Function names should be unique and only be declared once.
-
I have told you what needs to be done. If you do not understand PHP then get someone else to modify the code for you, Freelance forum
-
Yes you need to pass the connection when calling the show_users function. You have spelt connection incorrectly here function show_users($conection) { two n's not one Make sure you are including database.php before you call the function too.
-
You need to read up on variable scope as this the issue with your code. The problem is the $connection variable is defined outside of your functions. Functions have their own variable scope, meaning variables defined outside of it are not accessible. The solution is to either define $connection as global or pass it to your functions as an argument.
-
Prepared statement in if conditional not working as expected
Ch0cu3r replied to AJinNYC's topic in PHP Coding Help
Your conn function is not returning the mysqli connection. Change it to //Database Connection function conn($host, $user, $password, $dbname, $websiteName) { //MySQLi Connection $dbConnection = mysqli_connect($host, $user, $password, $dbname); /* check connection */ if(!$dbConnection) { if($_SESSION['siteisactive']=="no") { $errormsg='('.mysqli_connect_errno().') '.mysqli_connect_error(); } else { $domainname=getDomain($websiteName); $errormsg='We couldn\'t connect to the database. Please return to the <a href="//'.$domainname.'">homepage</a>.'; } die('Connection Error: '.$errormsg); } return $dbConnection; // return the connection } -
You need to also pass on the file request too RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^/directory2/(.*)$ /directory1/$1
-
it is most probably the colon that is breaking the url. The colon has a special meaning in urls as it usually defines the http port. Urls should only contain letters, numbers, dashes, underscores and periods. Any other character should be urlencoded. However this will make your urls messy if start encoding non url characters. What you are better of doing is adding another field to your database that stores the url for the page, and the query the database that matches this field instead of the title field. So basically you need to make the entered title url safe. The following will make the title url safe $page_url = str_replace(' ', '-', strtolower($page_title)); $page_url = preg_replace('~[^a-z0-9_\-]+~i', '', $page_url); So if you enter this as the title "The New Era of Music: Indie, Metal, Alternative" it will generate "this-the-new-era-of-music-indie-metal-alternative" as the page url.
-
I dont know. The code is ok although it is messy but that is typical of dreamweaver generating garbage. You are better of coding it by hand than using Dreamweaver's code generators.
-
$row['institution_id'] holds the institution id. I guess you need to use $row['institution_name'] instead? <option value="{$row['institution_id']}">{$row['institution_name']}</option>
-
Is the connection located in another file? Are you including that file before the duplicate email code?
-
What is the database connection code?
-
It is trying to load the images from /includes/modules/kiss_image_thumbnailer/thumbs/76x72_brand_name.png For some reason the 76x72 thumbnails for a few of brand names cannot be found. Are you sure all 76x72 thumbnails for all brands exist?
-
Can you post the error messages in full