QuickOldCar
Staff Alumni-
Posts
2,972 -
Joined
-
Last visited
-
Days Won
28
Everything posted by QuickOldCar
-
Admin check login just redirects back to login page
QuickOldCar replied to laflair13's topic in PHP Coding Help
That's a better start, adding password encryption and your session data should work -
Admin check login just redirects back to login page
QuickOldCar replied to laflair13's topic in PHP Coding Help
That was an old tutorial you followed Besides what I wrote below the main redirect issue is that you are checking for $_SESSION['checklogin'] in dashboard.php but never set the session or check a value anywhere else session_start(); if (!isset($_SESSION['members']) || $_SESSION['members'] != "1") { header ("Location: index.php"); } mysql_* functions are deprecated and should use mysqli_* or pdo session_register() deprecated, use $_SESSION['email'] = "me@mail.com"; you are passing plain text passwords and should be using something like password_hash() and to check the password is password_verify() don't use stripslashes, only use the appropriate escape functions such as mysql_real_escape_string() , mysqli_real_escape_string() , or pdo prepared statements trim the whitespace or can end up different values You should find a new tutorial using pdo or mysqli -
What is the correct syntax for this echo statement?
QuickOldCar replied to dwest100's topic in PHP Coding Help
this is just one example that would work echo "<a href='" . the_post_thumbnail( 'medium' ) . "'><img src='" . the_post_thumbnail( 'thumbnail' ) . "'/></a>"; -
This should work for you include($_SERVER['DOCUMENT_ROOT']."/thankyou.html"); Otherwise you can use a relative path file.php or folder/file.php , no forward slash assumes from it's base document's path / starts from root ./ is same directory ../ is up one directory ../../ , every ../ additional is up one directory
-
You used a curly brace by accident here if(!count{$errors))
-
Do your own logging on the script that saves a database or csv file, save whatever you want from it. You can use $_SERVER['REQUEST_URI'] which returns script,query,directory or $_SERVER['SCRIPT_NAME'] just the name of the script $_SERVER
-
Another newbie question with phpmailer and gmail
QuickOldCar replied to VTXmom's topic in PHP Coding Help
I see you are using gmail as a relay, in this case you don't need smtp You do need the openssl enabled though. -
The old include location was in /cp/app/includes/ , you would need to use /plan/ instead You could even do this include_once($_SERVER['DOCUMENT_ROOT']."/plan/cp_config.php"); include_once($_SERVER['DOCUMENT_ROOT']."/plan/db_connect.php"); link to where you placed the files
-
Where does PHP go? How does the HTML page see it? etc...
QuickOldCar replied to StevenMG's topic in PHP Coding Help
Usually there is a form, that forms action will determine where is redirected <form action="contact_form.php" method="POST"> Did you ever make one or is one supposed to be supplied a website creator? you can try looking in \var\www\html\ using an ftp client like filezilla or in your provided admin panel from the host In order to parse php code the extension must be php, you can also allow html to parse php if set it up on the server. an .ini file is similar to a text file, maybe people are informing you of the php.ini configuration file. If you create a new file called info.php in the public www(root of your site), you can see where it's located or other information Depending on which hosting admin panel you have can access it from there as well. info.php <?php phpinfo(); ?> To summarize contact.html should contain a form and the action pointing to your php script your php script would perform the mail function Some people do it all in one php script, the form and also the mail function, like contact.php -
If you don't want to create a pile of if/else or switches for each one and name them the same try the code below. Assumes images are in a directory named images if(isset($_GET['show']) && trim($_GET['show']) != ''){ $keyword = trim($_GET['show']); $image = "/images/".$keyword.".jpg"; $image_location = $SERVER['DOCUMENT_ROOT'].$image; if(!file_exists($image_location)){ $image = "/images/default.jpg"; } } else { $image = "/images/default.jpg"; }
-
<?php if(isset($_GET['show']) && trim($_GET['show']) != ''){ $keyword = trim($_GET['show']); switch ($keyword) { case "house": $image = "$keyword.jpg"; break; case "mickey": $image = "$keyword.jpg"; break; default: $image = "default.jpg"; break; } }else{ $image = "default.jpg"; } echo $image; ?>
-
Another newbie question with phpmailer and gmail
QuickOldCar replied to VTXmom's topic in PHP Coding Help
Edit your php.ini file this line: ;extension=php_openssl.dll to this: extension=php_openssl.dll Restart server and then try it. -
I like the idea from Psycho to perform an action depending the count in the array. This simplifies trying to match domains which will fail in so many ways unless you make a pile of functions and checks, relative links, protocol/scheme, www, host or subdomain
- 8 replies
-
- simple html dom
- web scraper
-
(and 1 more)
Tagged with:
-
Handle many files linked to database entry in php
QuickOldCar replied to Ortix's topic in PHP Coding Help
The way you are doing it is the best way, saving image locations in a database. As for different resolutions you can use GD and do it on the fly and only keep one better quality sized image. You could even cache the generated images. A relational database is probably best here, one table would hold your episodes and going by id can link another table with all it's screenshots If posted your database layout and how you query them someone may be able to help further with what you have. -
Are you making an email spamming bot?
- 8 replies
-
- simple html dom
- web scraper
-
(and 1 more)
Tagged with:
-
The first one is the title of the document which is a hidden element of the page to a visiting user and used by browsers and search engines <title><?php bloginfo('name'); ?></title> The other one in body they are using as the title of your blogs home href link which is visible. This is way of automating the creation of your home link <h1><a href="<?php echo home_url(); ?>"><?php bloginfo('name'); ?></a></h1>
-
If you have permission the other server add a script to find the latest folder by date. If not ask them to do it. something like this <?php function latestDirectory($path = NULL) { if ($path == NULL) { $path = "/"; } $list = array(); $path = rtrim($path, "/"); if (substr($path, 0, 1) != "/") { $path = "/" . $path; } if ($path == "/") { $path = $_SERVER['DOCUMENT_ROOT']; } else { $path = $_SERVER['DOCUMENT_ROOT'] . $path; } $working_dir = getcwd(); chdir($path); $ret_val = false; if ($p = opendir($path)) { while (false !== ($file = readdir($p))) { if ($file{0} != '.' && is_dir($file)) { $timestamp = filemtime($path . '/' . $file); $pretty_date = date("m/d/Y h:i:s A", $timestamp); $list[] = array( "directory" => $path . '/' . $file, "date" => $pretty_date, "timestamp" => $timestamp ); } } rsort($list); } chdir($working_dir); //return list array; return $list; } $list_array = latestDirectory(); //use directory names,document root included in function if (!empty($list_array)) { //last directory created echo $list_array['0']['directory']; //list of directories echo "<pre>"; print_r($list_array); echo "<pre>"; } ?>
-
PHP and codeigniter script with if else statements
QuickOldCar replied to tomtom989898's topic in PHP Coding Help
Here is a little function to make it easier for you <?php function scoreLevel($score){ if(!$score || $score <= 0){ return 1; } $score = $score -1; $level = (int) floor($score / 100) + 1; return $level; } //usage //echo scoreLevel('201'); //test in a loop foreach (range(0, 500) as $number) { echo "score:".$number." level:".scoreLevel($number)."<br />"; } ?> -
Lat and Long not being returned from geocoded postcode?!
QuickOldCar replied to jarv's topic in PHP Coding Help
The code works fine for me as well adding echo Is there api usage limits? -
Third party script backend - custom frontend vs. cms
QuickOldCar replied to Troelsbur's topic in Third Party Scripts
Another framework to look at is laravel Octobercms is a laravel based cms made for developers -
Welcome, is never too late to learn. Did you visit php.net ?
-
Strict Standards: Only variables should be passed by reference
QuickOldCar replied to toppi24's topic in PHP Coding Help
You can suppress the strict standards notices php ini_set('error_reporting', 30711); htaccess php_value error_reporting 30711