wildteen88
Staff Alumni-
Posts
10,480 -
Joined
-
Last visited
Never
Everything posted by wildteen88
-
The typeof errors logged is controlled by the error_reporting level.
-
It is recommended to turn display_errors off on live servers. Instead you should opt to log errors to an external file.
-
[SOLVED] Using a foreach while removing empty post values..
wildteen88 replied to jaxdevil's topic in PHP Coding Help
<?php foreach ($_POST as $key => $value) { if(!empty($value) && ( trim($value,'$') != '0.00') ) { ?> <input type="hidden" name="<?php echo $key; ?>" value="<?php echo $value; ?>"> <?php } } ?> -
[SOLVED] Using a foreach while removing empty post values..
wildteen88 replied to jaxdevil's topic in PHP Coding Help
<?php foreach ($_POST as $key => $value) { if(!empty($value)) { ?> <input type="hidden" name="<?php echo $key; ?>" value="<?php echo $value; ?>"> <?php } } ?> -
Can you post the error message you're receiving here in full. Also the first line of your script should be <?php not <? php
-
I think you meant $_SESSION not $SESSION
-
I recommend you to read up on the basics of MySQL such as creating databases/tables. INSERT/UPDATE/DELETE/SELECT Queries etc. phpMyAdmin allows you to manage MySQL databases. If you don't know MySQL you wont be able to use phpMyAdmin. Got to tizag.com for such tutorials on the basics of MySQL.
-
Ubuntu Intrepid Ibex is about to be released in ~2 days time!
-
Move if (isset($submit)){ mysql_query("UPDATE blog SET blog_title = '$title', blog_body = '$body' WHERE blog_id = '$id_update'"); } before $result = mysql_query("SELECT * from blog WHERE blog_id = $id"); if(isset($id)) { $row = mysql_fetch_array($result) or die('No record found'); } Change if (isset($submit)) to if (isset($_POST['submit']))
-
You do not need a specific OS to run PHP. PHP is crosse platform compatible. You'll need to install what is known as the AMP stack in order to test a site locally on your computer. To easily install AMP on Windows download WAMP. When WAMP is installed move your site to C:/WAMP/www. Make sure WAMP is running then go to http://localhost/ to run your PHP. You can use any editor to edit your PHP scripts. PHP is not compliled You cant create MySQL databases via FTP. Your host should provide a facility for creating databases, usually from your sites Control Panel. Always ask your host if you're not sure Not sure what you mean here. You'll need to check with your host whether or not they allow you to use PHP with your hosting account. You should also get in contact with the original developers of the script you're using for support.
-
Ways of calling a class's method inside another class
wildteen88 replied to play_'s topic in PHP Coding Help
Using class B { function test() { A::test(); } } Should work to call a method from an anther class without having to create a new instance. -
Your code has a few errors from looking at it. The first is on line 4: if(isset($_GET['A'] && $_GET['A'] == "pass"){ It should be The last error is on this line 10: if(!isset(mysql_fetch_assoc($Update))){ die('Error: 10'); } That code does not make sense. The line above is running an UPDATE query. No rows are returned from an update query so you cannot use mysql_fetch_assoc to check whether the query succeeded or not. You should use the mysql_affected_rows() function instead. Your code fixed and cleaned <?php require_once('../../Connections/Epm.php'); mysql_select_db($database_Epm, $Epm);?> <?php include("../includes/functions.php"); check(); //User validation ?> <?php if(isset($_GET['A']) && $_GET['A'] == "pass") { if($_POST['password'] == $_POST['password2']) { $sql = "UPDATE `bexusers` SET `Password`='p".md5($_POST['password'].$Salt)."' WHERE `Username`='".$_SESSION['Username']."'"; $Update = mysql_query($sql, $Epm) or die(mysql_error()); if(mysql_affected_rows($Update) != 0) { header('Location: .././'); } else { die('Error: 10'); } } else die('Passwords did not match'); } //FIND USER $colname_User = $_SESSION['Username']; mysql_select_db($database_Epm, $Epm); $query_User = sprintf("SELECT * FROM bexusers WHERE Username = '%s'", $colname_User); $User = mysql_query($query_User, $Epm) or die(mysql_error()); $row_User = mysql_fetch_assoc($User); $totalRows_User = mysql_num_rows($User); if(isset($_POST['Pass']) && $_GET['A'] == "Try") { $Pass = "p".md5($_POST['Pass'].$Salt); if($Pass == $row_User['Password']) { $_SESSION['ENC'] = md5($row_User['ID']); header('Location: ../?P=User'); } else { echo "The password was incorrect <br>"; } } elseif($_GET['A'] == "un") { unset($_SESSION['ENC']); header('Location: ../?P=User'); } echo "Fail... no action specified."; ?>
-
Should be preg_match('/(.*)0(.*)/',$ad_id,$match); //if you just want to find 0's at the beginning of the string then replace (.*)0(.*) with 0(.*)
-
When you login to PMA there should filed called "Create New Database". Fill in your database name in the box then click the Create button and your database is created. You now need to setup your tables for your database.
-
In order to change your password via the MySQL command line you still need to specificity a username for the password you're changing You most probably changed the password for the root user (which is the default user). try using root as the username
-
Use htmlspecialshars instead Change the highlight_php function to this function highlight_php($matches) { $code = preg_replace("#(\[code\]|\[/code\])#is", "", $matches[0]); $code = htmlspecialchars_decode($code); //highlight PHP Code $code = highlight_string($code, true); //Encode certain HTML chars into ASCII Code $html_chars = array("[", "]"); $html_ASCII = array("[", "]"); $code = str_replace($html_chars, $html_ASCII, $code); return '<div class="code">' . $code . '</div>'; } Now change echo docode($test); to $test = htmlspecialchars($test); echo docode($test);
-
You should not be using htmlentities() prior to parsing the code tags. Otherwise you may get strange results.
-
Use a local file path and not a url eg echo htmlentities(file_get_contents('/file/to/php/script')); or $file = '/file/to/php/script'; $handle = fopen($file, 'r'); echo htmlentities( fread($handle, filesize($file) );
-
In a HTML/CSS forum perhaps
-
haha. I'm a complete tit!
-
You already had a post here
-
To highlight PHP code with tags use the code attached below [attachment deleted by admin]
-
If its not displaying correctly then this is a HTML/CSS issue and nothing to do with PHP.
-
[SOLVED] Help with error :Resource id #10
wildteen88 replied to Darkmatter5's topic in PHP Coding Help
There error is coming from here, I have highlighted the problem errors