wildteen88
Staff Alumni-
Posts
10,480 -
Joined
-
Last visited
Never
Everything posted by wildteen88
-
Nope no difference. Tried a hard refresh too (Ctrl+F5) aswell as a normal refresh (F5) and eveything loads fine in Categories, My Account and Contact pages
-
I notice you typed your session var as $_session['count'] PHP is case sensitive with variable names. $_session or $_SESSION or even $_SeSsIoN are three completely different variables. When ever using any superglobal variables (_POST, _GET, _SESSION, _COOKIE etc) always type in caps.
-
Site works fine for me in IE7 and FF This seems more of an html issue so I will be moving this to the HTML Board.
-
If you are passing strings over the url you should urlencode them. When you retrieve them you should urldecode them.
-
You might want to use return $this->$name = $value; instead then.
-
No you need to do that same as you did to the image paths add / infront of your links eg: <a href="/print/"> Instead of <a href="print/">
-
Using $link inside loginInfo.php: include('/home/folder/loginInfo.php'); $link = @mysqli_connect("localhost", "username", "password", "database");
-
It should be $this->name not $this->$name
-
I find adding / at the start of file paths works, so instead of doing <div id="top"><img src="logo.png" /></div> do <div id="top"><img src="/logo.png" /></div>
-
Try: RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([A-Z]+)/$ /index.php?page=$1 [NC,L] RewriteRule ^([A-Z]+)/([0-9]+)/$ /index.php?page=$1&var1=$2 [NC,L] You'd use $_GET['var1'] to return whatever x is in home/x/ that also work with your other pages too.
-
Use this as the .htaccess file: RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([A-Z]+)$ /index.php?page=$1 [NC]
-
[SOLVED] 500 error - what the deuce?!?!?!
wildteen88 replied to memphisweb's topic in PHP Coding Help
Agreed. Those if statements would be better of it you stored each banner within an array, Like so: // bannx px py $banners = array( 'bann1' => array(10 , 75), 'bann2' => array(108 , 540), 'bann3' => array(120 , 30), 'bann4' => array(120 , 600), 'bann5' => array(160 , 600), 'bann6' => array(180 , 150), 'bann7' => array(210 , 800), 'bann8' => array(215 , 35), 'bann9' => array(230 , 100), 'bann10' => array(230 , 150), 'bann11' => array(230 , 75), 'bann12' => array(240 , 120), 'bann13' => array(260 , 140), 'bann14' => array(295 , 600), 'bann15' => array(300 , 250), 'bann16' => array(336 , 280), 'bann17' => array(336 , 850), 'bann18' => array(425 , 600), 'bann19' => array(450 , 40), 'bann20' => array(468 , 60), 'bann21' => array(512 , 20), 'bann22' => array(550 , 480), 'bann23' => array(720 , 400), 'bann24' => array(728 , 90), 'bann25' => array(728 , 312), 'bann26' => array(800 , 600), 'bann27' => array(900 , 612) ); list($px, $py) = $banners[$imagesize]; That block of code will replace lines 14 - 170 and you pull the $px and $py variables for each banner from from just one line of code: list($px, $py) = $banners[$imagesize]; -
[SOLVED] 500 error - what the deuce?!?!?!
wildteen88 replied to memphisweb's topic in PHP Coding Help
Coupple errors found: Line 174 should be: //handles the variables for image size posting to display all images Missing / at start of line Line 186 - 189 should be: // figure out out to make this a selective mysql where image size is not a variable $bannersearchquery = "SELECT file_set.* FROM file_set WHERE $sqlcampaign AND $sqlopco"; Line 187 needed deleting -
Normally the most recent errors are logged at the very bottom of the error log. If you post the last 10 or so lines here then I might be able to fish out the error.
-
I dont thing it'll be that it should be called error.log or something like that. access_log will be log of all tcp/ip activity on your site. You might be better of contacting your webhosting company for support.
-
I don't know then it should work. There is obviously something not right. Code works perfectly fine here on my dev box. I don't get why you are getting a 500 internal server error if you have commented everything out within the .htaccess. Do you have access to your servers error logs? The cause of the Internal server error will be logged within the error log.
-
Ugh! That shouldn't happen. Post the full contents of your .htaccess here.
-
I don't know then. Looks like it could be a problem with your server. As if I go to http://www.carbenco.com/home.php I get the same goblygoop I cannot see how the code in index.php affects other php files, especially if you go to them directly. Perhaps contact your webhost for support. What happens if you disable the code in the .htaccess (comment the code out add a # at the start of each line).
-
Odd problem - PHP file made, no MySQL ><
wildteen88 replied to jayemsee283's topic in PHP Coding Help
Doesn't the script create the tables/insert the data automatically for you? All you need to do is create the database and run some form of installation file? -
That is an inline if/else statement. What this line does is check to see if the variable $_GET['page'] exists. If it does it'll set $page to the value of $_GET['page']. If $_GET['page'] doesn't exist then it'll set $page to home. The above line is the same as: <?php if(isset($_GET['page'])) { $page = $_GET['page']; } else { $page = 'home'; } ?> Looks like all you want to do is just include a file based on $_GET['page'] ($page). If so you can scrap the switch all together and do this: <?php $page = (isset($_GET['page'])) ? $_GET['page'] : 'home'; $page_path = $_SERVER['DOCUMENT_ROOT'] . '/' . $page . '.php'; if(file_exists($page_path)) { include $page_path; } else { die("$page_path does not exist"); } ?> I'm not sure about that, however this: echo \"<img src=art.png />\"; should be: echo '<img src="art.png" />'; . What happens if you change home.php to just basic text
-
Firefox Add-on Text Editor for Tabs?
wildteen88 replied to FrOzeN's topic in Editor Help (PhpStorm, VS Code, etc)
Prehaps Firebug may interest you. Or CodeTch -
As for creating the config.php file automatically based on the information entered in the configuratioin form you can do this: <?php if(isset($_POST['submit'])) { $errors = null; foreach($_POST['config'] as $key => $value) { if(isset($_POST['config'][$key]) && empty($_POST['config'][$key])) { $field = str_replace(array('db', '_'), array('Database', ' '), $key); $errors[] = '<b>' . ucwords($field) . '</b> field left blank!'; } } if(is_array($errors)) { $error_msg = "Please correct the following errors:\n<ul>\n <li>" . implode("</li>\n <li>", $errors) . "</li>\n</ul>\n\n"; } else { $config = "<?php\n\n"; foreach($_POST['config'] as $key => $value) { $config .= '$'.$key .' = \'' . $value . "';\n"; } $config .= "\n?>"; // write configuration to config.php $handle = fopen('config.php', 'w'); // open fwrite($handle, $config); // write fclose($handle); // close echo 'config.php created:<br /><br />'; echo '<textarea name="" rows="10" cols="60">' . $config . '</textarea>'; } } ?> <!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"> <head> <title>Database installer</title> </head> <body> <h1>Database Installer</h1> <?php if(isset($error_msg) && !empty($error_msg)) echo $error_msg; ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <fieldset> <legend>Database Infomation</legend> Hostname: <input type="text" name="config[db_hostname]" value="localhost" /><br /> Username: <input type="text" name="config[db_username]" /><br /> Password: <input type="text" name="config[db_password]" /><br /> Name: <input type="text" name="config[db_name]" /> </fieldset> <br /> <fieldset> <legend>Administrator Infomation</legend> Username: <input type="text" name="config[admin_username]" /><br /> Password: <input type="text" name="config[admin_password]" /> </fieldset> <br /> <input type="submit" name="submit" value="Setup Database" /> </form> </body> </html>
-
Probably because your mod_rewrite rule will only work if your url contains number only (eg: /01 ) instead of a string (/home) Change this line: RewriteRule ^([0-9]+)/$ /index.php?page=$1 To: RewriteRule ^([A-Z]+)$ index.php?page=$1 [NC] Also you'll want to use the following in index.php: <?php $page = (isset($_GET['page'])) ? $_GET['page'] : 'home'; switch($page) { case 'home': echo 'Homepage'; break; case 'about': echo 'About page'; break; default: $page = $_SERVER['DOCUMENT_ROOT'] . '/' . $page . '.php'; if(file_exists($page)) include "$page"; else die("$page does not exist"); break; } ?> <p>Links: <a href="home">Home</a> | <a href="about">About</a> | <a href="test">Test</a> (This page includes a file called test.php)</p>
-
What version of Apache do you have installed? Make sure you have installed Apache2.0.x in order for php5apache2.dll If you have Apache2.2.x you should use php5apache2_2.dll as the module Also attach your httpd.conf file here.
-
You'd use $_SESSION['username'] to access the username from the session. Make sure you have session_start(); at the top of every page that uses sessions though in order for PHP to retrieve the current session variable.